|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ j! o+ v5 N- S( X# r4 Q
- [code]EDMA sample test application# q" R3 M6 _6 G/ q+ |' R4 E
- /*
4 q+ ]) z$ H2 X/ j7 ^ - * edma_test.c
% L* h7 T4 n% C* D - *& H$ {& X- l* V0 n4 N* o1 g
- * brief EDMA3 Test Application+ B4 f+ X9 ]: v( o8 `
- *% G+ o V/ v: K8 f/ Y: B) G
- * This file contains EDMA3 Test code.+ h4 I6 p9 P: o' R$ z$ a% x( C! l
- *0 X$ A+ M4 Z& }( z. j9 ^5 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ J) T" I& U' k! D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 Q6 r0 d% P9 @8 ~- ] - * TO CHANGE.; h1 w7 R) T% D! F- c
- *" H: U( R1 V9 L( I& `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 Z8 z M% X4 x - *3 ~3 o' j) _; g; R) \
- * This program is free software; you can redistribute it and/or
0 v! |/ O. \ N! i/ k - * modify it under the terms of the GNU General Public License as
" e* i- i M$ k0 h' j - * published by the Free Software Foundation version 2.! H+ ~' u6 I& R4 J8 ?& P9 c
- *
& C/ V, s2 Y0 z( d& ]9 y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 w( o' X8 w8 B+ q. Y7 K - * kind, whether express or implied; without even the implied warranty
, d0 o7 m* [1 S7 r% k6 Y' ^3 d, x. |) q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 a' j/ i( D4 Q+ j/ B - * GNU General Public License for more details.
4 r% ~8 h3 W' S I: A - */
" s" J# t6 Y' }3 R
" q# f1 K R- }- #include <linux/module.h>
6 S4 L4 G! e1 l( P2 O/ ~3 y - #include <linux/init.h>
# y. b8 U% l* n1 S - #include <linux/errno.h>- d- n' ]# H: H) \) Z2 D$ @( r" a6 N
- #include <linux/types.h>
0 n4 r8 M. L N* f, s8 g - #include <linux/interrupt.h>9 q, X; H* r8 a8 K) a5 g( o
- #include <asm/io.h>( w" l- x ?' U: z4 S8 ~
- #include <linux/moduleparam.h> O( v) O0 V" k% I
- #include <linux/sysctl.h>+ h" H( [. ~3 [ ^/ j( y y! j5 G
- #include <linux/mm.h>
) O& r" O9 p0 K5 J+ t+ D: h5 J - #include <linux/dma-mapping.h>
' q( v5 F% N0 m3 K
1 D- _; \. b, W: @8 a3 K, i4 A n- #include <mach/memory.h>
& |; y) L z% T- K6 [5 X4 T - #include <mach/hardware.h>
- J* L# L c* m+ Q" v - #include <mach/irqs.h>% ^7 i2 j6 ]( {
- #include <asm/hardware/edma.h>) }8 {5 Y4 Q! T2 q1 q" x! Y* W5 J
. g8 Q& @* i6 T* d5 i( K- #undef EDMA3_DEBUG
$ v& M0 F$ M* l* X! ] - /*#define EDMA3_DEBUG*/
/ E8 w% g+ Y; @* A0 c
3 G$ @) S4 {, P9 H8 U3 I; E) L- #ifdef EDMA3_DEBUG0 w* g+ o: \8 p$ r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): x) E9 l% O L. y i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# q9 q9 N; D' A/ w( b$ U8 H: V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' P+ i* [; \- M - #else
O- V, @8 t& a" |& K1 t6 N \0 p P) m - #define DMA_PRINTK( x... ); X: I7 a8 d( B/ d
- #define DMA_FN_IN ]$ u! k* U% Z" n* o
- #define DMA_FN_OUT
/ T. ]2 Q. \. k! F, E( z - #endif
9 j7 Q6 h. g) l o$ ` H+ M4 d - ; \, ^7 Y% Y- V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# _4 s) l/ K! Y1 R3 C: C% U - #define STATIC_SHIFT 3
; e" Y: ^& C0 ^ - #define TCINTEN_SHIFT 20
. Q$ q& e) V7 Z" m. B - #define ITCINTEN_SHIFT 21
4 b) J. ` k: B) ~' e: C - #define TCCHEN_SHIFT 22$ j4 ]) D" f2 V8 C5 m2 s
- #define ITCCHEN_SHIFT 23
; k9 c6 z0 Q- F1 Y5 p% ?6 i
6 {. h* H' Z6 n/ A- static volatile int irqraised1 = 0;
% w( R$ O' @, }% t - static volatile int irqraised2 = 0;
6 ^& d3 G* Z3 j8 t9 N! I2 c
% h4 g; ?4 ^! z& U$ p2 K( z2 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ j* A9 y4 Z. J: }3 E4 O% o9 k* { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# O$ u3 r$ G. E! B+ |' r- ~' S1 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 M2 d$ d) c1 s* E
) }6 H( j9 d- Y, v P% ?8 X- dma_addr_t dmaphyssrc1 = 0;
+ U! J# C+ }# O4 A - dma_addr_t dmaphyssrc2 = 0;
- w. @: [) S) U/ z/ B - dma_addr_t dmaphysdest1 = 0;
- r( W' A' ?, k! T) P; \( P - dma_addr_t dmaphysdest2 = 0;: Q% ]* k! }! l# r
- 9 w; B' o C) w% a! ]7 g
- char *dmabufsrc1 = NULL;
& x* v: N# a* U. a; ^' B - char *dmabufsrc2 = NULL;* u7 ?+ D% L) u: r1 v% ]$ d
- char *dmabufdest1 = NULL;3 r5 h/ Q4 t% j
- char *dmabufdest2 = NULL;
, a( W5 F! W ~0 I* |/ c - 7 K& j) @. F3 u: H' S, \6 ^
- static int acnt = 512;9 t4 P8 `% E2 n7 p0 n V" i1 }4 _ n
- static int bcnt = 8;
: r7 \: W% H3 }* ]( T; M - static int ccnt = 8;* \0 M; K& z7 ^
p3 z l3 F9 ?- module_param(acnt, int, S_IRUGO);" F+ W. Q" Q, f2 y; a+ O
- module_param(bcnt, int, S_IRUGO);
/ @" A! H2 F- {2 C - module_param(ccnt, int, S_IRUGO);
复制代码 * l& H. V' ]- \2 n2 G
+ `; s R7 W: k1 i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 T: G4 {7 P G2 u6 p6 qarm-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 K" q( m6 A0 y! m6 m* Q7 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 F( T1 X9 G7 S4 m9 D V j/ T, J* k4 m# U1 N0 _0 z. ]6 T
4 u. U' o0 B! L: V |
|