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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 \0 o. }' `: w  a9 P
  1. [code]EDMA sample test application" N+ D6 y1 P! ]# n# H, n% ~, L
  2. /*( |9 @$ Q, N! Q% j' b) W
  3. * edma_test.c
    ) n5 {" l' B* m0 V( ~+ a
  4. *! c, G+ Z& C: A9 x! d
  5. * brief  EDMA3 Test Application+ t* F- ?7 S$ [% y6 ]- d  b
  6. *5 `- t( }  O5 h+ {
  7. *   This file contains EDMA3 Test code.* @- h/ c1 C6 Z1 I2 d& M2 A/ o5 O* U
  8. *# t& T9 f9 B  W. t  e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; E3 K( K% z8 A- Z2 ]9 H$ W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 o# j  m6 |7 @0 j2 r5 u% ^
  11. *         TO CHANGE.% g' I9 h( S( Y& i- E- e
  12. *. o( L1 C: D: y" _0 T+ M/ A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 f% x6 d' s( n1 t1 C% a3 z" S
  14. *
    5 x, J. M7 V' H0 ]8 v9 B/ p
  15. * This program is free software; you can redistribute it and/or
    3 a. O& D' I; t6 J+ F4 A- B6 a
  16. * modify it under the terms of the GNU General Public License as
    , O) Q0 T4 Z" U+ l* `2 @
  17. * published by the Free Software Foundation version 2.
    6 l! U; z! u. N/ p% X9 x
  18. *3 T* g' t% u$ S; f" F# `" ~$ K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , `- o1 f$ ^! y' e3 x6 c
  20. * kind, whether express or implied; without even the implied warranty" j9 L; s2 Q- }# e! }1 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! m( I$ B4 V& ?4 s! @  G9 o
  22. * GNU General Public License for more details.
    ; \( N3 r7 P1 @  ~: \
  23. */
    5 S; [0 i& ?' D1 x/ b

  24. + \2 a, N9 J( K6 e9 A
  25. #include <linux/module.h>
    2 n( Q# u# y& \
  26. #include <linux/init.h>
    0 u+ p1 p9 B& b3 q$ L5 E
  27. #include <linux/errno.h>
    3 s- ]' l8 e9 P1 p
  28. #include <linux/types.h>6 }5 R% C# g( [) |7 t# x
  29. #include <linux/interrupt.h>
    $ U& ^# o' W; [
  30. #include <asm/io.h># }/ H* d8 d" W# L8 f
  31. #include <linux/moduleparam.h>
    ; s/ o. u: E  z
  32. #include <linux/sysctl.h>
    ; f) P0 f) x* }. p) G' J* u4 @0 V& F
  33. #include <linux/mm.h>0 W! N' O( J& I  j3 I1 N$ u# }
  34. #include <linux/dma-mapping.h>, t. O2 t% I2 @
  35. 6 n8 \/ {! i  M3 ]$ \& `& ?
  36. #include <mach/memory.h>
    0 I/ g% L3 B" D& B* p5 d
  37. #include <mach/hardware.h>
    * w" V: Y6 r! T3 g0 a% k- k
  38. #include <mach/irqs.h>/ v2 c  H4 m" W/ D2 j5 [8 d$ R2 ~/ f
  39. #include <asm/hardware/edma.h>
    7 {7 Z8 _) P$ ^9 W
  40. 9 e/ k8 n4 e1 J" o0 f. T
  41. #undef EDMA3_DEBUG/ M2 ~5 A- D  ]8 H, a
  42. /*#define EDMA3_DEBUG*/
    & h- E7 c9 r5 z% b. ]! A# V% K
  43. $ g4 `; \; v6 R" ?# |% A# `" S
  44. #ifdef EDMA3_DEBUG
    " D# b' e& \9 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & V1 Z* o  |" d* B" \" d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 m  z) V. Y. S+ T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* u* x5 V9 z5 q! w3 i/ g6 K4 P" i
  48. #else
    2 p, y/ T; y; e0 F8 u
  49. #define DMA_PRINTK( x... )
    1 p* o, ]/ A8 R1 d
  50. #define DMA_FN_IN
    : v3 p0 P6 x  O
  51. #define DMA_FN_OUT- g4 Y, @7 r% G
  52. #endif
    6 s/ a- k# t  b! ^

  53. 8 l/ u" `4 @" `" y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 q2 G' u; H  Q- R, P
  55. #define STATIC_SHIFT                3
    - b. e' J6 V; k1 b2 M1 G
  56. #define TCINTEN_SHIFT               20
    * @' p* o" i1 A4 m
  57. #define ITCINTEN_SHIFT              217 s6 \7 e  z, u  z$ P; O
  58. #define TCCHEN_SHIFT                22
    $ X2 L2 n: r4 Y$ I! K
  59. #define ITCCHEN_SHIFT               23
    4 C0 h$ q: g  d) ~

  60. 9 Q+ f7 X. h! Q
  61. static volatile int irqraised1 = 0;& L4 T( \& _: o3 q# q+ I
  62. static volatile int irqraised2 = 0;. c: Y# M5 L7 L$ n; }1 e

  63. " R. R& Z. j8 Z& Z; X( l/ ]# V7 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , A! }( P* P& z+ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 u! S4 [* K$ @5 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& e- [/ w, m1 w% \& o

  67. ( n  b5 P6 b) a! E+ l
  68. dma_addr_t dmaphyssrc1 = 0;3 P/ n8 }1 Z5 r1 P2 N
  69. dma_addr_t dmaphyssrc2 = 0;: G3 g% |6 E/ S* p6 J* J; v- u
  70. dma_addr_t dmaphysdest1 = 0;& g5 Q5 @- {" T& O; A6 a
  71. dma_addr_t dmaphysdest2 = 0;
    / r( l% }* E. \9 r, F7 ^  e
  72. 8 J2 i5 @3 Q0 T- T
  73. char *dmabufsrc1 = NULL;
    7 `; F5 j% E$ j2 \' ?
  74. char *dmabufsrc2 = NULL;
    5 D8 h6 w' m3 V4 P' P& ^" }
  75. char *dmabufdest1 = NULL;+ ~. N; u' B! p* |1 m. r! j
  76. char *dmabufdest2 = NULL;- n" P% k: d$ F$ i0 q, r
  77. . l9 B* v8 M: Z" F* H0 G
  78. static int acnt = 512;0 p3 T0 {  Q0 w4 W, u8 [9 O
  79. static int bcnt = 8;% Y! B5 i: B$ O6 @. ~
  80. static int ccnt = 8;
    % U$ j1 d# ]8 x- G4 k! a

  81. ) B- u: Y5 P' g
  82. module_param(acnt, int, S_IRUGO);# x  x4 L( h8 b
  83. module_param(bcnt, int, S_IRUGO);
    ! v5 ?# B8 L( b; G' d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% U5 y; u6 h" a/ y! J+ h' C  l$ M0 \- J4 T2 i/ Z! }) \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. [3 K* Y0 Y& L- e( B  _9 {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 x: X8 z5 n' e3 r3 L$ N2 L2 v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 W* o9 N2 z2 N! l0 ?2 s
& X5 H2 G. C4 ?4 k; v3 a
# Z0 a% B' e0 w- ]* X' y* q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-21 05:16 , Processed in 0.037619 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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