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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ Z! s9 G1 H4 O9 l
  1. [code]EDMA sample test application) p: N! G, @* m' B6 m0 I
  2. /*
    & h/ l- ]9 g+ j/ c# F
  3. * edma_test.c
    : C9 Y: A8 M2 ^4 X
  4. *
    $ {! G/ Y! K7 b' d5 ]
  5. * brief  EDMA3 Test Application$ Y1 L$ @. b- W
  6. *
    ' ?" p# _+ R: @/ g8 Y0 E
  7. *   This file contains EDMA3 Test code.
    1 c  }, W: K+ {
  8. *+ h# }- ]3 H" `* F  C  J$ s+ O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 u5 ]) e5 v; S" Q7 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 |$ N- b# ?& Z2 N- `
  11. *         TO CHANGE." a* v3 {. }; M) z
  12. *9 c* y9 |4 V6 {6 K1 t7 `- B. Y2 y/ B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 x) U! R+ K2 M7 y( A
  14. *. w6 }% S, ~+ y* q
  15. * This program is free software; you can redistribute it and/or
    & f' b( e0 C3 Z1 D: {1 p& i
  16. * modify it under the terms of the GNU General Public License as
    , o$ x4 m4 s# Z# ~: Q2 @( j% M
  17. * published by the Free Software Foundation version 2.
    ( i" c* i. O  g/ \5 v
  18. *# d) A* d* \5 ~& c1 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" M/ r5 O8 V1 F) u* K1 t
  20. * kind, whether express or implied; without even the implied warranty
    ! ~1 h+ w3 L! C+ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " k: P. O! m( H( _) ~; C+ b
  22. * GNU General Public License for more details.' u( `/ P( F+ ^: H2 B0 D
  23. */
    * Z7 I9 j5 q/ {8 f

  24. , y+ V2 B4 o6 @
  25. #include <linux/module.h>
    2 e8 \% a; G2 T7 A
  26. #include <linux/init.h>; i1 u: }6 G6 E
  27. #include <linux/errno.h>4 E: U5 m' ]1 e. \& ^7 Y
  28. #include <linux/types.h>( R2 p* p  j, M& J, V+ I5 V
  29. #include <linux/interrupt.h>% Y, J+ Y  [9 g
  30. #include <asm/io.h>  H1 Q) s- ]) ^% w$ C, [/ B
  31. #include <linux/moduleparam.h>( o- b2 I4 Q" {$ {( C2 b
  32. #include <linux/sysctl.h>
    . O$ |# v5 i  n- Z9 x' f
  33. #include <linux/mm.h>- _' e4 p, E" ~& L1 N! S7 F
  34. #include <linux/dma-mapping.h>; B: y: R, r! J

  35. % ~( a' d9 `4 P& X: k3 v, t: V
  36. #include <mach/memory.h>
    8 ^, }, j! r* j6 O, A9 U
  37. #include <mach/hardware.h>8 \0 @: E4 T0 k  h. x0 H" L4 n5 A
  38. #include <mach/irqs.h>
    - r$ Q/ P6 e: D8 W4 R: ]4 Y: u
  39. #include <asm/hardware/edma.h>
    ) s  w2 q7 a5 _0 N2 q# r

  40. / p/ {* _& e' @- |* C
  41. #undef EDMA3_DEBUG
    ' W4 M5 O. \2 j) g
  42. /*#define EDMA3_DEBUG*/  D: X7 G% S+ Q$ n

  43. ' M0 [* H  b! S
  44. #ifdef EDMA3_DEBUG
    - l9 K4 d7 V0 g$ p3 L0 U" U2 J, B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 z. n$ q9 r# |% I% h8 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( Y2 s0 R7 Y) T0 v& W1 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) }8 b; v) a- U, L  \1 Y) h3 K
  48. #else
    % T7 L; ?- J" b* Z% I# T$ G/ d; u
  49. #define DMA_PRINTK( x... )
    4 O) ^, x% B" H. l1 L
  50. #define DMA_FN_IN
    2 F) s) x3 p4 O) T% _# ?! @
  51. #define DMA_FN_OUT
    . p5 y! m& ^. \+ L. B. F$ B/ k
  52. #endif
    + P5 J5 ]' j1 I9 e) c. R) ]
  53. 2 Q* N* [' S, p( d; V. L; M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 f) p+ u% |, q
  55. #define STATIC_SHIFT                3
    " n$ T1 _  z- o5 w% m6 {
  56. #define TCINTEN_SHIFT               20
    0 l: P4 X+ D& i' k& I0 @
  57. #define ITCINTEN_SHIFT              21, A% `6 A- j+ u8 o1 O; L
  58. #define TCCHEN_SHIFT                226 Z' F" B. R; H: k7 }
  59. #define ITCCHEN_SHIFT               23$ w# y2 }1 B: M
  60. ! H' b! W6 y# k$ H! }4 l9 Y' W
  61. static volatile int irqraised1 = 0;2 u7 L( W5 y3 A1 p
  62. static volatile int irqraised2 = 0;, G  ]4 G3 o% X, T" Q  n* w$ h. d; c

  63. # ~+ s7 x9 e  b4 q# q: T1 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 K+ v! Q# v2 B2 l! A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 C0 i# h4 H+ s1 D% p( B2 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; o4 L& o8 B* U0 V, _: ?, d$ s
  67.   c. x: j( {9 ^/ G. S% i
  68. dma_addr_t dmaphyssrc1 = 0;: E7 z. J3 r5 u- W4 \8 U! M& {
  69. dma_addr_t dmaphyssrc2 = 0;- G# z: I5 R/ ^* k, v
  70. dma_addr_t dmaphysdest1 = 0;# U% Z( I5 T3 J1 a. {# p7 f& i
  71. dma_addr_t dmaphysdest2 = 0;  e( j( Z$ T5 |& j( q

  72. / h& X2 \1 |) N2 i8 \/ x! g: H
  73. char *dmabufsrc1 = NULL;7 ~3 q/ i' B3 Z& k0 Y
  74. char *dmabufsrc2 = NULL;
    2 a. Z% H& [% Y3 |3 s9 V
  75. char *dmabufdest1 = NULL;
    / H8 B3 O: ~) |& U
  76. char *dmabufdest2 = NULL;1 g* t; w0 Q3 r0 e  v( K) R0 g* S

  77. * g* a1 j3 Y  D6 ?9 `( y
  78. static int acnt = 512;0 T; L" c8 C1 ~) ]! |
  79. static int bcnt = 8;
    ' B8 ]5 t+ ~3 U4 \7 m$ A: [* r5 w7 E  B
  80. static int ccnt = 8;( Q3 y; z! q7 M2 S

  81. 5 q  v4 P' g' }- y4 a' c* Y
  82. module_param(acnt, int, S_IRUGO);# l' p0 t( |: `" D) Q& m5 d
  83. module_param(bcnt, int, S_IRUGO);3 R, X8 y4 n2 }7 O4 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ [% j7 d( ?! A# G+ S8 h+ x: I" L5 \3 p* y, Y  x& U9 g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 h2 b8 ~* h7 W: Z* i2 ^: Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, K+ @3 n6 ^8 \, ~4 I8 E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: Z+ D' V/ r( G2 |
, x' ^0 b& ]1 Y; w# n9 o" _6 w0 a3 ^2 P* Y& w. ^/ N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 01:33 , Processed in 0.039571 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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