|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' V; v9 z+ O: t
- [code]EDMA sample test application. D4 ^6 b2 x" X- ]
- /*- C" u# w* f" u+ B0 ~" A& Q
- * edma_test.c
, c+ ^* F K5 } l% ] - *
% O3 S5 Z0 f0 C1 k2 B1 P - * brief EDMA3 Test Application3 I- H6 Y; b) {6 s8 u- n f* i7 g8 G
- *
; D3 K! L9 P7 e: V - * This file contains EDMA3 Test code.
$ }! t# r: G$ A( L - *
/ H0 W3 m) ~* s. c E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- X n5 U+ |7 p8 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ ?* i) c4 m+ Q W) v
- * TO CHANGE.
: h+ v/ v- e* { - *& L h5 I. H& j" B, w& w2 u5 b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 A8 n4 L" h9 }6 O5 g" R2 V1 H5 W( V, k6 C
- *
3 e- [+ g8 i0 m& F, n" n( O - * This program is free software; you can redistribute it and/or
/ p" g3 t4 ~8 W: Y0 b - * modify it under the terms of the GNU General Public License as
- I- S: B( w3 d2 W# J% X0 v - * published by the Free Software Foundation version 2.
( O8 P& J: `% s$ y - *
! |6 } G; T3 N! s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 B2 ?2 ?4 M: ? E - * kind, whether express or implied; without even the implied warranty' ?- p8 f( M; ^, n' B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 E. R4 n" I2 n+ b* [ - * GNU General Public License for more details.4 u3 V3 ?9 _8 A" G# C
- */
* l: G( @" k$ V& ?5 W& m& ~9 _
5 k( a6 Y0 p) J4 l; `. x- #include <linux/module.h>. Z, P; b/ E* k5 y4 x
- #include <linux/init.h>
4 v/ Y7 u O- f# } - #include <linux/errno.h>1 R" R; d0 o6 K3 N7 a
- #include <linux/types.h>
^( @8 \+ \% D3 B8 g! |7 X - #include <linux/interrupt.h>
1 ?1 s+ p0 L0 P" m' Q- E2 c - #include <asm/io.h>, @; e/ o9 z3 W& U+ `2 ~% d2 y
- #include <linux/moduleparam.h>
6 A p6 F9 \% G+ E. y3 ? - #include <linux/sysctl.h>) ]$ @# ]' @/ L' U% O) u* f% @
- #include <linux/mm.h>" `3 s' j6 v& [0 b
- #include <linux/dma-mapping.h>
) J) Q; [; |/ a$ |' N; L0 ~7 ?) q; f - 4 W: }& ?; B9 ~& D* p: u ?1 L# z
- #include <mach/memory.h>9 V M$ `8 T4 [
- #include <mach/hardware.h>! N4 i, ?7 [; z" g
- #include <mach/irqs.h>
: f0 @7 _! o h1 w - #include <asm/hardware/edma.h>. e' O) N8 a* I: }9 W/ q# r
' H1 X4 y% D0 u! N8 K- #undef EDMA3_DEBUG
/ u& w" P8 d: ~1 |6 h" `" i; z0 } - /*#define EDMA3_DEBUG*/0 s! [& j- [, W! _
, V2 x$ a: _. \1 E: _6 y- #ifdef EDMA3_DEBUG
O3 b# U( D" [& x! q X+ \2 H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: m7 Q5 k0 h; m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 c) [7 ? S2 ]+ j4 k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! v! B) u9 k1 i% |" E - #else) \9 `7 a4 f, i! D
- #define DMA_PRINTK( x... ). \" B9 H0 A7 P; ]
- #define DMA_FN_IN0 `1 g l7 L4 C& d# i) e
- #define DMA_FN_OUT+ U7 |$ N& A' Q+ S9 O2 I. b. X! f
- #endif
/ ^- g. x- X" p% t7 a - 5 y4 Y0 V# o6 |2 O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# U0 K, c) \4 |9 w0 T7 q5 x2 X - #define STATIC_SHIFT 34 a2 K: V6 o+ U* H9 P0 V1 A' Y( b
- #define TCINTEN_SHIFT 20
4 m7 o* f! [1 [3 } - #define ITCINTEN_SHIFT 21# y4 m( R; D& g; x
- #define TCCHEN_SHIFT 22
/ N, O: r0 s- Q( J - #define ITCCHEN_SHIFT 23- j& c5 k3 N/ v7 E S
4 u( P! L. f# ?0 l+ u5 }- static volatile int irqraised1 = 0;
+ N3 g7 Y5 D* @) N7 V% e - static volatile int irqraised2 = 0;' `# q" H# Q' T7 H! C
- ) D. l, _6 [; Z! e5 C, V$ Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e! L% A$ `. X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- J& q7 e) P% u; t. E) K% j# T6 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 A( ? h6 i# V3 y% `- N
\- }& {$ |) ?( E- dma_addr_t dmaphyssrc1 = 0;! P( e0 n" P8 ~
- dma_addr_t dmaphyssrc2 = 0;
" S; J% ^/ v8 t1 g% u0 C - dma_addr_t dmaphysdest1 = 0;
# g% }1 q0 X+ L6 z - dma_addr_t dmaphysdest2 = 0;7 @( } a9 {! a2 K! m( }
5 |" Q" d- ?) H# [- char *dmabufsrc1 = NULL;! U1 z3 h1 [! G2 U
- char *dmabufsrc2 = NULL;
- Q+ ~ x ]' ^0 M" i3 \ - char *dmabufdest1 = NULL;/ O/ `; R. t4 L$ f: N
- char *dmabufdest2 = NULL;) M/ m9 E& e2 l: d, J# I
- : |8 {3 Z6 |7 M. u/ t
- static int acnt = 512;
! @8 O/ Y/ o' ]" ]) ^# R- e/ b4 m - static int bcnt = 8;
: K7 D6 z0 T2 r - static int ccnt = 8;+ @2 v- {9 B p; Q, I# N
/ p' ?) H$ F* d* p4 |* {4 [' o- module_param(acnt, int, S_IRUGO);- }$ w! u+ g; {, A+ |
- module_param(bcnt, int, S_IRUGO);
; v* R, q+ }4 a( [ - module_param(ccnt, int, S_IRUGO);
复制代码
; k" ]7 f( W0 K9 b/ R4 J7 u% A% d( }+ S- v* O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& C( o* ?* w0 [1 P3 f! g8 v7 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 R" y5 Y' p( |; L9 g. D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 s+ f/ K9 e5 K+ `1 E0 t5 B0 |' T" E& ~5 m5 }$ v
2 Y; w& m. o. @ |
|