|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
L+ G' ^4 O2 P, u- g6 B2 x# D6 Q- [code]EDMA sample test application
. t n( y6 a$ E. f; j - /*
( v& A7 u! T0 |- n - * edma_test.c. | a" n. T0 ?. b
- *: Y3 J' [; b( R% a1 q& P
- * brief EDMA3 Test Application
' s3 X: {' u8 _8 s0 s - *
1 t4 N3 b2 _1 F- H0 J. E0 L; u - * This file contains EDMA3 Test code.+ y. _7 B9 i- }0 {
- *
& J1 t3 ~" _0 {1 I9 |0 \: _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* q) o( l% F* g" ?) G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ H5 _, K2 M q$ n- Q4 k! N& o - * TO CHANGE.5 }; g2 c* g1 V% o& i4 S, c
- */ ]# N( s; V; b; E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ^) w% x7 a! {/ s( f" G
- *" p% \; c+ R- J0 V {; L
- * This program is free software; you can redistribute it and/or8 E8 m1 K1 v. n- O
- * modify it under the terms of the GNU General Public License as& N8 @( _6 @& Y" W; h4 ~, f4 n
- * published by the Free Software Foundation version 2.
; o* l7 Q$ Z" \% }3 z - *
0 @& z& R" ]6 D; o6 \, r' K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ e) k8 k" Q! D7 d L - * kind, whether express or implied; without even the implied warranty# }) m0 B$ |/ J/ Q F/ a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; m- R! }" z2 l2 p' c4 g `
- * GNU General Public License for more details.
8 j5 B; z) ]6 b" e: a - */
( M7 X" M9 A6 E+ R1 D( J - u. C4 ^1 f; T
- #include <linux/module.h>* |4 l/ F, [0 | h
- #include <linux/init.h>
6 d: D& N$ O. H0 a8 ~% o+ u, k9 [& ^$ s8 } - #include <linux/errno.h>
+ E/ X# |6 j- K$ j) p( R - #include <linux/types.h>
( d' G- {) Q/ N - #include <linux/interrupt.h>
* z' A( Y" j; r6 U' B. x! }3 U& z8 I - #include <asm/io.h>+ W8 d% g" U2 s- n# `$ s0 j& i. U
- #include <linux/moduleparam.h>/ v+ W1 P8 s _9 t
- #include <linux/sysctl.h>
?5 U s0 @/ K+ { - #include <linux/mm.h>
& }; g) B+ ]5 v; `7 o - #include <linux/dma-mapping.h>3 h O$ f2 ^% T( h/ U
: y5 M) @% k2 n3 m7 S/ Z3 Y- #include <mach/memory.h>
+ L& D# T: A5 s. n2 ~* z" A! X - #include <mach/hardware.h>. {; j' _; S3 x: d( f* J) N3 e
- #include <mach/irqs.h>0 L& p5 K- H: V! N& Z6 ]4 d
- #include <asm/hardware/edma.h>
5 H! l5 x& \. n5 z- a6 g
( _7 m4 }; ^% r% G- I K- #undef EDMA3_DEBUG( u0 }9 z4 B- r/ N4 K, w5 D& _
- /*#define EDMA3_DEBUG*/1 O" ^! Z' W6 S2 I
- ! v% c1 W) |/ p8 ]3 x( l" Y
- #ifdef EDMA3_DEBUG3 R; p3 u: i' {# U; `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), k& ?3 I( P$ ~$ p/ J$ T/ C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 h3 q" |/ k: q, I4 i+ G$ [% R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) |$ a( L* ]0 g2 Z
- #else. c4 P: c: b0 J& P# _
- #define DMA_PRINTK( x... )$ @& V- H" k+ N5 b- K
- #define DMA_FN_IN
3 w2 ]2 b: D8 D1 o - #define DMA_FN_OUT! D& j# Z" n: p/ s) l" Y
- #endif
1 E. H) A' K* k ^ n
# l. L5 t1 i9 H5 r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ F' q& _: h3 `2 _' r
- #define STATIC_SHIFT 3
/ O7 g7 x$ A1 J I6 B0 V3 E3 A - #define TCINTEN_SHIFT 20
, h A4 i6 J7 l* [ w5 Y - #define ITCINTEN_SHIFT 21& u! Z/ c/ H' S1 H) S8 \3 g( n
- #define TCCHEN_SHIFT 22. z7 M/ X: \1 i% f+ [2 P
- #define ITCCHEN_SHIFT 232 `: p% q) E$ n/ L* l
- # L- c1 }+ e4 @0 x9 l, K9 K( }
- static volatile int irqraised1 = 0;: o! t* @, ^3 ?* T' t
- static volatile int irqraised2 = 0;
7 t9 X3 {" e U$ S
% \( z# y e4 g* M$ j& M2 W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 T2 s2 d( j! C+ M3 p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) t8 H2 S& ]" V- u1 w2 j/ V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 n9 X+ A" C" T$ ~: P5 U& ]
- 8 y# C6 Y$ P# V, G7 W
- dma_addr_t dmaphyssrc1 = 0;
% P4 T$ b- z) d& K; I - dma_addr_t dmaphyssrc2 = 0;
% ?- t& r! `" C o3 a# G& P - dma_addr_t dmaphysdest1 = 0;
/ C, ]1 |* k3 q - dma_addr_t dmaphysdest2 = 0;
& i1 Y/ K* s3 }: O) I, ^
; c1 [% ?' b5 j& Q s3 ~" Y6 \- char *dmabufsrc1 = NULL;
0 |& p3 A) D3 _2 s, x, M - char *dmabufsrc2 = NULL;
; ~9 M7 d/ d% [ - char *dmabufdest1 = NULL;
9 x1 q8 d: E- K7 [# ` - char *dmabufdest2 = NULL;- [1 l1 k" x' F! ^+ H O
- ) \, ^. J# s7 z! @ h% l
- static int acnt = 512;
: O& D2 w3 C" ]6 X - static int bcnt = 8;# U/ m+ T9 x( {( e+ _, y
- static int ccnt = 8;
* A6 ]( H4 o9 q! ]3 [1 \$ } - 6 \* i- _; ~; y N/ @/ j' V/ L9 Z
- module_param(acnt, int, S_IRUGO);
0 q5 H2 t; J3 R+ _+ w1 k' J) B- w - module_param(bcnt, int, S_IRUGO);
& D& Q6 v* k8 c* `! q1 n - module_param(ccnt, int, S_IRUGO);
复制代码 $ \9 [" F' m3 |) r8 r( x
1 b+ _1 }6 @& N( H: F- N' h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 k/ U) g8 I( q4 M! j& ^; A8 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 x- z4 R* q5 U" j3 p; v. l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- J( U. |5 P+ X( H3 _, `
2 j: y0 s! X4 T% ~) q A: N V- d( s
, N) Z5 {, E" t8 K( ?
|
|