|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' d- @8 ~! t# \+ h
- [code]EDMA sample test application' A3 W @( k z
- /*
9 z D2 V6 L$ ^ r, O$ H - * edma_test.c
4 @% P$ y- \. F, K. t* [ - *
) y" q3 z: L. I. i; G7 a) \ - * brief EDMA3 Test Application
2 T7 M3 l- Y2 v w" L! w - *
! \0 H' W. D; E* o+ z) j3 t* R - * This file contains EDMA3 Test code.
; O( b3 j. x5 v' c: }$ v) M - *6 B8 ]# A- k& J8 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ h7 o5 f) r# ~3 V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 r# B9 `" R+ T( V# u
- * TO CHANGE.
/ t2 s2 ?- c8 K. _0 k - *2 B1 ^4 {( w4 w$ ?. p& M$ H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 s& t2 r& m$ H" z1 ~
- *
8 ~4 k& d: U7 `9 F' H x9 Q - * This program is free software; you can redistribute it and/or
" U3 ?' c; Q2 f - * modify it under the terms of the GNU General Public License as
& { A( a. p$ a! G - * published by the Free Software Foundation version 2.
$ I- z: Z5 U- A) e& J% M% Q! q - ** j# w" J% B7 q# ~4 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ X7 Y. B1 q8 z; N2 {% d; i
- * kind, whether express or implied; without even the implied warranty
7 Z$ n! e7 {$ _2 j' r- Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. W6 N# _; k8 {: ^2 E1 | - * GNU General Public License for more details.+ e5 N2 a+ j; _) \& [' a3 ]
- */2 c" P1 n( R& Q5 p+ D# N+ f( {
- 8 u: H. Z/ n# T" S
- #include <linux/module.h>
3 Q% A$ d% Y3 d& r2 c. B# d - #include <linux/init.h>
# U7 ?# |; `$ O/ } - #include <linux/errno.h>$ S* ` k( B4 y; E
- #include <linux/types.h>* P8 y# h' j4 S
- #include <linux/interrupt.h>: c6 f: F* U$ S& a+ ]
- #include <asm/io.h>* l" d' u- `& w8 L
- #include <linux/moduleparam.h>
' P3 S0 n D8 r+ E$ f! P5 ]3 B - #include <linux/sysctl.h>
. M/ h& W! b6 A$ d7 P2 r - #include <linux/mm.h> D$ i+ _2 M. t3 j
- #include <linux/dma-mapping.h>. a/ ~5 i9 X) o
- ( S7 |6 |( K* K6 P7 D: x
- #include <mach/memory.h> }/ s) Q' \2 v3 V7 B) o4 Y
- #include <mach/hardware.h>0 t3 k: L2 a; Z7 b% ]; R2 k& I5 M
- #include <mach/irqs.h>6 I; ^! F6 Y8 V! f: w
- #include <asm/hardware/edma.h>- L) u# {6 ~3 b! @
6 m7 E" S+ j$ v- #undef EDMA3_DEBUG) \1 Y- X& o% |1 k/ e5 e0 K6 Z; q
- /*#define EDMA3_DEBUG*/$ a' k) A A! N8 J+ X: _8 }0 b, u. \
- # n5 w/ Y& e. J$ q- k
- #ifdef EDMA3_DEBUG- Q. \# R, x! t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 w. W. V( @% `% c7 \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& l: }& x+ z& _( x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 N1 _: |6 F0 P6 |& { - #else6 \+ Y5 f. R K+ I1 w" y/ h% \
- #define DMA_PRINTK( x... )& e; M* f( z m, m
- #define DMA_FN_IN, }+ T- D# g" T8 I9 W& @
- #define DMA_FN_OUT
; {) j0 b/ ^/ W - #endif
' Z$ z8 [7 C! b+ Y
9 J1 J; D0 _, {5 t7 K/ }; n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! h/ T E# p: q& }9 a - #define STATIC_SHIFT 3. \' h. N0 Z, v! g; V* ?
- #define TCINTEN_SHIFT 20, Q4 o! q9 j w5 I8 A
- #define ITCINTEN_SHIFT 21
$ R4 I$ H8 M9 c* ~% x9 q7 _7 g4 H - #define TCCHEN_SHIFT 221 `2 C8 o, n1 k2 q$ z, Y
- #define ITCCHEN_SHIFT 23; E0 s; T: h/ L+ B7 I0 d ~
- b( x$ y* h7 ` z: @8 G& \
- static volatile int irqraised1 = 0;
4 |# h! e( M: u; o1 D - static volatile int irqraised2 = 0;
, F, F$ u/ X2 O. v* |& S% _3 s6 D
. Q" R H9 M1 B6 H! E. |& N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ t) X' S, s% D; ^9 }. a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 B* l& m8 I, |: p( t" W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Y) F( u t; ]
- 6 c" k( p, h! F. }4 U0 Z% `
- dma_addr_t dmaphyssrc1 = 0;% p! I% I% ~" l- Z4 Z8 \
- dma_addr_t dmaphyssrc2 = 0;
. b( o, X, C8 H5 h$ W$ E' Q( e - dma_addr_t dmaphysdest1 = 0;
9 M3 j: o6 a, L4 q! q - dma_addr_t dmaphysdest2 = 0;/ z- N0 v4 N$ {1 E. y
$ V, w3 H Q- V- char *dmabufsrc1 = NULL;
, ~0 y4 M& F$ N/ @3 u; ]+ W: q) } - char *dmabufsrc2 = NULL;0 a4 G9 D" k$ K8 _! @# Y
- char *dmabufdest1 = NULL;9 j( s% i2 Y2 Q/ s+ q3 @
- char *dmabufdest2 = NULL;' o; S ~- V) H
% [' C/ B8 ~& N. p! h) W1 t U0 n& g. P- static int acnt = 512;
* }: d" n N' |" V9 p N2 T" C; ^- l - static int bcnt = 8;
7 {- F. n5 S& }1 B9 t5 y+ S - static int ccnt = 8;6 ~* X" d e! x" C$ S
* j( u: R5 @* P# T; R3 F2 u- module_param(acnt, int, S_IRUGO);
@& { C( A' o) {# c - module_param(bcnt, int, S_IRUGO);
! f7 ?+ V t: F: u6 g- ^+ Q - module_param(ccnt, int, S_IRUGO);
复制代码 $ ]. O7 O0 ?# z4 Y, j/ B+ `
; b' g0 _) a+ l& b- [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 V4 w* o8 W y+ \. c. Uarm-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 d5 Z) |7 N# h( b+ Q3 Z! T8 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. }6 x7 \6 K0 m( u! R0 i
3 e6 U5 \+ e& J6 h
0 n0 c- l& r8 `( k6 J9 k2 e |
|