|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 u+ \. h) {6 h, z9 q
- [code]EDMA sample test application8 B- x( J- t+ P! O) |
- /*$ `" m" ^7 q# k" Y1 `
- * edma_test.c
$ T1 Q8 W: @$ p9 ~& o7 A* R6 [ - *
! r* b+ ?0 ?+ r# _8 P( q - * brief EDMA3 Test Application
: E* L- G* Y: R: l. I/ [* } - *
G5 H0 @/ w7 b: d( k3 q9 E - * This file contains EDMA3 Test code.
3 u9 r- |# R5 a" ` - *
2 Y' G6 A* x9 R- K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* e0 N0 d: Z! F" [$ w8 @' b+ o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 Y$ x' Z/ P- l) s+ T - * TO CHANGE.
4 S) I& c5 q( u7 o# l: g3 D" P# L$ @+ f - *+ B. w6 W K/ U& C1 |; R- }7 ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// u1 Q9 \$ Z4 r
- *; k4 z0 Y# e* u; a% t' r7 Z
- * This program is free software; you can redistribute it and/or. Z# Y" ]+ T! Y( `' h% T
- * modify it under the terms of the GNU General Public License as0 s% N4 ^, \; F k( ~, l0 C
- * published by the Free Software Foundation version 2.
! ?% h& u0 u" Z8 b - *
3 e: p& E7 q- l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ O8 S" z5 l( o; H* A2 A6 T& O1 ~5 U
- * kind, whether express or implied; without even the implied warranty
/ B0 l" N+ X, Y8 J6 K L! o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 Z' j* O; ]8 L
- * GNU General Public License for more details.4 t @9 R" @& t* t
- */
u+ I6 ^+ |" u7 U - - A" a3 l! D& m9 [- j+ P; a. l
- #include <linux/module.h>
# F ^, E" n/ I' E# g) d - #include <linux/init.h>
* _4 b. y. @0 g4 W: G4 R - #include <linux/errno.h>- q S# h( ?" F. Y% X$ \
- #include <linux/types.h>
/ Q$ k( z7 V1 c; ~ - #include <linux/interrupt.h>
. n' D F( b( C' `! ]9 v - #include <asm/io.h>
: ^! _! X6 H5 O% m+ p - #include <linux/moduleparam.h>
4 {' G$ B0 t2 ] V0 W; Z5 }. E - #include <linux/sysctl.h>6 D: D1 V! Y1 {+ [: s
- #include <linux/mm.h>+ `+ X9 h2 B) l* e/ Z& t3 U
- #include <linux/dma-mapping.h>: m, T5 x( _* r3 P
- ; w- t( O& Q3 E7 v* g* L' f! b7 F2 u& {
- #include <mach/memory.h>* K# X$ q. a* i
- #include <mach/hardware.h>
( \+ Y) Q9 E, l9 {, F: I - #include <mach/irqs.h>
* ?( Y: u7 \# P - #include <asm/hardware/edma.h>
% y+ I; i2 _. [+ a
0 B- P4 x8 ^8 J1 Z9 _7 U- #undef EDMA3_DEBUG: U3 M5 J. A/ ]" f4 O; X8 L
- /*#define EDMA3_DEBUG*/
* K2 d+ X# \0 g* m4 N, @# V" O
3 ]9 i+ v& d* Q7 ~- #ifdef EDMA3_DEBUG
) J# Y |0 b! U J+ i9 ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* {9 i% M2 G4 Y$ Y& n0 Y( U) s# l/ q0 F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) S5 W* y1 c9 k" M& B6 ]8 M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# |& O j* u( B
- #else4 p0 f: h7 _' z- |2 ~- ]" A! x+ p5 I
- #define DMA_PRINTK( x... )
( D3 e1 i+ Q" @4 N$ W/ V$ i: b, g* s - #define DMA_FN_IN7 T2 f. m1 r3 Y& a* g) Y
- #define DMA_FN_OUT
6 J! @4 ^5 I6 h6 V4 Q9 t' Z9 S% ~ - #endif
$ @' B ^/ ~- b8 S! c - , Q& D1 {$ @9 e' V9 R1 e! x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ V' s3 u1 ~- [3 |/ l1 Y0 e
- #define STATIC_SHIFT 3
' W; }7 r1 v( o" V9 w - #define TCINTEN_SHIFT 20 _. X1 ]. J) ~* A7 ~6 i- q K
- #define ITCINTEN_SHIFT 21
- U" o) X1 _) u - #define TCCHEN_SHIFT 22# E8 U5 y0 |4 M; E6 T% P
- #define ITCCHEN_SHIFT 23
3 _7 b* x) G& T" f* {; O; o
2 w: s- Y* Z( n4 R y! K8 C- static volatile int irqraised1 = 0;
% g8 S9 v9 O/ `& |# Q: p, J6 a - static volatile int irqraised2 = 0;
' Y" q5 P2 I% O" n) a - 5 W, c* ?. \" ?0 ?7 r1 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ]: ~, N) V" M( E9 v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" u+ c s( N6 p; Z# i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! q: R/ N* _ Q5 q5 J- |& v - ( t- d" n# \! e; f# L8 V
- dma_addr_t dmaphyssrc1 = 0;
1 }5 M/ ]; y7 U3 {0 ^# R - dma_addr_t dmaphyssrc2 = 0;8 c2 W [% ?1 j& |
- dma_addr_t dmaphysdest1 = 0;/ ^: ~) Y" _1 r" b
- dma_addr_t dmaphysdest2 = 0;
8 I3 H4 d8 R2 g - , I& X) ~' ^8 o8 r4 A
- char *dmabufsrc1 = NULL; o5 X6 S% d8 }$ V# f
- char *dmabufsrc2 = NULL;
. W! U. X) H% X0 w - char *dmabufdest1 = NULL;
+ x% c; m- Q; w% F X: A! y - char *dmabufdest2 = NULL;
2 h' w% |$ p( Z6 ~: P+ T: j, I
% q$ z$ D8 ]& a. H+ q- static int acnt = 512;* s, d' Q# v0 |& M. g
- static int bcnt = 8;
( f* U& s3 |7 N. P, `: b6 R& i, T8 z - static int ccnt = 8;# X' V) p& j3 S3 D8 F
5 Z! Z! K* ]& H( x q5 _9 w, |, O- module_param(acnt, int, S_IRUGO);0 `) t& P. `; F5 q( W
- module_param(bcnt, int, S_IRUGO);& B' J+ i4 ~: m( b
- module_param(ccnt, int, S_IRUGO);
复制代码
4 D5 Z$ ]1 {/ B9 ~4 n# P) c$ g9 D- s& a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 V+ l4 j3 ?7 O- q" s# qarm-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 v8 T6 E) _# S2 Z* c, y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( o2 x+ K8 @* L0 R4 m- K( R; I# Q
' y2 {1 G- z0 P+ M) w# D* ^
3 I' I$ @; N3 R- X! K |
|