|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - p8 I9 d5 N' |. b; i" \ Y" l
- [code]EDMA sample test application* T7 e9 H7 M0 }+ `/ D; o
- /*
4 c& q. w# `0 ~' C: }- b: U2 ?% P - * edma_test.c
2 S: _% Y2 R- H9 P0 H - *
4 W! B9 A3 Q; _) q+ N; N+ A - * brief EDMA3 Test Application$ P2 b5 ?* ?) p. ?/ o$ p- a4 }
- *$ l- @4 f* ]8 a" ]7 V: d2 S7 {
- * This file contains EDMA3 Test code.
8 I9 b$ B6 C) {9 T2 N - *0 t7 K- D+ t7 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 P c% c5 f" H" |. T0 n4 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& e: P# m+ p i - * TO CHANGE.6 Q2 m" H+ |1 B3 y3 ^
- *) }2 m/ \$ R6 L u5 q" f+ @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* f9 ^/ Q4 _; y+ x7 z9 ~1 P - *
5 O( _3 ~3 r/ t6 v4 l9 h - * This program is free software; you can redistribute it and/or$ |0 M% h( F' p* e; z* n
- * modify it under the terms of the GNU General Public License as% u% B) V5 o! e' {& X
- * published by the Free Software Foundation version 2.% }$ k( |% h8 e3 e4 C
- *( {6 h, |$ d( [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* x# Z& N( R) m# E - * kind, whether express or implied; without even the implied warranty7 V2 x$ i$ G4 F; K a" p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# Z$ h$ y0 a; l9 @
- * GNU General Public License for more details.8 L1 a- k% Y- v- M& f
- */
: r5 F$ A: y( n7 n" ]" u( ]" k9 g
7 j. S+ Y# d' y# z7 c4 _- #include <linux/module.h>
- V/ s/ O9 Z9 R4 } - #include <linux/init.h>7 n/ P$ |6 J& v
- #include <linux/errno.h>" I$ \) _% w! ~
- #include <linux/types.h>
* p) g) v5 q" Q/ f/ e: ~) U! s - #include <linux/interrupt.h>+ ?% A* |! e; \
- #include <asm/io.h>! L) [$ k: \2 _2 E" Y* c
- #include <linux/moduleparam.h>
( s! s" i( ? y3 X4 q" e' ] - #include <linux/sysctl.h>
4 L. J' n% R2 U% Y - #include <linux/mm.h>
. n% ^( P! L. W: Q3 t: X - #include <linux/dma-mapping.h>
. \+ O6 M0 L2 a" [6 i
+ ^( t( s1 ]( V5 g; a- #include <mach/memory.h>3 ~: q) K) W, l2 ^+ A
- #include <mach/hardware.h>
$ R5 e/ g1 u- m+ u; Q9 X3 L, P, k - #include <mach/irqs.h>( n5 J; h4 u- \% }9 F
- #include <asm/hardware/edma.h>! k2 ]) a& v2 `: m3 K( u1 Y
- " g& ]- u0 W$ A. {" g
- #undef EDMA3_DEBUG8 T, c' w: Z2 Z' h
- /*#define EDMA3_DEBUG*/: ?3 \; O+ s0 `) Z+ Q! J% C
- - Z4 }# f3 t6 z- d; D
- #ifdef EDMA3_DEBUG
! o/ W0 x* G0 X1 Z# E* P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! @% W8 j. _4 o- g, X9 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) U0 |3 S/ ~: X8 O; P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 s$ @7 L# X; C- \, g5 l - #else
6 E4 F i4 Q- i& v - #define DMA_PRINTK( x... ), s" p: q; L w# O) S' _3 | r$ ]
- #define DMA_FN_IN: A0 s* s5 y f. q
- #define DMA_FN_OUT
( J& U. G$ a+ B# N0 _" B4 x - #endif' n/ k3 ?3 L% a' b- g
. g1 C" i2 X; n J" K1 J6 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 Y8 H* Q6 O7 |2 W, x$ g- |# m
- #define STATIC_SHIFT 3
( G1 c5 X9 h5 u/ J. {! h - #define TCINTEN_SHIFT 20- S$ g' d+ M; H7 b" u" c. r7 e% _
- #define ITCINTEN_SHIFT 21
0 B1 E* t# `' F; m8 ~9 z2 Y - #define TCCHEN_SHIFT 22
! r+ O; I4 S9 v, A' _% f - #define ITCCHEN_SHIFT 23, t# J* z. q( X
- 9 F0 h' M1 k5 z& P6 @! [7 [ [/ v
- static volatile int irqraised1 = 0;* I1 _# ^( y( j3 e& p% E4 T
- static volatile int irqraised2 = 0;7 W4 t: p1 q# `
- . n2 U, P' p5 y- r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, t- i& h$ v& h; [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M3 O) U# c) o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ]* \) I- H1 Z) b: `1 H' r; T
% y/ u# W$ W$ j- h- dma_addr_t dmaphyssrc1 = 0;
% t4 X i; o, y/ M% u; | D6 ? - dma_addr_t dmaphyssrc2 = 0;1 v! o/ u6 j: n& i
- dma_addr_t dmaphysdest1 = 0; |, Z% N! c; C7 m% _6 W; g2 x
- dma_addr_t dmaphysdest2 = 0;
, z& r5 I4 h( E( [1 y! j0 Q - 0 m# ^7 s5 l1 e
- char *dmabufsrc1 = NULL;
! i1 G }/ ` I& \ w+ ] - char *dmabufsrc2 = NULL;
& x% |0 V4 V o7 M7 f6 q8 d9 |3 @ - char *dmabufdest1 = NULL;( Q ^+ u# D& Z0 I2 k3 b* C4 O. V
- char *dmabufdest2 = NULL;, [5 d J' ?% ^/ D
- 4 ~/ a: l% J; M* M6 ^ x
- static int acnt = 512;6 l: w& d/ f+ u( U: ~# I
- static int bcnt = 8;
' g( X$ s; ?# o- u- T+ r3 Y - static int ccnt = 8;
# h! M- _* a6 [1 V! O" `
- k+ a5 s- _/ y5 c- module_param(acnt, int, S_IRUGO); ^8 L9 H$ H3 U& O+ k N5 P# E
- module_param(bcnt, int, S_IRUGO);6 Y$ t- m! ?1 T
- module_param(ccnt, int, S_IRUGO);
复制代码 7 h& w& C" H6 v& l
( i8 |" \! f) H8 m) P% P4 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 g* M. C& l0 T" \& u+ f( b4 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 ]) k* U" j( l2 i; f+ `% ^& L7 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. B$ x+ R5 \, C% L7 B5 x) X* Y: m& J
4 G) Q) i& I4 ^ i
6 [% |3 k: K( f* P
|
|