|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* {" ?+ a. B1 {" f1 E- [code]EDMA sample test application1 [& ]! ]: [! {$ t% H
- /*
" ~4 A$ H: u* X% O( M3 k - * edma_test.c6 r+ M7 e3 ?! P4 m8 k+ r
- *
5 n) i6 [* _- q3 a# M* U - * brief EDMA3 Test Application
. S3 ?" y3 y& T' e - *
1 Y6 H5 } J1 P h: a - * This file contains EDMA3 Test code.
* |# Z) E2 I* r) h* V1 J - *
% v0 v! p, @. T( o. j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE |8 ]4 _( G* y1 w, m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( z2 \9 ?) e" L& E, ?6 [% o
- * TO CHANGE.
7 C* @/ `4 B0 z0 B; c" D+ P: O5 q - *
+ J7 }2 e" K: }5 W/ g/ a" q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ r( @5 ?- C7 D# Y
- *
$ m. [7 ~; U, M/ `1 \" k9 M - * This program is free software; you can redistribute it and/or2 {: j7 A4 A% K0 I8 V& A6 {
- * modify it under the terms of the GNU General Public License as
1 ~) w& Z: z0 M& s - * published by the Free Software Foundation version 2.
" q* w+ B7 g5 U- y5 k - *
5 [& U& F, [: Y$ T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ B ]0 v. v* X
- * kind, whether express or implied; without even the implied warranty B* c" Y1 s6 c2 S% q: }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ C8 V$ [: C" j0 \ - * GNU General Public License for more details.2 m7 ?8 m' _& |+ q2 l: E
- */$ g/ k) h @! X" r1 [
- 3 Q' Z: S. Q+ U) ?' t% E: d/ o
- #include <linux/module.h>
3 `: B! i5 v: d) O: m" L - #include <linux/init.h>
2 O- N) k/ I a7 `( ]( n" X7 I - #include <linux/errno.h>
$ ~8 J. u, l. B7 C0 @+ v - #include <linux/types.h>
+ B0 _( r% ~4 B - #include <linux/interrupt.h>% ~7 U- {0 D! Y' O! b6 l b
- #include <asm/io.h>- P; E% ?* Z2 g- Z
- #include <linux/moduleparam.h>
5 _4 \& G, [/ d, h% B8 q- L - #include <linux/sysctl.h>
8 d* V6 R) e) k5 w5 }) b4 m - #include <linux/mm.h>
( [* \* M" z# t. J - #include <linux/dma-mapping.h>8 I: p5 N2 Z1 ^9 p# N
- + q W s& b5 s+ V
- #include <mach/memory.h>
' i+ P& c9 ]/ ~7 l9 O6 }/ \+ ]5 _ - #include <mach/hardware.h>
; J6 a j- Q6 M9 V1 k Q/ K& q - #include <mach/irqs.h>% {# d" y- ~% C4 q6 v) v1 P
- #include <asm/hardware/edma.h>0 q- g; i9 C; R8 V- p- I) ~
" V: j8 k) B. K; F7 n- #undef EDMA3_DEBUG
& f: i$ J5 u* q* ~ - /*#define EDMA3_DEBUG*/
0 x# s# E% ^" H6 y
. P# Q+ a8 F3 Z9 l9 A- #ifdef EDMA3_DEBUG9 b) a6 E3 {6 o/ [8 E2 j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ B- s9 R6 a( j' J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 k3 q% m) K. X7 v/ Q5 e9 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ F7 g0 F% c. w4 I, u& m
- #else0 ~ }$ B4 h& ]5 E6 T D* c
- #define DMA_PRINTK( x... )
0 Q8 E6 G' l, {3 I - #define DMA_FN_IN
" \* j* ?: |+ L3 v( ]* M - #define DMA_FN_OUT, E7 [: K# Z9 D& s C. ], _6 {
- #endif& M, L6 e, |& X4 M: o
- 7 T0 q( ~. {) K8 E/ w" p d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" }' n, x( T9 ~2 A4 [; H6 R) Z - #define STATIC_SHIFT 3" ?* I- \5 [0 u2 j* \
- #define TCINTEN_SHIFT 20) \" o. @ J* E; [ `5 h! d
- #define ITCINTEN_SHIFT 21
S0 T4 K0 h: X# E: _9 w, _ - #define TCCHEN_SHIFT 22
. O9 E( R' ~! z! Q8 p! E - #define ITCCHEN_SHIFT 23& \0 B* s) ]: |* G a* A/ o
- # u' C) d. Z$ J1 V
- static volatile int irqraised1 = 0;( a4 ^2 u, d- k. e
- static volatile int irqraised2 = 0;6 h0 q& @" O w" X
- ) b/ C, x! M8 C7 `: B" ?0 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" W% _7 Y, ^+ U7 d6 h& W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 `- Y1 r4 a' p' ]1 Z N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# `/ ~* H2 B. O$ n' c0 w3 h
$ d" A* c; x# q1 W8 o/ `; p- dma_addr_t dmaphyssrc1 = 0;' H+ w( w( S9 ?. X+ o
- dma_addr_t dmaphyssrc2 = 0;5 e% V- A9 [: |+ V7 T! Q7 N0 U1 X! t, v
- dma_addr_t dmaphysdest1 = 0;3 L4 j+ S8 D4 f- }( f% R
- dma_addr_t dmaphysdest2 = 0;% I# {, O; U4 l; G! F
4 H7 I+ s( j: }7 a5 y @- char *dmabufsrc1 = NULL;. p. ^4 w6 r4 E9 i% Z
- char *dmabufsrc2 = NULL;( w5 U+ H& u# Q# P R# K
- char *dmabufdest1 = NULL;
+ V& \% s4 F' Q: S3 ]9 D - char *dmabufdest2 = NULL;
% L) d" p6 Q8 y3 J, u6 e4 Q0 L& x
/ c# _: `) V* r$ Q* E+ f" G- static int acnt = 512;+ ]9 m. c0 y( C& o+ }+ ]4 e6 a
- static int bcnt = 8;6 o* e) H6 C* K) ~! e A; I
- static int ccnt = 8;
* i; R" k' b3 @) u - : P( e/ q; l2 w% j7 J7 D! t8 e
- module_param(acnt, int, S_IRUGO);
- X+ x/ O4 |; k, o - module_param(bcnt, int, S_IRUGO);' }+ \4 _ c; z5 G
- module_param(ccnt, int, S_IRUGO);
复制代码 0 t A3 q; }. W6 G% n- @
8 _& b! H. T5 r9 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 R5 u, n1 @: K( `" ]1 }1 m; T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ M: { z* ~4 I3 O" U, B3 x9 B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ L/ {. s* C& o: _3 t' |) R* x
t1 S- C# j% m6 u+ U5 _% Q$ \
|
|