|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) g: X- i. T7 b$ X- [code]EDMA sample test application
" C) {4 @0 r3 W - /*
) j9 g/ F9 U! m0 V( f; Z - * edma_test.c1 i6 `4 `7 ~' T
- * n8 T$ ?9 e* y% x X
- * brief EDMA3 Test Application# [ i8 |2 c) r) H9 Y
- *
* p" u1 B0 D$ Y- j$ P - * This file contains EDMA3 Test code.
; L1 I& j$ J. b( d: i* u2 ~ - ** [3 q: ~5 N) s1 o6 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ R: D( }0 G0 b; W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Y, a$ V ?# c
- * TO CHANGE.: H' B5 \) z% w2 T; U* T
- *
, l& ]+ U3 w' P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 m Z* ~* w8 o
- *
8 C' m6 i! R& P, W - * This program is free software; you can redistribute it and/or( x, z7 J6 k& o
- * modify it under the terms of the GNU General Public License as
0 E$ r; @6 p+ E* n1 x: j - * published by the Free Software Foundation version 2.
5 u+ ?9 ?" l+ x; z8 P - *
6 b9 A U; F' b( e6 h8 v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) z" S) M5 Y% j7 R# j. X
- * kind, whether express or implied; without even the implied warranty
3 T- ^3 s7 i5 Q( R: F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. C( ~, J! G1 d3 w8 y1 N - * GNU General Public License for more details.- w4 I6 X0 H0 B* J" ?5 r; |5 H& e
- */) i6 Z8 Z7 [) i0 `% A* n' q
, @# ?4 c) X# V- j* l2 | C- #include <linux/module.h>7 z+ G) E$ U" ^$ ?6 d
- #include <linux/init.h>/ }3 X# R( X) K
- #include <linux/errno.h>
5 N+ A) J+ `% ^2 ] - #include <linux/types.h>. X: m# {7 k9 N
- #include <linux/interrupt.h>/ F6 c0 `5 Q, ^ ^
- #include <asm/io.h>
1 p* L0 z+ J$ C8 X - #include <linux/moduleparam.h>
( L" J, j s* { n2 L' ^5 @ - #include <linux/sysctl.h>6 x) w6 R" E# ]* j$ h7 L
- #include <linux/mm.h>
^; x4 {2 l6 v* x/ c - #include <linux/dma-mapping.h>, t" b; r8 P5 _7 U
0 e5 g/ e# p6 E2 X- #include <mach/memory.h>+ ^; q& \& _0 J1 ^( Z
- #include <mach/hardware.h>1 ]' e! g3 f! b
- #include <mach/irqs.h>
- K/ f# e9 D. e$ Q8 p3 o# b N - #include <asm/hardware/edma.h>% v6 U4 s" q' M' T3 l; Q
- 3 P9 n: v. ~1 V! T
- #undef EDMA3_DEBUG
# ?" F- t. a8 Y8 D6 @3 e - /*#define EDMA3_DEBUG*/
. \# K" \& h1 ~1 i( n& P
, c6 [6 H% q; i# H' \7 y& t3 S- #ifdef EDMA3_DEBUG
5 g# N, A$ {1 Z, [9 s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( v: H y, D+ i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% R/ x' R1 G6 L% q; H4 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 @% _- j% @+ m$ ]( [+ j3 Q
- #else
8 w' f `9 \* S+ e - #define DMA_PRINTK( x... )9 N g+ Q; n N" @0 C! V1 J2 Z
- #define DMA_FN_IN: W! W& W2 j) s+ d6 _, Q; d! J( A
- #define DMA_FN_OUT
8 k. @2 L+ }' T: ~. R- a: q - #endif
: t/ a: E! i5 @. p0 U6 |4 L! s
6 P6 t2 [* l* s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& M$ s; l! L3 j - #define STATIC_SHIFT 37 H8 s! _, P4 j8 w4 _6 g
- #define TCINTEN_SHIFT 20' h- h: n, M; @0 @' T2 q" |- Z
- #define ITCINTEN_SHIFT 215 a( a; ^' Q P; \9 u2 o* {( |7 y% Z
- #define TCCHEN_SHIFT 22! u. N) Z1 V m, o' n3 [/ n
- #define ITCCHEN_SHIFT 23" g4 s6 e4 U2 q n l
- " g) A9 ~: |$ G$ l( z; V
- static volatile int irqraised1 = 0;
/ D5 C7 Y# _& A) m* |8 U( h - static volatile int irqraised2 = 0;
. W* R8 Y& ]2 V4 `, ] - l" |( C. g0 y! x4 s; A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) C* h. z* H+ q; f# u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! i, V5 [9 v% z5 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ _' ]! o, O0 }9 @: }5 l6 t% g
( ^, g" l: W$ @ V2 X! Q% c- dma_addr_t dmaphyssrc1 = 0;
% g7 ]3 Q) ^/ T5 u$ J - dma_addr_t dmaphyssrc2 = 0;
0 A* [2 X; v P. d, u- x, l, | - dma_addr_t dmaphysdest1 = 0;) f( @8 M. @+ ~2 E
- dma_addr_t dmaphysdest2 = 0;
( O) x% T# z% a* ]" f. s* |& b: i - 0 X- A1 @- @1 K
- char *dmabufsrc1 = NULL;
/ y& l4 j# ~) \, W. H. I3 T - char *dmabufsrc2 = NULL;
7 T' X C7 U8 U4 x* H% V - char *dmabufdest1 = NULL;: p1 `4 x* e1 o% n# F: N' g
- char *dmabufdest2 = NULL;
. A" c5 S% a3 A0 I q; \: g
2 v9 e9 Y) L! ]0 j i- static int acnt = 512;2 k% p& Q* p7 B9 U# q3 o6 w; b
- static int bcnt = 8;
( n: c4 p8 R& C' |; q( { - static int ccnt = 8;6 a& z. L2 W% |8 m, a
- R) N/ s/ w# G6 j/ G4 d: B0 A- module_param(acnt, int, S_IRUGO);8 b5 P( R) I) ~' o! `
- module_param(bcnt, int, S_IRUGO);
% G6 {! u- ]0 R9 E - module_param(ccnt, int, S_IRUGO);
复制代码 6 O N! [7 i4 ?% g; y
5 }4 V" Y3 F) T6 c/ G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 e2 F# n( z: U' iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 S4 ]( S# r/ B5 U k1 N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 x$ x3 u* M* F, E. v
$ h& p: G. ?: ~# }1 H4 y* L+ r3 n% N% K4 r, j1 |6 n
|
|