|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % I ?( N. o3 l4 J7 U: K
- [code]EDMA sample test application3 j: i4 d4 i. h! j/ d2 k
- /*" P e6 b1 D/ N9 U, ^0 U0 ]
- * edma_test.c* L! O$ I' J2 Z
- *3 `1 B0 c5 B2 @) W+ D' h
- * brief EDMA3 Test Application
' b _' b! {2 n9 j+ | - *' o3 J6 r9 H* k1 C$ V; N4 {8 m1 P! I
- * This file contains EDMA3 Test code. L' D& S' j! s, ]# Y% L
- *' t0 f) z3 Y8 J' q$ j5 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ Q5 a. N. v Y: n$ L9 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 o+ M1 d& q4 w% q: F0 ?
- * TO CHANGE.' B4 y. [/ `# q4 L! P$ q. ~
- *4 Z4 k4 k% W- h% t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 V* B, V2 p/ e$ n
- *
: X/ ~- X% N3 W, R8 N, }2 P/ o - * This program is free software; you can redistribute it and/or* j" |5 n% e' n& M- M+ M6 C4 y
- * modify it under the terms of the GNU General Public License as
1 B% U: |0 I& R - * published by the Free Software Foundation version 2.
# f; v' y! x0 Q - *
1 i% }) y; A: _6 V8 T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 }" w2 ?' H8 ` - * kind, whether express or implied; without even the implied warranty5 _( f4 ]7 {2 N+ G9 n& }; J3 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, w0 j! F; A, e' s7 ?
- * GNU General Public License for more details.
3 f9 ?# i0 v9 T - *// C' K8 w( ^/ |, j0 Z0 y: k
0 S9 E/ d" O% Y# B. ~- |9 g- #include <linux/module.h>3 ?3 I1 P* i( Z+ W
- #include <linux/init.h># f: ^7 [. K1 U
- #include <linux/errno.h>
' i; @3 E" Q" h, H - #include <linux/types.h>9 |' @) P7 w. w- T
- #include <linux/interrupt.h>
' B, ]- x: t& J& x0 ^ - #include <asm/io.h>/ t6 e! |! j! Z& ~' E
- #include <linux/moduleparam.h>
) `6 q) b) x+ ]7 a% p7 T - #include <linux/sysctl.h>5 c3 ^' e+ \' O; o/ L4 s
- #include <linux/mm.h>2 _& Y$ a% _. ~. a& E$ ]& }
- #include <linux/dma-mapping.h>& b6 W5 _- f3 @+ W
& j& X; x I4 }& _- #include <mach/memory.h>
: h9 r9 m1 A% l - #include <mach/hardware.h>, ] T: l. P2 u. u; H4 p
- #include <mach/irqs.h>) W/ U! j ^/ ^; Z, [4 n+ @
- #include <asm/hardware/edma.h>
+ \7 N6 a b) O+ a7 [* p
/ a2 n# _" z7 z, L& G# v3 L+ N- #undef EDMA3_DEBUG- x2 n5 k- T) J$ o% |* n, g8 K
- /*#define EDMA3_DEBUG*/
! a b5 ^, ^; Q& f8 E0 B) q' `
" t4 M5 K. @" W7 N) y- #ifdef EDMA3_DEBUG* R1 ?) F3 e) L9 t3 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): X3 k; q- P% v: B/ v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# D% \# q; W! ?0 t, N& O/ e2 T5 V1 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; X. [$ R7 O$ C - #else
% C5 f9 V6 G, u; i5 i4 [4 J \4 @ - #define DMA_PRINTK( x... )
; G4 K( l- V8 w6 P& o; m2 i5 z - #define DMA_FN_IN
* ?) P! V/ U9 ?, M% a5 x. }' m - #define DMA_FN_OUT" j) R ^( P0 g5 q$ P
- #endif0 b7 i0 q9 L* g& E3 [* A
- 3 i1 M7 t m% k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); f& l. H2 a* Y/ Q; A
- #define STATIC_SHIFT 3/ C* k2 C2 D9 E) {, j! r' g
- #define TCINTEN_SHIFT 20: [: [8 W. C) v, r
- #define ITCINTEN_SHIFT 21) v, T( e( m. V% O
- #define TCCHEN_SHIFT 22/ e* a4 s7 i9 o( O
- #define ITCCHEN_SHIFT 23' e6 L9 t% w# c6 L+ o6 y1 P
- 1 `: G/ y2 p. {, I/ w2 t
- static volatile int irqraised1 = 0;( m- } W( S* J1 I `" A( e+ _9 s' B
- static volatile int irqraised2 = 0;
9 U& @3 d, O7 P' P' ~9 o3 n/ g - / ]0 G$ |& \& {# x/ P5 G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 V+ ~( E7 f; c2 L, q3 T* Z. Z9 E6 f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ X/ J, t) c1 c \+ ]( \3 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 d0 f, [0 t$ ~' i) U5 U( c - - G8 K, v" [ l0 S3 ^; v; k
- dma_addr_t dmaphyssrc1 = 0;0 I" C# s' P6 v1 z
- dma_addr_t dmaphyssrc2 = 0;
% \6 G/ W, h- E/ F - dma_addr_t dmaphysdest1 = 0;
( |3 f; D! Q6 \, O& G - dma_addr_t dmaphysdest2 = 0;
7 K$ y8 ^& m* `; i - ! b( a- v: s$ q3 o7 h! F
- char *dmabufsrc1 = NULL;3 ]- Q$ Y. R' B- A ]2 ^
- char *dmabufsrc2 = NULL;# J/ e! O, ]7 Y$ P% ~: Z$ T6 v2 F1 [
- char *dmabufdest1 = NULL;
0 Q7 e' e p1 k% a. k3 Q! A - char *dmabufdest2 = NULL;
# H2 F+ Y; n5 k# c7 a
, q; C8 c* R. A" V* k0 f- static int acnt = 512;
0 [, F% P: Z0 r) V - static int bcnt = 8;- K- w9 a0 v8 i* g
- static int ccnt = 8;6 Q( U& q% T& c' ~4 t' M4 @6 q
( D" e$ m( d, }! j9 K- module_param(acnt, int, S_IRUGO);
& l4 x% j6 n) w4 w* _4 p4 q. L - module_param(bcnt, int, S_IRUGO);
/ N) @# v( D( n1 U2 [( F* F - module_param(ccnt, int, S_IRUGO);
复制代码
# a; Z8 v Y* Q, S% M' X( U
8 Q* r& q! S' q1 I: r% m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& v0 y1 B8 J ~ y7 e" \3 Z7 A! T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
B+ K/ D9 a) {- Y0 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* N2 e8 X# q6 |; s2 [7 G) a: Z
$ e6 W3 F( b4 X" D& @% {- Y9 n8 u5 x) c4 P ]1 v
|
|