|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 d6 Q; @, [9 n+ }/ Z
- [code]EDMA sample test application! L7 F6 s" T7 I& R
- /*1 c+ G+ s; X' Y% ?4 f
- * edma_test.c
/ S! c2 G# ~9 v: c) f# \2 E) Q - *
+ V$ _7 |+ v, U* S t - * brief EDMA3 Test Application
$ A' f& K# n3 _. V - *' {* Z( `8 h7 J6 u; p
- * This file contains EDMA3 Test code./ {2 Q x8 g ~2 u" O
- *
$ F" f4 v6 I# x7 u* ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, X9 T! k( D( P, u4 x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 v7 i# e: R2 ^$ h$ b; w - * TO CHANGE.
& R* N8 B8 q! v2 G- p( S/ b - *$ z+ }: b5 r1 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 K% q" Y7 C' ]9 D+ u
- *
+ l0 k! h% }( i E4 ` - * This program is free software; you can redistribute it and/or- t. l7 `+ v& ?9 M
- * modify it under the terms of the GNU General Public License as
. ^, d3 L, R- _0 s - * published by the Free Software Foundation version 2.( j- B1 P9 O, V: F6 Q: ^ Z
- *
2 y4 f K6 L" F) f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' }! w9 ?! {( _1 | - * kind, whether express or implied; without even the implied warranty8 g' A& b+ O s7 w9 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) `. R8 b+ r4 x! j/ B
- * GNU General Public License for more details.' `; X, [* l; o( w! o
- */: w0 H. i! A% k( {& M# K5 L
6 y% Y2 O7 y* C: |- #include <linux/module.h>
! O. A# \+ o& p+ E- J - #include <linux/init.h>" H v8 d; ?9 H, T; S) }1 E
- #include <linux/errno.h>% p4 W2 K' l/ ^
- #include <linux/types.h>
2 o% Z& W0 m6 B) F& F6 s - #include <linux/interrupt.h>
% g2 F6 }6 f2 g5 p: ~ K - #include <asm/io.h>3 I ?1 v# b6 B
- #include <linux/moduleparam.h>) v; y. c4 [: a
- #include <linux/sysctl.h>; b0 S' L0 c7 u
- #include <linux/mm.h>
% V n( X7 {# t - #include <linux/dma-mapping.h>& l) \2 n7 d {( F& W, B% t. a
- + t1 W( H1 q/ K L" `
- #include <mach/memory.h>- g% C# s J& _6 E/ N
- #include <mach/hardware.h>
( V8 [# h# h6 F7 z) ]0 g - #include <mach/irqs.h>/ g6 Q {$ Q. T9 c1 P" _
- #include <asm/hardware/edma.h>) d9 `$ K& G6 P6 o8 P+ F7 I
- ' X1 x, {$ q2 d* f
- #undef EDMA3_DEBUG8 H$ H3 U! ]1 I4 l: R
- /*#define EDMA3_DEBUG*/
8 Q4 W$ K7 ^9 p, a - - O9 s+ }9 q. V. a7 n+ K: e! A) p+ R
- #ifdef EDMA3_DEBUG& v, p/ B n) u$ n7 C/ {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 Y9 w+ t6 s7 ?$ {4 m/ i2 k& R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 W$ Z/ I; \1 Y }" F; f5 F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! L6 t# ~+ b, @; C! k% R - #else1 a1 c |: Y3 w2 Y( R \
- #define DMA_PRINTK( x... )
8 W; [, [; A& e - #define DMA_FN_IN
) o6 }4 e$ R% ~: _* E1 O: a- s- N - #define DMA_FN_OUT U- I. A1 \- ~8 }$ H; k* w( e
- #endif6 s7 J1 C2 x! l% z: e. m( r; _
7 t# N% r1 a. @, N0 d m8 d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- {4 Z5 l2 t$ T5 H - #define STATIC_SHIFT 3
5 K/ ?/ ?- @5 X1 L5 B - #define TCINTEN_SHIFT 20
) M I9 y6 ^' q( \6 z - #define ITCINTEN_SHIFT 21' c4 B$ V2 N7 H! \# \# H' i: R1 Q
- #define TCCHEN_SHIFT 22
9 I( c2 N, c9 x( v8 Q% ] - #define ITCCHEN_SHIFT 23& x# v- [7 N( h* Y! [1 H/ O
- 6 N& N) v' s- D& G5 D7 q7 s9 O
- static volatile int irqraised1 = 0;
. L# }& S0 Y1 r. `5 k - static volatile int irqraised2 = 0;* ~0 X6 |" }4 |4 {* j; _% O( {. w
, d# s& I O3 Q1 l; V, v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 {; c! u4 T$ ]( D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 t5 M! k, {6 C) q, ~: p# v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 J' r! F7 Y% F1 d6 D3 P
- # D3 ?. H4 X$ a5 t
- dma_addr_t dmaphyssrc1 = 0;
+ Z2 Z5 w% j; o e" w - dma_addr_t dmaphyssrc2 = 0;
3 r' e- b' P( k7 N - dma_addr_t dmaphysdest1 = 0;
" n$ X& Q6 U) S7 B2 r! L& w- C* y* j' [ - dma_addr_t dmaphysdest2 = 0; m! y+ w; ?0 c
- * I9 k1 n9 m) u! C/ `& q/ o
- char *dmabufsrc1 = NULL;0 h' D7 E+ W0 [( Z+ N, h9 W& e
- char *dmabufsrc2 = NULL;' \1 a# N2 ]+ N8 t( d' [' t) `
- char *dmabufdest1 = NULL;
% {! t" T9 ?7 m2 g# D+ D- `3 R - char *dmabufdest2 = NULL;! O! ^2 |% o: J
9 n' l0 N% a5 |- static int acnt = 512;9 e' h K0 r" |# Q0 ]1 H ?) [: J
- static int bcnt = 8;
' E3 y" [( ^. Y" d2 {- Z+ W. C2 P - static int ccnt = 8;
, j7 M5 ]6 L) @" w2 i
* a W9 U+ `3 h4 ~- module_param(acnt, int, S_IRUGO);7 W: n1 @1 Q5 {% P0 N* U# h( C" {
- module_param(bcnt, int, S_IRUGO);
7 }9 d1 o4 Y) t6 L7 f - module_param(ccnt, int, S_IRUGO);
复制代码 ! ]; p' T; J B7 y( _8 c% r% j
8 v. F* i! j) y0 D4 y5 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 e x% L8 H; ?7 A7 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 S% Y% ]: G4 A# X/ `" P" Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: M4 m& _( p6 @+ M5 j8 N4 ~- s# d
6 B" C8 ~) Z( d& _
3 W" H* z$ N1 e: j |
|