|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; I: S) A5 I6 G& `; g2 W, s
- [code]EDMA sample test application5 _# l; K) Q/ A6 ]
- /*( J% \9 B* I8 F' G4 P( q
- * edma_test.c! U( J# Q8 W j0 O( ~, v/ W
- *
# k! e. g, ?9 U& o3 W. R+ w2 a7 s* w) M - * brief EDMA3 Test Application; _" z& A) M- ^2 m% d% E
- *1 M2 K* P! f8 L) Z A& g
- * This file contains EDMA3 Test code.
w, B4 _/ A9 t. u6 j, l e- X - *
1 z2 u3 Y% S1 }3 k3 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- ^' j& Y1 m7 E( i6 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% X; w" T0 G! L: c! A - * TO CHANGE.) q! u3 u$ P4 j) |$ T0 T
- *
1 ^* P- l9 A0 p# S" W8 _+ \- B# } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& e( g+ J3 l4 N. o
- * m* @, P4 K, g" O5 S2 H1 m Z
- * This program is free software; you can redistribute it and/or
: m; C$ ]! D$ n# Q0 m - * modify it under the terms of the GNU General Public License as
" G- n1 \. M9 o5 G4 _/ h - * published by the Free Software Foundation version 2.* P! w3 L N; \/ ?
- *$ J4 S, R1 b& _( J: U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( ]% q; Z Y/ C3 T0 ^ - * kind, whether express or implied; without even the implied warranty
/ a: x1 F/ \- H& } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% k' C/ W4 |2 Z2 `( k; j) D
- * GNU General Public License for more details.7 }" _- b+ [+ X
- */
( s, c0 O* q* B
4 l6 n* d0 o; V2 w) s1 C- #include <linux/module.h>
& H+ h7 A% A) p - #include <linux/init.h>
) I' e) {5 H; E1 U; | - #include <linux/errno.h>
; o g2 ?; F. |5 S: \! I3 f - #include <linux/types.h>; O7 m" Y* K! o! d
- #include <linux/interrupt.h>% ?6 W$ K; E; s) o4 A0 v
- #include <asm/io.h>
1 m, L6 ^6 O# p" H0 I" d: | - #include <linux/moduleparam.h>
9 _; N9 t. l; \. Q6 i - #include <linux/sysctl.h>
! c& B! n9 w' [# Z2 D( o# o - #include <linux/mm.h>
- t# ]" T/ n! v [" o6 }8 v, @ - #include <linux/dma-mapping.h>$ ~' x( ]& f3 G' X9 I% K( q
- , P' Q) T" f D) u0 F" i
- #include <mach/memory.h>1 N$ a; K: w) r4 I
- #include <mach/hardware.h>, B M5 q, I* |. B' `9 H: D7 j
- #include <mach/irqs.h>
; Y" t J! s7 ?5 \* | - #include <asm/hardware/edma.h>! e2 Y- G: F$ @! L5 M) ?& ?$ F8 u3 Z
- / W" o# `7 T0 a& W1 X- v' I0 h
- #undef EDMA3_DEBUG G' y {9 w+ s* A9 @* w; A
- /*#define EDMA3_DEBUG*/
# R( x2 h: }2 s* u8 K1 s" E" P
) f" c6 B" T, u9 g# v- #ifdef EDMA3_DEBUG
0 q, V* ^4 q% L9 q; ^" d" D& E' V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# ]( z) x, c! {6 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 d) L$ q* G% K$ p: L8 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 q) ]4 |$ F* o
- #else' I+ f8 ]+ V( S- M3 i/ W
- #define DMA_PRINTK( x... )2 S0 u Q+ ~6 {5 e, K
- #define DMA_FN_IN3 v/ _" q: o1 C) }$ S
- #define DMA_FN_OUT3 a( M; |7 b V* ]: c/ z! n
- #endif
3 c# p* K8 A8 ` d - 2 f4 t; B4 n1 D: i$ r l V9 W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 h! N8 W5 ?7 v+ G
- #define STATIC_SHIFT 34 R: E4 p$ ^& G. m0 J4 {
- #define TCINTEN_SHIFT 20. \6 j, C2 r+ q/ S. O* V" {: v
- #define ITCINTEN_SHIFT 21# h& Q: z3 _* i" P) E# T
- #define TCCHEN_SHIFT 22
* V! B- R0 l z. I2 E4 O4 a - #define ITCCHEN_SHIFT 238 Q ]# r. F3 Q5 b! h2 d; ], X
- ! O2 a! V5 D8 _% A, o, `3 l! J3 a
- static volatile int irqraised1 = 0;6 b. Y+ [7 v- x$ T4 l! r
- static volatile int irqraised2 = 0; u8 u8 C# U, P1 d! y
- * l1 p) {: E) G3 {+ N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% S8 Z$ [" I- A L0 N3 Q& i2 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 {8 a* M0 F- m' O9 o2 Y3 }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 L, N b7 ^: w. n+ g
8 O$ L8 V8 C9 Z/ T; a8 P2 L- dma_addr_t dmaphyssrc1 = 0;
z/ S8 z: _3 s. h. B+ K7 G - dma_addr_t dmaphyssrc2 = 0;
1 w, Z7 H" m& m; C2 P3 l0 Y* T! O- q - dma_addr_t dmaphysdest1 = 0;
% _; r+ }. G4 ^ - dma_addr_t dmaphysdest2 = 0;% k: A+ W$ {" X$ r/ Z; |/ t% ~7 N
) V/ |7 K6 m7 H y/ j; ]- char *dmabufsrc1 = NULL;# O) w$ |1 f* V4 h9 P
- char *dmabufsrc2 = NULL;5 V6 f% V; O2 C# B* D6 ?
- char *dmabufdest1 = NULL;
6 B! ?. T; N% H - char *dmabufdest2 = NULL;- }7 G0 C* D- y% Z
& D8 f7 t+ Q/ N% f5 q. Y- static int acnt = 512;% \+ ~3 h4 z& ?1 G. F6 K
- static int bcnt = 8;: J4 T5 M2 O- g) N' R8 e% [
- static int ccnt = 8;
* d$ N4 y/ @: W3 N) u" C: ^
1 J' A, s7 x* ]- l' U; U0 U9 `3 q2 j- module_param(acnt, int, S_IRUGO);
4 K3 A$ d; w1 I* k" I8 X( R# i4 u - module_param(bcnt, int, S_IRUGO);
7 k+ T% ?- R9 O8 \. ? - module_param(ccnt, int, S_IRUGO);
复制代码
; \1 Q+ s2 W9 K# T6 W- m
! w& T% o J/ ?/ X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" _$ v9 R9 K: c# K. G2 r" C3 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Q8 P E _) O8 d* b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, e9 N U: Q. R5 V' g
) T. ]7 n h% x0 E' o* ^' r$ |, p4 H, r
1 a# U9 g3 x- l |
|