|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ S/ d9 H4 `, R c- [code]EDMA sample test application; E# o: v$ C9 k2 _; A: ^2 J
- /** I8 k: L* @0 W$ L
- * edma_test.c# C2 Q' t6 X" I! k4 L
- *
, I; ~% k& w' E+ y: w - * brief EDMA3 Test Application* x5 ^$ g" b! {, n
- *) `6 G: R' s8 _6 i1 }, s
- * This file contains EDMA3 Test code.( `9 i/ z( ^9 R, V' z6 G
- *
3 D4 R3 B5 m' m; E' }. t+ n( U" D3 ?, t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 L* ^* ]% m# I, @2 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ^1 x- H& W) i6 l: a+ ~
- * TO CHANGE.6 A9 E; Z9 c4 D) R
- *
5 D- m/ o3 y& q- Y7 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// k; y& s" k1 f* J2 X
- *
% p) \7 y, B9 d9 M. V - * This program is free software; you can redistribute it and/or. C2 a* U) w) ]+ L
- * modify it under the terms of the GNU General Public License as
, b C$ G, G% K - * published by the Free Software Foundation version 2./ v' J# q2 Y- M6 S+ X3 q0 t: ]
- *
0 s) k' ~" P6 Z* d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& A. D/ }/ t+ J, ]- ~
- * kind, whether express or implied; without even the implied warranty
: G& m( y& e, a3 k) F' W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) x7 Y6 A! b1 M/ n - * GNU General Public License for more details. M& y- P/ L3 D8 m- N& e5 H3 D2 \
- */
% w% S* \. i) s7 U9 y; I" G - " W$ I" F" l2 d) X/ {# h j& ]
- #include <linux/module.h>/ J$ T- ~1 ?) W- U7 R! m7 N7 g( h
- #include <linux/init.h> K9 e, O: p m+ A1 j6 x, Z' \
- #include <linux/errno.h>& I2 j4 f9 u$ Z6 ]7 N# y+ a
- #include <linux/types.h># Y$ v" e! o9 b0 l9 D' K
- #include <linux/interrupt.h># s4 Z% E7 T0 a& {6 q
- #include <asm/io.h>, V9 m0 W, d/ o0 X8 @" O7 c
- #include <linux/moduleparam.h>
4 Q9 ?; Q/ C, a: E& s' c - #include <linux/sysctl.h>
+ Z+ |. x0 K5 r+ O" }! Z: U; ~' g - #include <linux/mm.h>
8 r: v# h8 `' \: A0 x% \( @ - #include <linux/dma-mapping.h>: o# ~. d5 Y8 ]
- v. s7 `, L+ g, w# `6 q) M, p- #include <mach/memory.h>" `+ D" d2 |% g$ K1 v z
- #include <mach/hardware.h>
. M, G6 ~' S) S7 t - #include <mach/irqs.h>
" B$ p* l/ O/ g, Y - #include <asm/hardware/edma.h>3 n" }6 ~/ l1 q& v
- + g3 x* L' A2 U% p; H% S2 J0 t
- #undef EDMA3_DEBUG9 z* [) m, G: \. Q7 b; G/ \- z! j
- /*#define EDMA3_DEBUG*/
; t+ G( v" I! D; ~) ~ - ) b8 y A7 I# h# d! ?1 p
- #ifdef EDMA3_DEBUG
5 @9 o, s& }7 d7 k) Y( B- T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 t- c5 Z. ^& a% M o) y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 e7 M# P5 h4 } k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 j% d. e8 S) a, }" ~# Z+ R
- #else
2 X' Z6 k6 O. o) [ - #define DMA_PRINTK( x... )2 ~4 R7 K; `$ M" _, j% @1 m
- #define DMA_FN_IN$ S8 [, A& P6 c. T/ k
- #define DMA_FN_OUT1 ~2 D( a. F; ], q- L
- #endif
2 D0 @5 i4 m. e. X) N- L - 2 s/ J9 z! Z6 Z. K- b- {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! Q+ D: s! w& q
- #define STATIC_SHIFT 3$ C8 ?3 V# R+ o3 O8 n& @7 e0 S: s
- #define TCINTEN_SHIFT 20; n9 h' t: {5 `% V8 V9 s
- #define ITCINTEN_SHIFT 21$ p5 m9 G( T* \3 g8 x( C
- #define TCCHEN_SHIFT 22
/ r$ v0 i6 R! X6 ]: @! I0 \: @+ B - #define ITCCHEN_SHIFT 23
: b b: v) Y4 G0 x. w4 f r - : U p6 B0 l& x. s8 K
- static volatile int irqraised1 = 0;& V, X2 [3 s) w: k- U
- static volatile int irqraised2 = 0;1 Y. H3 D- n, Q7 c K9 c, l
- 6 ~$ O2 X$ L: q$ A0 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" N% Y% K0 l9 f1 \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 V# K! J1 Z& |6 |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& E0 u% `4 i W- ]
- * ]/ t2 z7 y- _- Z: _
- dma_addr_t dmaphyssrc1 = 0;
7 N2 ^6 Z9 O$ \% B* N% P+ d# o - dma_addr_t dmaphyssrc2 = 0;
$ D% ]- @5 t+ ?! w& Z - dma_addr_t dmaphysdest1 = 0;7 E1 I. L# C( e6 R
- dma_addr_t dmaphysdest2 = 0;8 Y* c; C* ?1 G/ q) u2 N g
/ n+ x" O0 s2 L6 O- @( S, M& ]- char *dmabufsrc1 = NULL;
9 I: L ~; k8 s" |- Q/ b - char *dmabufsrc2 = NULL;
8 l# l) `9 M! {! B - char *dmabufdest1 = NULL;/ _6 H" b9 g0 }' V
- char *dmabufdest2 = NULL;
* P6 q$ M- D( t7 C) M
9 W: n/ a0 g5 z% ^- }% D; }( z- static int acnt = 512;7 g. V- f2 k& ~; c
- static int bcnt = 8;! r/ Y6 v) G6 L
- static int ccnt = 8;
; o/ a* I9 N0 G) ^3 F1 K4 r - & X% v& [7 N& l3 F9 w
- module_param(acnt, int, S_IRUGO);. h3 C+ S+ t& U/ L
- module_param(bcnt, int, S_IRUGO);
- d0 ]& q9 d z* n v; G4 J - module_param(ccnt, int, S_IRUGO);
复制代码
% F; g V" g& u" p& N& K% o) ?! A% q3 W0 M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. [$ p& A0 P$ I1 N2 A. \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: ~8 d9 d- ?$ m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 J/ I5 k/ S2 Y' \: N/ y5 N
- \: }5 |# q7 J" ^, I3 h& _& H" ~/ l
|
|