|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# }/ w7 {$ K. ?5 D- [code]EDMA sample test application
0 q; l! g* J' g: X5 T; m3 b - /*
( Q4 R& i5 }8 u+ b) ` - * edma_test.c: L' P, H) h4 C7 t& l
- * {3 |' N+ w6 L* {9 e, f' q. m+ q
- * brief EDMA3 Test Application& G) S4 C, W2 e( E/ U7 e g
- *
, [ G' R2 S7 C/ e$ T' g - * This file contains EDMA3 Test code.! ^: w6 l% |8 J H8 `
- *
! ~9 j8 ]9 B: P* k) D" S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 i) h- W7 q$ M# e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 C4 p: j. p4 z
- * TO CHANGE.
1 T, s0 W6 E2 }. M0 y - *
! _% q& z1 c' p, _( T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 S. P8 ~" V: t& |) s+ ? - *
% v9 e7 [ Y5 J0 P - * This program is free software; you can redistribute it and/or- ]8 O% R% g( D
- * modify it under the terms of the GNU General Public License as
6 T" x8 p) P) X5 f& x - * published by the Free Software Foundation version 2.# X }4 o; S1 r8 W6 ^
- *; e# W4 F- }5 N# }* n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ?5 y. P8 y }& r2 N
- * kind, whether express or implied; without even the implied warranty) m: N! s; o4 Z& x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 @ V. p" t- K+ N5 k$ K - * GNU General Public License for more details.5 [* U" c4 e6 R
- */
, V* b8 J5 m( O: G
+ ~/ B4 E$ r, P; S4 t5 n- #include <linux/module.h>
4 K O) T! [' G0 B( }' S! k$ U - #include <linux/init.h>
) q( L, ^; k# w4 U. S h - #include <linux/errno.h>
i( `5 c( F( `7 C - #include <linux/types.h>
- c' b$ b2 u* ~' _ - #include <linux/interrupt.h>$ |/ R, r1 Z/ x, C! K4 A
- #include <asm/io.h>
4 P; K+ a1 W) E2 m8 t - #include <linux/moduleparam.h>
' h8 y3 \3 S5 [& F5 K* s1 m, t - #include <linux/sysctl.h>
1 O; I6 ` _4 m - #include <linux/mm.h>
' b, ]& {2 x3 \* ~8 {# G - #include <linux/dma-mapping.h>
. A9 ]9 n4 P6 n& T! x2 X
/ C1 h& C t2 B! H- #include <mach/memory.h>: S8 M' T& k4 B1 t Z/ D
- #include <mach/hardware.h>
$ W* |) w" b- w! W& V- S! S0 F - #include <mach/irqs.h>$ h# [5 y* ?8 D9 g$ o& d U
- #include <asm/hardware/edma.h>
# u! I, T, _% _3 W# j
1 I" |+ A( E' L; L6 } T& D- #undef EDMA3_DEBUG- |$ \' g1 v+ o( P
- /*#define EDMA3_DEBUG*/
3 a$ L/ d8 ]0 F' D. W
5 \6 `; a0 b3 F4 @- #ifdef EDMA3_DEBUG
9 P* i" D+ y4 d4 A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
o$ q" \) Y9 d) c* _" I) C# x& A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 P2 k9 e" J, x ~! \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): V% V" ~+ K% D$ }0 t% f
- #else! z" H8 Z' E8 m9 R( G! P* w
- #define DMA_PRINTK( x... )! s+ q5 l( C' E! N' q
- #define DMA_FN_IN
, ] {: I3 l8 n) Z0 w4 O" T2 c1 l e7 o - #define DMA_FN_OUT0 B) G! x) O: |5 s6 t' h
- #endif
& N& L1 m3 Z( h, C# i( n! i1 @ - % j( M" B! K7 T: E4 R+ N C+ J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 i) I7 n* Z+ m" i: A3 L3 ?/ M - #define STATIC_SHIFT 36 d, `, ~: q4 @
- #define TCINTEN_SHIFT 20, Q8 R; ]2 H7 H" w! F
- #define ITCINTEN_SHIFT 21- M9 w2 Z; C. Y* t j) x
- #define TCCHEN_SHIFT 22( L- r$ ~5 O. d7 m f; z
- #define ITCCHEN_SHIFT 231 k. S B0 o \( g) K+ S8 y
. m5 p6 q5 B3 R, p- static volatile int irqraised1 = 0;" c0 B& S2 `6 h; U! B- [
- static volatile int irqraised2 = 0;. @; g; @. i. d- R) Y
6 \( h$ [7 n. o" A1 D3 Q9 P) j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 x- r1 |, y$ M* D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M9 x& U- p+ [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! b# U. K9 D2 n) G {
; J2 _2 ?4 X8 G2 ~- dma_addr_t dmaphyssrc1 = 0;
7 H! @" X5 k- u) H - dma_addr_t dmaphyssrc2 = 0;
6 i2 r8 D6 m& Y' d J; P$ \ G9 P( t, [ - dma_addr_t dmaphysdest1 = 0;4 p9 J7 ^: H. p& ?; g; D" D
- dma_addr_t dmaphysdest2 = 0;
! w* Q% x9 ?! U+ _& c) z, Z- i* w
, X F* J+ T9 E5 r. x4 Q4 F- char *dmabufsrc1 = NULL; N# Y+ h3 b) Q
- char *dmabufsrc2 = NULL;, k0 P% u8 P6 C& m, A& A
- char *dmabufdest1 = NULL;% l8 E, n( Y) l
- char *dmabufdest2 = NULL;. m8 C5 R+ H" j* \+ T' \
- ; _( w" @/ E3 o
- static int acnt = 512;+ ^2 l# X% x5 V* M1 ~3 i- k
- static int bcnt = 8;8 W( Y: S w u( h
- static int ccnt = 8;2 B* n% J6 E/ Y* _; F
& _ p: i$ C' a# L' u( H3 Y/ L- module_param(acnt, int, S_IRUGO);5 h: W* N0 F2 h9 M9 N
- module_param(bcnt, int, S_IRUGO);
. C' y& h. j' R# Y; c - module_param(ccnt, int, S_IRUGO);
复制代码 0 n+ o( ~! Y1 [0 B' Z" Q7 r
% t" s( F" z9 N/ f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 H. Z4 C9 g* v, {+ y: D7 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 d0 a; }" A7 H$ M. Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% F# u! f" W+ W; [9 h1 W/ H9 I: G+ N1 m; d* {3 z. X4 {4 e1 d
" D7 A0 ^7 @' h% g7 D9 `
|
|