|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 a8 Z) r& f1 K
- [code]EDMA sample test application+ c6 D, F3 a. [5 D j# p2 R
- /** z* E+ M0 V" H1 n
- * edma_test.c- g) k2 f" K4 u, |
- *; T# Z/ R2 D) }# v l
- * brief EDMA3 Test Application8 u* r% T7 A7 Y$ O0 m
- *
# u" F4 s( v' H4 l. s5 y - * This file contains EDMA3 Test code.
4 X7 e; x% S+ T, Q! ~, Y9 b6 r - *: Z2 W1 U0 l; E& u# A ~8 ]; T* \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( `) b; C" b' s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. L/ Q# k. M3 u! z9 e2 J. {( Q
- * TO CHANGE.- Q8 X0 b: q' J: J
- *$ ^$ }0 U" J- r* ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" v6 F d9 j; Q2 Y5 O+ a7 [8 Q - *0 L- V" j% T }/ ]8 ]
- * This program is free software; you can redistribute it and/or
& o. i0 M, v: ^, _8 V8 ` - * modify it under the terms of the GNU General Public License as2 T" \% \2 G+ m, f6 J
- * published by the Free Software Foundation version 2. u5 V. i/ K, V* ^8 }9 }
- *
5 k" N4 M N6 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# c. \, a+ R/ H - * kind, whether express or implied; without even the implied warranty4 F5 b+ l9 b+ f: j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the e% K! o; ~" Y1 {
- * GNU General Public License for more details.
9 a( y& p' Z1 {1 c( c - */: Y* |0 q9 [5 B! L. w/ k3 L
& S' f4 o. u6 b- #include <linux/module.h>
& G% P- j# d7 F6 T - #include <linux/init.h>; k# J; M) x! {
- #include <linux/errno.h>, i4 F3 G- I' Q2 B
- #include <linux/types.h>
7 i$ k; K0 H/ l - #include <linux/interrupt.h>
, J3 b0 w7 Y' `. g - #include <asm/io.h>
% q; R2 X6 J- w' ]! E - #include <linux/moduleparam.h>
; h% X# G3 s/ l. O( ~& ~' U - #include <linux/sysctl.h>/ ^& E/ p. J {' G6 c
- #include <linux/mm.h>0 n3 h& R" u' d$ ]( o: }( |) G& K9 B! z
- #include <linux/dma-mapping.h>
1 r- R* N5 V5 F' q, c - : R; S9 e/ @' u3 i$ V. P
- #include <mach/memory.h>
- @- y- i1 V2 F% X - #include <mach/hardware.h>
V% }) h0 p% l4 p - #include <mach/irqs.h>
5 I' z) l% E2 f4 { Y1 T1 f - #include <asm/hardware/edma.h>
* s# ~. ~1 D, s4 E
: S1 }. r( z k- #undef EDMA3_DEBUG
- A/ h6 D9 f% F9 w3 ^7 |$ m, {9 a - /*#define EDMA3_DEBUG*/ e" R' X7 X" C
& ]0 M0 J e- G- #ifdef EDMA3_DEBUG
; I8 H" B9 d" D% z; ^& | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); \; y4 W: Z) O$ o5 H2 }. w, ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 {2 G x a, H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); u8 r$ h1 l" F) j
- #else
" Q( ~9 l Q( q3 I - #define DMA_PRINTK( x... )6 G- \" ]9 _3 q* z) B+ V0 V
- #define DMA_FN_IN
$ @8 R4 P, {* ~8 |' h - #define DMA_FN_OUT- f# h+ X: `% O1 T! J6 R/ W: S
- #endif2 A7 a6 C4 | H, I
. ]) D s ?9 I: L4 U. Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, f* s0 P6 h* d - #define STATIC_SHIFT 3' H" ?+ D; J0 `$ p
- #define TCINTEN_SHIFT 204 u: L" E- X& R3 J
- #define ITCINTEN_SHIFT 21
3 U+ A! K9 J) a" U1 q - #define TCCHEN_SHIFT 22% A7 x; g y2 B5 R1 o) u
- #define ITCCHEN_SHIFT 23; f' G% U' h1 V( g9 w
- 7 O8 ]1 y* g+ n- r% _* l
- static volatile int irqraised1 = 0;! B1 K' q" W# m- V5 F- |
- static volatile int irqraised2 = 0;% F6 r. H4 t" g! @0 z
$ Z# q' e7 v5 ^) |8 E& |( N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 A/ K# ~# v8 p6 ]1 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 I% |3 |# t2 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( i( W& K1 [" z' x# U# h k& j" U - # T1 f, ?, W4 y. b @/ G, o8 p: M
- dma_addr_t dmaphyssrc1 = 0;) A, f8 t& A- K" `8 e
- dma_addr_t dmaphyssrc2 = 0;
. c6 l4 e: a* ?+ s' m& |# q - dma_addr_t dmaphysdest1 = 0;
4 C8 P1 ?9 y8 S - dma_addr_t dmaphysdest2 = 0;
. v. f" ]& E9 ?& I3 s# v- Q5 [
4 h9 M; {; x7 G8 `! m# H$ a* z) i3 s+ g- char *dmabufsrc1 = NULL;+ J5 z/ t' V% O6 o% @
- char *dmabufsrc2 = NULL;/ e* d( }$ p) h+ C7 ?/ f- z7 `. O
- char *dmabufdest1 = NULL;
, E9 {4 X3 F. d/ s; r2 ?; O# t3 v - char *dmabufdest2 = NULL;
% F+ K6 {" U6 X2 V. Y$ Y8 {
) F9 h# v( Y# L7 L- static int acnt = 512;3 m" F! c4 ?& e, e# | m
- static int bcnt = 8;
$ C- D% Q/ a q3 Y - static int ccnt = 8;5 O$ J1 V* q' y: F2 @
- 5 e# p$ K( |4 ~' V7 Y2 E8 i
- module_param(acnt, int, S_IRUGO);
|& |% g3 S! K. M4 P+ m - module_param(bcnt, int, S_IRUGO);* ]* r9 P7 m/ Z
- module_param(ccnt, int, S_IRUGO);
复制代码
' l+ V& \4 P S0 [/ T5 \- Z. j( @) I* {5 F* \: y+ ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( k, g, P7 w5 C5 s, S3 y. m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 F. N' G0 W/ E Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ P) C, e2 p* b2 G r
/ n8 E& N, X5 E6 [
3 j6 A0 a* k1 ?/ C) Z: ]
|
|