|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 b. w4 H/ f6 y8 i2 A' V: K4 I
- [code]EDMA sample test application3 H; T. _9 Y" e" }" J# @' `
- /*# a- |9 {" Z( }; p
- * edma_test.c
$ Z8 o$ O3 X% ?& ~1 ^. D+ r - * ?9 h! j. f8 N3 a5 z3 M9 s
- * brief EDMA3 Test Application8 y* r/ u. w2 Z: R. Z& E
- *& u7 g T) }; h; B0 \6 M
- * This file contains EDMA3 Test code.
2 `+ s' g( @% ^& K9 ] - */ Y( `3 |8 b% r" q1 U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
I" K4 y, q# f2 R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: V" K; i% k: F0 d
- * TO CHANGE.+ h2 m" \6 ~ L; E, d
- *. ^. u5 e( E( e5 ?$ e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 u! Y+ U3 T: @ - *
% C- f6 m" W: C2 @ - * This program is free software; you can redistribute it and/or
) `$ x" [3 A0 {* Q; U5 V' ` - * modify it under the terms of the GNU General Public License as7 y. N5 F. S, ?
- * published by the Free Software Foundation version 2.
) R7 U- u, s4 q& E$ ` - *+ H+ y$ X+ G" O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" v0 Y+ `8 B, Z( Q9 |+ Y% M
- * kind, whether express or implied; without even the implied warranty U& z9 E$ W$ n* _) d1 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" ~8 q2 k# J8 m3 W! p0 I. o - * GNU General Public License for more details.
" t4 w1 h6 i& n# Z- l- {" @ - */
* `; O7 {& t- E9 }4 r7 L' d
! _6 h5 Y, m# e* ?9 T- #include <linux/module.h>, Z1 q' @. O. ]& o1 X, T7 v. y
- #include <linux/init.h>
$ S2 X8 `0 G) `2 K r) E - #include <linux/errno.h>! d) M6 Z" y2 {" A
- #include <linux/types.h>
" W0 C# [: [5 v; T5 W - #include <linux/interrupt.h>) C5 m0 p7 M3 F( d9 q5 A& U3 T
- #include <asm/io.h>0 _5 a4 m. U* d* T! u
- #include <linux/moduleparam.h>
# K5 K4 G3 \, E/ Z. y" b, U - #include <linux/sysctl.h>0 r$ W0 M# q; t! _) g) l$ |: `: ?
- #include <linux/mm.h>
, |8 f% N2 \+ l( D5 D - #include <linux/dma-mapping.h>
. y" D5 S# M; ~2 ~
8 N8 D6 c1 F0 P! j- #include <mach/memory.h>1 n) ^1 E) E0 z
- #include <mach/hardware.h>
- j* A9 v' q) ^( e/ x - #include <mach/irqs.h>2 b" z0 ^% F( |" y* i1 Y
- #include <asm/hardware/edma.h>" f& r" T* i! c: }& v L
% W. l" B, P; B& h P0 A3 r) \ T- #undef EDMA3_DEBUG
4 a: A8 ?6 {1 J, g! x; U - /*#define EDMA3_DEBUG*/
& I. Y- x0 L/ j) k' N0 | - 9 y6 \9 G5 u! e8 f! I9 C
- #ifdef EDMA3_DEBUG# N V! K6 q; E+ z4 I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ r; I1 m. b& m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 Z( G5 ~9 d2 V+ b ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 c1 ?' H6 J. G1 V& s; w
- #else
9 u4 W8 u4 ~" I& V( g7 o - #define DMA_PRINTK( x... )8 C* Y+ F9 O+ ], f
- #define DMA_FN_IN( M5 r8 ` I. H: q9 \9 c
- #define DMA_FN_OUT
/ ~$ u: }5 |6 n1 j+ Q3 u+ H - #endif
5 T& x u; w% g
; @. L+ H+ ]; V6 m4 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* r) l* ~ A8 W% X. Y* X1 F
- #define STATIC_SHIFT 3
1 h+ G* _& A; n$ p - #define TCINTEN_SHIFT 20
2 @: Y; ^" g" V* I- Q - #define ITCINTEN_SHIFT 21
* H( I' \& m7 I - #define TCCHEN_SHIFT 22* h2 J; L/ l# Z/ l; T
- #define ITCCHEN_SHIFT 23+ W: m& N- X4 F6 |; g8 S
- 5 Y! ]! p$ C8 i- m; N [0 Q
- static volatile int irqraised1 = 0;
; L8 l; @" ^) a6 ~8 J - static volatile int irqraised2 = 0;
v$ L1 r. ]$ ^2 f1 F9 Q
$ B$ ?+ u+ e0 P+ M. c8 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 {; j4 d# G3 I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- J2 b, P+ N( o9 e' `2 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 s+ J/ o' b/ r" r6 ~- c: ?
- $ D- o2 i! H! e, C$ A
- dma_addr_t dmaphyssrc1 = 0;
4 U: g- |( ?8 n( U7 g& |4 M: u - dma_addr_t dmaphyssrc2 = 0;
# a, ^# c% c+ a Q' \' o1 z+ C - dma_addr_t dmaphysdest1 = 0;
: N& N) [3 m' l8 S' [ - dma_addr_t dmaphysdest2 = 0;5 W e4 X, K5 g y8 J
' Y# N8 I! P4 [8 @8 u+ N- char *dmabufsrc1 = NULL;
/ c9 x" o- G' o3 l- B - char *dmabufsrc2 = NULL;
0 d6 c/ s3 Y5 ]8 P - char *dmabufdest1 = NULL;
3 Z. [4 E1 B: g! o$ [7 N) H - char *dmabufdest2 = NULL;- r# j2 ^4 v+ [ ^' \( p7 G
- ) \. ]+ U c& Q
- static int acnt = 512;
& d, X7 \8 w$ c, |( e - static int bcnt = 8;+ N/ x; G5 r/ K8 S0 z
- static int ccnt = 8;
- N; a2 j# U7 D - # o2 T, c7 |0 y. U F& Y
- module_param(acnt, int, S_IRUGO);
4 P8 n# b, a7 \! e9 L+ c0 N - module_param(bcnt, int, S_IRUGO);) [) q/ u0 L% [, T' y3 W
- module_param(ccnt, int, S_IRUGO);
复制代码 ' j+ x: [- `$ ?
! o2 h5 s5 I& K) ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* c3 V$ d7 G' r1 C3 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 e& Q: y/ z. c# U/ h" u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 z' @. z7 g% u" p# u( ]" a7 i Y) g* K+ X
& J; Z5 V% q: L: G
|
|