|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
[4 b- y e( ~* D# Q- [code]EDMA sample test application
& A r( o! @2 @) y' G5 @; P. J - /*
% ?* W; t5 U$ ^' a5 `; c- k) G - * edma_test.c6 o! k/ O" ~! c, K" _( Y7 W
- *+ p' b" Q" i, O0 n! O
- * brief EDMA3 Test Application
8 N+ j% R3 ?' y* y3 ^; E+ a4 w - *: W6 u! ~$ U3 w3 \" P
- * This file contains EDMA3 Test code.( W1 L+ d4 Y! ^0 X5 x( S7 Y
- *
6 ?0 X* n- J" d! C) c( e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# |9 m$ P# I; D% G$ g7 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* k1 d( f, H8 O( k6 ^ - * TO CHANGE.
# \& Q# a5 y3 N2 J4 r5 w8 u" } - *9 O- j8 l( O. u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ]5 X$ a9 ^1 H+ r X9 V. q9 w
- *
+ T0 _, W/ \- C* P+ @% g# f - * This program is free software; you can redistribute it and/or
% }' W6 C4 C- m( O: j X8 v - * modify it under the terms of the GNU General Public License as
4 r0 N# L3 F/ W* r - * published by the Free Software Foundation version 2.
9 C. P6 V; N- y* G - *
9 i8 @# u. u9 g& n0 ~: c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" A% ?- e: E* W* ?+ f - * kind, whether express or implied; without even the implied warranty
9 _7 D+ A# q# }, d* ?0 ]. h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. `. _- f' a; \/ ^; _' |3 b) y/ x
- * GNU General Public License for more details.& ^1 `# W H; c4 h
- */1 B. e; D( j; W& c; i5 ?0 U
- |7 P$ @2 d9 U0 g( y8 Z$ ]4 v- #include <linux/module.h># F( g2 S8 T' r1 @5 L9 ~: W9 V7 Z& L
- #include <linux/init.h>
5 G4 }& k. ^" Y1 U V5 m - #include <linux/errno.h>1 `/ F5 c _1 c0 B; C9 J9 z: S3 R, f
- #include <linux/types.h>
0 X5 d* M9 f" v) d+ \1 ^+ g/ Z6 I - #include <linux/interrupt.h>2 J3 f3 o1 k) \1 c/ a% u$ x4 ^3 R
- #include <asm/io.h>) ^3 n" B) F8 @; K& C
- #include <linux/moduleparam.h>7 g' V/ a/ t K p' k
- #include <linux/sysctl.h>
; K* F& ?) V. d3 i; X& ` - #include <linux/mm.h>7 z4 I0 J& I B) B* h' p* M7 A
- #include <linux/dma-mapping.h>
7 n3 Z7 ]8 d4 d, ?' [, Y* z; g; R7 G - 6 h+ M, \( N/ d; V5 G
- #include <mach/memory.h> A6 |. X4 P7 @1 z9 K
- #include <mach/hardware.h>; Y L! ~4 p$ u8 K8 ?& }- B% l
- #include <mach/irqs.h>
) M9 f0 v* Z" l2 D1 c( P5 p - #include <asm/hardware/edma.h>
6 R0 a" o( F7 G) Y - , h3 O: \/ ~- D$ `6 H) n0 I! v' I4 v
- #undef EDMA3_DEBUG
- K1 g; R2 u! q* | - /*#define EDMA3_DEBUG*/3 p6 Q2 w8 B; J; E4 W9 Z% `* z
2 F6 J. a0 [# }3 c: h8 y3 V" |- #ifdef EDMA3_DEBUG
1 o$ }; N4 C7 S1 w0 \) [/ _4 c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( H# _# Q2 n, N0 J- ~3 O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 N1 R$ L6 g: S) f& l! ~ y/ I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 @& d0 M2 F* s' x, G
- #else
9 c2 d# _) \* u2 ~) d4 y! m8 { - #define DMA_PRINTK( x... )! }2 |) C4 F& J' d& G
- #define DMA_FN_IN
5 d0 Y: i! h0 `7 P. U( e# H, @ - #define DMA_FN_OUT
* y/ L2 z! {4 n2 E. q& G# g - #endif! e# L, `+ f" F" j
- 0 |. w# p( J+ e# J U9 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! P1 R$ X7 B% D - #define STATIC_SHIFT 3
& ]0 ?) Z9 h" p" B" t. g e - #define TCINTEN_SHIFT 20( @( O; T9 O5 F o7 v6 k
- #define ITCINTEN_SHIFT 21/ H5 f0 L2 F, n& `" W+ U5 F5 M
- #define TCCHEN_SHIFT 22
8 n2 q1 k j9 @0 L5 W - #define ITCCHEN_SHIFT 23
c; ?; T4 k* m. d* s& i- V( h - 0 z$ r. k2 @' E3 q; q8 _
- static volatile int irqraised1 = 0; W1 y' w2 S$ g7 `- z7 o$ _
- static volatile int irqraised2 = 0;
# E8 u- z3 k6 W1 O9 p
* J. @7 c' X( W( C. n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 q3 p w& f3 z' Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 z R' ?, X( t r, z8 N/ ` C; W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Z& h, r. K8 n( x5 |3 F
) R! Q0 O( A1 r, J9 v( y8 V- dma_addr_t dmaphyssrc1 = 0;
7 \: ]/ p6 B* o8 S/ t - dma_addr_t dmaphyssrc2 = 0;
$ c2 i: z" ~) C( L7 y - dma_addr_t dmaphysdest1 = 0;
/ Q7 a: d: j5 D1 g5 X5 l- F: Z - dma_addr_t dmaphysdest2 = 0;% g% O9 U' f1 Y2 K$ G) t5 W
+ A9 r7 Q9 i$ p) O; y) Q- char *dmabufsrc1 = NULL;) R. N' f! c/ S4 I9 n
- char *dmabufsrc2 = NULL;" h- {, Q: V1 p+ r' S
- char *dmabufdest1 = NULL;$ S7 j/ T2 N# k) U9 p
- char *dmabufdest2 = NULL;" m5 _3 Z! r$ _
6 X6 l% V, w; B7 R; c- static int acnt = 512;- U. K1 G- M4 g4 Y
- static int bcnt = 8;& `/ u1 g& W( @* ]0 }
- static int ccnt = 8;
! k1 A$ ?' f/ m' f- N! r; R+ O( _; [ - & V' w$ N8 S Z h
- module_param(acnt, int, S_IRUGO);
0 a1 A$ `- ?) h& X1 Y - module_param(bcnt, int, S_IRUGO);
+ L4 b, C' ~5 u, ]* c: C4 T - module_param(ccnt, int, S_IRUGO);
复制代码
q+ C7 F: \$ m! P" u0 A
7 R& G" R9 y$ N" h% z |# _4 m9 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 X8 k5 S. }% J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ E1 R( B; r) [" `% `/ h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: `3 f5 K* ?5 s* v; a; q
9 Q( Y2 w; I9 `3 a0 ]
: T7 }" z+ o/ B; G% Z |
|