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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. C) x- e- G6 D, l1 M# l5 n" C/ a* S
  1. [code]EDMA sample test application
    ' I, M% j& C& j5 q" |
  2. /*
    * a  \4 [( ~5 W0 q% j; J" j0 F
  3. * edma_test.c
    " z. n+ C- `6 _- }3 A
  4. */ w) P; ]6 e2 B# o4 t- w, e
  5. * brief  EDMA3 Test Application$ t: H& X0 `% v& D5 c  l
  6. *
    . y; _7 k! i8 J& U
  7. *   This file contains EDMA3 Test code.
    : s- P' M1 J3 w" N
  8. *
    " G% Y1 G& @1 v0 i: U% h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 O% `* s% ?: _; X4 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 t; K4 O0 `! U
  11. *         TO CHANGE.
    ' i/ J8 P: D3 @* z: T
  12. *% m, X# l2 q7 y5 k  \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& a. s5 T; p6 r# L' \/ E! U6 Q# A2 a
  14. *3 c9 v, P8 ?4 @: T0 M, S/ z
  15. * This program is free software; you can redistribute it and/or  C/ b3 z$ G' [1 k
  16. * modify it under the terms of the GNU General Public License as- h5 r! d+ D, [
  17. * published by the Free Software Foundation version 2.- E" d: o; f+ Y! R" j6 U) P" K
  18. *" C" X' v+ i1 s1 ]/ C2 x; t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / p2 d6 C  b2 C- H
  20. * kind, whether express or implied; without even the implied warranty5 K' ~/ |- r( x* D7 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: d! `  `# |) k0 r4 Z; X3 O
  22. * GNU General Public License for more details.
    $ _8 R9 Q* I$ ~
  23. */
    8 i/ g3 e! _4 ]1 c" [! ~% ~
  24. 2 V* G3 H0 S' y6 o9 b6 d
  25. #include <linux/module.h>
    7 I7 s; V# g& s; R( {
  26. #include <linux/init.h># @9 Q/ G+ o* @
  27. #include <linux/errno.h>0 {7 D  m" S$ o( d) o
  28. #include <linux/types.h>* k' W$ P6 z! t$ Z6 _. L/ C7 _
  29. #include <linux/interrupt.h>
    ' h* _& s4 c9 o8 C$ R% S$ T
  30. #include <asm/io.h>
    & b1 ?7 x6 W( m5 W6 e1 B
  31. #include <linux/moduleparam.h>
    5 P1 ^& @6 o/ s7 ]" c" A
  32. #include <linux/sysctl.h>
    ) M7 I# \7 O7 D8 L* K6 I. V
  33. #include <linux/mm.h>
    % a1 a$ m/ Z" X
  34. #include <linux/dma-mapping.h>
    # q* l. E6 F$ a6 ^; p
  35.   t! `6 k1 [$ Y6 m8 p" E6 a( ?# O
  36. #include <mach/memory.h>8 E/ f+ P& `! u& t) S9 a. `
  37. #include <mach/hardware.h>7 n5 r( F! U' i4 L' [; |
  38. #include <mach/irqs.h>& E' @, \3 Q" E
  39. #include <asm/hardware/edma.h>: l6 s7 i" ~4 T

  40. : H* B! y6 q+ z2 o1 C/ Z
  41. #undef EDMA3_DEBUG6 u2 Z1 w' f" m8 C1 u
  42. /*#define EDMA3_DEBUG*// d. B/ c: q- u+ E) R1 s- k$ l

  43. . y! }' H& x9 d1 l6 @( s
  44. #ifdef EDMA3_DEBUG
    - x# m% k) h/ g  l0 o) ~( M( j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # o1 i# S7 i1 G  h: O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% w4 g2 S3 I  _' U, v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ ]* r8 B9 ~' ~& T! j: J9 y/ }* w
  48. #else
    6 D* V# R7 Q+ c/ K) d- x- ^# {
  49. #define DMA_PRINTK( x... )9 v% ^6 m* J" x$ ]
  50. #define DMA_FN_IN
    2 b4 {% N* F- g( }' C$ i$ Q
  51. #define DMA_FN_OUT/ L3 w$ m& V6 i# U
  52. #endif
    * j0 t( }% R8 z. U) W
  53. # i, W% ?% |: b7 g4 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 y) f3 x  a0 Z1 q7 ?
  55. #define STATIC_SHIFT                3
    4 M- h  i- A' M; X! u
  56. #define TCINTEN_SHIFT               20! @% U4 i- C% y9 A
  57. #define ITCINTEN_SHIFT              21
    9 t) Z5 d' h, a& g4 h
  58. #define TCCHEN_SHIFT                22* y; U7 @2 @; \
  59. #define ITCCHEN_SHIFT               23( Q' y2 j4 F$ y/ t

  60. 3 |4 L8 T+ f4 V& Y
  61. static volatile int irqraised1 = 0;5 @2 |& ~4 f9 o3 Z
  62. static volatile int irqraised2 = 0;
    3 Q8 S9 [  J8 M1 p$ Q" n/ U

  63. % \5 f1 G1 H: u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 O& D- }( v2 [$ V" _5 Y2 Z8 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # o* v/ x2 s3 E! s7 b% V2 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' g7 ^3 V. U& u0 O/ b
  67. 8 t5 R. Q7 s( Y) _2 e
  68. dma_addr_t dmaphyssrc1 = 0;  J( q2 {, ~" b9 U
  69. dma_addr_t dmaphyssrc2 = 0;2 P1 X) a0 W( w+ L. S* N, Q! r+ _: j
  70. dma_addr_t dmaphysdest1 = 0;, ^) N$ L1 j4 [/ H( E& H
  71. dma_addr_t dmaphysdest2 = 0;
    + R/ \' y9 c/ E3 m# G4 H
  72. . A( J9 h1 P$ m3 S& t
  73. char *dmabufsrc1 = NULL;# x* R2 T6 o/ |9 Z$ F
  74. char *dmabufsrc2 = NULL;
    ( f0 L, B/ j; l/ n, i5 V3 J
  75. char *dmabufdest1 = NULL;
    1 O$ r1 h' t% T4 X1 X3 ]
  76. char *dmabufdest2 = NULL;. F. e) x$ C( G$ N
  77. - r& z# e6 R) a2 L5 x: t! ~% H; L
  78. static int acnt = 512;& R8 x) _: ]5 \: T# l  v$ C
  79. static int bcnt = 8;. d0 M9 L% v$ z2 X2 L+ r
  80. static int ccnt = 8;: S$ M" u* ?' ~

  81. $ z& o; l5 L3 i6 Y4 ~
  82. module_param(acnt, int, S_IRUGO);& L. q2 Z. y1 U. r9 Z
  83. module_param(bcnt, int, S_IRUGO);8 \* S. u3 e9 N) d+ \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* F& }( X/ l, U% b: Y

8 c: A* B) s: l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* }- D: M5 m! r# ]9 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% N5 d$ s6 N7 c7 ^' c% v2 Y5 U% N0 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ `" E' p1 a: Y$ r- b

5 G1 l7 ^$ k2 G8 D: U6 v& u
  R* c) s/ H& O7 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 19:12 , Processed in 0.043003 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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