|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - [4 w( `7 F+ W6 e
- [code]EDMA sample test application
3 X" t" y& y3 ^3 D! s" W" t - /*$ b) W5 B- l& E
- * edma_test.c
- G6 j X8 Y5 }* u - *
5 y1 K3 X" ~" P2 h3 A* d9 d) M - * brief EDMA3 Test Application
- e% h( H* s# ?3 g1 ^ - *! d& ?% f0 K2 V9 [
- * This file contains EDMA3 Test code.4 v, y$ W" o- C2 c1 I
- ** I4 V- f ]+ O6 `0 [$ H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 O1 z3 E5 N5 \, u3 V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# A' ]0 F% ~: P9 T8 ?8 b" [ - * TO CHANGE.
0 e) C% Z8 i9 |6 m0 p/ M( [ - *
Y8 E2 I4 i$ y7 Z4 J; L8 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( u1 ?" N8 e; |: ?* p2 ~
- *, j5 U: h9 h' [1 e& u0 ]
- * This program is free software; you can redistribute it and/or
j7 o W* }+ p - * modify it under the terms of the GNU General Public License as
/ J) _- Z1 F9 e7 ~ - * published by the Free Software Foundation version 2.
2 H1 ^4 l g" r1 U - *
0 k. B7 w _% n) O3 d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ~/ q! E8 i2 }3 d& B
- * kind, whether express or implied; without even the implied warranty M M! e! ^4 S7 T- r9 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& E: P$ B& h# V) q; P) l/ W4 B& a
- * GNU General Public License for more details.% k5 @# Y& H) ?" G1 h; r) P. L
- */
" W! P7 A% @0 L- c - 3 ^2 P( p1 b3 p+ Y* k8 Z+ m( ]
- #include <linux/module.h>) ^: G0 \- u* Z) p6 r" v. ^( E" `
- #include <linux/init.h>8 g0 a; ]- O! u5 m+ f& N
- #include <linux/errno.h>, \1 U Z. p0 H* C* {
- #include <linux/types.h>7 z0 e0 z4 G1 ~ J
- #include <linux/interrupt.h>
. d; f0 i+ X& t6 C( r _ - #include <asm/io.h>
: N9 Q! C- J! |$ \4 h3 W - #include <linux/moduleparam.h>
+ h6 v s& K/ i1 x$ } - #include <linux/sysctl.h>% N5 x' C' ~6 O0 r* W/ f/ I
- #include <linux/mm.h>7 m8 e0 y' f2 M" |8 ^1 z7 S
- #include <linux/dma-mapping.h>7 G `% Q) y/ f5 {4 c, U
" h! K! C1 T$ ^3 v1 T: ^- #include <mach/memory.h>
0 K7 @+ b a6 b7 n - #include <mach/hardware.h>
! o m9 _* q1 u' F' i& L - #include <mach/irqs.h>& A' o' u, w* P
- #include <asm/hardware/edma.h>6 p+ M4 B' Q A+ `7 K
* l6 ]) d# t4 f# ~3 e- #undef EDMA3_DEBUG* Q+ R3 t5 x8 D
- /*#define EDMA3_DEBUG*/$ q5 q) q) ^( y- }5 o1 [0 x- F" ?
- 4 A/ c5 ]+ M) Y" m- h$ s, H" j7 Q
- #ifdef EDMA3_DEBUG
. i! l/ X) g" _$ G9 g0 S2 T" x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( P o$ P6 \. ?& D' w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* Q# @$ o( m& B6 g) z {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ Z w9 K. U, k% u) }
- #else
: \* E3 x* t* y% g9 k - #define DMA_PRINTK( x... )
) x" c. S8 Y1 L0 ?: w - #define DMA_FN_IN0 `. E* \9 j9 ~4 J
- #define DMA_FN_OUT6 P I5 p. x4 g- q* b) X0 x! d/ K
- #endif
) v' g+ h7 L, ~
! U, G! n) S; H" o8 X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 z: B- _; Z8 W5 I - #define STATIC_SHIFT 3
7 ^# n6 x" U2 v$ O! S% \ - #define TCINTEN_SHIFT 20, e6 {0 l- ?1 g- O; [3 d1 L
- #define ITCINTEN_SHIFT 21* l, f8 G$ D9 f5 L
- #define TCCHEN_SHIFT 22
3 b( d! B& L- D" e- X! ? - #define ITCCHEN_SHIFT 23
p4 ?$ I+ |" p$ ^6 M- X' v9 }9 z - / l+ X% t+ _# Z% L
- static volatile int irqraised1 = 0;) H9 K8 ~8 I2 @9 n& x+ V
- static volatile int irqraised2 = 0;
. ^1 z5 {' |9 c0 y0 ]
/ a5 S' k/ W2 R% E- M: H( T8 J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 I. H# ~; A y) M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \7 I6 R) T& z: }- t% @& E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 L7 y: I; g8 r/ H
- . z8 C6 Y/ y3 q, d
- dma_addr_t dmaphyssrc1 = 0;
8 [+ b9 m) }! |% y+ w0 s& L& c - dma_addr_t dmaphyssrc2 = 0;7 d4 P2 x3 R Y0 F( p
- dma_addr_t dmaphysdest1 = 0;
0 F2 ?! y7 e i - dma_addr_t dmaphysdest2 = 0;
/ p ~6 C, r2 t - + X8 D. n1 r( O" {
- char *dmabufsrc1 = NULL;
& @2 y, a5 I4 t$ V/ l9 {* P - char *dmabufsrc2 = NULL;
' R/ g9 G6 [/ @6 k! W - char *dmabufdest1 = NULL;
7 J1 q9 y$ p. H# q; y0 o# X2 U - char *dmabufdest2 = NULL;5 m2 }4 P3 l: f4 `: w4 j
- R) u" W! v3 q6 v2 b! Y! C8 G
- static int acnt = 512;: ^: Q" R9 ~0 S. b: B* Z7 v- z
- static int bcnt = 8;& y1 Z& Z/ g) l6 B3 F
- static int ccnt = 8;7 k% N; r. V- @2 S
% _1 S* Y. E, x5 p+ v ~- module_param(acnt, int, S_IRUGO);% o; K/ x5 ^- m) z& O { V
- module_param(bcnt, int, S_IRUGO);; L! K/ ^, J2 X7 D k
- module_param(ccnt, int, S_IRUGO);
复制代码 5 q G2 Z! K' x
4 h s! K3 v$ h+ _4 @4 ~5 J# j( _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 D/ |# n: w, y* q0 ~' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- j' Q: o0 x8 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ v( }4 d' {3 h5 Y+ r- Q5 S4 G) Q! ?3 o! t. G
/ {; j, R) d" t; ` V8 W0 i. q! V
|
|