|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 R' L& u* ^0 {! L# b
- [code]EDMA sample test application
v% o3 s2 U4 F) e1 M& F - /*
; i* b5 ]5 w9 c+ q4 p/ C! A - * edma_test.c
0 p$ W$ [; c6 ^+ y" f - *. b' R: D0 F6 ~( t' n! w
- * brief EDMA3 Test Application
% ?4 ~5 T+ k4 ?0 n+ j% N+ O n - *
G# S) ~. U3 y& i$ u - * This file contains EDMA3 Test code.
2 U5 Y# _* F! G" j' q - *
+ h1 D. _; y" ^. v6 p; W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 E6 V& Z$ F% L& y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
e5 Z" ]# O8 G: x: L - * TO CHANGE.$ s) b( }$ G3 I \; f7 h8 e. W4 O
- *: R, S- M! w4 l3 V; I1 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% V+ Y8 P$ m+ g
- *
+ |) @0 p7 S4 c- G9 S3 Z - * This program is free software; you can redistribute it and/or
9 y9 a, n/ j0 w% t5 ^* c - * modify it under the terms of the GNU General Public License as9 t/ q" }, z5 e- R9 V7 e x
- * published by the Free Software Foundation version 2.8 M+ {" G" \* c* B
- *4 B0 Y+ V! d! O( V; R# m: ?# M/ _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 }3 z2 ^% m, P* @7 ` - * kind, whether express or implied; without even the implied warranty
- X5 s$ c( D" A6 Z8 U4 F; l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* I, K' J! p4 Q9 l4 F- D
- * GNU General Public License for more details.$ u3 b. E1 x! f8 M& D' t" O7 N' K
- */
3 { f* b+ i7 A - 7 Z& P5 b1 O1 b$ `/ ]
- #include <linux/module.h>
* o2 i* t1 d! ^" V1 Z2 A6 ] - #include <linux/init.h>
5 s9 @+ o! E z8 @7 J- R - #include <linux/errno.h>
, m1 @# x8 @5 \9 J7 w3 E- L - #include <linux/types.h>
$ v* [+ r! M1 \7 f# } - #include <linux/interrupt.h>" Z! q" e+ _" _( H s [; w
- #include <asm/io.h>6 ^+ X1 F3 D( X. E7 I
- #include <linux/moduleparam.h>8 @* q5 F' c; P( h
- #include <linux/sysctl.h>+ F/ Q. b6 Z0 j
- #include <linux/mm.h>5 c3 `& s. R G: S# w7 n
- #include <linux/dma-mapping.h>
% T9 g. }9 ]1 v1 Y
" `1 z$ P) m! p$ Q/ r: }3 C- #include <mach/memory.h>" \* `+ S$ |1 z' s# T4 |0 u
- #include <mach/hardware.h> y! r Y8 h8 U) s/ V# A u3 q
- #include <mach/irqs.h>- g' E o: ]+ p! ~( T: W
- #include <asm/hardware/edma.h>6 P% F+ w" C3 a6 x$ U
- 5 d( {7 j3 l# {- s4 L4 C& R$ q
- #undef EDMA3_DEBUG8 _/ x: T- D- P
- /*#define EDMA3_DEBUG*/
$ q- G/ J; Z, W& l& d - / u: A6 u! h$ c7 L) P, Y! i1 q
- #ifdef EDMA3_DEBUG
, O/ s! ^# k' K6 D( N( a& c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); E! z' |4 Z5 n( d& c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; w2 \1 L' G& v G- | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( e3 g" X+ I5 L6 M3 b
- #else6 \/ U$ H! L- e2 w
- #define DMA_PRINTK( x... )' n Z/ w2 F3 m( m
- #define DMA_FN_IN* K: [, W2 H5 H: N5 A
- #define DMA_FN_OUT
* M: e9 W( c+ W6 F - #endif
: X$ t4 u4 E. u" r; B
6 H! c. e5 H3 \1 P) q$ e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ d& }7 d2 e( e7 S3 x - #define STATIC_SHIFT 3
' \* e& C0 D; O/ d* w( i1 M2 O - #define TCINTEN_SHIFT 20- w. z, M( B1 O2 s I" h1 u
- #define ITCINTEN_SHIFT 21' l& \9 ?. ?2 y! a% K, f, a
- #define TCCHEN_SHIFT 22
y. |6 I+ S$ B" g. h9 F8 l - #define ITCCHEN_SHIFT 23
0 k3 M# _! K! E+ E% | - ; Y: i+ G: t; n; {7 M6 _+ T
- static volatile int irqraised1 = 0;7 a- x5 Q& p. p& {2 O C3 [& P
- static volatile int irqraised2 = 0;
- _* L0 n M6 S" O* w" i8 [. R5 \. B
- i: s1 @5 a+ W0 S) p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 U4 p. A8 T2 y/ L. I% g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 x0 i# j9 ] L* v' m8 W6 l. r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 c9 y/ y) v' k& ]; q# Z$ Q
- 3 D% D9 i" Y. j
- dma_addr_t dmaphyssrc1 = 0;
( c6 }( n- m/ b9 Z) {7 g) V& J! d - dma_addr_t dmaphyssrc2 = 0;
3 ^0 v5 |2 c8 E% p0 a - dma_addr_t dmaphysdest1 = 0;
" h+ L: v$ o* e' m - dma_addr_t dmaphysdest2 = 0;
. Q- @9 B9 p) d: X - 0 `6 ?- j% C( A0 |7 S! t# D8 f
- char *dmabufsrc1 = NULL;! I7 {. R( ~' p( m. [# J
- char *dmabufsrc2 = NULL;4 G9 I3 K5 e e1 F0 q# F/ n9 D
- char *dmabufdest1 = NULL;5 ]+ a" Y7 T/ b; N! o1 |/ v
- char *dmabufdest2 = NULL;% Y* G( A$ P% Q8 A5 h
- 8 g: k I l/ \
- static int acnt = 512;5 _" W" S2 g' o) [
- static int bcnt = 8;
( W' [- ^5 k! x8 \' i: z7 P - static int ccnt = 8;
5 G% n' e: U+ p# E* o
# A9 x, m7 V) ~6 I" b. m- module_param(acnt, int, S_IRUGO);7 q% J7 P* I& i& @# Q, g
- module_param(bcnt, int, S_IRUGO);
: c9 g- @# B( V! f' r! Y, l7 y - module_param(ccnt, int, S_IRUGO);
复制代码 ' O! `# d% W" J) k! x m4 O
9 l7 _0 P2 _0 J0 \9 g1 l! t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, ?' w' s( S1 P v+ D9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 A* y( ~+ a% U2 G7 x% O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 R8 s6 W6 R! M! @( [
# Z: p5 A0 G) l+ u# t9 Z' T* @
' e @& D" P' z9 F3 ^ |
|