|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 k+ i7 U% y W- C" J. Q+ V1 c3 o
- [code]EDMA sample test application" W2 M* p4 N" O
- /*0 i$ Q9 ?$ v6 T9 D9 {
- * edma_test.c
/ V; m+ M$ c! m9 x+ w+ A - *
, L+ m$ X! e6 D - * brief EDMA3 Test Application! t. ~3 R9 G8 ~8 _, @
- *
3 P: A2 j7 u' f4 k) C/ I! z9 f4 i$ o - * This file contains EDMA3 Test code.; A* r* o( J1 J l1 M
- *
( q+ \$ Y* F9 I% _* z& t1 B6 ~6 \* I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; Q1 e1 ?: K& K& X& T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Z4 c$ }' h7 J, e; d; z4 Q* S
- * TO CHANGE.
) k& H y4 z, s. E - *5 @4 Q8 y: T$ X# B$ N1 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 }2 C5 A V* W! T6 M
- *
, P/ Q) v' Q' Q f+ z - * This program is free software; you can redistribute it and/or
4 y0 P$ n3 @3 q" | - * modify it under the terms of the GNU General Public License as
9 |2 k5 N1 r" t0 A - * published by the Free Software Foundation version 2.
" W2 p( Y& i+ r3 [3 ?9 d' b - *' |4 A; w7 w; F/ x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 X5 o/ m, F0 z0 U: ]7 K+ ^ - * kind, whether express or implied; without even the implied warranty, d2 I( y- _& h2 T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 u5 c; o" P. v7 o7 |3 q
- * GNU General Public License for more details.+ ]1 r* l5 p8 U7 r. Z
- */
$ J6 V, Z# Y) S - 2 x5 I8 V7 P g
- #include <linux/module.h>+ x Y$ G4 H9 {% s$ N" I
- #include <linux/init.h>
. M- v; w" i9 H8 N4 U - #include <linux/errno.h>; E# U4 A* e3 F& h
- #include <linux/types.h>7 G2 V# G. q( T2 y' s5 L
- #include <linux/interrupt.h>+ m% x* f' D6 [1 b/ E
- #include <asm/io.h>
$ |5 |6 Q$ w+ Z% z5 F - #include <linux/moduleparam.h>- _, i4 U7 g* g$ K0 n: L" S
- #include <linux/sysctl.h>
4 r& g: y9 O' Z% S3 h P7 r - #include <linux/mm.h>
/ v: R& b. O+ d - #include <linux/dma-mapping.h>
9 A7 ^8 {6 H9 X; p' J; Z - 2 l" H8 K0 i2 O6 z- R, `
- #include <mach/memory.h>) q" O0 C9 b/ O+ e) U, S
- #include <mach/hardware.h>
4 v3 H( y0 w( d3 E* X - #include <mach/irqs.h>! r/ \" R$ H1 D9 U, O7 z6 O
- #include <asm/hardware/edma.h>" A. F8 k- {9 R$ j9 p/ h2 Q6 F" u
- ( x- X% `+ w6 N _" H) s
- #undef EDMA3_DEBUG
# U4 I: g+ d7 J9 g, \* ^* R1 y - /*#define EDMA3_DEBUG*/
" R$ x1 h' G3 t0 g* {/ ~7 O - 1 R2 Q( q: q1 Q1 D# z( Z
- #ifdef EDMA3_DEBUG7 w- x/ {1 m7 E9 I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ a @8 R2 |0 S! l& d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ H' E' p; k/ T) X9 f, e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, f9 k' [ {1 L1 g4 r6 ` - #else& U9 ] \) B @# A" h) I8 h2 }
- #define DMA_PRINTK( x... )
' v+ D" D: S( K - #define DMA_FN_IN
$ m0 K7 _ i0 C1 R0 J - #define DMA_FN_OUT
- e" Y( S8 X ]! H# G+ X1 o9 U - #endif u# H* O1 y5 U9 ?( l- h
- ( v6 m1 Z# l# h1 n1 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); M6 M' o& L; S+ K6 D2 }$ V' g( e
- #define STATIC_SHIFT 3" M. _: B, l# F) M W% P! \: c
- #define TCINTEN_SHIFT 20
, N- Y1 U+ `1 Q - #define ITCINTEN_SHIFT 217 f% S" f3 S( P& e
- #define TCCHEN_SHIFT 22
9 t! }- g3 S J6 ~8 f; M6 v - #define ITCCHEN_SHIFT 23
& \% R i: w- |/ o) G3 H1 R+ b( N - , [: O/ J0 n! b* s
- static volatile int irqraised1 = 0;
" x) ]# b* \, \/ [' M - static volatile int irqraised2 = 0;
# t( e' R0 ?7 B! ^8 ~- U - ( s* K' K; C/ O; B5 w0 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s' y, j% j6 E( N! J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ k! a; V6 J8 G3 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 u. {% v: W3 M, V" |/ U: F u
- & Y2 X1 Z D8 a* d, x4 s
- dma_addr_t dmaphyssrc1 = 0;
& f; d! t+ |% p0 L - dma_addr_t dmaphyssrc2 = 0;
0 f5 d6 O- V# r6 S6 B' Z - dma_addr_t dmaphysdest1 = 0;' J& l: s, R& j9 @
- dma_addr_t dmaphysdest2 = 0;. b) q2 a% L+ l, e
$ c" m- | \) o( k- char *dmabufsrc1 = NULL;8 I U; ]& o+ w2 N2 M
- char *dmabufsrc2 = NULL;
8 f" A- X$ h/ u5 d - char *dmabufdest1 = NULL;
2 L; Q1 P! d1 U* p5 ^! x* @ - char *dmabufdest2 = NULL;5 J% r- W5 W! N& s2 O9 s6 C
, G& o) p& B6 k- static int acnt = 512;
2 M6 s$ H' V p5 Z - static int bcnt = 8;6 b' a& J: j. D" d- \5 R5 ]/ A& t
- static int ccnt = 8;" B& T8 N+ T# u$ _
- - k: g7 `# x! W1 y* B9 w! t
- module_param(acnt, int, S_IRUGO);
* ^/ N) l; `. i7 K( N9 ^/ |& N - module_param(bcnt, int, S_IRUGO);
5 Q8 _6 P1 \- m7 @7 s3 e' @) p - module_param(ccnt, int, S_IRUGO);
复制代码
. f. O) Y/ W4 a3 F7 T3 R. c( F% |* }5 H4 D6 l& z% A4 I) y& Q+ ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% q1 ^& O; l: Y# w" V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 F' x% v+ C; o! q, h9 D* [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 J7 ]8 r( ]9 a b
& ^8 x* s# _: ?# ?
" b T& Z3 h8 N" Y/ _% J
|
|