|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' L3 X" s( W: U) Y. i2 D
- [code]EDMA sample test application" I3 y9 b+ [) [) r; l) p; `
- /*
2 m* a: ^1 ?. \& e7 ?+ p - * edma_test.c5 C5 o) C" Z0 Z4 h/ c
- *
$ F. g4 t6 [) a* x - * brief EDMA3 Test Application- U2 R4 E0 Q u
- *
/ c6 s$ _+ l" n) d4 G - * This file contains EDMA3 Test code.
2 b+ y7 O# `4 c0 R4 m8 z - *
7 I' T& ?; X4 P, q+ c; M4 I2 G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 T8 @, |8 f* p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ R7 O+ G" X4 t$ T/ G6 l - * TO CHANGE.
0 g$ n5 X* g7 g# r- D" Z2 G1 O a - *
" Z7 F5 _# c; G; e+ v1 u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; ~/ o$ v) K) ^5 g( J
- *
6 h: x: \% I* s, k u - * This program is free software; you can redistribute it and/or
0 T- M/ G" [, B J/ L) T6 d - * modify it under the terms of the GNU General Public License as9 [* @: T: P$ J' M( `
- * published by the Free Software Foundation version 2.
{: q$ t9 z$ B; I k& R9 s - *) y3 [! {* P) I0 {9 Y) V8 \/ [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; o/ H( Q4 @( u
- * kind, whether express or implied; without even the implied warranty; _8 Q2 k0 ?6 m' S( o4 |1 W" A' j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; N5 d2 N0 U/ Z6 N; S" d: q- t" |
- * GNU General Public License for more details.
0 ?# Q$ B1 p7 J Y; [ - */$ C' w# Y3 H0 g) T' q2 j' t7 _5 J
3 u& G0 y+ K# Q9 [1 l- #include <linux/module.h>
0 s1 Q p/ b/ u# ?( Y' f - #include <linux/init.h>
( z6 C2 Z" u! N. ^, o - #include <linux/errno.h>
7 Q4 I+ ^! I! y# R: w0 u - #include <linux/types.h>
+ f& [! J3 o4 `7 M: e9 X - #include <linux/interrupt.h>
8 w/ B- Y5 U* c$ Y' ~ N- p: _4 l - #include <asm/io.h>
, h) N. Q" t9 i) Z - #include <linux/moduleparam.h>
7 ]9 W0 P" H) `2 s- K; P - #include <linux/sysctl.h>: T4 {0 X: a. n3 I+ b: K% Y
- #include <linux/mm.h>5 e% U. P$ P; K% u# S
- #include <linux/dma-mapping.h>
# M, {. {5 S* ?) l
! j. Q6 ?; m- z; C [' \) t- D- #include <mach/memory.h>
% |9 E2 G7 T/ J3 n" H) Z' E( L+ A - #include <mach/hardware.h>
, R+ H3 q/ M+ e( ?6 A+ \ - #include <mach/irqs.h>
1 k p G4 o, \; V - #include <asm/hardware/edma.h>+ P# m8 h! _" S- H2 C' m9 c9 u; S
5 d7 X6 w8 R' K& Q- T6 i o9 c+ |- #undef EDMA3_DEBUG5 |0 }* ~4 I9 _' Z
- /*#define EDMA3_DEBUG*/
# t0 F- |; i( X; @; T - 7 _0 I' j9 z5 n# p
- #ifdef EDMA3_DEBUG" G5 y" O1 I% L2 N8 J! P! t6 u) Q3 g" Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' K/ Y7 Z+ l5 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% ^* @5 ^9 D6 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) g8 |+ Q# Y$ K# Q& ]& l - #else, n8 g1 T3 c+ T6 I
- #define DMA_PRINTK( x... )+ a7 {: F. l6 e
- #define DMA_FN_IN
0 ]) l7 @9 e, }, |/ Z/ I - #define DMA_FN_OUT
( \% a+ _0 D5 J' x - #endif5 g& ?8 |/ P. I5 l
8 r& X, g) `# `# A d4 y0 h' ~3 H# @! D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 s& E& u( [8 A( q0 I% G8 C& H* o3 u; p - #define STATIC_SHIFT 3
, }. s" b3 H3 @% u5 W/ R - #define TCINTEN_SHIFT 20
. j t! D( S4 G) t - #define ITCINTEN_SHIFT 21. Q: q% ]! m: x- y
- #define TCCHEN_SHIFT 22
. B$ G& T6 C% a$ `( v - #define ITCCHEN_SHIFT 231 Q* a# B' l. ?2 Q- v5 }2 L
- 5 q: V' Y5 X5 K' X6 o$ o7 N
- static volatile int irqraised1 = 0;
# J& K! e7 ~1 X4 W# D3 P% Z - static volatile int irqraised2 = 0;. |7 X3 o- I/ [. ~2 i% Q
. O$ b+ k8 L" r9 U, V1 c. a: k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; i& Q1 y( D/ m# J# d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" F7 l! Q8 c& K' t/ P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 G- F; p% n- F- u - 6 o6 @, F4 t, E( Y* d m
- dma_addr_t dmaphyssrc1 = 0;
* u0 G I9 j% j- h# a( T - dma_addr_t dmaphyssrc2 = 0;' n2 B6 e* L3 H! M! @: D: Y
- dma_addr_t dmaphysdest1 = 0;
8 W2 V7 Q8 O5 T" e* {3 r - dma_addr_t dmaphysdest2 = 0;" f3 F4 x" F& }; [# L# t
5 w V2 c% ?/ r) L& Q$ z- char *dmabufsrc1 = NULL;
# ^0 R+ D/ |1 V4 U; q# @ - char *dmabufsrc2 = NULL; _* d' j) R2 s/ H: [
- char *dmabufdest1 = NULL;
3 r; V8 o4 R2 K2 t - char *dmabufdest2 = NULL;
* n6 ~. F8 p# [2 g' d$ x
2 M5 v% f, I& l. k! p- static int acnt = 512;
3 [8 D/ x' C# H8 u% D. k' o w - static int bcnt = 8;
' L# O7 @( e, E9 D1 a3 ]$ h - static int ccnt = 8;
# f; H, g* E% k2 ? - - J1 a- v3 R; o
- module_param(acnt, int, S_IRUGO);& p5 P- }0 ~) C3 G, Y ?
- module_param(bcnt, int, S_IRUGO);
, M4 v+ m: U- b( v( z3 }0 j - module_param(ccnt, int, S_IRUGO);
复制代码
. N0 I7 \2 l/ q0 I9 Z- |% V+ p
* v. J3 e4 S* T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( ~8 T; N3 ?; c, ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ i! y) J% J* \8 m r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ @" H$ z! {9 A x! V N$ t# X% I& }- N: m/ x6 s
) W3 k$ r( Z. T4 k# l8 z
|
|