|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% N4 Z4 D/ A7 r1 r9 T- [code]EDMA sample test application; B- p3 e0 J2 \0 m6 C3 G# P
- /*
6 T$ z8 F) X5 J1 Y( b% V - * edma_test.c
* a9 r3 ` o ~. q: t; V5 d - *
6 S. Y4 i6 e+ \! Z; t5 @ - * brief EDMA3 Test Application
5 f7 W9 J7 E& b/ V3 }7 } - *
9 `$ s: m, w$ A5 w; ~3 N - * This file contains EDMA3 Test code.
2 h h7 k# h% b. L6 k - *
) V) l5 \" Y; p6 u5 P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
S z( ~6 F' W" _ _& Q, `2 Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# y9 A) w6 f* f - * TO CHANGE.
/ u: {% W C* {+ _* {- g: q - *
Q7 c" K0 G' N: V' f1 z5 b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' U" ]5 l) w& @1 n5 s
- *3 H7 Z7 d8 ?+ x3 D
- * This program is free software; you can redistribute it and/or; ?/ g: z s6 O# i7 A4 L0 `8 a
- * modify it under the terms of the GNU General Public License as
* V+ W3 M- x8 D; @- } - * published by the Free Software Foundation version 2.- p. v/ N# i0 \2 G2 W( g6 n
- *! W3 Y6 m" B2 L7 i k. t' B T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* g+ z9 E* |2 d2 u/ T1 z
- * kind, whether express or implied; without even the implied warranty3 F7 o8 n! b5 z9 b" R5 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 [; p& I- `5 o6 ~ - * GNU General Public License for more details.3 T2 m0 r# F2 _1 p
- */
% K/ W& s4 w- _0 X+ j5 n
" a3 E1 z- s$ K8 ^* H- #include <linux/module.h>' t% k% H6 Z7 _: d, X1 o
- #include <linux/init.h>; `! @ x9 a- x& r y$ R
- #include <linux/errno.h>
0 J( W, U7 b' ~+ \! ^2 w) _ - #include <linux/types.h>8 d K* T- [: G$ K/ \( Y* X+ ~6 u
- #include <linux/interrupt.h>
' ~, G7 l8 s3 f9 p# [2 M$ r b7 \/ n! f - #include <asm/io.h> v, U# J6 a6 M& q! u( l3 @ m
- #include <linux/moduleparam.h>
5 l' K- O$ @+ J/ l% _. c - #include <linux/sysctl.h>, t+ V; F' o+ Z
- #include <linux/mm.h>1 q' P# g _( M0 ~3 I2 j! p }
- #include <linux/dma-mapping.h>
) t7 n3 _0 K) x. }; J5 { @
" l, B& a' w* f4 h2 D- #include <mach/memory.h>. p2 o; E: G0 ~( i- A
- #include <mach/hardware.h>
~& B& g5 o8 I - #include <mach/irqs.h>
- U- b t+ `& u* @" a+ k1 |/ H" u# y - #include <asm/hardware/edma.h>
0 w/ q+ Z1 W- a0 {0 D0 ^! S4 } - : J1 m: Z% U! L6 Z4 Q7 f$ I6 S
- #undef EDMA3_DEBUG* d; G5 Y/ G, e2 f1 K
- /*#define EDMA3_DEBUG*/
4 U) L% _9 i' {4 M4 a - , C: m* Z( o. b/ r% B
- #ifdef EDMA3_DEBUG2 q+ `, V$ k* d) a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# d4 x0 z3 L( c' q# K' |& V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 J2 g$ x, _/ D3 z3 s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) h0 \0 L# r3 w2 ?/ x
- #else
0 v6 e/ a; _) b' {! M- W. j - #define DMA_PRINTK( x... )
) _3 s5 g- s9 d" x# H8 ?4 @ - #define DMA_FN_IN' M K0 P, t1 u/ W7 n# d N3 j1 H; O0 N; T
- #define DMA_FN_OUT4 P# U0 b' t: q3 k
- #endif& S: U$ J7 l0 I6 g0 ?& }/ U. g% g
# \7 P8 F1 ]# }$ d- r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% K( {( m. m0 R, ]! R, V$ g - #define STATIC_SHIFT 3- T5 V3 k3 _3 J
- #define TCINTEN_SHIFT 20# `7 p! K" f* S2 L! M7 {$ F
- #define ITCINTEN_SHIFT 21
. T6 ?& x" M4 F' Y- M - #define TCCHEN_SHIFT 228 w+ M- @7 W7 v6 M1 g' j7 O5 Z; m$ \
- #define ITCCHEN_SHIFT 23
# W% \' q9 n; z& I, \3 B4 U& p- b - ) {- `$ b P+ ]* c# Q- _# u
- static volatile int irqraised1 = 0;
7 o$ a4 A* [* t& ^2 G2 {. D - static volatile int irqraised2 = 0;
9 |! O3 Q8 ~2 U! E& K5 N - " K4 {4 L; z* l! y5 e" ~1 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ~, r# N1 D; g4 W( ]- d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; S1 W0 K8 x; b" F2 D3 ^; ~( v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 g6 i, f. K4 m - . D0 ~8 x/ J' x5 [) r" X
- dma_addr_t dmaphyssrc1 = 0;1 ?3 T( [5 ]3 w' [: ^
- dma_addr_t dmaphyssrc2 = 0;
5 D& ]/ C( c2 S - dma_addr_t dmaphysdest1 = 0;) ~& V/ j. G2 a/ Z' w* W6 ~- h) Z
- dma_addr_t dmaphysdest2 = 0;* [6 a4 ^9 [" u. K9 ~: Y
, z P: K8 q1 O) {# V9 t- char *dmabufsrc1 = NULL;
8 F b: j" I+ N: D& T& _3 ^ - char *dmabufsrc2 = NULL;
G) K' Q5 D/ N - char *dmabufdest1 = NULL;2 m* t& N/ p! d9 J
- char *dmabufdest2 = NULL;
& p$ w/ m+ P2 u" R$ H - ! R& b {# I/ o2 P. H6 z5 ]6 a1 I5 q; ]
- static int acnt = 512;# b$ z, z' r* V
- static int bcnt = 8;
4 C: m7 ]9 B: A$ \0 l) j - static int ccnt = 8;3 n+ g8 r: J+ i& l
- 5 s' w3 n* Y( Y% P
- module_param(acnt, int, S_IRUGO);' f0 s p9 Y: t8 l* g0 Z: B: n7 Y/ p: B
- module_param(bcnt, int, S_IRUGO);
: c8 Y4 ?$ Q5 {1 \( l% ~$ c - module_param(ccnt, int, S_IRUGO);
复制代码 9 N6 p: G, H. K7 g
$ P% F5 C, a" W! H' H. H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# B: w" M" o4 s" C5 m t9 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! f- U9 ^5 Z: P+ W r& M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! \5 P9 ~3 _5 M1 m8 F
' p. F {7 m. i; D( x0 ]# V
# B S _$ _; X! g' R# [6 s |
|