|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 U8 y1 z& K! {( o% a: }- [code]EDMA sample test application
- |' q9 I% P3 s, a; D/ \3 @4 {5 h - /*2 A! l, J' o- V! O/ o9 M* R
- * edma_test.c2 E1 W- h7 o4 Y* T
- *5 T1 c* e& b, C" A, Q O( Z) C/ @0 \
- * brief EDMA3 Test Application7 ]( v4 _$ o, D; F- F+ i' r
- *
% t7 }' L# C3 C% z G6 ] - * This file contains EDMA3 Test code.
. ~6 v5 ~4 d" u" b5 g7 N, z - *
$ p# Q! n, R0 {/ F) d- g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 T, y3 a. f/ m! C: c! p* ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 D0 M/ f4 E5 z! I7 b& q
- * TO CHANGE.; x; O1 A5 \! D) v9 W+ F
- *
- `6 q O1 g- W" c5 e2 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% O0 S; |9 b) a/ q0 h, U9 e7 G. W! S
- ** p+ u& g( A2 D- C C9 C" q
- * This program is free software; you can redistribute it and/or6 K" X6 q% y* l L0 z2 G
- * modify it under the terms of the GNU General Public License as* {( m* I5 B" ]2 \6 E4 M9 ]
- * published by the Free Software Foundation version 2.& t& c# M0 w: ~- X
- ** ?- d, _7 \+ Q B/ T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, H0 P5 O! o5 r1 e( j) o
- * kind, whether express or implied; without even the implied warranty
) Q8 `+ ~) _) g) c3 b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) y7 y) w; S' O j* g - * GNU General Public License for more details.
; d' h" K& D" I* A3 y9 N - */; u" |5 s. f6 }4 M
6 f0 B d" m3 x4 J5 J- #include <linux/module.h>
' ?6 {" _4 B% y6 X9 Z3 q - #include <linux/init.h>
$ K+ ^ m1 ]0 o9 ?1 o/ Z) O9 A* P - #include <linux/errno.h>1 p) r- l9 P5 y0 r0 ~( R1 j$ w
- #include <linux/types.h>* w7 y8 v. D6 J3 k' v
- #include <linux/interrupt.h>
& `5 \. D Q1 G7 L* I' t7 V - #include <asm/io.h>; C8 H' M" I( k' U
- #include <linux/moduleparam.h>
8 w. F0 F$ m" g: ~! r, J: j2 P - #include <linux/sysctl.h>
+ O( R% l B$ d - #include <linux/mm.h>: a# v$ z+ m: O+ Y7 a$ ] c% g
- #include <linux/dma-mapping.h>3 b2 Y" t |* b. \1 h
) w# p# U9 W, n3 u- #include <mach/memory.h>* F, M! S. [! ~* i7 d0 e. I
- #include <mach/hardware.h>
- Y7 G# e4 U" q2 ?5 Q; p C, u# \ - #include <mach/irqs.h>
& s$ T9 d1 ]4 O+ I8 o* N& k' n/ Q - #include <asm/hardware/edma.h>' ]/ q( _% R1 ]( c
- 4 c% p4 x& X0 O2 p9 u4 y- H
- #undef EDMA3_DEBUG/ g# t) |% I2 q l! K) i$ a1 a
- /*#define EDMA3_DEBUG*/. y' s2 i: w; N, w1 s+ M! l
, p; s! W. K+ S( T- #ifdef EDMA3_DEBUG3 O1 c6 h* n7 t5 O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 S, {# p: X" Z C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ R+ p0 }$ h/ Q0 A/ s( a/ G; I" o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! ~$ o' i! u4 f3 |+ t - #else; S* p8 }! ~ O, R+ T3 C( Q6 l5 Z
- #define DMA_PRINTK( x... )
# y. X2 K+ H. A0 x - #define DMA_FN_IN
& E9 |/ D& H7 k% V$ r- I; r$ t - #define DMA_FN_OUT
: Q" x3 K) K8 G+ C/ G) o7 _# `2 ~ - #endif
4 H. J4 ~1 m, h, J8 m. a
/ C D6 X2 G7 q) C; u( U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 @# q% E6 |! q5 [- y4 S
- #define STATIC_SHIFT 3
' I' }( x. V$ ]8 e) s. w - #define TCINTEN_SHIFT 20' _; s/ F+ l' w2 u- { u* d
- #define ITCINTEN_SHIFT 214 L" ?0 f' E! d* F
- #define TCCHEN_SHIFT 224 q) J7 x9 |* i4 X- U2 E4 W
- #define ITCCHEN_SHIFT 23
% _) h1 Y: ?& V. L - 0 H: j$ l& e) D! z- a5 K
- static volatile int irqraised1 = 0;( O3 x( W) o! D" E7 r4 d
- static volatile int irqraised2 = 0;
1 p, F. G7 A" }3 e9 G2 v& w( S: O6 U& O - 1 K/ V$ L P( h7 N3 {0 h r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! ?: T) V' q* h" Z! o- ` f) V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! e% _, m+ C6 M" z V/ `% X6 @8 n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 o: N* U- W$ ?+ d: A
- - m p) @; E# }) a& Y( W
- dma_addr_t dmaphyssrc1 = 0;+ j3 p' x7 H. z/ Q8 c
- dma_addr_t dmaphyssrc2 = 0;
% [ c5 q% C j0 O - dma_addr_t dmaphysdest1 = 0;
- X) C0 s( s3 }) D - dma_addr_t dmaphysdest2 = 0;/ z) \0 s; s7 S
6 M, W5 F0 A% b& f- char *dmabufsrc1 = NULL;
& ~1 E. @: K- y0 u" k) q - char *dmabufsrc2 = NULL;
3 H6 I7 R* L3 B - char *dmabufdest1 = NULL;
8 [3 L( Q t* n/ G - char *dmabufdest2 = NULL; j/ P w* x" b( m" w9 N& M; c) ?
- 9 N0 `! P/ U8 {" J; k+ M: j
- static int acnt = 512;
7 Z0 |/ c2 I) r) W% | - static int bcnt = 8;
3 Z) F9 X2 \4 P& @; z" r9 k* ?& Y5 @9 o) I - static int ccnt = 8;
1 @9 P% X" X S& j7 I& H - 9 e; B Q" n# H5 P1 w5 A$ U" Z! }
- module_param(acnt, int, S_IRUGO);3 |$ {- G6 l0 B8 a
- module_param(bcnt, int, S_IRUGO);
: B6 Z, {8 H; g6 U( {' h7 G - module_param(ccnt, int, S_IRUGO);
复制代码 , s. |+ O' J5 ^6 w' F. U: q
: F* t1 }* @6 b( J& ]# ^: \$ d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( O, s* h5 ~/ b7 ]4 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ u8 f2 C' s" ?" `) E, M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% |* |- `3 Y' b
- _ L* m- K1 X" ~6 M* \! |3 A
0 I0 [! R( c7 `: V8 q |
|