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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : \" U( H" _% }5 J
  1. [code]EDMA sample test application
    . K% m6 F! ?2 l6 x
  2. /*
    - m* |3 A+ u& c4 X7 H
  3. * edma_test.c
    : H7 a( a2 l8 G# F
  4. *
    . K7 r4 m, e( i( w1 x& n& e
  5. * brief  EDMA3 Test Application4 D6 L6 q0 N% \8 B$ u! ~! N* |0 ^
  6. *, V8 c. {2 s- n
  7. *   This file contains EDMA3 Test code.1 E, f5 Z* m6 {( a8 ~3 x
  8. *
    , X" |% U) p2 [) L7 I9 J1 D/ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 w* q: A2 @; _& y! a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 Z/ d# V4 F) @1 r
  11. *         TO CHANGE.
    ( |0 {0 ?3 `, M3 G  a, D  x& O
  12. ** _& r( J  e7 N9 f; L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 p& |8 Z) e2 p. m
  14. *
    ) X) c3 @4 a, {3 w$ _/ k( s% d  I; S. e
  15. * This program is free software; you can redistribute it and/or& z- f8 c( g) Z* N. U; X6 A" }
  16. * modify it under the terms of the GNU General Public License as' y$ y- [8 [' O* E1 T% r" r
  17. * published by the Free Software Foundation version 2.
    : m$ L8 z" d' A! N6 |
  18. *3 \/ d8 _3 X7 z. C6 B  T- q8 W/ R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( L. p8 u6 B- B! O( d. K) K* ~
  20. * kind, whether express or implied; without even the implied warranty
    6 H' w0 i* T% x0 N% f  L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 L% e+ J$ i  [8 |: n
  22. * GNU General Public License for more details.- A6 R4 m3 E1 ~9 ^; e4 J
  23. */+ q) y) Q- W" |- o' W) l

  24. : X% Q" A' N, q" P8 ~/ B& V
  25. #include <linux/module.h>, ]9 _7 B+ V; R0 p# U7 O& y* D
  26. #include <linux/init.h>
    9 _% H3 o" N( p# P/ T
  27. #include <linux/errno.h>
    4 Q5 O- ]' Q6 h& Z+ ]4 ~
  28. #include <linux/types.h>$ {5 ?4 V! o) u' T, s5 c" w2 n
  29. #include <linux/interrupt.h>
    0 f8 B# o/ k1 m4 s) k
  30. #include <asm/io.h>
    ! j. w9 F  p( h, H0 `
  31. #include <linux/moduleparam.h>* `/ [% Q, Q+ w; \& I7 Q: m. a
  32. #include <linux/sysctl.h>
    9 q1 r5 E. T: X
  33. #include <linux/mm.h>
    5 S! q  {$ w3 l9 @
  34. #include <linux/dma-mapping.h>
    - A; V# \5 h1 q- ^! N

  35. * ], d$ S# y! v0 t7 D. v: u7 H
  36. #include <mach/memory.h>. o" `3 F- ^2 v" u5 P8 g
  37. #include <mach/hardware.h>! U, |2 ~1 s' j# h, B
  38. #include <mach/irqs.h>
    9 ]+ Q3 [) \. a& x7 A: p# r& U$ a2 W
  39. #include <asm/hardware/edma.h>9 r, |* d1 [" ]. Y8 k/ O% G
  40. ! t. ~- g" H2 P8 A" b
  41. #undef EDMA3_DEBUG6 f6 b) k$ D' E. `# e
  42. /*#define EDMA3_DEBUG*/
    7 w) x+ t8 y1 R8 Z# m, Z7 i* j
  43. / y* h/ m8 ~, m! r+ N- |7 a
  44. #ifdef EDMA3_DEBUG& Q. I2 G- Z3 f* _5 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ g7 I9 u+ d1 t) q; c2 `6 K: K- r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 F" p. |1 {* Y. a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 r( n2 t' g0 F, A/ {+ j
  48. #else
    4 T6 N# _2 P( x# a; G5 p: l
  49. #define DMA_PRINTK( x... )
    # q+ Y  L# w. P7 c% f& o% f: L
  50. #define DMA_FN_IN7 i0 G5 i3 j9 H& a" T0 F" a+ T
  51. #define DMA_FN_OUT; y1 `# X5 t1 @: e/ k
  52. #endif1 o# |& a& S7 j' T

  53. * D4 T! C+ }9 E7 L/ Y9 R" a+ I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 T. |) C- d# v- F: U* N" }: ]
  55. #define STATIC_SHIFT                3
    ; I" L' i! k" N- Z% u6 i
  56. #define TCINTEN_SHIFT               20
    & f% D: W. D! G! e5 F
  57. #define ITCINTEN_SHIFT              21: W5 b% N; `3 T
  58. #define TCCHEN_SHIFT                22
    2 y5 G) ^# S5 c$ T/ G) d( t) S
  59. #define ITCCHEN_SHIFT               230 V$ o  Z" G: D5 E1 r. |
  60. + l8 x# o9 x/ n0 O5 U- h& C
  61. static volatile int irqraised1 = 0;
    6 Q0 c9 _) O: E* M% _7 |4 E* P
  62. static volatile int irqraised2 = 0;- f6 ^9 N6 U: D- I) u
  63.   G" d6 U6 j# X; M7 T. w; s/ R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, _1 v) l7 {( w4 K  _8 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 U0 l* {; u* i& b- L; k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ?2 X" a$ j8 D* L" O8 l/ h
  67. , d$ R6 V* p0 \* y: \1 U2 P
  68. dma_addr_t dmaphyssrc1 = 0;: L  Y4 {3 q% b# z0 G
  69. dma_addr_t dmaphyssrc2 = 0;
    4 o* y: O; m: ?6 O" Z+ u
  70. dma_addr_t dmaphysdest1 = 0;
    ' m3 ?3 H1 e; E
  71. dma_addr_t dmaphysdest2 = 0;
    1 a: q- Y, I0 I8 q& ]
  72. ! h. f( z) t; L2 ]% i
  73. char *dmabufsrc1 = NULL;# n3 s* `1 T' D
  74. char *dmabufsrc2 = NULL;3 v; ~. n8 ~+ n# u, b9 D$ D
  75. char *dmabufdest1 = NULL;! ~' d' s! k  n% {2 ~* G
  76. char *dmabufdest2 = NULL;8 f$ x) z: w  A( s# v% k

  77. % \: W# V0 G0 c3 `2 z: a+ W2 Z, R
  78. static int acnt = 512;) Q( p9 H% w" L8 {# R/ Q' t
  79. static int bcnt = 8;
      h; @1 G) O& `- \8 o% h7 k: V) f4 D
  80. static int ccnt = 8;. N/ u$ x8 i2 H+ U1 s- a- Y
  81. - o5 \2 o( f6 h$ }
  82. module_param(acnt, int, S_IRUGO);
    7 z5 ?" G9 b& z6 ^; C& E* {  b) h
  83. module_param(bcnt, int, S_IRUGO);
    # m+ R4 d0 c8 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ l" h/ \+ }4 ~9 g3 B3 R; ^: U

3 w( p6 h5 m7 q* i9 t0 k+ p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) h& O2 q9 T/ e: H: E- larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 ^" r  Z/ g- I6 q. G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 X( I/ r( C4 S( R" e0 p& n( A9 m9 k2 Y9 O
; s1 M- q; r7 V: v/ N( t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-4-30 00:04 , Processed in 0.035305 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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