|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 h6 b! c7 _+ \
- [code]EDMA sample test application
1 ~. F: M. p- U* }! J( S - /* i4 @% A# T1 o, E( u! }
- * edma_test.c' O3 ?/ n8 ?* R$ k+ Y
- *
5 C/ h) j' E/ \ - * brief EDMA3 Test Application& k- y6 T. W, X. ~: p$ c
- *0 J6 e" r* u% [' j8 x
- * This file contains EDMA3 Test code.$ p" s/ k: r- X* G( R4 X
- *
: Z C: v# I* v, X* U1 ?# F3 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 w& l4 x4 u& X C! E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 O7 x/ d7 y' ^ - * TO CHANGE.
" z6 Z4 l" P$ q, r* U - *
% X3 l0 {2 m s% U, B& O' P; T" C; ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" D& D( [2 e0 l5 j: z5 ?. }
- *$ C7 {4 A6 |9 p
- * This program is free software; you can redistribute it and/or* s5 Y# O# C$ ]
- * modify it under the terms of the GNU General Public License as% T G( P3 j8 o; }# T: C2 B
- * published by the Free Software Foundation version 2.
: k7 s) x5 ]/ y$ d6 Z& n3 H - *
' e9 S2 B ^) @" T- t: ], Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 r/ J8 q2 y8 ?' e3 j
- * kind, whether express or implied; without even the implied warranty
- D4 s2 m N7 F3 w0 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ T0 ~* D3 _2 K3 b1 ^+ W1 J
- * GNU General Public License for more details.3 ^3 A: A+ ~3 r- L
- */
5 S q o; p0 a
2 H5 B- \" z# E6 ^- #include <linux/module.h>
0 @6 S* Y- u7 V - #include <linux/init.h>
, U+ J* q, {8 H5 P4 m - #include <linux/errno.h>' C0 J% n7 e# t; c+ ]4 k2 `# t
- #include <linux/types.h>
8 j) G; w. S/ r0 {7 v - #include <linux/interrupt.h>
1 V' o5 p' `/ x - #include <asm/io.h>1 z) C$ g; m2 Y$ ^; s
- #include <linux/moduleparam.h>
* N6 j, B$ H2 g# f3 E2 E- `' I - #include <linux/sysctl.h>5 n6 B9 m) A8 K5 @ U
- #include <linux/mm.h>
0 t* t9 n i3 ^ - #include <linux/dma-mapping.h># i* j0 C* A! n$ G
4 a; Q- J7 k' M) y2 Q* m( A1 Y) H- #include <mach/memory.h>
. ~( i7 ~8 g4 y2 `$ p/ ^( u8 B- {. K - #include <mach/hardware.h>! S# P* n. L3 {7 y. [
- #include <mach/irqs.h>0 Q- X9 B* x! a" ^
- #include <asm/hardware/edma.h>
7 ?. P' W3 @, q0 k( {
: k$ A8 v3 P. S2 H& Y! B/ k- #undef EDMA3_DEBUG, ?! I7 t, q6 L" R2 F( t& L% c ]
- /*#define EDMA3_DEBUG*/
' c! q' E0 C U! F. D4 D. M
+ k9 y9 A0 h: I- #ifdef EDMA3_DEBUG
) g7 M# v6 j7 E" a( N7 m. [7 L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) m! J6 q! N m; g( x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; X) y! h, C, U3 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# @ @8 L( Z0 w3 { - #else
, P1 h; ^7 w5 H# X2 ]' ^ - #define DMA_PRINTK( x... )
- R4 j% y0 w4 {3 i - #define DMA_FN_IN3 |. A' c9 S1 f1 u% A2 r5 V
- #define DMA_FN_OUT
! N+ q" }1 ?: j* V; R! X8 P - #endif! |* F! m5 E: R! @
- ; m0 M+ A) B, z2 c+ S5 C: E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 z8 J1 M" K8 a' ~1 g/ H% T" C
- #define STATIC_SHIFT 3
( z. ]3 K+ S) d( Y! l - #define TCINTEN_SHIFT 20. W4 c9 e+ x0 ]0 \
- #define ITCINTEN_SHIFT 21
+ Q3 h5 g" ]) K5 G5 s4 J I8 I - #define TCCHEN_SHIFT 228 A6 L, g; [5 d7 ~
- #define ITCCHEN_SHIFT 23. e1 i! q$ [- b. B& W+ J1 q3 a
- , f+ c, Z, d9 m2 h% D# e
- static volatile int irqraised1 = 0;" Q+ i6 @9 k* m4 ]6 U
- static volatile int irqraised2 = 0;
( w4 U9 E: _3 K" J- @ - 7 x0 w I! Z( l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: [4 `: a0 ]- Y4 K# e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N6 {3 k, Q4 |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ [9 U& U+ x3 ` - ~7 W& m+ w/ t$ q2 m: k- i
- dma_addr_t dmaphyssrc1 = 0;3 N9 [# y& [1 ~# B% _4 S6 V
- dma_addr_t dmaphyssrc2 = 0;: C0 A% R$ x! _
- dma_addr_t dmaphysdest1 = 0;
; N5 u6 K* V) B" h, h - dma_addr_t dmaphysdest2 = 0;' r* t! p6 ?0 C: B7 ?( Z7 J' }
2 R3 y. W2 k+ \$ u$ [- char *dmabufsrc1 = NULL;
' |$ t0 z, L0 |0 O$ E, j9 q - char *dmabufsrc2 = NULL;
1 S# f/ s8 s l- { - char *dmabufdest1 = NULL;* i! E. W8 j# ?* |8 N
- char *dmabufdest2 = NULL;
/ t3 H2 m8 l" J n' c
, W( _* p5 ~. G( W6 p- static int acnt = 512;
: U# e, |- B- a0 \9 n% I. F/ Q - static int bcnt = 8;- ~8 N1 ^$ ?& q# I* x! @# p
- static int ccnt = 8;" ^/ T1 B n' w* T$ `8 W
3 g+ |% p$ a8 T1 @; J- module_param(acnt, int, S_IRUGO);. p# g$ @' a" h! n7 D% ?0 \
- module_param(bcnt, int, S_IRUGO); b; O8 g2 q/ E S0 v
- module_param(ccnt, int, S_IRUGO);
复制代码 6 R5 K+ C9 D) i# J7 S
# v* f1 B6 I! h Z# J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 k) r# \* u* C% o: b; V" I+ r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ @% _6 `' y, D# x+ ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ Z/ |' e6 G& \2 i5 \; d
% s9 k1 s& Y/ z% @
7 s& o4 s- Q# Z; k) U
|
|