|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * b# S2 s- E# f& M! f k2 |. L
- [code]EDMA sample test application
- E4 `8 T8 Z3 J9 ~ - /*
6 r' N( |& K* n( f; |0 \ - * edma_test.c* m9 g( A; N4 Q2 O; U
- *- r8 Q" x# f9 L
- * brief EDMA3 Test Application3 n" o, ^, L* Y
- *
! Y8 o. s u1 g& ]6 H, R/ B$ W* f - * This file contains EDMA3 Test code.* Z: J! g' X& m+ b6 q# e3 s
- *3 Q$ E& N7 B1 @) b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% U* u E. p: H7 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& H: p$ G8 ^ S( R* F( I% W
- * TO CHANGE.3 [: ]/ s, F9 b$ ?: |
- *$ o/ A- e( y, p- q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: l# v' B$ O9 K' _
- *
. u# K% O' W/ Q4 y8 e - * This program is free software; you can redistribute it and/or, k+ _* k9 i- n. d2 }% B
- * modify it under the terms of the GNU General Public License as0 V* z% v% I1 i
- * published by the Free Software Foundation version 2.
. j/ v4 F& u5 K! n8 a" t" R - *" j/ \) g# \ x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# A) x0 z5 _! d; q8 h
- * kind, whether express or implied; without even the implied warranty# G4 X* C) P1 ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' t# l) e7 O {9 [# v! v3 T - * GNU General Public License for more details.
) h7 r6 Q( X$ s* i6 u& d, Q1 h3 O' x - */0 j3 B1 N- d1 d" d8 ] V: W
- ( `4 [$ \( E7 X. k8 L
- #include <linux/module.h>
* @" X8 p7 E1 y3 V" f; j - #include <linux/init.h>- f' o. j4 [# B' r) g/ \' c
- #include <linux/errno.h>: @) d: i) j5 h* R: X
- #include <linux/types.h>$ g& G1 P7 k% Y9 H
- #include <linux/interrupt.h>
! X z" J% k" B( ~, o e$ f - #include <asm/io.h>+ H* B& ?+ M0 q2 b0 P* H) G; S
- #include <linux/moduleparam.h>
; m: ?" \; Q7 l7 l' Y1 ] - #include <linux/sysctl.h>
. g/ N9 r( q/ S1 a6 N - #include <linux/mm.h># D. N9 o# v7 n2 X* S
- #include <linux/dma-mapping.h>
& \9 c0 f4 f5 t) u) O! C/ } - 9 p. ^9 w( w! S# e* J+ J
- #include <mach/memory.h>
! j9 k9 y7 S! C I6 Q/ |6 E - #include <mach/hardware.h>
" v, g# ?! |" a) e3 E5 u F) z& G6 y, d - #include <mach/irqs.h>9 \. i6 M& e1 P9 ^/ v/ p: F W2 c5 `! A
- #include <asm/hardware/edma.h>
& [% Z7 D+ N: ^ - $ I4 a" \' I3 f4 b I
- #undef EDMA3_DEBUG
. C+ X& L& e9 ?1 u - /*#define EDMA3_DEBUG*/
8 {/ f: h I/ Y9 `! [9 j p$ x
4 _/ m2 J' `9 I$ s! [- #ifdef EDMA3_DEBUG
/ U: ~, w# ^6 i" S' w5 O. ^- d0 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 E" e0 K4 n5 w+ G/ Q* O/ Y+ y3 ^" y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 w+ {7 @9 J8 G2 @( `5 D) e4 p/ I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" R9 O2 u9 S/ x* r+ u! L - #else
# u/ W& M' j0 Z& k5 x B0 |6 k - #define DMA_PRINTK( x... )' o) v. `. x o2 c5 A5 R3 S
- #define DMA_FN_IN0 p) `: {, h& n. v8 Y5 C6 ~
- #define DMA_FN_OUT
) F: D* j+ [; N1 ]0 P) a0 y; t - #endif. [7 q- Q( D2 A6 P2 P6 f
- " f: _7 J7 R/ k9 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% x R) b$ z0 x, h9 F - #define STATIC_SHIFT 31 B8 w3 P. w! B9 x9 l- T! e
- #define TCINTEN_SHIFT 20
7 _7 P7 W: K0 M - #define ITCINTEN_SHIFT 213 a* I' D0 q. P) u0 p* k0 e* K, o
- #define TCCHEN_SHIFT 22# H9 ~7 k3 d) R
- #define ITCCHEN_SHIFT 23
- W1 Z/ H) R# F7 S8 @& G8 r j - : M! [. w# P7 `8 y
- static volatile int irqraised1 = 0;- i7 z( E: f; b. O" f+ Q* ^9 O6 E
- static volatile int irqraised2 = 0;' g5 g1 z2 m: S; e9 F( H
0 ?. i& G% o% I: v" ?8 J0 c4 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" y u% P) V% X- I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 H% S" U1 o* `6 T6 l% } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 _, Z: D( `( Y2 b" j0 F
+ C% B/ r5 P1 @( C6 }2 ~& D' h- dma_addr_t dmaphyssrc1 = 0;
' o* B. x3 z2 K' w) R - dma_addr_t dmaphyssrc2 = 0;8 d1 |' i4 d7 c) ~4 v1 e' O/ n& S
- dma_addr_t dmaphysdest1 = 0;" y5 J @# l7 T! c4 i# g/ J, [
- dma_addr_t dmaphysdest2 = 0;
8 I/ w; U8 o9 n7 [ F - ! `5 q! X% y0 q) S- W
- char *dmabufsrc1 = NULL;) K% d P: G7 f
- char *dmabufsrc2 = NULL;
4 }0 h: l+ X; @# f! ]* A - char *dmabufdest1 = NULL;1 g% ^) F: x* G0 T) x: D
- char *dmabufdest2 = NULL;7 u# B7 G! m0 D* m: a- r
- 4 ?$ w# s+ \5 m, q, k9 {
- static int acnt = 512;! m: b1 k9 H" Y) ` s6 v3 J0 W. ?
- static int bcnt = 8;5 ~3 k- q& v: w1 G5 X$ S7 \; E
- static int ccnt = 8;
: @+ D- x* j! Q% n$ A6 Y
% f9 i) c- ~8 ?- module_param(acnt, int, S_IRUGO);# z3 Y3 M {" t2 K8 F1 v/ W
- module_param(bcnt, int, S_IRUGO);
5 m7 Y6 u2 k& S, R& z4 ^& H - module_param(ccnt, int, S_IRUGO);
复制代码 ) C7 `3 \* `+ f) G; U5 |4 i
2 W0 B1 {. z5 B6 p5 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 E) I* C5 v r' O# Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( O% \+ i; t1 P5 ]5 m; `- Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 p9 t/ g# w8 h- s& c4 E
" h# e' u2 a2 B ?
$ W2 k7 {# w$ R) g+ f |
|