|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , U& x) }1 \- L1 F7 s$ _9 g4 @4 c: [5 Q
- [code]EDMA sample test application
& X4 n* y( J+ s5 @ - /*
- l0 c5 Y$ X3 b4 }. z ]% Q - * edma_test.c% D% ]4 h4 X+ g- _: W3 S1 B; i
- *
m2 }% i" s. @! ]0 [ - * brief EDMA3 Test Application7 i5 s9 i+ h0 | {' B" Q$ }+ x/ w5 ~
- *- k3 a# N6 u9 k( j& j2 X( N
- * This file contains EDMA3 Test code.0 U! \- s& f1 P0 s1 e% R9 P' a! i% W
- *
4 U+ m0 B. V1 u6 B& _: t, A6 w. V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( r/ E2 z# _( q/ _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" L8 _& {% s1 G
- * TO CHANGE.+ I- K% s: x/ j2 k* B1 H
- *
7 {) c; B* ^% W# u) p* c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ i3 U# C" w R
- *
# s8 l. F- j. _9 r* X3 @$ z" Q8 x - * This program is free software; you can redistribute it and/or
# x8 F$ A% }4 \" `& Z - * modify it under the terms of the GNU General Public License as0 O; U4 Y2 k4 ^& z* Z, q* H
- * published by the Free Software Foundation version 2.
0 e! k8 S! `! I D% B% B - *: O- v% ^4 {; _8 b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 O( A8 I. [; T; z4 w( W
- * kind, whether express or implied; without even the implied warranty
0 M q/ C# h( q4 E* }8 o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! I/ Z) b0 U! Q, r: x" M - * GNU General Public License for more details.$ W, l1 ~2 F) v4 I7 D
- */4 |6 H7 V% v# k1 l
P0 R" _- c h% M, z8 S- #include <linux/module.h>
7 I7 p% r7 X/ o+ S1 }# S+ ] - #include <linux/init.h>
9 ?1 X0 I$ m. a+ C; ^! { - #include <linux/errno.h>9 y1 R$ z! K1 F' ?; V8 ^& v
- #include <linux/types.h>
% F# K) V# ~6 v7 V2 _! T: b2 ~* e - #include <linux/interrupt.h>
/ u* l2 c. U( w/ y+ G3 f - #include <asm/io.h>
, b( @5 U8 c5 @; e9 j# g' H - #include <linux/moduleparam.h> a& o. x5 I( z ^
- #include <linux/sysctl.h>4 Z* k; R: S; b+ J
- #include <linux/mm.h>
- @/ R8 M# f5 H& p# W - #include <linux/dma-mapping.h>
; F* e) c9 E. X/ u4 R& s/ Q; i
9 Z* G8 o1 |& E$ e: c- #include <mach/memory.h>
' F) z. M2 j% u! q - #include <mach/hardware.h>, z5 L" C3 H, R0 Z) u9 c
- #include <mach/irqs.h>
8 O& C. `/ d, F- R! j - #include <asm/hardware/edma.h>/ a1 R" w3 C4 }/ h# D. l* }
/ o" N" k; }3 _, Q( q, r i- #undef EDMA3_DEBUG
* s8 {# l/ C6 y3 A9 f; h - /*#define EDMA3_DEBUG*/- `9 J7 u' V! ^) h7 ?6 X. E- b1 m9 _' w
; ^' E8 t. u6 {8 A+ [- #ifdef EDMA3_DEBUG* D9 X" y7 e$ q% n) y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: O/ X1 `2 j+ M3 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): v. M) R6 F E! C# C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ], j2 s5 ?" Q4 M. A" v
- #else* b8 W! ~8 e$ E8 c: h. I9 N
- #define DMA_PRINTK( x... )) H" a* k3 c4 A w7 U
- #define DMA_FN_IN) v' Y) x1 t% I* k: N y
- #define DMA_FN_OUT1 Q6 \- R( a6 Q7 m' t) d4 E0 m
- #endif, f( y9 z9 Z$ ]) n
) ]8 E6 h4 M6 \0 I( _* l* |+ O1 h& X9 F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* l- w- m# q+ @9 J: V - #define STATIC_SHIFT 3
- T. h& j/ r0 M' P - #define TCINTEN_SHIFT 20
" x- j, G! @, P8 A3 Y - #define ITCINTEN_SHIFT 21% E/ e) v' f i7 h0 M" Y
- #define TCCHEN_SHIFT 22
& q0 @4 O1 ?8 C. K6 A - #define ITCCHEN_SHIFT 23; f4 ]) e. f& L4 `5 k' K
- * g; e/ l* ~5 r
- static volatile int irqraised1 = 0;
1 W6 G1 L) D5 `. f3 E6 F" d$ y - static volatile int irqraised2 = 0;
$ e" e3 Y+ a; X! }9 { - 0 n& m) x) Z& b) }4 S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, r% q/ ]$ p1 E( j9 z0 R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c# c8 _* |& @2 g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* N% h: n+ i; ^$ ~: w: [
+ H3 ~% k3 l" [- y- dma_addr_t dmaphyssrc1 = 0;
5 n9 o0 U( k" O* T' [# N, _ A - dma_addr_t dmaphyssrc2 = 0;
' g9 f* n& C* f9 x C% G - dma_addr_t dmaphysdest1 = 0;
5 F7 M) Q9 ~ k - dma_addr_t dmaphysdest2 = 0;4 k, g. _& J# ? y
! h0 {4 d7 K$ Q- E- b4 N- char *dmabufsrc1 = NULL;( Z! ?( Y5 M1 K/ I1 k* |0 N
- char *dmabufsrc2 = NULL;: ^1 u1 d, h# U' P. Z3 h7 [
- char *dmabufdest1 = NULL;
8 Q: O0 g2 x- ?9 r" {4 G - char *dmabufdest2 = NULL;$ I/ S9 `" U' g
8 o/ D- ^ a% n( {6 l* I# u7 Z- static int acnt = 512;
1 X' |6 s" X* u5 F. X, B' \ - static int bcnt = 8;7 p2 [9 K( ]+ \! [7 }9 t
- static int ccnt = 8;- y/ C3 ]6 l7 [3 T9 K+ s' x9 w2 W7 l' s
2 E+ D$ U- ]/ l4 I- module_param(acnt, int, S_IRUGO);
! N! V7 f& h9 y- d# p - module_param(bcnt, int, S_IRUGO);
) m) p( H; K0 H7 S& j0 f2 i - module_param(ccnt, int, S_IRUGO);
复制代码 9 t( H0 t6 X E+ n
9 d/ t) ?- c3 D0 U0 `6 `7 } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 j _: r0 H1 C j+ p. G' @+ u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, x5 @5 k- J. v/ W% a( B" E+ q. K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ [" A8 V: X! k* Z2 Q! Q
* m. r1 g# z8 n6 g* j! ]/ f* n) ]( T% n3 |
|
|