|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ N7 ?# N' z; Z5 F& g9 N4 e
- [code]EDMA sample test application
% _4 X/ Q) _% L - /*$ D4 L% D9 E$ z C. h. m! }0 W+ R: t
- * edma_test.c
1 o g( D4 \8 q9 A6 [ - *7 m3 W# Q- Q- v
- * brief EDMA3 Test Application/ q0 Q2 y" W% p+ T7 z% n5 }
- * m9 p9 [+ j+ F. t
- * This file contains EDMA3 Test code.
5 R0 u- }6 W4 v% B7 }( g# }' u7 C, X - *! y3 w7 b* v. [) k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 B% E# \- D) z `/ E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 E$ B9 e' s' f1 i4 D" s, o( J - * TO CHANGE.
) m7 O" P% W" ?7 P0 {* c - */ @( |3 V- E7 ^/ t; D; g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% E* i; E( Z. W" I - *
8 ] ` q- x9 m - * This program is free software; you can redistribute it and/or4 m- i* K6 n6 s+ e: h( m" U
- * modify it under the terms of the GNU General Public License as
6 F) t" o0 d9 i) P - * published by the Free Software Foundation version 2.
+ K) Z6 t- Q# ?. x0 q3 O ? - *
t+ F. s! Y3 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( `) _) S0 z; X9 a0 y
- * kind, whether express or implied; without even the implied warranty1 Y. [4 ^5 Z/ F- \5 |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ H6 m' a, b3 G5 ?: ^* y# A: u - * GNU General Public License for more details.
6 ^9 |) C c: s) w - */$ k9 e$ l$ k/ K
- 1 g& e# o' ~3 X! v% [. X" n
- #include <linux/module.h>
" q& x0 _$ ?# A - #include <linux/init.h>
1 a: J: @ G; f - #include <linux/errno.h>3 p5 ?# n9 u7 w2 k* i6 r+ A( o4 V
- #include <linux/types.h>9 D3 i- W) s) i! `( e
- #include <linux/interrupt.h>3 s$ c7 W2 l& q
- #include <asm/io.h>
! @" g! {/ y6 M% }& ?) w( C - #include <linux/moduleparam.h>
2 \7 u0 x' v. E- j+ s% z( F - #include <linux/sysctl.h>& g$ O8 B, U4 M
- #include <linux/mm.h>
) f3 o8 \; g% x: N - #include <linux/dma-mapping.h>6 t( J$ G3 k4 W
! G" P9 O1 e4 a1 y! a- #include <mach/memory.h>
! [: h! u: Y$ r' J4 D0 x9 \) A3 d - #include <mach/hardware.h>
8 ~* d2 y @2 Z9 d* p- h$ O - #include <mach/irqs.h>4 \/ j- Y2 e# P0 \- ^; }! K' L/ p
- #include <asm/hardware/edma.h>) M) U. x. d5 n& Q0 y5 j* I/ N
- 4 @7 O' y' {: Z8 L }: r
- #undef EDMA3_DEBUG
* ^/ d) p/ y# k9 q( p, e - /*#define EDMA3_DEBUG*/
; l& z) } D- ~- T
0 J# ^ d2 p. Y. E6 R. `% q' R6 e- #ifdef EDMA3_DEBUG4 O; K4 S! h" B' Q/ `% n2 F$ X; v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" G/ V% P2 e* f% Q$ y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% c) e( o" U( ~5 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- Q5 h6 R5 u; [/ T6 U - #else
; d* C( _* a4 H - #define DMA_PRINTK( x... )
& G# g: _1 ?! N' S, I* } - #define DMA_FN_IN
( {9 n5 A r: C( u; c1 V2 a/ g8 r - #define DMA_FN_OUT. I) k) ]' B; O: m/ B
- #endif
6 q% c% M$ t F8 E: [ - 0 z D2 D4 e, b8 n/ B7 @ C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 ~) @# O% S: G, F. W+ d0 J: [
- #define STATIC_SHIFT 3
7 f8 z [7 t& c0 j& _$ n% \ - #define TCINTEN_SHIFT 20) o4 G* C2 D( j3 @( v9 Q
- #define ITCINTEN_SHIFT 213 H# r6 p: q# }8 U) v* t
- #define TCCHEN_SHIFT 229 l' U% ?$ a g& a* R
- #define ITCCHEN_SHIFT 23, s! Z) G7 _2 r1 ]. v" V( o. A( Y
- 5 E, Q8 E) |0 G9 ?) R* @
- static volatile int irqraised1 = 0;
7 F9 w& }/ o# l- c+ s& N - static volatile int irqraised2 = 0;
; V% Q3 |1 O& Y0 H% D
# K8 [3 [- m* |9 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! I+ {( z7 S2 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- g6 y4 u+ v& Z* V4 h5 }0 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 O' i& c* B6 n: H! ?4 g/ n
9 G$ o, _) O9 f% H* H! f# o- dma_addr_t dmaphyssrc1 = 0;
% g% F2 x; o. K Q& F - dma_addr_t dmaphyssrc2 = 0;0 D% F1 [, f) S2 V" a
- dma_addr_t dmaphysdest1 = 0; A* ]6 a7 E3 S4 l# k
- dma_addr_t dmaphysdest2 = 0;
; g9 H. s I0 u g, ^
& n2 [* B. I! S ?- char *dmabufsrc1 = NULL;
. W, ~2 m2 r; ^* ^$ e - char *dmabufsrc2 = NULL;. O* U: L/ O4 }2 |' ~/ w+ j
- char *dmabufdest1 = NULL;
4 w! x% o& Z2 {2 J4 E - char *dmabufdest2 = NULL;
; I7 n. e* T$ U, X2 w6 F - . M* D" E6 }! j+ f
- static int acnt = 512;
2 ^0 C5 J$ Y2 U L$ w5 M - static int bcnt = 8;
) Q9 a- M3 x8 t* v8 l! W: x - static int ccnt = 8;' z" Y( _9 ~ }9 q# f8 a8 U" `
( E. r0 Y/ c4 A; o6 x' X/ \" ?- module_param(acnt, int, S_IRUGO);
+ L% f% @% c2 X3 F2 [) Q - module_param(bcnt, int, S_IRUGO);1 y# m5 g5 O# `: q% q5 l
- module_param(ccnt, int, S_IRUGO);
复制代码
7 f% r$ n* i) S7 v2 F; g
# s- \& a S( v$ ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" d5 i7 |7 w) m2 q/ X1 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( m9 l& |+ a% c s1 B" J( U- _. ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 }8 ]8 M5 A2 P0 \, O* u- x/ g0 V/ V0 I
6 h$ s7 F8 W6 `; K7 f
|
|