|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' [ ?6 c$ g9 ?3 @/ B. S- [code]EDMA sample test application/ Q, s* T/ W, _, ^- ^! m) S$ O
- /*: T: _1 C p' q# n: i9 f
- * edma_test.c
- ~( u6 n' O' V - *
y, C1 d& k, X - * brief EDMA3 Test Application
- L0 e4 T- I; O8 ]& t - ** t; Q: e- [8 G( ` b& P
- * This file contains EDMA3 Test code.
9 k' D& _* P6 K! e- L - *
. b$ `# g7 S- N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- n2 R( ]8 t) I( Y5 l9 g: ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 j. B, W* P/ X0 Z6 o
- * TO CHANGE.
$ P" U& V, w% C% {5 T* l0 c+ \& ? - */ e) l9 @8 `8 ?4 J$ r) m P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& B/ X3 Z3 t. H/ l/ K' F - *
1 E6 C2 p# X3 W - * This program is free software; you can redistribute it and/or
3 ^/ r# C! r6 V: q! N- ?; ^3 i - * modify it under the terms of the GNU General Public License as
/ d, E, q% {" } - * published by the Free Software Foundation version 2.
: Y: H3 F& s S/ u& ]7 G - *
* Q# H& H7 k9 j/ G/ i* o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* t$ R! a/ y6 L' K
- * kind, whether express or implied; without even the implied warranty: t( W4 w( f" n6 G4 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ A& h) ?; [2 F) P7 { - * GNU General Public License for more details.# ?% w" G0 A* S) |6 Y
- */3 C( O; G( z7 W4 v
- 8 A; K4 T0 H' l; ~% h; [9 D( t: p ]
- #include <linux/module.h>+ @7 z3 Z9 n+ W% k
- #include <linux/init.h>
/ e1 n4 j* s1 l - #include <linux/errno.h>8 y0 h% x( `7 e% h$ ?0 s. t
- #include <linux/types.h>
) @- R( @, C% i! }; b1 v - #include <linux/interrupt.h>
) `, R* G0 ~. A1 P- a - #include <asm/io.h>: E" w3 }* k) q" i& J
- #include <linux/moduleparam.h>
6 _+ d: Y. n" _. S# R( Z9 d) _ - #include <linux/sysctl.h>% a8 a; w5 V/ @9 v2 P: F) L
- #include <linux/mm.h>( W; Q. E' | E( b0 ~. f
- #include <linux/dma-mapping.h>
% V8 d. A/ P. N7 T6 `
0 N* {) M2 f' I, j/ v6 G3 N( l- #include <mach/memory.h>9 b# j0 @3 U4 W+ l/ q
- #include <mach/hardware.h>
1 k+ L% Y2 |) }/ I* n6 o. `7 M0 j - #include <mach/irqs.h>
) e4 E( |( m. q3 \9 o2 U - #include <asm/hardware/edma.h>& k9 D# p9 S- s# h6 I# k
- ( g" d. q3 t9 Y) ]
- #undef EDMA3_DEBUG w% y2 f( x9 j f; \- M5 K6 Y
- /*#define EDMA3_DEBUG*/, Y* S8 T7 {3 {; P+ l
- 4 `- ~# K# ~: i- }
- #ifdef EDMA3_DEBUG9 ~+ Q4 r) m0 a4 i& o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 k2 u" r4 e$ s$ P' \+ g) f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
?( }) h4 f+ G, Y, T7 H# V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( L0 ^. y1 ?8 Q/ J8 v0 N
- #else
1 L: {+ m& ]- t4 f# } - #define DMA_PRINTK( x... )
* Z; l; w) {" v5 h$ h - #define DMA_FN_IN7 b5 m1 |& |8 m6 P0 {
- #define DMA_FN_OUT- ?- V7 k; K( r# e) N5 ]; t
- #endif
% f9 W* N7 ~$ @0 K
. E2 F0 V8 `9 S/ p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! o" @3 E" U+ x' V$ T3 c% r M' j) V
- #define STATIC_SHIFT 3; x9 L% M7 Q$ a* g% B
- #define TCINTEN_SHIFT 206 z/ T* b E% v( X9 D& X
- #define ITCINTEN_SHIFT 21) V, V! Z; g( a( J4 e% D8 E
- #define TCCHEN_SHIFT 22
$ Q5 U1 l7 N# F2 q - #define ITCCHEN_SHIFT 231 U# w+ t' G2 m& W1 U( ~
, Z7 P! b ]. ~- static volatile int irqraised1 = 0;! v0 Z' E( e' q, y' c. M
- static volatile int irqraised2 = 0;' o7 r2 c( [- ~8 Y7 x) y* ~3 z4 n
0 S- d" c ^& U# `7 C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! T, i2 A* ]: `; [8 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! t6 R5 c/ z; @3 [; {$ V% r0 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: @2 B: X2 I3 D - ) V5 g1 R6 P3 t* Z3 w( s# M
- dma_addr_t dmaphyssrc1 = 0;4 F3 v8 ~. B! z0 A* U
- dma_addr_t dmaphyssrc2 = 0;
4 _. _% x& b4 S c# d - dma_addr_t dmaphysdest1 = 0;
- U$ a7 m$ s% N* A# n0 @% ~" m) @ - dma_addr_t dmaphysdest2 = 0;# R: }+ \2 {" [/ \& ]9 P3 F u0 G
/ g4 _/ w2 ?) A% d% D9 K( J% P- char *dmabufsrc1 = NULL;
+ E6 v3 g# W$ L A# q - char *dmabufsrc2 = NULL;
$ @ O; H, T w$ J6 z6 V, W - char *dmabufdest1 = NULL;
# L8 \0 h' g- O& a - char *dmabufdest2 = NULL;
4 c/ j& X; v0 O. _% `9 |
0 }2 i/ L: m+ w' J/ F- static int acnt = 512;
, H7 c& s" i; i1 {( S - static int bcnt = 8;
( K+ E( c9 @& w - static int ccnt = 8;1 m5 s, ?/ L% g, m
- % F2 h/ p4 v! ]1 o8 s3 z$ t
- module_param(acnt, int, S_IRUGO);
) O6 w: d- ~+ W3 y - module_param(bcnt, int, S_IRUGO);" S `( J, L, t& L+ @
- module_param(ccnt, int, S_IRUGO);
复制代码 + ~3 C9 D/ T- C$ N
! I6 X; I: E" j$ \. X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 O$ V6 ^$ C" B6 @% d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) m3 P4 S8 \* }$ q6 D8 I/ p: b( h% H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# c$ F! E( |% K) w( z
- r& L8 l1 |$ S8 u+ F) Q3 O
8 P6 I+ B6 A0 @0 p% |, ] |
|