|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 f1 {8 ^+ M% ]8 j8 ~ b! L
- [code]EDMA sample test application% K$ h. h7 K. e/ w
- /*
, R2 N( Y$ L2 O( R5 I1 ]* D5 g - * edma_test.c
: ?4 W& P$ v" m - *
* e4 t/ m$ F1 o5 H - * brief EDMA3 Test Application5 \0 K* a8 C2 L0 T
- *0 H$ l3 o, i) n: L6 a" J( }( }: _
- * This file contains EDMA3 Test code.0 ? r; V& d5 D
- *
& R, _/ `5 @) L9 ]- O) @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) ^9 T. {6 Q8 v0 Q" O! x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 s8 k% f) F# Y+ N4 U
- * TO CHANGE.3 r" C0 f5 Z' [8 t7 ]8 Z% ^
- *; j. V, Q# X) T$ _4 N$ J9 O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 ^% H, B+ Y d0 z5 o
- *
1 D, h& ~8 Z" I1 u - * This program is free software; you can redistribute it and/or
( C" j) ^( b% A' y+ i+ l5 ?' i - * modify it under the terms of the GNU General Public License as
2 F, ]6 m, i \5 G; a7 k3 ~ - * published by the Free Software Foundation version 2.
* F/ \6 C7 w( \. V: B' e% I6 P1 H - *
0 U9 x% v/ f& o# H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! B) C# e6 W2 Z; T" s
- * kind, whether express or implied; without even the implied warranty
* C: f: P7 ~ F( U. ?6 u' T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* \ n b. P# |9 D, b3 [) y; _8 E5 [ - * GNU General Public License for more details.; O" l' q) C7 g2 ~; ~7 D
- */3 v3 k( ~5 o3 E5 ~" [
- " G4 l, \9 B1 x' f+ Y- A6 h' a; R5 c5 r
- #include <linux/module.h>
& v, T7 [" k+ j- a - #include <linux/init.h>
, R/ Y1 V9 a* a& I- n) j - #include <linux/errno.h>
( x, Y% x0 Z0 p - #include <linux/types.h>) ^; t5 \1 \% V. t+ w
- #include <linux/interrupt.h>+ s& W% G( i0 x8 f
- #include <asm/io.h>5 Q" B! X9 ]6 Q9 i: G5 A. P! p5 ?
- #include <linux/moduleparam.h>
" ^; c4 x" x) f8 X" L - #include <linux/sysctl.h>
* B+ \: k; ~* F3 K1 y' a - #include <linux/mm.h>
, ~1 g$ [: L }" V$ Z* g4 e - #include <linux/dma-mapping.h>6 ]" h1 X w& |8 \) F& l7 I9 z
- ) g2 e, Q. H# B
- #include <mach/memory.h>1 n4 P) @. b; ^, P7 H
- #include <mach/hardware.h>4 r4 l6 M0 u8 Z0 A; _
- #include <mach/irqs.h>
7 R. P3 o8 F, N' m% _4 C, y1 c1 L - #include <asm/hardware/edma.h>
- @* V9 g% K+ f8 d
: z* a7 P1 h& q( [7 N8 P- #undef EDMA3_DEBUG
3 D3 d7 l1 `4 b) E8 @ - /*#define EDMA3_DEBUG*/
( K: o& g% r( v* Q1 V6 e
$ t( r9 A$ U' p& O) |! h- #ifdef EDMA3_DEBUG/ b! s) L/ x/ V" m/ {7 A; I* w; j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# |% A9 L$ H, Y' L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): b6 h' K$ v: \- o3 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ x# H8 v; E! h& e, v' P$ [3 n
- #else. _# D$ X' i0 a" ~* E' [! r! P
- #define DMA_PRINTK( x... ); D1 e7 s- I8 I( V% k# i
- #define DMA_FN_IN3 F( ^! I$ t; V5 l; i; d+ l! Z
- #define DMA_FN_OUT
1 r- g8 H3 s. V - #endif
1 l+ s5 B8 o a
1 }6 y0 R4 T0 l# q, p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) v" B2 r( r5 e5 f0 D - #define STATIC_SHIFT 3. H2 D8 I. _' _# S
- #define TCINTEN_SHIFT 20
2 `, K. u$ Q8 n+ ~ - #define ITCINTEN_SHIFT 21
8 n/ L$ i6 w; \8 |# i - #define TCCHEN_SHIFT 22
% e' Y: W _; C; P2 S2 Q - #define ITCCHEN_SHIFT 23
! F8 N+ j" H+ |7 Q5 \2 K# u$ j - 6 v# ]: |- x- l" f" ]9 u) c( u# z
- static volatile int irqraised1 = 0;7 C3 E$ p" N' F+ y$ A/ z& P1 e! l
- static volatile int irqraised2 = 0;
) V3 ~1 h6 R- W - 5 I D2 c" L, m# p5 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 e- ]& r: Q0 R+ n j0 I7 o! V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ~, ^8 Q# g; [# r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 P* @$ a3 X+ Z8 T& ^
- " a' t$ S9 n# c; g0 s1 @
- dma_addr_t dmaphyssrc1 = 0;5 U" G& P3 J- w7 U& ?# B3 p
- dma_addr_t dmaphyssrc2 = 0;
0 b2 X& O3 R& s ~2 c e - dma_addr_t dmaphysdest1 = 0;
/ q0 y4 {6 x' X. Y - dma_addr_t dmaphysdest2 = 0;
5 N6 m" Z& H8 ?- G9 P( w - / `5 p2 B4 {) S/ v8 p6 M" o
- char *dmabufsrc1 = NULL;# u4 F# @9 P) s" A# ]& ]4 r3 e
- char *dmabufsrc2 = NULL;' E6 p1 D9 |: v' _2 v4 p
- char *dmabufdest1 = NULL;: g9 t" j# h* y
- char *dmabufdest2 = NULL;- X7 Z$ ? w6 C% t, E6 G
Z3 u2 i4 M3 N% w- static int acnt = 512;
4 Y/ w. u) T. \) x0 u" j5 ^ - static int bcnt = 8;4 X5 p( L& ], J9 b8 z0 r
- static int ccnt = 8;
/ [% J7 Q: r3 d+ M. E# J
8 u+ ]4 H. i/ J4 \$ g+ ~- l& L- module_param(acnt, int, S_IRUGO);" r( \. j4 Y5 g/ K: `! y3 \3 n
- module_param(bcnt, int, S_IRUGO);" v% h4 f$ B1 e$ f w) O9 O- z& g
- module_param(ccnt, int, S_IRUGO);
复制代码 3 T5 Q% m) C. v3 ]+ {. H$ b
" i6 w; J F* V6 F- @2 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 x2 R0 I6 }9 S/ }* Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
@& Y8 K0 ~9 r( U- l) l0 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 M- ^/ o9 X. C2 A& Y5 M
( a) }, R ]: U" ~/ Y
: b; {2 r* y$ _+ x/ ? |
|