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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / c9 i3 g# {" e3 k, n% t
  1. [code]EDMA sample test application: P9 u* U5 x2 \" D$ j* r( A6 n
  2. /*
    # w0 B9 U: W2 l; f
  3. * edma_test.c
    + c' k& h9 A9 P7 t+ O+ t4 A$ Q& `$ v
  4. *( h" b5 m. A, y/ K8 j8 t0 H
  5. * brief  EDMA3 Test Application1 n* h* R+ F! t8 B* ]
  6. *7 `4 o) k, F' F3 L! m
  7. *   This file contains EDMA3 Test code.
    1 Z& U4 B3 ]9 J6 K0 b
  8. *8 Y; P+ m/ `! B  j5 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' L. V2 s+ `5 N( [; c' N+ m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; t+ N$ t6 U" i6 ?
  11. *         TO CHANGE.5 d9 P/ p' {  p8 s& j+ T
  12. *
    & d, q! S6 q; `/ }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 x9 @' n9 i! J) P# @4 f9 u) H
  14. *
    & \# y: U' G5 E5 d
  15. * This program is free software; you can redistribute it and/or3 Q6 T+ O7 k8 N. D& P5 j3 T6 x9 o
  16. * modify it under the terms of the GNU General Public License as& u( M3 u& B4 G% l  Y
  17. * published by the Free Software Foundation version 2.. w" g) u# ^! g8 W  G  n
  18. *: q  Q9 B' |2 {7 Z: d/ x& P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) x# E7 {1 M4 e8 @
  20. * kind, whether express or implied; without even the implied warranty
    5 c4 ^- A; V7 M+ u9 v1 C% T: c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 g% }6 Z7 `! j- t
  22. * GNU General Public License for more details.
    4 {/ W' \; M) z0 w7 u+ C. N
  23. */
    : Y& ]: f+ o2 N, B0 ^$ n& g

  24. - l$ ?) x/ F5 j9 L( a* x
  25. #include <linux/module.h>+ P6 t2 v$ s  P
  26. #include <linux/init.h>
    ) x3 K! [) }+ B2 r3 ~% N& v
  27. #include <linux/errno.h>6 x; u! x9 Q% ]! q
  28. #include <linux/types.h>6 m! n/ ]$ ^# U. _' }
  29. #include <linux/interrupt.h>% p+ @8 K8 r2 C- G- D; g) g3 Q
  30. #include <asm/io.h>, _* s" w& {. g
  31. #include <linux/moduleparam.h>2 ?6 `" R+ A4 @; {
  32. #include <linux/sysctl.h>
    / Y- D5 f, k. r% x
  33. #include <linux/mm.h>
    . K. f% c! x+ F( x: V
  34. #include <linux/dma-mapping.h>% T' h; M) X% ~+ F

  35. ( j! x- ?+ ^, {
  36. #include <mach/memory.h>( E$ x/ d2 J6 b) v5 \: H1 B9 P
  37. #include <mach/hardware.h>
    / k  U( m+ [3 N; j% G5 _, L
  38. #include <mach/irqs.h>  L7 x6 N' P3 d
  39. #include <asm/hardware/edma.h>
    - w2 l, L: P7 u1 X: `" V& L
  40. 9 K. V+ f1 |4 g+ [+ u, Z3 m
  41. #undef EDMA3_DEBUG
    8 a, P) l( W3 W) u) B: j2 _2 b
  42. /*#define EDMA3_DEBUG*/
      n0 }9 t+ E6 H1 x! d

  43. ! H; V$ i: C0 ~* R- Z7 x
  44. #ifdef EDMA3_DEBUG
    " b+ K) Y( N0 d: N) u" d/ I9 M- m5 |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 E" r- ~, a% |& d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 [( c  y% m& ]5 r2 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # x, r1 h  I- `/ |2 ^* I' C( G+ X* y% P
  48. #else
    4 V7 x6 M* B0 V, s( @
  49. #define DMA_PRINTK( x... )' P0 t7 |0 r! l) q0 S5 I. z
  50. #define DMA_FN_IN
    . K& J  ^0 K& v* w/ r9 i
  51. #define DMA_FN_OUT% m; W% R4 r  ?1 T
  52. #endif
    0 J+ F' T- u2 h( x
  53. ' [, H7 r$ L& X0 b4 g9 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! T0 e8 M5 C2 y6 G* p+ U( ~2 l
  55. #define STATIC_SHIFT                3
      R! a1 S5 ], ^+ n& E, R& A' L
  56. #define TCINTEN_SHIFT               20
    ; D# p$ |; m# F3 ]# P! F
  57. #define ITCINTEN_SHIFT              21' p, e+ A6 Y$ `" C  G& c5 G
  58. #define TCCHEN_SHIFT                22
    # @7 e( M, {5 ]0 `% c  Z8 e
  59. #define ITCCHEN_SHIFT               23
    & w: h& J" t( s! i. T, B/ R
  60. # [) b# d- j  D! p% ~
  61. static volatile int irqraised1 = 0;
    0 R5 X% @& m# ]7 g% R+ U
  62. static volatile int irqraised2 = 0;
    4 \. `' |! k/ l, a. {' X' n
  63. ; A6 Z7 Z% O# u* W7 ]4 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 T5 T) i* E& c2 Y: i2 G1 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! y0 _+ J- H( u3 p0 }, y9 h0 p: X+ {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 j9 Q2 }! |% Q) ?/ e

  67. 1 v; C0 M: v" F- t6 q3 q  C3 w
  68. dma_addr_t dmaphyssrc1 = 0;% N: x2 L% c/ b' r6 R
  69. dma_addr_t dmaphyssrc2 = 0;
    / J0 m2 C! s' J3 V3 l% [% g. B
  70. dma_addr_t dmaphysdest1 = 0;& Z3 l6 k9 a: B  \, Y0 C; u
  71. dma_addr_t dmaphysdest2 = 0;! a$ T/ X, z) S+ g# v

  72. & o5 i; \0 f% I$ s/ i; o1 r
  73. char *dmabufsrc1 = NULL;( X0 j% L% \* F
  74. char *dmabufsrc2 = NULL;
      p5 \, J- e' o6 O! |: b
  75. char *dmabufdest1 = NULL;9 O" q- I9 u5 d8 Z- J( T% x
  76. char *dmabufdest2 = NULL;1 O& u9 C8 h8 |

  77.   s* L' _% t3 D7 ~2 L
  78. static int acnt = 512;
    / k5 x+ G& \, X, o" ]* F) c" D
  79. static int bcnt = 8;# y% [0 M7 @5 ?: f# J6 L3 @
  80. static int ccnt = 8;
    / u0 k+ @, f! @6 k7 ]+ W

  81. 8 y8 L4 t) v. F+ E1 n
  82. module_param(acnt, int, S_IRUGO);
    4 r4 o8 W7 c' b+ d: R: ?
  83. module_param(bcnt, int, S_IRUGO);
    - K. m+ V  ~6 Z" S" _; g: j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' U8 N, N' U$ M* ?
9 F$ ?! T: [5 |/ j. y% p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) _9 A  ?$ x! p" |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( `$ N8 H+ Y: F* {1 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ Y3 }9 G. _7 A% I
" e; Z$ e$ }+ K1 I
) ?4 V, t) z; J0 t$ o( ?" O8 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 03:53 , Processed in 0.055646 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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