OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, W8 m! V& Z% ?# e1 C
  1. [code]EDMA sample test application  o, J9 ]8 n0 j( c; I4 B
  2. /*! }: U8 }4 M# E9 a1 f1 S1 C7 M
  3. * edma_test.c. {7 p, {1 T4 ?
  4. *
    $ ~- O& J. R6 a4 m, W- k
  5. * brief  EDMA3 Test Application
    . P" W$ j% \; ?) \
  6. */ L4 [% e( C( s3 U/ c- M
  7. *   This file contains EDMA3 Test code.# i8 ^2 M  h* \* A
  8. *+ M6 s+ D, C+ ~; G* m* n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 z6 Y" E0 ~9 b4 z9 H! q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 ~% r% h, R9 A6 y
  11. *         TO CHANGE.* b1 \. X4 a* p) p
  12. *, i; F; Q9 ~8 ]) p6 G! t) {) ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! O  ?7 J- G3 @" P
  14. *
    : r7 ^, S+ H, I& \
  15. * This program is free software; you can redistribute it and/or7 c; i+ A5 J5 V! @- ~5 ~
  16. * modify it under the terms of the GNU General Public License as4 r$ P8 f! }1 @, s, R8 j" _
  17. * published by the Free Software Foundation version 2.
    . {% P: `+ B  y# d
  18. *
    ; A+ P" N6 P, k! }/ P, e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) j; M, O0 k2 |3 u* z' w/ `& J
  20. * kind, whether express or implied; without even the implied warranty1 O; l3 {$ B/ y3 o1 b1 s- P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' A) Z  N" c1 U: l4 v2 \$ t, V
  22. * GNU General Public License for more details.
    3 ?/ J. A$ m: y+ n
  23. */
    6 {1 ~$ G: H+ y

  24. 9 \+ Z( d6 b! b9 |3 t; e
  25. #include <linux/module.h>  k3 F6 x1 b+ e
  26. #include <linux/init.h>' p! ]: @% u4 c# Z, Q
  27. #include <linux/errno.h>' A# I* i& r+ s  v( o: c3 s
  28. #include <linux/types.h>3 G, }/ Z8 ]( ~+ c% a+ d9 G/ W2 c
  29. #include <linux/interrupt.h>
    . _. k. v* n. J8 X5 |4 c* J3 t
  30. #include <asm/io.h>/ o4 Y  d' q# s2 X% k: ^
  31. #include <linux/moduleparam.h>
    6 y: l& x& T8 V5 u5 |! O5 N
  32. #include <linux/sysctl.h>4 I4 Q. O: M( s4 s% x6 u! n
  33. #include <linux/mm.h>
    " z. I* A# g4 ]% x- ~
  34. #include <linux/dma-mapping.h>) \/ L; d$ I# z& v1 J4 s2 s+ L5 V
  35. / e1 B, T8 j' v. `; T8 ~, k$ r/ h) ^
  36. #include <mach/memory.h>
    9 o% n6 P8 u$ A6 T. |
  37. #include <mach/hardware.h>( H8 F# Q& \; }+ q- p% S; @- P
  38. #include <mach/irqs.h>
    3 w* \& _4 [  _, A. R# f
  39. #include <asm/hardware/edma.h>
    8 Y% l; w3 A6 z5 m$ d

  40. % M0 c/ N. |5 H. H( i  P9 a; X
  41. #undef EDMA3_DEBUG
      n% s6 v2 [4 X1 z$ S5 c" x4 F
  42. /*#define EDMA3_DEBUG*/
    4 k) x- y9 A0 i# l) L3 K5 ~
  43. , w- S: p( B4 r1 M( W
  44. #ifdef EDMA3_DEBUG
    * H$ B9 {; j5 _+ u' t7 y/ }$ c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& R, R+ {  K* g0 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 b1 i6 \" C. K6 w1 Z/ R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 o4 {0 q9 O2 c1 `0 X; y
  48. #else
    8 G( ~9 h" u8 L2 p& k1 t. O9 L
  49. #define DMA_PRINTK( x... )6 B9 L3 O+ H) Q% a, t( t: G  q
  50. #define DMA_FN_IN: `1 `+ @1 w0 `2 a: F6 Z$ B
  51. #define DMA_FN_OUT
    & }+ z9 n  Y3 i; |! j
  52. #endif
    3 Y3 {4 F1 S* h+ t  C

  53. ' `5 o, }. ^7 O$ e3 _$ ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): s8 P3 G9 o* U! u3 J& I4 r
  55. #define STATIC_SHIFT                3: ]. ]; c: [/ [9 K
  56. #define TCINTEN_SHIFT               20  n5 b# `' A% }& r' s/ }
  57. #define ITCINTEN_SHIFT              21
    $ {) W$ e6 c9 ~/ r1 o; x, N) X5 M
  58. #define TCCHEN_SHIFT                22
    5 a3 }" N0 J* [! G  M, e# Y
  59. #define ITCCHEN_SHIFT               23
    ( w" ^: s% U* R2 p

  60. " i: Q. a9 X7 \; B/ h
  61. static volatile int irqraised1 = 0;* B& Z! P. D# s$ I- |% o$ _
  62. static volatile int irqraised2 = 0;; x8 `9 |! {  U( o1 x
  63. $ l6 u' d: k5 m- \5 J1 b! J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # N+ L5 Y1 B! V+ A0 J0 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 N! b3 s( T% b7 ?  S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) a+ o% b% X* V6 C6 p
  67. ; F9 q4 |. |6 J
  68. dma_addr_t dmaphyssrc1 = 0;
    0 W& F7 Y; {! J; {$ i) g; T8 N9 N
  69. dma_addr_t dmaphyssrc2 = 0;. t( H2 ^: ~' _/ K' ]
  70. dma_addr_t dmaphysdest1 = 0;# S, b% Q2 r3 G; Y: R6 S
  71. dma_addr_t dmaphysdest2 = 0;- M1 \, r. T1 d$ S4 b! W1 `  r* a' r
  72. + J3 I3 c5 W+ P
  73. char *dmabufsrc1 = NULL;/ R4 b" `  F' N2 |( c, J6 s; P& O; p  M* M: E
  74. char *dmabufsrc2 = NULL;
    8 M( [1 G- L" F
  75. char *dmabufdest1 = NULL;
    " f% c, a" R+ j4 J0 d( a
  76. char *dmabufdest2 = NULL;
    $ B# z- o0 V/ M! C6 E& U! D- m

  77. 6 \7 b1 @+ ?9 Z8 a& x5 d
  78. static int acnt = 512;/ X& s  d& k) b; ~- p+ ?7 u
  79. static int bcnt = 8;* E% s. z5 ~8 K6 r* z/ N+ F# s
  80. static int ccnt = 8;, a- y- `* T2 }! ^; T; i
  81. . g& H2 K: Z: ^5 V5 U0 Z2 ~
  82. module_param(acnt, int, S_IRUGO);- E( G# E7 I4 `( _  r& Z. X7 Z) C
  83. module_param(bcnt, int, S_IRUGO);  Z4 v4 r( J+ D& G: b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* d) U) Q5 `- ~0 U/ S; t3 Z
' P! Y* L: J/ V7 K  g0 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  b6 Z+ Q: X# H% X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. h, m  [1 b+ [8 E* n( H# y  B9 R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 B6 h- y8 C! Y- S! T1 C4 p
: B! A0 x# u7 t8 B
$ [- b' h. X+ r. j  ~) r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 22:13 , Processed in 0.038055 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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