|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( W+ i$ L7 Y7 F
- [code]EDMA sample test application( l3 R3 K1 d; Q
- /*
[; t4 ?: L. I - * edma_test.c3 C- S+ x( v) A1 f& O0 ?
- *" q, h$ v3 r7 e% t" i. o9 E
- * brief EDMA3 Test Application2 Y: o0 u! w: _, y; m
- *
& W3 ~# J4 G# k( Y% A - * This file contains EDMA3 Test code.3 u7 p0 j% q5 F- q3 X! q& I: }# I
- *6 b. Q4 {$ ~2 ]5 R" F5 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; j+ k& c ~' `, g, x. n9 i1 T3 B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* {- e; [" z" Q, v- m( J5 S
- * TO CHANGE.
; y8 T: b" f' [, p9 L - *% m4 t8 l% n. F/ m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 {5 r Z; \* Q1 n4 H& N
- *1 U7 S5 F- R/ K2 s
- * This program is free software; you can redistribute it and/or
6 d% e! j0 w d( P: d - * modify it under the terms of the GNU General Public License as* ]( i- c5 O& ~2 {% r
- * published by the Free Software Foundation version 2.) H" b1 o: w" d
- *, M0 H/ w5 Y0 Z+ w: h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 m4 i0 s1 @- h9 ?, f0 V6 s1 z - * kind, whether express or implied; without even the implied warranty0 r5 S/ d1 U. ]/ J( V i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ L/ q/ ~8 M! E4 D% d) w* X: O) A8 ]
- * GNU General Public License for more details.7 G5 \, E% D7 i; q" b
- *// F; y; h8 d$ h9 L3 Q7 T) X1 {
5 M7 F) c- i k9 m- #include <linux/module.h>
: \' d3 ~2 m0 F+ E - #include <linux/init.h>
0 X }' O; K& p0 U8 q - #include <linux/errno.h>. c4 f, o5 Z5 o8 U5 T9 s( g* R
- #include <linux/types.h>
: T: n. F. B# m$ Y" b$ H5 O0 \3 J - #include <linux/interrupt.h>$ Z4 I, ]" ?6 c9 H
- #include <asm/io.h>, ~& S# y0 c- C" G
- #include <linux/moduleparam.h>' n4 @% `2 H% ]7 c0 q/ R
- #include <linux/sysctl.h>
! Y, w4 F5 I: j' i' |/ q! X - #include <linux/mm.h>
' b& ]( ~1 C+ n0 }% D - #include <linux/dma-mapping.h>
0 A [0 p* Y( @, z6 G
* ^4 N5 [/ c8 G: F7 `- #include <mach/memory.h>& m9 {! B; G" v/ R3 o: \* z
- #include <mach/hardware.h>- C# y0 V+ H& ^, ?% l. o- T
- #include <mach/irqs.h> G! `+ ~$ ~% l4 d3 F
- #include <asm/hardware/edma.h>
0 H7 S8 P+ x( {2 z8 D - . Y! p E4 s& |% E: Y
- #undef EDMA3_DEBUG- c0 \; F6 U% l4 n" G6 z; B% L; ^
- /*#define EDMA3_DEBUG*/
8 \5 ?$ L$ Y; O* z - 1 j" `( B( s- `
- #ifdef EDMA3_DEBUG
V [5 b( ]* @: n. O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& q2 Y7 \9 ]5 V* E" @& O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) o: o/ u, P2 {6 m0 F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 {' F: x2 c: H
- #else
+ U U( W3 R* N* r, q/ | - #define DMA_PRINTK( x... )- I: V& e5 E! ~1 A' c
- #define DMA_FN_IN5 Y+ V( X: j; q$ K/ z
- #define DMA_FN_OUT
7 u: r& W4 @/ i1 b& Z, q( _ - #endif7 F. J/ b7 c1 \
- ! R- M: C+ O2 s0 }! a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( c6 M" J' [& S( Y& c6 F5 S
- #define STATIC_SHIFT 32 X, K8 v1 {8 m6 _% U
- #define TCINTEN_SHIFT 207 U: G, f; y+ K! E1 S4 k8 k; v' a
- #define ITCINTEN_SHIFT 217 w. ]0 N. R6 G$ a! D
- #define TCCHEN_SHIFT 22
, ?; I: F9 m2 O: w% @8 ]' x - #define ITCCHEN_SHIFT 23
6 \! D& O7 y' z' `* u& ~
+ j# u0 G+ L% M+ `- b# ] |- static volatile int irqraised1 = 0;# P9 g! {5 Y. q- I2 o$ @7 h
- static volatile int irqraised2 = 0;4 Y: b8 f* G. ]$ j* [( }+ ^
$ V7 ?- E' D. B B& ^+ f5 i+ j8 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: a: M E7 L- K/ O7 d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ V' h9 }* g3 ~0 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' e* O1 ~. O3 T* ^* q/ `
- ! F3 h' \' ]' x0 k
- dma_addr_t dmaphyssrc1 = 0;
- p$ Q- v- _! Y( ^ - dma_addr_t dmaphyssrc2 = 0;
( w8 m( a' e4 t# u D - dma_addr_t dmaphysdest1 = 0;
% }/ }3 |, j# ]* s3 w9 ^. L! R! Q - dma_addr_t dmaphysdest2 = 0;) q; b6 m$ ?4 z% P* r
- j$ e* C7 {$ {, c$ V- X- char *dmabufsrc1 = NULL;
+ Q, Q4 ~' d$ `. K% e; O - char *dmabufsrc2 = NULL;
6 Z3 K0 }# s$ \3 j" ^5 y# c - char *dmabufdest1 = NULL;
4 A/ m: S3 e2 X. { - char *dmabufdest2 = NULL;
- r2 }4 y5 n: v - `7 n' `6 r1 W; E7 X; J E
- static int acnt = 512;
1 q$ ^- s( d3 v& V# {# ]8 b8 {6 P% i - static int bcnt = 8;
# q5 }" }6 x5 Y/ P - static int ccnt = 8;% L5 m1 d) H5 R$ X
- 2 F0 B4 f s8 h
- module_param(acnt, int, S_IRUGO);
0 b! y( C- E } - module_param(bcnt, int, S_IRUGO);
2 k) z K/ C) y, g. G$ \( a - module_param(ccnt, int, S_IRUGO);
复制代码
9 J1 c2 ]" Q0 K( ]: a3 X2 G/ [' e' k8 O. C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( I. A f$ _. r2 n/ F* H+ ~% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ D6 v% \( G/ Q" t: d7 L, G) s$ m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 `0 e) T" ^, T: ?/ f+ M. o3 a/ p; L
6 H* T$ U* x5 y: P
|
|