|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' p9 k6 J% @, C; S0 g7 D- [code]EDMA sample test application" o ~3 B5 `. x+ b0 C' t
- /*: B) \5 l' Y6 w& L: x
- * edma_test.c
2 z6 d% j6 a/ s M7 ] - *' n4 F4 I2 h! B, n. U
- * brief EDMA3 Test Application
+ \6 C& T: a/ P. g - *
8 \; q& y1 z1 F& _ - * This file contains EDMA3 Test code.
b, c6 V4 V9 {/ k - *: t# E$ o/ d% z: S' n5 ]+ }) C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( x$ T! e/ e o* v+ l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( f0 g5 X: L+ a; [. K5 p" }
- * TO CHANGE.
: ?. l% Q% v V. _5 p8 {/ [3 V - *
2 B% J# Q5 z9 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# l6 X. ?2 d6 I8 I, `; {4 v
- *
( y( s/ R$ C8 I2 x1 T5 ]- ^! {. ? - * This program is free software; you can redistribute it and/or9 Q% Z6 T! q4 D3 g$ H! T
- * modify it under the terms of the GNU General Public License as( p- `, H2 E% \, k: o9 w
- * published by the Free Software Foundation version 2.& C7 O( | {9 ~ D4 l7 g d
- *: r' g$ c% L) ~4 \* a0 h9 b1 g8 b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 C/ r1 f5 ^9 @' n; L& h& h
- * kind, whether express or implied; without even the implied warranty
/ c* U- d" H, ?$ R9 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" C: t" b4 M3 \' C% E2 F& P
- * GNU General Public License for more details.
6 W: ~ |3 c2 `$ p% l - */
: p8 \- H9 @% z1 |& Y& ~" S& F% O - " I; d2 r ^. I2 ?/ g
- #include <linux/module.h>3 N3 Y$ l# L" ~ \( }
- #include <linux/init.h>, v c3 q7 T t# K) R7 H! Y
- #include <linux/errno.h>9 a2 f! x. D& E" q1 Y4 \2 B
- #include <linux/types.h>
: z& X- G6 r# Q6 x% { \! ` - #include <linux/interrupt.h>! e% ^0 D0 y, @( i, z( m4 L: l+ u0 p
- #include <asm/io.h># z' Z- k' R2 ~& f4 m, y& Y
- #include <linux/moduleparam.h>3 G1 K/ z8 L3 [: ?7 V: a: ~+ ~
- #include <linux/sysctl.h>5 p0 U3 f( ?7 h P2 k
- #include <linux/mm.h>
4 _/ v3 w Q% _4 ?/ Z' `- } - #include <linux/dma-mapping.h>8 R( C) Q3 E$ i; n N. f. l. d* l
" C5 D3 Y( Z, N; T& i% S& b7 w" q+ M- #include <mach/memory.h>
4 R I4 d& t$ [: ^+ H: t - #include <mach/hardware.h>
+ S; D( B$ z- x, F0 r9 _ [# N - #include <mach/irqs.h>
& N8 p8 m" g& J& u - #include <asm/hardware/edma.h>
* F4 ]3 _7 f4 I; T - 8 A' `1 l; m$ d2 g. m+ s; U
- #undef EDMA3_DEBUG7 }" I$ z9 O: T7 D
- /*#define EDMA3_DEBUG*/; t2 o9 h1 N9 i
- % t( d2 E* R7 T4 j9 P7 j
- #ifdef EDMA3_DEBUG
0 h: y& }, R. _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 r) U; j) ]5 x, c$ [2 k/ B2 q1 \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" }9 f' M0 ^. L% j) k# O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* g6 d! I5 u7 m5 v/ R' T% x
- #else3 o/ F5 R3 j9 }% P" c2 C
- #define DMA_PRINTK( x... )& R1 z h" a- v5 a9 `$ G8 l
- #define DMA_FN_IN4 h. g9 E0 d+ U3 z, Y, D2 K) K9 z) J
- #define DMA_FN_OUT2 }* T' m: V. i2 l: t8 R
- #endif1 [7 W% |" M2 A. s4 D/ ]( y
( B% F* I6 u ^+ E0 {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
k% J: L# Q* j" [- a7 R3 { - #define STATIC_SHIFT 3
) h8 J8 b' a3 U9 q - #define TCINTEN_SHIFT 20
o) h: J7 ~: ]6 j* e" R4 ]- t - #define ITCINTEN_SHIFT 21
! c: T) f5 O. p, g: s4 b - #define TCCHEN_SHIFT 222 y7 z7 @3 G2 A4 e& a' Y' ]# B+ P
- #define ITCCHEN_SHIFT 23
" c4 i" R) Y; {: [
3 L# ?6 x. ], _! X3 f; [- static volatile int irqraised1 = 0;4 n8 L9 M$ V$ a* F) Y# }
- static volatile int irqraised2 = 0;
1 H1 w8 B" {/ S+ T - ' B) n. j+ I. N' y1 b, V G, I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ j! p+ U. t( B: P$ C0 n$ I* ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 R* C1 c, e+ U7 f y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 p8 l+ I( Z7 q* q1 `, L% c/ ?
- T9 F/ J- I" i* z- dma_addr_t dmaphyssrc1 = 0;! s3 ^0 y% R& i
- dma_addr_t dmaphyssrc2 = 0;
* X2 \6 ]) k8 S/ \8 P% ]3 P( }$ g# M - dma_addr_t dmaphysdest1 = 0;7 s3 Y: F9 c" K, {. C9 u# Q( I5 }
- dma_addr_t dmaphysdest2 = 0;7 J& c% u5 i. P- r; V
- n' I6 F" s% J' P1 B3 c- char *dmabufsrc1 = NULL;
^4 X$ A1 z8 K - char *dmabufsrc2 = NULL;
6 v( l" T& Y+ S+ D- K- M5 b - char *dmabufdest1 = NULL;; _4 t4 Y& U" z. e
- char *dmabufdest2 = NULL;/ v: `; c- C/ F9 T$ ?; g
- 5 k* n+ a1 b& S; B
- static int acnt = 512;
" O( ^1 K8 o: H; J$ [9 K3 X - static int bcnt = 8;" w& o% }* Q* z
- static int ccnt = 8;
- t& c* C, Y( M7 m6 i - 2 { w( M% s- \3 P2 O4 ^
- module_param(acnt, int, S_IRUGO);
/ M- g: P# h5 C6 G - module_param(bcnt, int, S_IRUGO);0 H2 O+ q- Q! n2 i4 _- R7 J
- module_param(ccnt, int, S_IRUGO);
复制代码
4 m$ ^" ^- k2 S4 U$ N* A o( n' B" ^3 c: J: T1 @ E; @" B/ Q3 \0 y/ h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& }1 G) ?" b H4 c: p H4 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 g( a9 P* h' c2 ]: C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: Y! \! w9 d3 v: A: \2 _$ _8 @* x6 f$ d" X
) ?* }5 G; h; w) F
|
|