|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) B, w' p3 }6 k' x- c1 K3 N
- [code]EDMA sample test application6 r* T" E3 h" Y
- /*2 M* s6 ^( }7 I( `! m
- * edma_test.c
5 q( }) u; u+ a9 a - *
5 t$ e, x+ y3 J4 H; Z K: ? - * brief EDMA3 Test Application+ Q% f3 t/ \& J* m+ ~/ ~( B( B% m2 D
- *
4 q u& U4 m# U$ ]' M" W3 i! m - * This file contains EDMA3 Test code.- y, K5 O0 V% ~
- *
4 T& y( [: `5 W7 ^; |- s7 G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 _+ g* G4 r8 K0 S) _' y4 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 F0 U1 j3 e2 p% n - * TO CHANGE.
" S2 D5 O. [* _: ?% ^) ?$ O - *
3 J6 S* O/ Y" K! d/ d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! L7 J+ Q' k7 }8 h - ** ?. B, A) e' B" Q" l
- * This program is free software; you can redistribute it and/or/ v$ l8 h6 e3 d; V( Y* s2 P, x
- * modify it under the terms of the GNU General Public License as+ S) F; h5 K/ x6 S/ j3 g5 E( h( y( g
- * published by the Free Software Foundation version 2.
; ]0 |# K# x7 Z5 y2 K - *4 E& j, r& p, l/ r& X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 g* x7 d' M+ O* f
- * kind, whether express or implied; without even the implied warranty
8 E2 b/ ^ X# e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 T; E8 u' s4 z" l" @" S
- * GNU General Public License for more details.1 ?. c) b* w; r
- */! c* T5 I4 i+ h& p# i; |- @( {
- + X% L% s- e$ J; @+ D; G
- #include <linux/module.h>& \" d' ?& I. }
- #include <linux/init.h>
2 `; g$ k7 B$ [ - #include <linux/errno.h>
7 P, ^, h" M; g - #include <linux/types.h>
" H _% b2 b i - #include <linux/interrupt.h>
; g5 R4 [' E. \2 Z4 A) M - #include <asm/io.h>
j Q. |7 g: |! _0 X+ g - #include <linux/moduleparam.h>+ @3 V4 N+ B9 d1 {. ~/ a2 J+ T3 m
- #include <linux/sysctl.h>
1 y' b+ K- s; Z! C - #include <linux/mm.h>
. D5 M4 S& K7 S- [! q- Q: W - #include <linux/dma-mapping.h>
3 Y$ q, C7 f9 x( z3 ^
$ E c! y. Q1 r2 ]- #include <mach/memory.h># I7 ^8 x5 b Z! u/ j: J
- #include <mach/hardware.h>0 Z* v* G1 z+ `; ^, C
- #include <mach/irqs.h>$ I4 w w% F8 e/ e9 L% P4 x% l
- #include <asm/hardware/edma.h>
# [$ o: \6 A8 r$ a8 k- `2 `& a - 2 F$ T8 L" z, B( B A" H# J# R
- #undef EDMA3_DEBUG. U5 m* z8 J E
- /*#define EDMA3_DEBUG*/
+ d2 p, p6 ?) b - , x0 m' t& z8 B, {4 ^
- #ifdef EDMA3_DEBUG
1 w* ]6 m9 Q9 A( C. G+ v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ q. s5 |) n) h- G0 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ V# ]! i, J$ J3 c9 L& l. O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 u1 n, m s9 V# Z; x- ^ - #else
8 }% ]% _ V/ {+ h+ I& f1 Z - #define DMA_PRINTK( x... )0 C4 q. i m$ ^8 S+ d) k+ P- W5 }9 J# A
- #define DMA_FN_IN
6 \: s4 X7 g& ]- l0 M - #define DMA_FN_OUT. G% O, a6 f Z. n+ l a5 B; N- l
- #endif8 P7 ~9 P8 O& }3 F) B7 t
; F2 h; b& m( F1 r& W- #define MAX_DMA_TRANSFER_IN_BYTES (32768): C! w1 ]' j) C. v/ |. R1 R
- #define STATIC_SHIFT 36 w6 _+ j- A9 y8 ~4 m
- #define TCINTEN_SHIFT 20
- K+ P- f1 P% v3 b; J% w - #define ITCINTEN_SHIFT 21
* d1 K% ?- l4 S2 j2 n- G( l - #define TCCHEN_SHIFT 223 ]: D. L4 s0 F5 B* J
- #define ITCCHEN_SHIFT 23
% P. a# b" P. s7 w# v8 m - ; ]- B1 G; f- T0 h; F k7 h
- static volatile int irqraised1 = 0;/ m" a$ \; y+ n- F# U; a
- static volatile int irqraised2 = 0;5 g' m# c0 o" b. O8 d
5 t4 I0 s5 ]1 q, P3 e0 q) d8 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ~/ g* q& [4 e2 I- n/ z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 j0 T5 }+ z' ~, |$ { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# w- C/ i" o7 n1 _ - . d* V ~$ t* V$ x. f* @- _
- dma_addr_t dmaphyssrc1 = 0;8 E) l9 ^ ^7 p
- dma_addr_t dmaphyssrc2 = 0;; c+ M. K; _& @ O& U) d
- dma_addr_t dmaphysdest1 = 0;
& B' ]# B6 a0 V) C7 x0 q - dma_addr_t dmaphysdest2 = 0;
+ G4 Q. N4 f5 a+ n
& n9 B o9 I f' p, V8 [: N4 i- char *dmabufsrc1 = NULL;" f& b5 |& x( p' O" Y" v
- char *dmabufsrc2 = NULL;. _5 ^" q; ]- O" R$ p* O ~
- char *dmabufdest1 = NULL;2 T7 `; A" z. J& d$ Q' }
- char *dmabufdest2 = NULL;* ]$ a8 M2 \+ y9 _+ b$ p$ r5 q
( f- E2 u$ I0 @' E6 L$ Q- static int acnt = 512;
2 S4 z( I2 U6 P1 V2 P8 R2 y4 l - static int bcnt = 8;
& Z6 h; [. f5 G3 c - static int ccnt = 8;
" P' U( n- i5 J& y! v* W1 X
- P0 a. w _& T2 ~# B- module_param(acnt, int, S_IRUGO);
}* C: U) x8 G( B- W: i - module_param(bcnt, int, S_IRUGO);( g: v/ M. L% g5 N& A9 d$ {
- module_param(ccnt, int, S_IRUGO);
复制代码 0 K9 {3 w1 w; v0 M" |6 g
4 O( F( D7 l9 P* c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 W1 x; ?8 v: k; ]3 Y0 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 _. P0 S8 x" H/ d! |2 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 j0 M) s9 S( B& j
5 A% e) w- X; s6 Y
& u- V+ V. j4 J; @! A |
|