|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! @; E+ k0 p. C# ]& P$ `3 S6 g8 w
- [code]EDMA sample test application
" u! k7 a z8 e; F) F& e- r. L - /*
5 L; b+ Z/ c* h6 @ - * edma_test.c; c. j6 ?8 `/ C3 p" Y7 v
- *
! C# n+ f5 \; D* L; p5 M - * brief EDMA3 Test Application& n+ c! N3 L1 s* A
- *
5 s& Z( M+ H% ^- P; `+ P$ T - * This file contains EDMA3 Test code.$ H7 @" @$ D! R$ o& p/ G# k5 m
- *! i$ i+ F$ s$ [5 r( g# B. F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 B) d0 b. G- I0 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& s; _1 A$ z( \
- * TO CHANGE.3 D# y- ^' x3 i
- *
0 f" b% X' O) r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ? h! i. x& E# e9 _& E' C
- *! x6 U6 b" Z. q2 |# t( T
- * This program is free software; you can redistribute it and/or
7 u# H- {# z( \# B7 f, q2 c - * modify it under the terms of the GNU General Public License as; s) f2 z! {) f T- j s% A4 G
- * published by the Free Software Foundation version 2.
+ ~. V4 }. e+ B - *& H1 S2 Y4 \: u4 z/ K1 V# p, C1 w! p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& @6 X* E) N# ~% S* W x - * kind, whether express or implied; without even the implied warranty
$ z1 M! p" d8 R4 P2 o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 b( W% f. t, W9 [" S) J" o - * GNU General Public License for more details.
6 z- N: N. b2 r: y% N( f9 ~ - */) \9 K; n1 c+ k! o6 J2 U% u
- : L7 D9 C8 y* i5 c8 }* {
- #include <linux/module.h>9 ]" B. g) e" T: E- L0 q
- #include <linux/init.h>$ i: c+ M4 Z5 y; O# t
- #include <linux/errno.h>
6 M$ ]! _5 M. A - #include <linux/types.h>8 _7 Q: B9 B& ]
- #include <linux/interrupt.h>
7 f/ L# f/ C' @; m8 J - #include <asm/io.h>
/ V0 I0 J( a% H6 `" U" z - #include <linux/moduleparam.h> x! n' i* S. M L. g
- #include <linux/sysctl.h>
! v9 e$ A1 U; X, _ - #include <linux/mm.h>4 [5 [$ |) M; H" |) S& ]( L4 Z/ f9 }
- #include <linux/dma-mapping.h>6 S2 ~: e! s1 Y6 y, ?
- * I/ B6 u7 x& c# I
- #include <mach/memory.h>- L! A, t3 G, V/ ~
- #include <mach/hardware.h>, R% }' V$ z3 N$ f3 N& j u
- #include <mach/irqs.h>6 r; I9 ]: Z2 E- |2 K! T
- #include <asm/hardware/edma.h>( D: j) T- s! C1 O, l$ R
; s! E9 y' n1 D# C, H: M- R- #undef EDMA3_DEBUG$ ?( X+ F( p3 v+ r" B1 m' Q& n
- /*#define EDMA3_DEBUG*/
+ k; Y% d: ~$ s% m2 j/ o6 A7 u - ( R. P) T, w8 h$ \, N
- #ifdef EDMA3_DEBUG
0 [2 y+ U: m: m& B$ A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 m0 x: b% R% U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ O ~- d5 D. l( Q/ A& X. X! F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- |: {8 {+ z* x* t! e( A$ v# \ - #else
) @$ r( T6 x4 o. T) U' N - #define DMA_PRINTK( x... )6 _! d' j6 C$ _8 a7 m+ E
- #define DMA_FN_IN' a" J! K" Y' c+ J# _, F
- #define DMA_FN_OUT
' i9 z% o( b9 d" V$ C! j - #endif: n( x; r9 J9 t1 t8 |
- % l, p4 r" P( Z A1 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" f$ N- K! _1 ^' P3 \( ~ - #define STATIC_SHIFT 33 z; q+ A2 H4 x2 S& k1 b1 ^1 }6 f
- #define TCINTEN_SHIFT 20
$ Y) k# } Z: L r. ~+ n2 c( M - #define ITCINTEN_SHIFT 212 \- r/ ]/ { r. [
- #define TCCHEN_SHIFT 22
0 f# F5 y0 y4 A( e# q" P - #define ITCCHEN_SHIFT 23 x3 v# u! t3 [" a/ B
( s( } O- ^9 N5 C# p1 S j# q- static volatile int irqraised1 = 0;
$ _" u3 N. D! k& u; H - static volatile int irqraised2 = 0;
& o9 d8 T$ j {6 U2 h2 K. b& `
% _, o( J+ Y( U# J4 I/ |% _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Y! s& @% `1 R% [ G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 j( x, I/ |$ f* p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
V, q3 f; [7 M q, D - / Y- j6 l v- K
- dma_addr_t dmaphyssrc1 = 0;" r+ ?: I8 I" g
- dma_addr_t dmaphyssrc2 = 0;2 ?6 b# S/ _; B3 |. r$ E9 h
- dma_addr_t dmaphysdest1 = 0;
9 R( n! \4 Q' r8 e7 n - dma_addr_t dmaphysdest2 = 0;! z- b7 E. `7 `- `
- 0 d+ `! i) \4 A- d+ x; ]
- char *dmabufsrc1 = NULL;
0 m2 _0 A9 J- _* o% s2 Z( v# B - char *dmabufsrc2 = NULL;" T; R7 W3 t# u9 L0 z# L6 A9 w7 W
- char *dmabufdest1 = NULL;
" M6 d3 m1 D* L/ Y - char *dmabufdest2 = NULL;
2 I8 Y* }; l) T4 D7 [* Z - * H* N7 _8 @5 {' ^, m2 [ X
- static int acnt = 512;
, z5 `/ t4 S: S# Y - static int bcnt = 8;
. e+ Y) `& U8 |, k7 E - static int ccnt = 8;0 w d' I; k& D
- 6 ]6 E* w$ q D& b* F9 e+ n* ?4 u
- module_param(acnt, int, S_IRUGO);
/ f9 W! o5 \2 R% t - module_param(bcnt, int, S_IRUGO);0 Y8 I2 o- g, z
- module_param(ccnt, int, S_IRUGO);
复制代码 / P9 H7 s+ D" D) s2 f
* D2 w7 `# q+ a7 @! u; l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ^) W: [8 d% w
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& n4 @0 i2 ?3 F! ~) a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 s* z! _1 ]1 E* J& i9 S9 p& J& W9 p; P3 ^! k- w& i# Q' b
3 {, B- o' o! W, F2 }! t1 P( H: ~
|
|