|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % e1 g9 j3 I4 D' l3 ~0 {
- [code]EDMA sample test application) ?& u8 y0 G. |1 p) r& ~
- /*
3 N( k4 _) G: x4 |( T/ g - * edma_test.c
+ y1 M2 i; b$ j8 x8 q - *% m7 b8 j: Y/ b( @* F
- * brief EDMA3 Test Application: R+ X d+ v Q
- *- X5 Y; n3 Z( [5 I
- * This file contains EDMA3 Test code./ e: M; m% ^* v& H* e( D, c& v1 [7 Y
- *
5 i# y0 E& d8 o6 K" P D5 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; e; f! `3 F0 }2 v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- H) V, H1 b0 p - * TO CHANGE., \6 v ~1 c8 k2 F5 L' ~
- *! i" ~) d- G" {- {0 f* ?0 K$ l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ I R- O, }. }) ^ r# K) Y - *
V5 x& A9 H: v* X+ @- j' M4 \ - * This program is free software; you can redistribute it and/or
/ }* k0 B" Q1 S5 b; } - * modify it under the terms of the GNU General Public License as
( f5 D: u! F( Q9 N - * published by the Free Software Foundation version 2. l. B/ ]: }2 F7 v3 n5 ^# ~3 O
- *
* D% l9 O7 Z8 Y! A" o5 G. J; W3 m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" p* \8 a/ V$ |6 m - * kind, whether express or implied; without even the implied warranty
; v" L% m& o0 z6 m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ U/ N5 i9 b* V$ p" d - * GNU General Public License for more details.
: J+ J$ n8 X5 \$ q/ C - */& r" A# Z T( Q0 U( \3 s( _( t" O
' [; l+ q7 j5 W. M& n/ ~& d4 M- #include <linux/module.h>6 u. {8 o" r R
- #include <linux/init.h>
/ ?0 p& S$ O/ U/ i% {7 f - #include <linux/errno.h>$ P) }/ Z5 _2 L8 A0 \
- #include <linux/types.h>$ x- R1 P3 d" P/ f, X1 J- X
- #include <linux/interrupt.h>) Z; g8 m& y. w1 C9 @
- #include <asm/io.h> Q, M: D6 Q/ d; f
- #include <linux/moduleparam.h>+ S( d5 H1 H3 |* p% N9 S; d
- #include <linux/sysctl.h>+ o. h/ f ]. g2 t7 T
- #include <linux/mm.h>
4 n$ T @2 }5 Z0 ?+ { - #include <linux/dma-mapping.h>: P; W) m& g+ C5 H
/ G$ M `0 z! ]# Z" Z8 l) ?- #include <mach/memory.h>
2 U; d, _) s" z0 V - #include <mach/hardware.h>8 m* p# G. y# a0 {4 G7 N b
- #include <mach/irqs.h>- f. ~4 e& R3 _. F
- #include <asm/hardware/edma.h>
J+ `0 }- [9 _: y4 |& j6 O' F - ! U5 {' L' t/ p+ U
- #undef EDMA3_DEBUG$ p5 I4 c6 ?: r& n
- /*#define EDMA3_DEBUG*/) P$ v4 z( H, ?/ R* k3 C3 p
9 k* a0 J! x- J1 a3 r( u# k0 ?- #ifdef EDMA3_DEBUG* B- n# a& \* Y% S; o( }( ?* L7 w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 M- @. @. Y# w8 k" p' g& A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 \/ M! Q; J- }( f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 Y2 G3 E' y% }% W H
- #else; h# R& l( R, E" [5 H3 }2 }% M8 E
- #define DMA_PRINTK( x... )
% ?2 @( |: ^1 T: a( S - #define DMA_FN_IN5 g; `3 A- L2 y) B4 `3 U, X
- #define DMA_FN_OUT
) a, i) c' x; t4 ^2 j - #endif0 L5 b. l% Y! F; M
- , b, n& ^0 B) V# ^' v: x$ e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& I4 ~( `2 X- Q' _. P- e - #define STATIC_SHIFT 3
8 V$ U) Z2 R1 I+ ~) s$ V9 O* { - #define TCINTEN_SHIFT 20
6 ^* V- F/ y( ?+ T: M - #define ITCINTEN_SHIFT 216 n& t5 P+ E# ?0 A* ^
- #define TCCHEN_SHIFT 22
( }; K" W6 h& p9 C' q - #define ITCCHEN_SHIFT 23
# t$ b& O0 @( a# _+ A0 g7 q
+ ]& f* k+ w+ w3 v- static volatile int irqraised1 = 0;
7 @3 H) H1 h0 Z \ - static volatile int irqraised2 = 0;/ t( a, ~4 `5 j5 p7 ]: [8 {5 r
- ; `# R( q3 Z/ K" y, U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' a1 t. {1 c. A J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" C; _* w- |' e! a; n% h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 N; i8 O0 w& F2 ~+ u
! f6 u) ?. e. E4 f5 c- dma_addr_t dmaphyssrc1 = 0;. P' l* P" f# f0 D
- dma_addr_t dmaphyssrc2 = 0;
9 d ~' F; b1 Q - dma_addr_t dmaphysdest1 = 0;# U. s8 d: E. c, U& T
- dma_addr_t dmaphysdest2 = 0;
( E% K+ A* `1 Z - : v3 A, ?8 t) z1 G. @# J
- char *dmabufsrc1 = NULL;- |( L, w$ ~+ q/ ?( G0 k2 ?/ d
- char *dmabufsrc2 = NULL;
+ A! |3 K9 J+ T# e8 G; @; s - char *dmabufdest1 = NULL;5 M: i7 o7 W0 o2 @- l9 Y4 |- c
- char *dmabufdest2 = NULL;0 }3 B0 e. |+ }7 h' b
( |5 b8 B" C$ y& E% r- static int acnt = 512;
- T' K) T) s Z7 g: _7 W - static int bcnt = 8;
" e0 x7 F" r; w) u* G - static int ccnt = 8;2 p6 g \1 }( i! j
- - u1 p: I% P, `: W2 l7 H9 ?
- module_param(acnt, int, S_IRUGO);
2 ]& b* d1 |; k5 P3 w. \% Q1 N - module_param(bcnt, int, S_IRUGO);
1 h# Y, \* _; S8 M; a, `. j3 H - module_param(ccnt, int, S_IRUGO);
复制代码 6 M, K' u/ [- f, ]. Y
1 O! m( y9 b# ?5 Y" f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& {1 |& d2 k. o7 j) i8 V$ {, g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ]$ Q+ g; C9 |9 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; v G! G b7 v- Y& a Y8 K1 q
9 f3 [7 h& A& J" I" u# y5 V1 L" n7 `
|
|