|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 d$ D. T5 Y$ J3 Z1 [7 @) b- [code]EDMA sample test application, y( x7 b5 @/ U7 _6 U) ?& B
- /*
2 {/ @5 V( g- ? - * edma_test.c
5 S: A1 Y; a# P - *
s- [9 ^ O- \" i( t - * brief EDMA3 Test Application1 [9 E9 M3 [+ |5 i# S$ T- v
- *% y1 w7 E9 e1 r1 b
- * This file contains EDMA3 Test code.- [6 b) Y1 Y! G9 q" S* v
- ** s, V3 ?( Y7 C+ Z5 }# j+ g7 u0 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 U% Q k0 x+ | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ j A, W' v8 M/ j' t
- * TO CHANGE.
% X1 `$ I8 ]; B4 k( Y" j, r0 S6 M0 W - *
& O( q7 N0 i+ a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( b$ P7 g; g) @6 e - *
u. e, T- {9 m* k5 { - * This program is free software; you can redistribute it and/or
/ s/ r4 W, C- K* J! k0 J( N' J - * modify it under the terms of the GNU General Public License as9 V$ a9 l* I* ^2 ]& i& Q
- * published by the Free Software Foundation version 2.
( l. I6 H$ d }) ~. v( b - *9 P6 }4 J$ |- i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- {2 F, F- m9 ~8 U - * kind, whether express or implied; without even the implied warranty- W$ ~* J; T7 I4 ^- a, J q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& _4 P' Q H0 }* E0 w3 T - * GNU General Public License for more details.
2 r# \2 v3 D+ }- q - */
1 i- P) d- Q8 c% U - 4 I0 z$ W" ^& A# N! A
- #include <linux/module.h>
3 u) T0 P, R. @. k" R4 ~+ c: H - #include <linux/init.h>; ^ h: ]9 K8 N
- #include <linux/errno.h>
2 \/ m. ?/ c2 R1 a2 g5 \5 @9 A$ ~ - #include <linux/types.h>
8 T$ X6 j% c8 b x! @3 s - #include <linux/interrupt.h>+ `% T2 w7 H y/ q3 V
- #include <asm/io.h>
4 Z& ]5 W, d1 \" N; U5 [ - #include <linux/moduleparam.h>. u7 P6 F# z6 G
- #include <linux/sysctl.h>
7 Q& D! a* @! ]1 F2 P# n3 E- [ - #include <linux/mm.h>$ ^. I2 V& s* w' f
- #include <linux/dma-mapping.h>; r% j/ W9 i" d) i5 ?# L5 [) ?
- ; n: ?0 L( ?, X" ^' D. e$ R4 F
- #include <mach/memory.h>
& U2 x! Q* T' {8 k4 K4 y) { - #include <mach/hardware.h>! |3 r# X- Y* A" ^2 J
- #include <mach/irqs.h>( A3 M4 j* p, }* G
- #include <asm/hardware/edma.h>/ b8 Q3 P- o/ @3 c9 m5 I& y
/ }$ }6 v4 q/ |9 f$ y3 s1 @- #undef EDMA3_DEBUG; v X# ^5 q' s9 B0 q
- /*#define EDMA3_DEBUG*/+ q; b* `/ s& W" \
- ( G) t; Y1 Z9 P. a. Z; J3 K) ^
- #ifdef EDMA3_DEBUG
9 h9 N7 K0 n2 K" n7 U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
M% m5 r& c* G' ^: }# w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), D) J3 {! C9 z: Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& S' o9 ` ?* U& _( D6 I* [
- #else3 O, c; R! [9 L0 z5 ~
- #define DMA_PRINTK( x... )8 L9 S* K4 R4 k
- #define DMA_FN_IN" U# L! |' y0 p/ I8 z
- #define DMA_FN_OUT3 g4 A' G5 i1 S2 \
- #endif
- T9 J2 F7 f& E+ ~+ O - * G# W1 h; \. W& H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 M/ M7 }3 [6 Y/ I - #define STATIC_SHIFT 32 K6 }7 U6 z- i2 y9 ?
- #define TCINTEN_SHIFT 20
8 j; e2 ^% i5 \' M$ U: Y* d - #define ITCINTEN_SHIFT 21
/ b, q( L- o8 w$ z& |- _ - #define TCCHEN_SHIFT 22! j# n( b' I% _9 A9 \1 l$ y
- #define ITCCHEN_SHIFT 23
/ B) `9 ]" S( c T8 H5 [. Z/ H
5 T! q/ y: `$ e$ Z- ]; }% a- static volatile int irqraised1 = 0;' m$ p! N$ H( O& j) j4 D! |
- static volatile int irqraised2 = 0;
5 _! V; I7 D* x3 x; B+ ?( b( G
* S3 O- ^6 M# ?- p' f% `. I6 v# i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 A2 p& N/ R9 S$ b- X- ^) b! g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 L6 R$ M+ X5 {6 V* Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); n' K* K' ~2 G
& q+ p4 m! H/ s0 R- a5 v& K% c. o- dma_addr_t dmaphyssrc1 = 0;
8 G; B1 @+ b0 C- [$ z) J - dma_addr_t dmaphyssrc2 = 0;
3 I- q" o% T9 H% }9 S - dma_addr_t dmaphysdest1 = 0;
* d' s3 {3 m" U+ U9 \3 T5 [/ [& j$ ]1 Z - dma_addr_t dmaphysdest2 = 0;
; i" d: K2 d7 e- E% | d e" ?
4 E+ k+ l( V; \5 T: C- char *dmabufsrc1 = NULL;
; L% T/ H( B$ b - char *dmabufsrc2 = NULL;
& [9 K0 t. o- l2 z* o - char *dmabufdest1 = NULL;
* Q4 D4 f( e! j+ u# e - char *dmabufdest2 = NULL;
! Q% z8 x, K9 b
. |6 E }) M& O9 j5 `( ~$ k- static int acnt = 512;
1 M& I5 `* t' \ - static int bcnt = 8;
5 `+ j8 N1 o8 H& _ - static int ccnt = 8;# }( T, \( ?* }+ _; M" x3 k' e
- $ u }& v& g+ H% P6 o3 C( s6 c
- module_param(acnt, int, S_IRUGO);3 r! V9 c. [3 s3 Q8 B, c
- module_param(bcnt, int, S_IRUGO);/ l" k+ O" ^; Q) c2 v
- module_param(ccnt, int, S_IRUGO);
复制代码 / `; S/ C/ b! B/ o
7 P& v' `. c9 J# j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 }, o1 l/ E5 {3 e- U$ \3 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; }1 q$ R; z$ X9 C- u9 r4 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) l+ l5 D3 r3 O% J
1 F0 N4 v5 u4 F
3 C, Q7 H: y5 L |
|