|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( a$ @" r( d1 R& ]" X7 v- [code]EDMA sample test application
& k6 [. D7 |: {" K# t - /*
3 M9 ]+ x! {1 `' |+ I5 s5 ? - * edma_test.c. P3 N1 g' v9 P3 ~& _1 m
- *
& y: T0 a" F- @0 q8 { - * brief EDMA3 Test Application" J& w y3 @) h% K" g' b
- */ r$ Y8 w8 [! d* `$ A. N4 W4 ]
- * This file contains EDMA3 Test code.. u! \' Y- c& g9 o
- *# ?7 [0 A: {- k2 x7 N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 d0 y4 q# f! w3 t" y" A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# p* x% Z( J6 ]1 `5 O7 g
- * TO CHANGE.
7 J+ H* H. d) s- t2 ^ - *
2 |0 ^# l4 s v. ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: j6 {4 k: _. b7 Q9 q& x
- *
8 {4 n% H7 L4 d1 ~. ~; H& T' j - * This program is free software; you can redistribute it and/or" {3 H) H- n* r
- * modify it under the terms of the GNU General Public License as2 ~: H3 y: u4 B2 z' Y- s. f" o% c
- * published by the Free Software Foundation version 2.9 g2 t- N6 @* ^4 k( G3 P
- *
& a F7 [& ]& o* C# |) G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 d+ Q5 ^ H" r s4 g# ? - * kind, whether express or implied; without even the implied warranty8 B/ }5 R/ u. a) C% ?. n$ ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ L) @1 J; _; D. G" A2 p: }
- * GNU General Public License for more details.. N- p4 k4 t: e9 e4 N
- */" V4 ~1 ?' ]( h! b$ b! v8 v
3 {6 P% E$ t( Y, V l- B- #include <linux/module.h>
) t$ A3 q. o' I+ E! m0 G* W - #include <linux/init.h>4 e1 f2 T6 }9 `( p8 m! h( ]
- #include <linux/errno.h>
" y- k4 S% T& m1 g$ g& e( I - #include <linux/types.h>, v% w2 |2 S$ W% H \% c
- #include <linux/interrupt.h>
} t. [& {- j2 W! b3 J x - #include <asm/io.h>$ T9 t! G2 V! P
- #include <linux/moduleparam.h>5 E3 P7 P. Q: W! `/ V' s
- #include <linux/sysctl.h>
' V- H1 c9 {! r7 ^! v2 }- J - #include <linux/mm.h>9 d; M6 G9 k0 _
- #include <linux/dma-mapping.h>3 }0 Q% X, {. K, H/ m9 m( {
2 ~" Y/ s) w3 [1 {: g2 Z. i& f- #include <mach/memory.h>% N) U& J( \0 v: Y
- #include <mach/hardware.h>
: Q9 g( G5 ~* l - #include <mach/irqs.h>' B: u1 t9 y* W# w" j( k8 W7 V! R2 _
- #include <asm/hardware/edma.h>9 Y t6 p' v6 U- l2 A+ e
- 8 Q' y4 u/ k+ [( x1 I
- #undef EDMA3_DEBUG
D! J6 J8 E) V - /*#define EDMA3_DEBUG*/
3 H( ]$ g+ J3 c% I* h6 O3 R
) {$ S4 P0 f5 `" h# Q2 U ]- #ifdef EDMA3_DEBUG1 a- H2 A5 }6 c- t. U ~5 x9 h8 |+ ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" X+ P( M8 U( Y! c5 }8 k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 \( Z2 `) L0 L9 T! q# F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). M" a, l- Q' \7 z0 z& X% n
- #else& Z, S. ?, G4 G" }$ F: M+ H
- #define DMA_PRINTK( x... )
8 B7 p$ d& M' Q, e* B# h1 B' @7 U - #define DMA_FN_IN
, {* I" b4 X& `, e - #define DMA_FN_OUT; k y+ k) ?0 M- F& @% p5 F0 F
- #endif0 f2 `' t3 ]* t2 D9 s7 r* ~
- ! u% `$ p9 p$ b2 i% k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( w: s# h O9 p' A& G! h$ w
- #define STATIC_SHIFT 3
4 b# G4 ]3 M6 {- l e( z8 l - #define TCINTEN_SHIFT 200 f9 C8 } @ B0 I" j4 t* S
- #define ITCINTEN_SHIFT 21
+ A$ c* R7 J% [6 B0 x - #define TCCHEN_SHIFT 22 R$ `) l- x9 } u& ]
- #define ITCCHEN_SHIFT 23
1 G3 k. V6 `/ U2 R5 [ - ; P2 c3 U2 [, Z$ G6 N6 p+ u3 ~3 b
- static volatile int irqraised1 = 0;
4 o R; }7 I: h* a, l+ F - static volatile int irqraised2 = 0;
2 w9 B) O( s; F6 W; M
4 B' h" R# [. z+ Y) y/ ^# G" i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 E2 |4 [0 _4 K8 g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 l$ ?* c" P) _$ |2 s- S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M3 x% q8 H# \' i
- 3 j5 |6 e5 q) `- ~! m- d! Q" F
- dma_addr_t dmaphyssrc1 = 0;
1 `6 S2 x. j" `. `4 L2 ?* Y3 }, Z4 x - dma_addr_t dmaphyssrc2 = 0;
& p. W% A5 o- T a1 N- i - dma_addr_t dmaphysdest1 = 0;
2 F" ^' `0 [$ e( k8 H9 q - dma_addr_t dmaphysdest2 = 0;( w. M. ?0 Z0 Z, H0 q2 h
- , J: o7 p( u- D9 z
- char *dmabufsrc1 = NULL;
# O3 J. t7 U5 Y) I3 H - char *dmabufsrc2 = NULL;, n2 J# x& N! j
- char *dmabufdest1 = NULL;; H# j0 T0 Q) \/ p; Y
- char *dmabufdest2 = NULL;
4 P: ~: j/ S- k% e7 @1 X - 8 E# z$ y0 |2 p: X ~0 H
- static int acnt = 512;5 e: `3 E+ i( t9 w$ s
- static int bcnt = 8;' z2 n3 C7 c& c( e! R
- static int ccnt = 8;" ?- G& e$ S$ P, A) G5 x+ t
% J! K, {1 O+ A* S& S- module_param(acnt, int, S_IRUGO);5 r; x a9 g+ v1 N: B$ {4 b0 ?
- module_param(bcnt, int, S_IRUGO);
( @( e7 p% ^( B0 B - module_param(ccnt, int, S_IRUGO);
复制代码 6 c. S, [' H9 }7 P4 {
5 U- k$ n+ {5 h/ ]: o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 n# S- E) {' w- l7 W$ Q r6 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; x7 f" D5 D7 N u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 U$ h1 i( _' e- G
& r. w& ~4 h8 a, e3 X/ k: B
/ Q5 t: E. U- V1 u+ R+ n |
|