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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- R- P5 B0 \% W! J# ^) ?
  1. [code]EDMA sample test application/ x* s/ p- s- M" C7 n( j' L6 p9 s
  2. /*
    + x2 C- j* {1 P5 u" l7 N
  3. * edma_test.c- M+ K, u  L; ?: T0 I# p+ ~4 d
  4. *2 L5 I1 O/ o+ F4 s2 F
  5. * brief  EDMA3 Test Application' @) c6 ?+ s( F" l$ a4 t
  6. *" \& P4 |1 h+ p9 H" l0 o6 a
  7. *   This file contains EDMA3 Test code.
    , i3 `( w* }% Z( X2 |7 n; O
  8. */ b+ {0 e; J! S( i/ \* J* ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # h  a3 k2 C5 ?. p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 _( ^. d6 B$ H& j- q! e  j
  11. *         TO CHANGE.) @2 f/ k' I9 }% e
  12. *' h( q* e  ?. `" r' g2 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( q  G+ f3 ?" k2 o% T
  14. *, a/ s4 j; a6 T3 A8 d
  15. * This program is free software; you can redistribute it and/or
    3 T+ y5 w" ^6 p2 K, w( T7 M( o
  16. * modify it under the terms of the GNU General Public License as7 u$ l4 f6 y* ~5 k7 d
  17. * published by the Free Software Foundation version 2.5 L" R; {, a/ W; ^- t
  18. *3 f+ A$ R5 G+ G; h2 r& M& p. P- K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! t9 ^) q" S: v4 M0 b5 |
  20. * kind, whether express or implied; without even the implied warranty. q9 v9 n+ v+ R* i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( j1 U: T  h4 k& E) d% |9 P
  22. * GNU General Public License for more details.
    1 W" G2 o8 ]/ l( @; j0 F
  23. */
    : g4 E8 r! e: s9 L+ f. ]; d
  24. : b# c$ T5 h" B$ }
  25. #include <linux/module.h>
    6 N5 S8 D* Y+ [- _' @7 X/ B
  26. #include <linux/init.h>7 L6 y0 R/ c) V# @
  27. #include <linux/errno.h>
    7 h* Q- n: O: M9 O& p
  28. #include <linux/types.h>
    # M0 n# E5 h2 b  i. [4 D
  29. #include <linux/interrupt.h>+ i$ G( F$ m& K" R0 `
  30. #include <asm/io.h>
    0 D! t( x: q7 c
  31. #include <linux/moduleparam.h>
    1 K8 b  ~, X) U8 H6 z4 V) ]
  32. #include <linux/sysctl.h>
    7 A% k6 i/ m3 c( Z8 X
  33. #include <linux/mm.h>
    : k0 a# Y( H9 S' O) L: C5 a! C
  34. #include <linux/dma-mapping.h>
    ; x: j! i% F& X' L: m/ H. n

  35. - ?! y, T( l& T) F
  36. #include <mach/memory.h>9 v2 g0 m5 L, w) o, {! D3 p7 r& U
  37. #include <mach/hardware.h>7 e5 h2 f8 _( E
  38. #include <mach/irqs.h>( t3 W# s- N4 J2 ?1 |9 W6 Q, _% s2 @
  39. #include <asm/hardware/edma.h>9 t2 J% F5 [9 b% G
  40. $ |* B: q0 k- S  b2 j- \
  41. #undef EDMA3_DEBUG! c. ]4 T9 u% e) H
  42. /*#define EDMA3_DEBUG*/
    " J. [3 w7 h1 S5 {# V' t: b

  43. * i. p) ~" Q9 U0 |) ?6 ~9 e
  44. #ifdef EDMA3_DEBUG7 }; n- L0 j8 x+ ?- v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 v, O) t2 H8 g& {! E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ~' j3 b2 f8 E$ o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ y7 b8 z$ y& C' u' W6 j; H
  48. #else
    9 H( ~8 j8 l; u& F+ d) w
  49. #define DMA_PRINTK( x... )
    * Q0 l$ D/ }$ V1 d! g0 D
  50. #define DMA_FN_IN
    + N1 V: m; ^7 O1 M3 ^+ @
  51. #define DMA_FN_OUT, h2 u* e% M7 ^; K0 w3 c
  52. #endif3 ]4 b" ^, o( r9 v

  53. 7 O; B# q: }9 b$ q' |/ u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* Z/ {  M  n2 V8 B7 i) t, v
  55. #define STATIC_SHIFT                3  z/ P; g/ a% p6 l# y
  56. #define TCINTEN_SHIFT               20
    # y, T4 W; m( K: U: L- n
  57. #define ITCINTEN_SHIFT              21( o/ E! t0 R  f2 p$ P; g
  58. #define TCCHEN_SHIFT                22
    " c, P. m4 M3 c1 ^! X8 k' d; X
  59. #define ITCCHEN_SHIFT               23+ B/ o; M7 U# Q, U! D6 B- ]4 x8 W

  60. / U2 v% u! u; a# c, M* z0 |- s8 S
  61. static volatile int irqraised1 = 0;
    7 `+ \3 K( C# A# b. r' k- w
  62. static volatile int irqraised2 = 0;
    ( W! ~$ N: z5 O* f! A! z
  63. 5 V( V4 j: l5 x! s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 P2 f' }: D8 S& O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . I. ?$ ^' K- `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) d4 W+ S* x, C& j8 n
  67. 6 e8 H2 U8 H  z0 M
  68. dma_addr_t dmaphyssrc1 = 0;) \$ Y8 n6 N# t, o2 R, O4 q5 C
  69. dma_addr_t dmaphyssrc2 = 0;5 i% l" ?# Z) Y6 B* X' Q8 r
  70. dma_addr_t dmaphysdest1 = 0;
    - M) x0 s) F# P" B8 O
  71. dma_addr_t dmaphysdest2 = 0;4 O5 m; Q( w! N+ G* u. V6 g% c/ B" m- ^

  72. / [& i; e+ E+ {# z( I: A- J- T8 J
  73. char *dmabufsrc1 = NULL;: K" _! a, w! Z( O0 a' C7 q5 o
  74. char *dmabufsrc2 = NULL;5 u0 H+ y0 e4 _7 q
  75. char *dmabufdest1 = NULL;/ Z$ y5 X. S( Y( Q6 y0 l8 B
  76. char *dmabufdest2 = NULL;& }9 v2 J0 @9 p6 h, q) f- w
  77. # i: f. h$ g/ y6 {
  78. static int acnt = 512;4 [# m; ?' z6 F( d% G
  79. static int bcnt = 8;7 ~' K4 z" L4 {' I9 a9 |, `
  80. static int ccnt = 8;& d/ ]$ Y& B8 A0 m% [5 a
  81. ' x! i' w' p, ~0 j8 V# t4 G. P
  82. module_param(acnt, int, S_IRUGO);
    " d0 C: X4 Y9 D( Z
  83. module_param(bcnt, int, S_IRUGO);) _$ }' m" _; f# i; C4 B) @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) o- E3 a! m+ M  [+ I- J' p; t
* N. h2 B* y8 C1 D  Y* _0 M, {+ w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& D. i, @+ X+ f9 h  a$ j% W7 m' u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. L- b4 q0 @1 I3 C& t  V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 W8 \; L' L$ I. F. I' V" m
' |" P. I9 x0 R5 M4 j9 o: G

, Z3 v( P! o# C$ F$ K8 j3 t6 [4 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-25 19:43 , Processed in 0.042919 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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