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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! d9 a- d3 v' H* f9 F
  1. [code]EDMA sample test application4 L% p9 @2 e, C
  2. /*
    ; d' }, t. d$ [9 Q. d
  3. * edma_test.c
    " a% i& W2 M8 y' @7 G  Q) k' u
  4. *
    8 c# U' v9 U% b9 c- v
  5. * brief  EDMA3 Test Application
    ) R* d1 g, M& S5 p
  6. *; j4 r& u) }( t) t% s1 ]. t
  7. *   This file contains EDMA3 Test code.  w+ w( L( ]4 W! _
  8. *
    5 j# f7 r+ x4 k; I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 }1 L0 o  y# k- k) V! v" s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, z" y$ Z* N8 z* r+ p, k
  11. *         TO CHANGE.* P- \0 Y' i( D6 c" U+ X" b* t
  12. *; z/ h4 L* }* o3 L5 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; u6 L8 }8 c/ G. Z# L
  14. *8 \# x9 `; l* L) z; |1 C
  15. * This program is free software; you can redistribute it and/or% P3 H" o7 w% D# W8 `* S. D! F* V
  16. * modify it under the terms of the GNU General Public License as- s/ D: `+ X8 ]! A7 B
  17. * published by the Free Software Foundation version 2.
    - l0 c8 |( _$ [9 z0 e# Z
  18. *
    % Y! F( U  G3 U2 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 d% L, o; E5 E
  20. * kind, whether express or implied; without even the implied warranty  j1 @% v+ d( w# A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 P  e4 e4 {8 E! U+ ~" q4 X
  22. * GNU General Public License for more details.
    & R. w4 {& b: ?. ^; A- ]5 S/ c
  23. */7 j7 D% G0 B1 N% t+ G7 `6 e* Q
  24. 6 {* B* N' Y8 N+ V
  25. #include <linux/module.h>
    ) Y1 ?2 T. v$ V& f* [$ x) M
  26. #include <linux/init.h>
    6 k* _* r2 r) F) X' I6 u
  27. #include <linux/errno.h>- ~" u& ~& I2 S9 r
  28. #include <linux/types.h>5 v  q  H6 F4 s# k! {% c
  29. #include <linux/interrupt.h>& t! B9 K9 m) V' g( v
  30. #include <asm/io.h>5 y; f, @& v+ _+ V
  31. #include <linux/moduleparam.h>; b: l) d% E' ^5 j
  32. #include <linux/sysctl.h>4 ^. F% G: ?) F0 h
  33. #include <linux/mm.h>! }+ i, O( m+ h# U+ t2 e2 c
  34. #include <linux/dma-mapping.h>  a# d( [  m) E) j) I; g# m8 H* g4 w
  35. ; K6 Y+ M$ G( x& l) {
  36. #include <mach/memory.h>
    ! ~, n$ I- }1 Q* E
  37. #include <mach/hardware.h>
    * _; z7 ^6 f$ R6 ?) x2 f
  38. #include <mach/irqs.h>
    ' T7 w: H$ K+ x/ M) K
  39. #include <asm/hardware/edma.h>' z$ _. Z$ E8 T

  40.   `8 A  v9 x# g3 s
  41. #undef EDMA3_DEBUG* e! i- m1 z& r  Q. v; q! l! D
  42. /*#define EDMA3_DEBUG*/
    $ X% u6 v, {; k! B$ P: w' j
  43. 4 E0 ~: D. l" G
  44. #ifdef EDMA3_DEBUG
    $ C( d+ G- r9 c/ u$ |5 _/ U$ k  A$ @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( W" Y9 {/ b. {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- g7 O: ]2 Y1 q, x6 O. H& r' J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      H, V2 M( z2 T6 K8 _- q' F: ?5 s
  48. #else
    ! e2 ]* I3 ^2 Z! I( D% T
  49. #define DMA_PRINTK( x... )
    / v2 \! P8 t& i/ n
  50. #define DMA_FN_IN
    ) w+ v6 a7 p* Q+ e( j  j* M, t7 L
  51. #define DMA_FN_OUT2 f2 v- B9 k( M5 @/ `# X% Z
  52. #endif
    4 `& [( X5 U" Y

  53. + I: s3 J% t8 u6 J7 F+ o! O, U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - [: S9 T. d7 Q3 s1 A* c& K3 _" I" r8 y
  55. #define STATIC_SHIFT                3
    " V% w3 @* G2 k) v
  56. #define TCINTEN_SHIFT               20( X& \$ k* ?( H# v
  57. #define ITCINTEN_SHIFT              21: G' W. ]- R' i. L: T  p' n2 J. S
  58. #define TCCHEN_SHIFT                22
    4 y; {+ T. ?9 S$ K4 |0 M* A
  59. #define ITCCHEN_SHIFT               23
    / I& w8 j0 U4 v# r7 _  N
  60. 1 p5 P' w) O5 }9 S+ z
  61. static volatile int irqraised1 = 0;. x+ q9 G0 ?' T- v7 T3 B" _. T
  62. static volatile int irqraised2 = 0;
    : \$ Z# c3 g5 w* `/ a$ L# j
  63. # j/ P# t+ }  g: P$ l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ]9 d- F7 Y' d9 i5 ^# Q  [. A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; k4 e  I  I, f  g, P0 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  v$ x, h- l" A$ Z: R

  67. ; G  C, w5 Q7 K) a% ?* y/ [
  68. dma_addr_t dmaphyssrc1 = 0;8 v) H$ N8 z9 P, t) `) y
  69. dma_addr_t dmaphyssrc2 = 0;
    , M0 P+ [* W1 u, ^  ?! u9 C( f9 s
  70. dma_addr_t dmaphysdest1 = 0;  C2 L9 H) B( ^) o( N
  71. dma_addr_t dmaphysdest2 = 0;
    ! N6 _7 t$ l# C0 p( V* d% `

  72. & w4 D0 @/ p: |7 `- j" h5 f6 @
  73. char *dmabufsrc1 = NULL;
    1 u8 P6 P. ?% r" f) U/ {2 w+ ~0 u0 D
  74. char *dmabufsrc2 = NULL;0 w, i, ~9 Z" h) k9 g) |1 S( X
  75. char *dmabufdest1 = NULL;
    : e$ g* j+ R& ^
  76. char *dmabufdest2 = NULL;
    2 J5 ^+ h5 ~- H  T" C) f1 C5 _1 ], ]

  77. ! ~4 a# Z: ^( C* F  g3 c0 b
  78. static int acnt = 512;" g) b, b, q! i/ F& Z" |
  79. static int bcnt = 8;
    1 [- X2 _$ y' w/ [8 z
  80. static int ccnt = 8;3 ?; v5 M2 v9 [- Y$ {' e0 G
  81. ' I/ j8 r- |- y( o5 M" g
  82. module_param(acnt, int, S_IRUGO);
    8 w. L9 Q9 K/ D0 }
  83. module_param(bcnt, int, S_IRUGO);
      N$ C2 f7 `/ B+ N7 R" t+ j. l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 I4 s+ z. q; G; N" l
" _0 P& i% O8 j8 w1 l: }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: z/ w$ Y6 ~; q% Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( x/ n) y  r' N/ [% ^1 O6 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. G8 |) I( ]" @4 \; m" l, j: P4 {  U. y' d
% e1 @) x( ?3 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 05:40 , Processed in 0.038222 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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