|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' b7 u: @- r# r ?5 r
- [code]EDMA sample test application
( `7 s! G# u8 \5 A - /*
4 U2 q# U2 c5 f" |* X) e+ Q - * edma_test.c
( N: F r, Y% E2 U; Q - *
2 s& S; V, u5 ~0 W# T - * brief EDMA3 Test Application% p9 R% E5 P! D% }+ L/ I
- *
0 S; }3 s5 e* O5 ~' K1 n - * This file contains EDMA3 Test code.
& s" G% m6 w6 [# w - *
" \# Y4 v% Q |3 D2 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ |4 Z: E" K: K4 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 S! O$ `1 E$ U& W7 \- n
- * TO CHANGE.
' k# d5 L# c9 B. L - *
" f8 x# Z" c0 A0 L- P3 S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ w: T, G; v1 _ - *
3 W h5 Q8 r$ G - * This program is free software; you can redistribute it and/or+ m5 i/ |# h$ G/ H
- * modify it under the terms of the GNU General Public License as7 f6 X8 X; P. s7 X/ e3 P
- * published by the Free Software Foundation version 2.5 O& r+ }6 }6 \" U- s
- *0 u' Y+ S3 O1 T* s7 m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& f1 z4 Z3 s" p) c' S
- * kind, whether express or implied; without even the implied warranty
: B' a2 v& z* E" _# o; o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 C6 p! y0 A$ I* R6 j6 x
- * GNU General Public License for more details.
; V, E- o1 a R3 M' h' P* J - */
1 Z/ f/ E3 |: `( t0 h - ) U9 {8 y1 T4 {. V
- #include <linux/module.h>
& U9 X; H7 |* @, P% m. O - #include <linux/init.h>3 f# c% J# S# Z
- #include <linux/errno.h>
- _0 W% K3 Y3 @* p5 D - #include <linux/types.h>. b" ^% ^: ]3 v% R7 z& S
- #include <linux/interrupt.h>; U `+ s: ~) _
- #include <asm/io.h>9 a; v+ `9 W, R! b
- #include <linux/moduleparam.h>
$ j# h1 \+ m+ O$ L" f, s - #include <linux/sysctl.h>
4 W) F" C2 x6 ]; G* Q - #include <linux/mm.h>
& ]# m% y( A. f! U3 a) _' D - #include <linux/dma-mapping.h>4 Z, G( p5 C5 v3 H( x& z4 a
- * \, R# s6 _4 @# L
- #include <mach/memory.h>
$ U2 ?- _" n( B* J - #include <mach/hardware.h>
) J/ ~- x6 ]9 H) u2 M r2 x0 b - #include <mach/irqs.h>' _; p- O' \) ?0 p- w1 D) ~
- #include <asm/hardware/edma.h>3 r2 B4 z6 Y# z8 g
+ J, d/ f& d6 b8 q- x- #undef EDMA3_DEBUG
) P9 ?0 s$ G5 l7 \: t$ D - /*#define EDMA3_DEBUG*/3 e! G+ N3 m" K% E( l2 K5 z+ p
1 D. H: \/ R6 y- #ifdef EDMA3_DEBUG
9 E( y& t1 y$ o1 C/ T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 m2 _2 D5 _/ Z1 [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
]6 K$ l! x3 P' ^6 d2 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 O+ [9 J# m9 ?& f: A. e( L' d4 e
- #else
" W8 G* D" M& I4 u% ~0 Q. B! w - #define DMA_PRINTK( x... )0 f D* f8 }# _4 S+ j
- #define DMA_FN_IN$ F5 j' T1 q0 q( h' z
- #define DMA_FN_OUT
; P5 H8 d M% ?) E7 P5 q; R - #endif$ W8 a w5 E( N- u& T
- C/ q# P2 m* x# T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), z6 @+ \, }) n' u) N9 V
- #define STATIC_SHIFT 3
( b) V- ?. M3 @# }$ k! m; F: G - #define TCINTEN_SHIFT 20
$ u [4 \6 |' }9 ~+ { - #define ITCINTEN_SHIFT 21! Y- k& D2 T' _
- #define TCCHEN_SHIFT 229 B% _/ z6 X% F( q; r6 ^
- #define ITCCHEN_SHIFT 23
5 m* j3 S7 Y/ g5 A
1 _( s- b9 A6 i ^- static volatile int irqraised1 = 0;8 O7 _! ~+ S/ w/ s
- static volatile int irqraised2 = 0;
; Y& x# j+ }9 s5 [8 C' s$ l. m
3 D* D7 U1 V7 Z9 z. u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 B7 A8 A2 l6 n) N$ T* P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ M3 ~$ d! I2 H. m( Z3 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& C6 ~+ j/ f/ g# Y: g" h. z* `9 V
: n: ^7 t$ q2 d9 ]: ?) n: o- dma_addr_t dmaphyssrc1 = 0;) F( o6 i8 S4 Y/ U
- dma_addr_t dmaphyssrc2 = 0;! f- S# c6 r. `: E! G+ F$ ?
- dma_addr_t dmaphysdest1 = 0;% @" _3 w1 t% E. G* V1 h6 n
- dma_addr_t dmaphysdest2 = 0;9 Q& M' f8 y! J+ M) L7 p8 u
- , c9 r: Y% D# T: { e: _
- char *dmabufsrc1 = NULL;
5 U4 h9 J& c, D) E1 s - char *dmabufsrc2 = NULL;
; y R1 X$ P3 h5 }3 `( _ - char *dmabufdest1 = NULL;( ^' a4 j: f$ ]% A; Q; ~% H
- char *dmabufdest2 = NULL;
. D! ~' ]% {$ @: E% U7 M - 1 b. W) G J5 A# r( }' v
- static int acnt = 512;2 C: F9 t3 B. \9 S* S) ~
- static int bcnt = 8;
5 l( @) X/ O7 J: z8 F - static int ccnt = 8;
' T. {' j% E/ L5 Y, e+ u
8 W- s* K+ M4 q' d; T- ^- module_param(acnt, int, S_IRUGO);4 v6 R* V* g, `8 ?
- module_param(bcnt, int, S_IRUGO);
6 y' Q) R; o/ Z$ I. K - module_param(ccnt, int, S_IRUGO);
复制代码 ) W2 C' m6 Z- Z* p1 w @, h
) ^) J9 U5 G; x, o$ Z1 [! y7 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Z4 Q {! G9 K; f7 k$ r/ i7 D/ c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ I* h) b7 k$ K2 j7 f& W1 v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* M: V2 e0 a1 L. B
0 m. k1 [' b# M, Z
/ m7 D# S T( H9 @/ s
|
|