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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( v' k1 n& ]1 \
  1. [code]EDMA sample test application* X$ x# b) a! `1 ^
  2. /*
      G! r0 I! A, Q* r6 O! B1 S$ o
  3. * edma_test.c
    $ A' [8 Q  l, I4 J& X% _
  4. *
    1 a; p% B4 P4 g' c4 l
  5. * brief  EDMA3 Test Application& v0 h( I* O. y$ z
  6. *" G# t+ {" t! t# ?9 D: q
  7. *   This file contains EDMA3 Test code.0 y; c, L* s# Z# r- F
  8. *1 r9 n/ Y5 i# U0 V) S  j; E) N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 R  H+ e8 Z# D0 T- T7 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ n' n) S& T$ ?6 X
  11. *         TO CHANGE., |2 p" b! q4 V0 W0 s  w3 j
  12. *; |- l! ]" k  U; Z1 A) A0 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / a: r0 ]) s2 H: U7 B- k* J: @
  14. *- p, _9 r( f/ f5 n
  15. * This program is free software; you can redistribute it and/or( h1 Y/ _# Z1 B
  16. * modify it under the terms of the GNU General Public License as' f' w) z+ Y2 O  }+ ~
  17. * published by the Free Software Foundation version 2.! M) |3 {* G* c2 Y
  18. *+ Z) c( h' g. P6 X" m7 b; M& Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ L. _4 j7 A+ _4 e5 t& P7 a
  20. * kind, whether express or implied; without even the implied warranty) v* R& \$ ?/ T4 |  u* n% E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 h* w' K8 p" Y: T& X
  22. * GNU General Public License for more details.
    - B2 |) d8 B+ y+ V2 @' M# S
  23. */
    4 f- ]' Z1 l' M- O4 U
  24. 1 O: w0 j1 S9 \3 ?) Q) q
  25. #include <linux/module.h>: A' t% x# k2 V2 C8 \
  26. #include <linux/init.h>5 H- T* L1 |9 S' t6 _
  27. #include <linux/errno.h>" q; l) Z) m% Y
  28. #include <linux/types.h>- d( y2 g4 z- e/ M* X3 B
  29. #include <linux/interrupt.h>: d3 R( [/ M6 e9 K! Q) o- g( `1 `+ I
  30. #include <asm/io.h>/ N+ j* J2 N! @' G
  31. #include <linux/moduleparam.h>
    * v  r$ b7 q- I8 v
  32. #include <linux/sysctl.h>
    / q. O8 I$ d5 L$ i3 h3 J
  33. #include <linux/mm.h>
      O) I+ k9 I2 s6 B
  34. #include <linux/dma-mapping.h>
    & C$ h* \" o& Z( e- H& r3 _9 c

  35. ( }. c3 L( h- a- {2 o) P' H
  36. #include <mach/memory.h>
    , G# @6 \8 R- K) X
  37. #include <mach/hardware.h>
    ; v1 b! _9 r3 ?# Z" l
  38. #include <mach/irqs.h>" b6 S& ?, e4 y+ T; ]# y% `' l% B
  39. #include <asm/hardware/edma.h>. w& ^7 {/ _5 I$ Z- N1 C4 Y
  40. 6 ?4 k% o) u# }+ q% j* X; x& j
  41. #undef EDMA3_DEBUG, s! u4 A- Q3 _8 T: y& c
  42. /*#define EDMA3_DEBUG*/7 j1 K$ `; S7 q8 |' n# {2 O; r3 r

  43. " w/ F( t9 }  V, _7 @7 g1 `/ {
  44. #ifdef EDMA3_DEBUG7 O/ q4 L% o$ `9 I4 W& t9 f6 G! s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , N) N$ i+ M1 d0 T1 o7 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' M/ q; o# D4 f- H# X9 H8 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& H0 [' B: t0 R4 B5 v
  48. #else
      w* R( _3 k- L1 L3 L+ P! S# a" N  l
  49. #define DMA_PRINTK( x... )
    " I) Z! h2 |0 W1 I+ G
  50. #define DMA_FN_IN
    8 r) L& t4 I8 o$ h& H
  51. #define DMA_FN_OUT
    ) R! W4 @4 [; [# ]
  52. #endif
    7 d" I" `  `; N8 V; p0 ?$ k4 U$ O
  53. . K/ o0 ?5 q! d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) g6 E- Y) S& H. [
  55. #define STATIC_SHIFT                30 r) ^  e# c3 D
  56. #define TCINTEN_SHIFT               20. p; a% y+ G. u, u2 ]/ D
  57. #define ITCINTEN_SHIFT              21% {- L9 {  ]; Q- k
  58. #define TCCHEN_SHIFT                22
    " T5 R( m7 p' S
  59. #define ITCCHEN_SHIFT               23
    , A  d# j  Y) C8 `. K' U

  60. & P- d* j0 T/ b! q) Y+ o3 x) ~  j
  61. static volatile int irqraised1 = 0;- g2 ^1 B/ t. k! @9 q
  62. static volatile int irqraised2 = 0;
    $ n3 y$ ^/ m# B* J: q
  63. + o0 t/ w0 i: C! E! |0 y; E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( q5 n- }9 O' @: G$ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [. Y/ P  g' s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! J( w. V, m% K6 }& P0 E, [6 \
  67. 9 J4 o  @% b) d+ ]
  68. dma_addr_t dmaphyssrc1 = 0;
    5 W3 x3 w" _; Q/ x- {
  69. dma_addr_t dmaphyssrc2 = 0;
    : C- r* x3 w2 Z$ b
  70. dma_addr_t dmaphysdest1 = 0;
    $ h' N' C* a+ A% P
  71. dma_addr_t dmaphysdest2 = 0;
    3 d& h5 A- J, o, D6 |. \6 z
  72. 3 f! d2 X2 b# C' O5 }4 U
  73. char *dmabufsrc1 = NULL;. i5 ]$ [% R! D9 p  O0 @4 i( H
  74. char *dmabufsrc2 = NULL;
    ( N: F* ~- o# H
  75. char *dmabufdest1 = NULL;4 r( x9 \: e( s- m( v
  76. char *dmabufdest2 = NULL;5 s. r6 q4 s: I4 F, ]& p5 _

  77. ' }/ ^/ P; M+ m: G
  78. static int acnt = 512;9 J! {8 M+ A. X  V
  79. static int bcnt = 8;9 z- k% h# x3 v+ a2 P# H/ c
  80. static int ccnt = 8;% s' l: r9 `/ B3 u  P
  81. + H( H0 [+ P# J* }( F
  82. module_param(acnt, int, S_IRUGO);1 [$ l+ ~: p7 @' j
  83. module_param(bcnt, int, S_IRUGO);
    4 s( c; I& x1 k5 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 C- ?3 {/ r. Q3 ]/ F0 m
8 V( o2 ~& T: r0 @$ r$ ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 D9 s, ~  p# c2 u/ ~: g: b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 E% m) z8 l9 C$ F; O# V$ D0 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ D9 c. Q* R8 W4 A! |* v: Y

0 `: G# _- i& J& f8 z1 G. J9 K& X/ A
3 s# t, B1 f7 u$ M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 19:31 , Processed in 0.036238 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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