|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( x. D- u- W; U1 D3 r ^8 A: G
- [code]EDMA sample test application+ L' @* ] _; _( Y
- /*, E$ A% b3 R7 [1 r) D
- * edma_test.c, `. _" z' p! O% _
- *0 j) Z! H! V* b3 \0 p4 L( N& H& S4 Q
- * brief EDMA3 Test Application) Z5 K9 P2 J0 r/ n+ X* Q* p
- *
; [6 r5 |& ^7 S- B1 ]4 e% B7 w% x - * This file contains EDMA3 Test code.
2 N- A( H4 B* @' }0 s - *
" x) x$ t" @5 s7 J6 n- G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 L' y# T) Q) S0 T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! W; w; m! l5 m# g' S% X7 A, _. B& ]
- * TO CHANGE.3 Y- F8 ^; Y/ k* w
- *
& i- l, R0 E7 S( `' ^# y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& h( U# k4 f& I6 `) _1 ^- V
- */ y* ?0 u$ i( ^& J) r4 e" X
- * This program is free software; you can redistribute it and/or
7 q. o5 h: Y: U - * modify it under the terms of the GNU General Public License as& t- k0 `4 W3 L4 f5 J9 G! B
- * published by the Free Software Foundation version 2./ u2 P% V* ?' ^+ M! |; C! ?
- *9 D) x" p8 e! D- d, J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! ?, f4 [! n! y
- * kind, whether express or implied; without even the implied warranty3 d, b( }3 O" z5 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 ?8 b: l0 H0 A6 X/ j: Y - * GNU General Public License for more details.. f( \- Z" f* K! z
- */4 x1 n+ s6 V2 O3 R$ l1 {0 S
3 C4 ?9 i" D; _- #include <linux/module.h>8 s7 |0 D& V8 g/ y6 ^
- #include <linux/init.h>
2 x) ^; x& A, |, { - #include <linux/errno.h>2 f s- V7 B+ p% u9 k
- #include <linux/types.h>! f# a, m# D2 {* i/ X A3 r+ l f# n
- #include <linux/interrupt.h>
9 S. }2 ~" @2 K, w0 n9 |7 L - #include <asm/io.h>
/ x5 j+ p4 i' Z3 D! T! ~) u - #include <linux/moduleparam.h>
& K' {# f+ `% M0 F - #include <linux/sysctl.h>
3 J1 B' u$ a# H+ T$ d - #include <linux/mm.h>
0 K0 T0 d0 ~0 a& \/ z5 T0 Z - #include <linux/dma-mapping.h>6 t; F* V9 M: Y
- p- d' {$ t% Q& L* x+ B+ h
- #include <mach/memory.h>
. }3 P6 W% n2 T6 l$ Z$ E3 j4 @2 E - #include <mach/hardware.h>6 R6 O/ p- {" V8 j, L
- #include <mach/irqs.h>
" W; n3 M! O) E! b" a - #include <asm/hardware/edma.h>1 e' a5 I0 R& z* `* d% b
- ; Y% r9 [9 b5 X+ e
- #undef EDMA3_DEBUG e, S/ `1 L" ~2 x
- /*#define EDMA3_DEBUG*/' L! G, t% x- y7 O- Z$ O. |
( q9 K* w: k, C" `/ L0 h0 O+ p- #ifdef EDMA3_DEBUG
. F5 k% F2 a" J+ L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" Q$ }; w( B( `; [& x; j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 G/ L {- K1 G8 i3 i# B& {' r o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 g- F7 q* e( h7 i% I7 a
- #else2 g& T1 D! O7 N+ y& H" H: E) a
- #define DMA_PRINTK( x... )$ w- V- `6 `( D' ?# c9 \" y# w
- #define DMA_FN_IN- b1 f8 O! |8 I7 q8 Y
- #define DMA_FN_OUT
2 M$ \# A Z1 | ]! W; o3 v' \0 t - #endif
# Z1 _: {/ X8 [: b
( a' R+ P5 H4 b. \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ r2 t6 I r' i3 f7 v8 M5 }$ e. p
- #define STATIC_SHIFT 36 J2 k0 [3 e* Z+ {) s$ [
- #define TCINTEN_SHIFT 20
0 {' R! K# v5 U' J* p2 B) W* V: ^ - #define ITCINTEN_SHIFT 21
3 l% J. ]* g/ A7 Z, K# u - #define TCCHEN_SHIFT 22
" v* y1 ?; ~: O; ? - #define ITCCHEN_SHIFT 23& {: h* O( G. k) Z
+ ^* k9 w: q/ E1 s; D+ V9 R0 a0 b- static volatile int irqraised1 = 0;
8 J7 _3 z7 j2 a; j5 \ - static volatile int irqraised2 = 0;
7 z% u5 o' G; w. F' w - 6 ~) s! ^; F. Y, K' u# ~2 @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 a6 g3 W+ a8 L2 ~; g9 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ h: H k5 g" S% x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& a8 ~5 b* c9 Z& k, x* b3 G
8 g1 y2 U* ^) U/ ]- \" h- dma_addr_t dmaphyssrc1 = 0;* e! L- J- v Q
- dma_addr_t dmaphyssrc2 = 0;
- f9 h# v3 U( | r - dma_addr_t dmaphysdest1 = 0;
# z7 T0 {8 d# e, t: m) W - dma_addr_t dmaphysdest2 = 0;
* i% G; v* ]! F# q - + o2 K, p* ?5 D# V" m$ R# w* l9 V; ^; S
- char *dmabufsrc1 = NULL;
. s1 k5 f! R& K4 k - char *dmabufsrc2 = NULL;
& W1 N8 ]/ q% S3 C; ] - char *dmabufdest1 = NULL;
4 r8 J$ G9 {1 ^9 Q" ] - char *dmabufdest2 = NULL;
# q& S7 X+ j2 p- L& o - 4 T w3 @5 u, h+ q, L0 B6 d- E, h
- static int acnt = 512;4 f. P6 ?; r" c/ l' u
- static int bcnt = 8;8 j% k. n+ O- R1 k2 ~6 a2 |# o7 V
- static int ccnt = 8;
! t5 U8 @# x' z+ \9 M - * E; Y8 w6 ~* ?; @; l( v6 l
- module_param(acnt, int, S_IRUGO);
7 g }. Z" f1 S$ w0 Z# c: _7 O2 u8 | - module_param(bcnt, int, S_IRUGO);
( z8 T6 C. Y# O. e' R - module_param(ccnt, int, S_IRUGO);
复制代码
; ] |# F8 |; b2 g% \4 `& u3 W4 K
" t. b- M& r" Z( V1 p! ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" h" R/ b4 G! z! _4 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 h6 _3 q' L5 T6 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& v6 W# M1 b* v5 X; o: R, h4 R/ z8 ]) L- A3 I k
' m5 x% {# W! G w2 q0 W |
|