|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" j# H9 Z. g" [+ q- [code]EDMA sample test application
( ^4 H0 g4 B7 V- o - /*' h& l$ W6 [7 k& G! i4 a6 I: A
- * edma_test.c
9 M# o# X6 N l - *
' _2 V$ \/ Y6 ^& { - * brief EDMA3 Test Application
, j9 ~4 g/ t1 S: c - *
$ N5 u. w: [: D - * This file contains EDMA3 Test code.
v, Y' z$ ?3 t8 y' e- | - *
0 l3 o% s' t$ L/ g' T6 ]$ x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 w9 T) ]5 p6 Z, q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 {" p8 M9 l i. @8 Y$ a - * TO CHANGE.
( ]4 m+ A+ y' | - ** c' n; }! s$ M2 w9 \. K+ T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 a& X7 L l c) |- m8 J7 e
- *+ r- V, V* T. @/ e9 y
- * This program is free software; you can redistribute it and/or
+ O6 |" }* I) r - * modify it under the terms of the GNU General Public License as4 }7 u# y% h5 b/ z
- * published by the Free Software Foundation version 2.3 x( r7 |1 i# I6 X: h, b
- *. w5 U( a" X" C, `" v/ H) E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% H4 M) D r9 }, G8 m3 r2 z; S - * kind, whether express or implied; without even the implied warranty, I1 d) i6 [: x/ d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 z* ^( _7 U# c5 \2 `2 T3 u- ?0 _ - * GNU General Public License for more details.9 W( T0 e1 A. }8 J
- */
/ m8 H) g) J/ C r1 @* t' z' U - 3 K. B& |' w, k( { a [
- #include <linux/module.h>- ^2 h' ]; z( I4 M8 M8 g
- #include <linux/init.h>4 c: ?1 Y. ^( P' k8 M+ p
- #include <linux/errno.h>0 F9 {1 \2 C2 `9 T% U: O+ `7 o
- #include <linux/types.h>
) E: E2 G" B- O - #include <linux/interrupt.h>) |" c% `) b& ^9 L
- #include <asm/io.h>* z' x7 L9 M) y. i/ L
- #include <linux/moduleparam.h>
5 ~) D5 |# _: q; X+ d# |# r: t - #include <linux/sysctl.h>. h9 m' f8 u; U' W) M1 i; ]
- #include <linux/mm.h>
2 R2 k8 l6 g7 u3 L2 A - #include <linux/dma-mapping.h>
: k+ z5 D' W) e5 x - + d9 C9 ]3 y1 x
- #include <mach/memory.h>0 c" d" M2 g+ W
- #include <mach/hardware.h>
2 ^( p, y4 P* I; z. r7 u - #include <mach/irqs.h>
6 k( c2 D- g; F+ x2 J4 `( m - #include <asm/hardware/edma.h>* ?9 p" |9 c' ]2 D& Y
- " w* }" W3 j9 e+ L( ~2 }: Q% \% Y" p
- #undef EDMA3_DEBUG5 V! c2 Z0 ^6 ~- S; @8 V7 L
- /*#define EDMA3_DEBUG*/* f1 _6 ]1 c. r( n$ |, Q
- % O2 M% Q# p) `
- #ifdef EDMA3_DEBUG; d0 W7 S' ^$ _) ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 h# w" n, L4 b0 J3 I0 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) n2 M! J7 J6 ?5 d6 Q; q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ k6 t, w4 m6 b$ m' x
- #else
0 z1 T4 y7 y' s) Y* u7 \% _ - #define DMA_PRINTK( x... )
( P3 O9 E4 n; l4 @ - #define DMA_FN_IN# n( K( x* U) |! N
- #define DMA_FN_OUT+ |( s2 H' f5 K2 H9 ?% l
- #endif2 F5 r( w7 y! x3 V$ I2 y
( p% R8 {5 P( ?; ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 l# }7 R5 I3 i' {9 t* J - #define STATIC_SHIFT 3, S6 k" H, {$ @, i0 [3 X0 A* G
- #define TCINTEN_SHIFT 203 E5 i4 _7 e3 P- s4 [) }0 P+ w
- #define ITCINTEN_SHIFT 21 ^1 @, l& P& K3 ]4 j
- #define TCCHEN_SHIFT 22. q9 r# @; I; b6 l: W$ r6 `
- #define ITCCHEN_SHIFT 23- d7 t0 c: `9 w" `# f
- ! P4 c; o6 |# n X
- static volatile int irqraised1 = 0;
/ G, k1 F1 v2 @0 V' q9 j - static volatile int irqraised2 = 0;4 v0 D2 Q8 U- c
- + l7 J9 ]3 u: ?& S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, `! H$ \1 A2 X9 ^- j& [1 L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# m% R" w' E* t2 @/ L. g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; j Z) [3 R/ c" H- ~
- ! I- z) d: e1 k( j4 r) C
- dma_addr_t dmaphyssrc1 = 0;
/ Q6 ?- g9 H; Q3 I - dma_addr_t dmaphyssrc2 = 0;
4 g3 p$ t P, B0 w - dma_addr_t dmaphysdest1 = 0;
6 k% ]( G2 T1 i$ k" v - dma_addr_t dmaphysdest2 = 0;7 a! @1 n" b" y4 y3 k6 w0 L e0 h+ d: n
& [+ ]. ^% H! I2 H) I0 v" T- char *dmabufsrc1 = NULL;& h3 w' ^7 ]* W0 j8 r
- char *dmabufsrc2 = NULL;$ M) _& i/ p p' t
- char *dmabufdest1 = NULL;
U; x. Y- i& z3 V9 @4 m' T - char *dmabufdest2 = NULL;
' ~/ k( e C# Z
2 B2 w5 J3 C+ G! j5 O$ D4 G- static int acnt = 512;
- Q4 y& O4 X6 V! F& n J. t! U5 \ - static int bcnt = 8;; {; f6 T. h$ E
- static int ccnt = 8;
) ~- C# x: M4 n. U# H: S
* Y5 W# d0 _) O! U- ~: _& x4 C. Z- module_param(acnt, int, S_IRUGO);) y. j! E1 M7 i' F5 A7 q
- module_param(bcnt, int, S_IRUGO);: R( }- S3 G9 Z5 b* _6 V, S4 p
- module_param(ccnt, int, S_IRUGO);
复制代码
1 K% A: c( x( C. C! g4 P y0 C: b2 J
* |8 f1 p+ Q! Z" Q- M* L) e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ [. v5 O) l, [! S9 P2 R) W) O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! h$ W. V* t3 W P$ n2 d ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 R: t1 q, |( Y3 r4 N
1 R* |3 t$ W7 A( M6 `' `# W% b% d9 [. h, b8 W6 R
|
|