|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. J! L5 w8 I7 M& T- [code]EDMA sample test application
& R$ E7 A) h* r+ A - /*
9 l/ l+ R# b, K: L - * edma_test.c. w! G( I$ P6 D) a' V1 W" L
- *
3 g6 w* A$ D: P& A1 E- q7 x - * brief EDMA3 Test Application
5 w% ] s% a( x- y) S# q - *
. E0 H' h1 G7 q - * This file contains EDMA3 Test code.
$ J- L% b8 y# F$ @% X9 d2 x2 d* Z - *0 E+ m& ~, b* e6 Q- ~$ s/ K2 \8 m- |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 j. f, G g! N1 u8 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT R7 D, A c) _/ b
- * TO CHANGE.
, g- x$ M x! l8 V. u - *
) ?% G* ]$ `% v2 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( L. B" w, s$ m) ~* E& b/ W. u - *
* V4 k1 u& c) \! h7 e3 \# w - * This program is free software; you can redistribute it and/or
1 a g+ t7 |4 E2 `' z: h' w - * modify it under the terms of the GNU General Public License as2 h9 @' G8 O r4 r
- * published by the Free Software Foundation version 2.- z0 S4 ]* t3 T9 s) a* S+ ?- w
- *8 Y$ a8 L2 w1 a1 {+ R: A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 m3 U# O+ c$ {+ L' t" t - * kind, whether express or implied; without even the implied warranty, @. `) ]0 K$ w6 h c5 ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ C1 ]/ y+ @& N - * GNU General Public License for more details.
. i. ~$ C5 D7 V - */
/ b) @! K) `) r1 }
1 H+ B1 z. }9 X M) T- #include <linux/module.h>
" V) K4 \ l+ u* `& T - #include <linux/init.h>! \' u& V, `7 r& X7 r& h I
- #include <linux/errno.h>/ ]/ i( m+ V) j& S
- #include <linux/types.h>" K, g* N" P. Q0 Y8 J
- #include <linux/interrupt.h>) _/ s2 ?7 ~8 l6 N9 c/ o
- #include <asm/io.h>; Q9 I! A' E0 z {: @
- #include <linux/moduleparam.h>
9 H# y) I2 {! q! p9 ? - #include <linux/sysctl.h>" |$ x \* t9 ]7 {7 v: g" I! I
- #include <linux/mm.h>0 }4 u# }, D0 F9 F9 P% N8 Y& H/ L
- #include <linux/dma-mapping.h> {4 J; d5 X/ {% }; p
- 1 N$ L; d: b" j! |* J5 B
- #include <mach/memory.h>0 L, A5 A/ @& Y: Y
- #include <mach/hardware.h>
2 O- L4 n8 x4 l, D% z! N - #include <mach/irqs.h>
- e4 S& L) U% J0 ~ - #include <asm/hardware/edma.h>
# C5 f- e; h5 L7 k
6 U& m- h, H+ {- K+ o" ?8 Q0 s( H- #undef EDMA3_DEBUG
% \+ |9 F1 J# ^/ W - /*#define EDMA3_DEBUG*/
0 H2 L* _2 m/ m0 ^ - ; H( ?% ~+ `/ Q
- #ifdef EDMA3_DEBUG* Y9 U8 @ k$ Z6 V' H9 S2 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); K9 P M7 ]8 m; v. _* O& i; g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ W' [- Z; ?3 M6 T/ P2 F. S( G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- q0 [! p* |( h% ?# ^8 H - #else4 h5 L& M1 j( N/ [0 }- ]
- #define DMA_PRINTK( x... )
8 I3 J/ b7 a6 j i2 ] - #define DMA_FN_IN
) ^$ X0 M8 J P7 p5 c$ O - #define DMA_FN_OUT
# N- p2 O, Z6 P. R/ r - #endif% X- {& V' l0 Z
- * Y3 @: x& q. h8 f0 J' P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 y( B V7 ~5 V% m - #define STATIC_SHIFT 3. }9 N" v7 Z2 [* u. B
- #define TCINTEN_SHIFT 20. `, A" `+ w; G: S* A6 U2 F7 x: D
- #define ITCINTEN_SHIFT 21
" g# g' w* `8 b# \( V c8 e - #define TCCHEN_SHIFT 222 O2 q. A9 k0 i6 [, \* ~
- #define ITCCHEN_SHIFT 23
3 l k" f+ b; L, h - ; V7 ~0 t E4 k
- static volatile int irqraised1 = 0;
8 ?9 J) Y; _! A# H8 U& } - static volatile int irqraised2 = 0;, r4 |3 S; J& w3 B$ Q) K4 d" Z0 {. @4 W
- 8 u' N* x% P, N2 M( M/ f I( w9 e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 d& b" F0 | z4 _ T8 x& [2 l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ f3 I! s' J. v" p' `/ d3 W1 P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 v# _7 R! l- W3 W9 O0 [: q
* K! @7 [, d( U; c# J0 k1 H) ~: c- dma_addr_t dmaphyssrc1 = 0;
; g1 m' {: I9 F0 A - dma_addr_t dmaphyssrc2 = 0;. S0 [' o! z. L9 }
- dma_addr_t dmaphysdest1 = 0;
: c! W7 y; `- u# h0 o3 R+ O. ?+ v6 G - dma_addr_t dmaphysdest2 = 0;
( F1 E ?8 ]9 G" F, l+ C. L - 7 _# p" g6 v2 K2 F0 n5 l Q8 P
- char *dmabufsrc1 = NULL;) g, }0 s# i! e0 Q+ a! T, y
- char *dmabufsrc2 = NULL;
* W& | f% {) [! D; {3 A) f - char *dmabufdest1 = NULL;
* k0 E; A, k2 O) a) r - char *dmabufdest2 = NULL;
9 s8 I$ C4 T$ d
* l7 n0 d) [/ m- static int acnt = 512;4 G. o- l( I) L1 z: d6 f
- static int bcnt = 8;7 m/ H0 y I9 g
- static int ccnt = 8;
( X! r+ \0 ~' T' C. @4 w - - h# e3 t# y4 m& v
- module_param(acnt, int, S_IRUGO);$ J0 ] l p$ Z$ @/ y) }
- module_param(bcnt, int, S_IRUGO);( z- B0 Q! g1 \& R1 |. U! l9 g
- module_param(ccnt, int, S_IRUGO);
复制代码
: D6 M5 @3 s, N' t/ h) e- {; {( X" t) {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" ?5 C# G5 v* Y" a2 f# ~: B) p/ R# E, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) h2 g8 V' `. Y1 Q2 Z, _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ]6 {! F1 P2 \. v
! ~ @9 g& L1 U1 r
7 F6 m- o# ^6 r: @, x+ _9 k
|
|