|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 V# A6 v ?& Q0 w! R' n9 Q, L
- [code]EDMA sample test application
, u. Y( [7 D7 G3 ]% e! J - /*
' D, E6 ^ [6 z2 y8 y5 ] - * edma_test.c
' Y; j' m3 [0 z; I4 C - *
M+ R5 R1 Q/ v, A% q; x - * brief EDMA3 Test Application/ n. ^5 O& K' D5 d
- *6 b, V+ l# O+ [( k* ]% t+ Y+ S
- * This file contains EDMA3 Test code.* x$ }! j) z0 k% y. P
- *
( b6 T0 w9 |; t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 M; }8 \* }4 n9 J) P; f8 J* @1 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- Y$ J( [6 _' \4 q$ Y+ w - * TO CHANGE.
" n; }& x6 V+ C5 F - *+ @8 j) t0 T+ L9 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 ]: b3 m2 a( u! y4 _' V - *
) t9 |+ n; R" T( { \" W - * This program is free software; you can redistribute it and/or
6 X" C5 x% F, H( Z5 l9 m - * modify it under the terms of the GNU General Public License as1 J% k; u: R) P: b6 ?( D7 j, u
- * published by the Free Software Foundation version 2.. ?1 q2 L& _- \( c: L
- *
8 a3 y+ L C& z7 L! B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" `) ?, I: A0 T8 I2 { - * kind, whether express or implied; without even the implied warranty
* R) E3 R7 S# \6 S# N4 F. F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 G4 K* h" a5 m* n+ u: I( B - * GNU General Public License for more details.
2 @' y( I5 b" T3 h9 `( i% h: X! e, I) S - */
0 w5 s; V" a# \. D5 m6 q - $ ~( K9 M; Y5 b0 r1 r. d& ^2 q
- #include <linux/module.h>
( K& |' t, f+ D2 V" P - #include <linux/init.h>
# J4 ~, N# i, {2 B, b/ F8 Y - #include <linux/errno.h>6 ~" {- x. I( o; _
- #include <linux/types.h>* O8 z+ S8 P7 j! V1 X
- #include <linux/interrupt.h>+ g! p) _2 O# \, u
- #include <asm/io.h>! p [: ^+ f3 z# z4 T
- #include <linux/moduleparam.h>
: C; J. r* L. l. \) S* u% p; {$ Z - #include <linux/sysctl.h>6 V$ V7 o: q" s5 l
- #include <linux/mm.h>- X7 {. `9 E6 P" g
- #include <linux/dma-mapping.h>
' J+ }9 d* _! J3 A - & \/ p) v: h- Y& ]
- #include <mach/memory.h>
8 I9 c: J; G* J4 ^1 ?0 @ - #include <mach/hardware.h>
4 e# n" z! t0 R! `6 ~ - #include <mach/irqs.h>+ x ~ ?& K# o1 F
- #include <asm/hardware/edma.h>
$ S; ~9 w B# V! `6 H o
- K/ V& A7 t7 C4 Q- #undef EDMA3_DEBUG: a% c5 |6 s- ]+ ]# y( w" f
- /*#define EDMA3_DEBUG*/ K& |( D) v: h: e3 G3 S( H
- ) Z* K: y9 Q4 P. o' h: r
- #ifdef EDMA3_DEBUG+ L$ ?$ h- V5 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 o: }: V9 m3 D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 w! K! w& | z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 j C/ W6 l, ]6 B. l- F - #else
' W" F% p8 i% t9 q+ K - #define DMA_PRINTK( x... ) ~6 |4 m) H3 x( O$ [
- #define DMA_FN_IN
2 i9 J1 n- t4 U- @8 E+ j* \/ o - #define DMA_FN_OUT
1 ?$ w. d; y [ - #endif
" K% m7 o5 l8 k2 J0 q/ T( J - 6 E5 D) V( h- }' T) Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); e! K, v/ d0 I. |- d$ p
- #define STATIC_SHIFT 3
c. V" B; Z& N k6 J* l - #define TCINTEN_SHIFT 20
8 x4 h) v, E. L/ D - #define ITCINTEN_SHIFT 21( F* E' t: l3 i3 z/ n$ N: U& V
- #define TCCHEN_SHIFT 22
?; }* w9 i6 V& o$ | - #define ITCCHEN_SHIFT 23
" D' P7 d( k- P2 i' Q" ]! a - % v, u/ ~' K) ]( a! w5 h$ }" Z: h
- static volatile int irqraised1 = 0;2 D. B# `- l1 b
- static volatile int irqraised2 = 0;
% z! v$ o' w: o& ]# g4 \0 O1 w - 7 y3 I% t8 s( V9 M+ z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& p4 v- B( Y2 j: q0 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 G8 Q# h: r9 _, L5 M4 g' w; u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 l' |( x4 v4 G' F% ^
6 a* @5 z' S6 R1 n- dma_addr_t dmaphyssrc1 = 0;
0 }/ X& g& f; I- g3 `9 e- G4 } - dma_addr_t dmaphyssrc2 = 0;+ M \4 K+ b7 S$ _9 a4 P
- dma_addr_t dmaphysdest1 = 0;
$ B& G2 q0 U+ n" B2 D7 ]6 Y - dma_addr_t dmaphysdest2 = 0;" h. y! p: D$ g6 _) s* ]
- $ q! w6 S& P' o
- char *dmabufsrc1 = NULL;3 C& ?4 H% c- [& v; o0 a" _9 e
- char *dmabufsrc2 = NULL;
( }( l R+ R3 M7 \ - char *dmabufdest1 = NULL;
2 q! X7 y$ c S, a5 V$ L - char *dmabufdest2 = NULL;) ]# q5 v9 K* o
! C: y6 P) `* O9 @3 D6 h- static int acnt = 512;5 E* z$ H7 A: i, b
- static int bcnt = 8;- N i, |& r. w; L9 Q6 J
- static int ccnt = 8;6 B$ B2 R" L5 }! f7 K
( P# {: i- l2 k" K' @) j$ R- module_param(acnt, int, S_IRUGO);
6 ]) g9 P) Y% W3 { - module_param(bcnt, int, S_IRUGO);
8 x' k1 S, }0 A4 S1 c- k - module_param(ccnt, int, S_IRUGO);
复制代码 ; Z! e+ Y# o7 \* q- ?9 G, Q
/ x& ?4 z: ?" ~5 [6 \4 F: s+ Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# V9 r. |) s6 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 A- t9 @/ J: R) [4 h# z1 n* L6 H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 U5 D. j" s7 o) {, x$ V8 `6 ^
6 d' @- J& b6 {- q8 |6 R( w
9 T4 E- R/ y& H; x1 F" v
|
|