| 
 | 
 
 本帖最后由 yyj 于 2018-1-30 11:01 编辑  
5 z6 S# j( J2 o( A0 m% S! Q0 M- [code]EDMA sample test application* _$ i3 o6 F0 X3 O) ^2 l! Z" A$ N
 
 - /*
 
7 [' ?' h( k4 A; ^2 d - * edma_test.c3 t; w. U* k3 ^* o1 _+ O& W
 
 - *6 Z. L* h, N1 u
 
 - * brief  EDMA3 Test Application
 
: k* [/ n) q4 x, w - *
 
6 d, @! V, F# D- d5 {  W - *   This file contains EDMA3 Test code.
 
) A) D2 R. w  c. z$ @ - *
 
( }) y8 j) l8 f& F" X - *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 A# L" A( r7 s0 e4 y1 o
 
 - *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
 
4 D+ g8 M! }& i: p4 ]" ]0 s - *         TO CHANGE.5 S; x# f0 M* R# D  N, ^
 
 - *3 U% s. [7 y  l- S" p  h( v
 
 - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
 
' t7 ]& V8 g7 @& e. j - *
 
5 e( R" p( o+ n* b9 I9 `$ P" r - * This program is free software; you can redistribute it and/or6 K$ }5 _" P! |, {6 y' W7 G
 
 - * modify it under the terms of the GNU General Public License as
 
3 n0 q" O: q2 u0 v - * published by the Free Software Foundation version 2.. p" [( y+ a+ J: O
 
 - *$ I  l0 N; r4 w
 
 - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
 
  w/ x3 V# y& f. c6 z; {  | - * kind, whether express or implied; without even the implied warranty! p: f8 \2 E& n( v# Z
 
 - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 O  ?. }- i3 Q# u  r9 `6 d
 
 - * GNU General Public License for more details.
 
9 E" ~; z- |2 Q8 R8 I8 L7 j - */
 
+ j( P3 l% b# w: I  
9 n- ~8 J  u6 i$ }0 o- #include <linux/module.h>7 x- e+ @1 p9 P9 E8 F6 R
 
 - #include <linux/init.h>
 
& k& ?( Q# _, [2 @  Y - #include <linux/errno.h>
 
! S! z  P- C/ [) }" b - #include <linux/types.h>
 
; A$ e4 y5 [! L' E - #include <linux/interrupt.h>: ?3 {& K" ^' h- z" [
 
 - #include <asm/io.h>
 
- T7 P8 u8 ?  l  e/ C" \7 L - #include <linux/moduleparam.h>* `2 V2 N7 B3 G: m# o
 
 - #include <linux/sysctl.h>
 
. u% h1 [, g# x3 ?6 t. T, \ - #include <linux/mm.h>1 ^, B) u- @5 I+ e& O' H: M
 
 - #include <linux/dma-mapping.h>
 
: ^' ?% B" o3 n; ~; C; d  
. {* G9 ^. q( g6 y" Z3 `' u& }6 x- #include <mach/memory.h>
 
/ o3 l% M, h* e - #include <mach/hardware.h>
 
) C5 h- a. |5 P7 i3 a$ P$ O - #include <mach/irqs.h>
 
" j+ l9 F* N. \- g; C; w( R/ R4 h - #include <asm/hardware/edma.h>) x: t5 a' n% Z- V( f
 
 - . ?5 |& u( B" O# M# y
 
 - #undef EDMA3_DEBUG/ V) D8 ^. f5 f' l8 t/ c' r
 
 - /*#define EDMA3_DEBUG*/
 
- j" j/ D8 g3 `7 j  B9 W  
6 d. I  o( r; d! B% A  L# a- #ifdef EDMA3_DEBUG! P, G& d% C2 {2 W- G8 A8 ^' v* t
 
 - #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ d7 B; [+ c6 r5 e6 W
 
 - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 A! p- O0 N6 w3 Z; ~
 
 - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
 
9 g( @# a. W7 |: t8 u, n - #else2 S+ d* G! |0 c: C
 
 - #define DMA_PRINTK( x... )$ t( G6 r) o0 R0 g2 x6 p; B
 
 - #define DMA_FN_IN' G! L: h8 l- G, L) f/ Z* d2 a
 
 - #define DMA_FN_OUT
 
& F: `' Z* o5 V - #endif" k8 w5 C; J& p( M8 Z
 
  
  y. n4 ^$ ~. t3 e7 [$ n# _$ t- #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
 
+ f; X7 t5 W! U2 b$ Z) r - #define STATIC_SHIFT                3
 
' f/ m, k/ w! T* u9 X# k7 a - #define TCINTEN_SHIFT               202 s3 n" ^0 B" c* R+ B0 A6 {: B
 
 - #define ITCINTEN_SHIFT              216 X' B9 `2 Y: M6 u
 
 - #define TCCHEN_SHIFT                222 _7 d, V  d; p' V
 
 - #define ITCCHEN_SHIFT               23$ a! ~2 a: K9 n0 |. m5 i& |# \
 
  
" B: k* }, {2 e) ^- static volatile int irqraised1 = 0;
 
, {& H# h1 D  R8 c1 B3 E& m - static volatile int irqraised2 = 0;
 
  y) j: u5 L. {2 L* u9 X  x- z  
' M8 a3 h0 q. V+ E' y4 Q; C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
 
1 z, O+ W2 c+ ^# d  e; I  `$ i, a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
 
" G' L; i3 M; ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Q/ T* k4 S' O' t
 
  
. v4 k7 s7 n$ O% I+ n; W1 r6 v- dma_addr_t dmaphyssrc1 = 0;. K' h9 x$ u( a- l, n; H
 
 - dma_addr_t dmaphyssrc2 = 0;
 
% i% N6 |% y$ N - dma_addr_t dmaphysdest1 = 0;
 
6 P- S, t+ f$ p  V9 R6 V. R - dma_addr_t dmaphysdest2 = 0;0 @# o4 T$ y6 J; Y3 I0 `
 
  
" M1 [/ U# O. f/ c# E, d3 Q- char *dmabufsrc1 = NULL;# i5 k6 H$ r& K8 \. b! A" Y
 
 - char *dmabufsrc2 = NULL;
 
1 F! P( z( Q+ w - char *dmabufdest1 = NULL;* ^' N6 y: N! s% `- E; b
 
 - char *dmabufdest2 = NULL;
 
" d; Y' F# N! [. E% h  
, b* y: t, K8 u. W) _5 g- static int acnt = 512;* u" D# u- D' F& {0 ?  N
 
 - static int bcnt = 8;
 
- g/ V: X) M1 ~) |; U - static int ccnt = 8;
 
* v/ Z0 @4 ?5 V* I) V& x; ~. q - 6 y* m; b8 l( ?0 o" c  `8 _6 F! z  K5 h* m
 
 - module_param(acnt, int, S_IRUGO);
 
4 l2 n* t- i4 ~ - module_param(bcnt, int, S_IRUGO);1 R5 o- `1 p) f9 O2 d5 [! H8 o2 Q5 d6 H
 
 - module_param(ccnt, int, S_IRUGO);
 
  复制代码 
5 ?+ Y$ |2 D% i/ x8 W0 o1 l 
3 a( I8 J5 j: ?5 j0 ~2 S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 
% C$ }  S. I1 I) w- m7 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 
3 l6 r3 q8 ]  Y' }6 k: k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 
1 d- f: k7 `! N* m. C% Z0 [' N' u, X% `. y. t- x 
" z. _3 X0 k  {' q+ Y4 y8 ^; y 
 |   
 
 
 
 |