OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 12590|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ Y+ D/ Z# n# K2 C) y; s# E# }) H3 C
  1. [code]EDMA sample test application
    : o, p! y( S6 F3 j9 [
  2. /*# b: U  q* x. r! [
  3. * edma_test.c! C! ~* F% L, h8 B
  4. *9 F- M1 `/ B! a7 g: }9 D" L  r
  5. * brief  EDMA3 Test Application9 ?6 I1 @: u1 e
  6. *
    6 s. P  f/ `# V3 U# i
  7. *   This file contains EDMA3 Test code.
    7 J; v% P0 r0 X
  8. *
    ! ?# }7 M" L, @. \1 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 J$ `& B, b2 [, j; C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . c  \- S/ N* |& b  p) z
  11. *         TO CHANGE.
    ; A) z1 c' {/ v2 t
  12. *
    . l' I! U! k. i  t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 {3 w- `# h3 W# `
  14. *. h0 `+ v3 W! F2 t7 S, j
  15. * This program is free software; you can redistribute it and/or4 ?& d0 r/ M4 n
  16. * modify it under the terms of the GNU General Public License as
    & d1 q+ H; z4 P+ G3 d. |
  17. * published by the Free Software Foundation version 2.# X# M. U8 J8 a2 f: t) u" Q3 ~  F
  18. *" Q; L, V. q: }0 e7 C+ W+ m! i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- k7 ?9 u* K2 I7 z5 G$ P
  20. * kind, whether express or implied; without even the implied warranty1 F. G4 H5 I$ `/ ]. [; v6 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! Y. p$ M: N, t! B$ V* V
  22. * GNU General Public License for more details.
    % L, j; \" j+ ^) R' n' _; F( Y
  23. */& `4 h0 S. E, n- N
  24. * W( I1 k' ^8 I' f9 [
  25. #include <linux/module.h>" y8 I  a: L  [4 w) w/ U
  26. #include <linux/init.h>1 ~1 [% g$ W) r' g
  27. #include <linux/errno.h>
    9 }: `. Y  u7 s* h3 K4 |* I9 j
  28. #include <linux/types.h>* }$ F7 l, @0 B, i
  29. #include <linux/interrupt.h>
    + ^) d1 r8 E4 o6 v
  30. #include <asm/io.h>& e4 E8 m9 [3 \; v
  31. #include <linux/moduleparam.h>- |' p9 ^1 V' Q- [" N2 q7 T
  32. #include <linux/sysctl.h>
    $ h( n3 Q# |) S$ s# y( d
  33. #include <linux/mm.h>
    ( j5 G! t( K* h8 Q  a! |
  34. #include <linux/dma-mapping.h>1 n5 ?9 G/ H* H% l5 `' @( @2 e- k
  35. & V' l2 U2 j( F
  36. #include <mach/memory.h>9 V+ z! y/ n) ~, N4 z! R5 \
  37. #include <mach/hardware.h>
    - N/ J" Y- b! ?' n/ Q% V0 q  X  R
  38. #include <mach/irqs.h>
    8 D1 m  l" C9 w9 e
  39. #include <asm/hardware/edma.h>9 t& M4 @7 [( Y6 H/ f- Y3 G/ r" y
  40. 8 P& c; P7 z" m; l9 ]7 W! L6 G
  41. #undef EDMA3_DEBUG! K( `7 M1 U8 |. W1 [
  42. /*#define EDMA3_DEBUG*/- M( C2 L3 R/ ]( p0 c9 q+ k4 Y

  43. ! y+ `! s- U4 H* S+ y* s9 Z
  44. #ifdef EDMA3_DEBUG5 Y1 B( q9 m- g5 z% O8 e, S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); b$ K# N1 }! @: T  x6 C2 L) n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + ^9 M# R  O, l+ d6 q/ g6 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & @) R- o: V& E6 g
  48. #else
      ~/ p5 S; h" n0 @2 _
  49. #define DMA_PRINTK( x... )
    " I4 G. T2 H1 K# b  S
  50. #define DMA_FN_IN8 K6 }  J$ y. X4 Q# p5 t1 Q
  51. #define DMA_FN_OUT9 p) {& z$ g9 t0 r# I! A5 g
  52. #endif
    5 P; L8 U) M& K5 @8 x' a
  53. 8 _3 x0 I; c7 n$ Q: @8 @9 B1 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 Z/ k1 N( Z, k2 C0 b' v
  55. #define STATIC_SHIFT                3% x( {, z8 e' a9 q7 K. G* y/ ?
  56. #define TCINTEN_SHIFT               20
    3 ^3 t" D% ^7 y7 T3 T! f/ f
  57. #define ITCINTEN_SHIFT              21
    2 r$ Q! D; i4 b7 l, p+ H
  58. #define TCCHEN_SHIFT                225 D; j: [9 j' l; U( u. t% J
  59. #define ITCCHEN_SHIFT               23
    & [; B" M$ d' D3 K# u
  60. 0 y4 w2 ^) _4 l. w! e/ u. k) q! c7 D
  61. static volatile int irqraised1 = 0;& L) V7 {8 y% K- N2 C5 h
  62. static volatile int irqraised2 = 0;
    $ a" d2 I; H+ U5 E. X2 V$ b

  63. : f0 j) i' M8 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 v; a2 ^# W1 Y" n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ]+ d9 ]% |, b7 j9 R- o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! E& z0 c2 N; U$ G$ q  Z& X
  67. 3 j' z' l, D4 F, i* I& d
  68. dma_addr_t dmaphyssrc1 = 0;* S2 h+ _' i+ D6 O' b2 o! N' w2 Z
  69. dma_addr_t dmaphyssrc2 = 0;& c' G; `. j: {) i
  70. dma_addr_t dmaphysdest1 = 0;+ p$ |" Z/ E7 i) t7 V
  71. dma_addr_t dmaphysdest2 = 0;3 v0 p: w7 a# g4 P& p
  72. 1 f& x" E3 z% l8 a# }; }' m7 y9 s
  73. char *dmabufsrc1 = NULL;
    ' l8 {! y1 ]' }: B$ l% d
  74. char *dmabufsrc2 = NULL;
      }/ |9 G. R  M5 W- V2 \
  75. char *dmabufdest1 = NULL;2 ~  |$ g. S1 y7 N
  76. char *dmabufdest2 = NULL;
    # \! ]' ~$ l5 N0 k1 }( h

  77. * E& |. J2 b% a& }2 k
  78. static int acnt = 512;. Z* X+ D+ W  |% ^
  79. static int bcnt = 8;# V7 [- A5 k4 J' t9 w$ {! K; B. _& v! K
  80. static int ccnt = 8;
    " p* H- s5 ?* K7 o! N/ L# h

  81. % Y5 x2 }2 O1 w
  82. module_param(acnt, int, S_IRUGO);
    * p, i1 z) F: k& B
  83. module_param(bcnt, int, S_IRUGO);2 ]( r- m: v- b/ {4 Y; w* C" \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 M: Z  t/ U% Z. S- K0 O
' p& u1 I& ]' L( V$ G* L) ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- [) c9 f  R3 D9 J, j
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 k3 u8 F" h. m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% M( I7 ~+ K3 N% ~8 C7 _0 r6 j; J
7 }* H- Q; Z8 N5 b) ]9 E& j9 i

, E* A( ]/ K1 H* _7 I- ~; j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-3-14 02:59 , Processed in 0.041289 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表