|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 K1 `) Z8 l% Z/ d4 T- H; v
- [code]EDMA sample test application$ P" J( \# i" r! U9 o
- /*
0 _/ L. x9 Y* ^( X. W5 } - * edma_test.c, `( ]$ Z* n: V5 X% \
- *
/ y9 ]# B& |- Q& D - * brief EDMA3 Test Application
% m5 D. I' u* U) c2 H6 p5 A - *
6 M$ x- [7 ^- q. { [ - * This file contains EDMA3 Test code.
$ f1 Z1 b9 b! k% D3 s - *) O. v3 k- z8 e/ X, M, ~. T( p6 ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 U( v+ I' E9 t) T* [- I a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( g! B9 Q2 F3 ~0 d - * TO CHANGE.5 d5 l/ J; N* e
- *+ A) g7 I/ C, j& m9 d2 a, t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& q) O$ g8 d0 U: j6 k" [" J: c
- *1 q( A6 V! T( k$ `) T( l4 o
- * This program is free software; you can redistribute it and/or- q, N6 {0 N( S' p: [& }( G: Y
- * modify it under the terms of the GNU General Public License as
# z: ]4 s7 A# E0 A6 G - * published by the Free Software Foundation version 2.
( p* n% \) a' g3 a8 I5 y - *
. w2 @( A" f* a+ h4 _5 c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ G" i2 A+ I$ z4 I1 _; P
- * kind, whether express or implied; without even the implied warranty
, u' u9 q+ o8 W" X, P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* |- \7 g+ m7 N7 Y- Z - * GNU General Public License for more details.8 i- T' n0 T" W$ I3 M; o
- */* D, m4 e) Z2 I* |3 y- S
- % t0 g$ g0 }( @- I+ v+ [
- #include <linux/module.h>
" r5 T1 b; R1 y4 l: A1 P# U& h! s7 Q - #include <linux/init.h>
! V, N! O Q! D" d - #include <linux/errno.h>) w5 j/ o' p- R; b) u: M
- #include <linux/types.h>6 D& G& }0 b3 d% X9 o( Y
- #include <linux/interrupt.h>" _0 x$ Y2 [+ B5 i$ P& r& @
- #include <asm/io.h>% I4 G1 n8 r6 ]7 {2 ]' K
- #include <linux/moduleparam.h>
! _( h& ^: A! H: N+ _ - #include <linux/sysctl.h>
7 m3 W2 B3 P2 K0 \+ b' g - #include <linux/mm.h>- O) x0 l5 K2 [, S( T
- #include <linux/dma-mapping.h>/ V i5 N7 W/ J4 _8 @
- & V, ^+ @. N( {" v, r8 `. e5 @
- #include <mach/memory.h>2 }- c% W b8 {, A# V$ Z1 {) m( d
- #include <mach/hardware.h>9 q9 ^0 ]% n ^/ ?4 b7 ]" Z7 l
- #include <mach/irqs.h>& U( n/ M: J9 a' @( |% m, ?
- #include <asm/hardware/edma.h>+ F% h7 @# y5 ]0 G' t
- ' J, D' {$ v# E5 E
- #undef EDMA3_DEBUG
S1 b) v7 `& V$ g* o- _ - /*#define EDMA3_DEBUG*/
, o, Q: D8 d$ J, c2 e
* Q# P0 I1 U8 n$ h6 u, p8 g+ K* r- #ifdef EDMA3_DEBUG( c6 I/ H0 i, ^5 v! Z' g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ q7 _0 O4 ]2 L# R! _3 d; | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 q* `& C, V/ e, ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 y! o7 P) m/ K1 t" p5 v3 ? - #else
* c6 t. Y+ r, s' b" Q( @ - #define DMA_PRINTK( x... )
7 L3 r1 ^; }6 z6 t1 d; a, |: ^ - #define DMA_FN_IN; Z4 L2 f: V- \3 }# A8 ^5 O
- #define DMA_FN_OUT
7 D0 z6 B4 y$ H/ h$ | - #endif
6 S6 C. H# H6 k) C! e+ D0 {7 ~
( X6 g. j$ {9 A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 T) {) D) H4 N0 _/ ?2 y - #define STATIC_SHIFT 3
5 Z7 D( K: V' X0 K' t+ o - #define TCINTEN_SHIFT 20
9 m4 n! ^1 \. y7 I, p - #define ITCINTEN_SHIFT 215 ]; n, N$ h8 j2 i6 s5 c: |
- #define TCCHEN_SHIFT 22
* X4 a2 m: x3 V9 @3 U& B t& _ - #define ITCCHEN_SHIFT 23
P8 C* B! {1 S' }8 \7 t' w - * l% I; A+ X6 r6 J/ R
- static volatile int irqraised1 = 0;' @0 c9 e) Y' }) ?/ _- Z% a4 Q8 b; j
- static volatile int irqraised2 = 0;
0 s, k! }$ {6 _, ^( E4 J3 q- p
$ @- Z; {5 u- g q( x% p- R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ], Z+ x, U; W! ?8 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 R) m' f( W0 K- E2 J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. u3 A, i0 e" m0 L* R. } - # F7 Y1 S. f' T. R: }
- dma_addr_t dmaphyssrc1 = 0;
1 ]) j1 K5 ?; R6 |. l - dma_addr_t dmaphyssrc2 = 0;
- X+ O1 f$ \/ w% R6 O6 H9 K' { - dma_addr_t dmaphysdest1 = 0;
2 Z0 D0 h8 Q3 z - dma_addr_t dmaphysdest2 = 0;
7 u+ d3 s. c7 ~" r( O; V4 O! T. L8 e, ?
9 [) }; y1 g4 k4 M. I' O0 R- char *dmabufsrc1 = NULL;4 H/ X; Z" r; B$ K
- char *dmabufsrc2 = NULL;$ H! k/ B( A' f9 S' j
- char *dmabufdest1 = NULL;
/ D h) R$ F9 D; P: ] - char *dmabufdest2 = NULL;
) u5 L7 }0 E9 n8 J0 ]% \" }, s( ?+ c% ^
) z$ T0 g/ ^+ p- ^ t+ c- static int acnt = 512;
% M8 ~1 P0 f3 [ - static int bcnt = 8;
( R, Y# v3 f; g& t. O- u - static int ccnt = 8;
; i0 B7 e0 n0 o: V
. A e9 S+ R2 w0 n9 b0 A) d( T- module_param(acnt, int, S_IRUGO);& j8 R5 `5 e3 b2 X/ M+ H
- module_param(bcnt, int, S_IRUGO);6 }0 g {2 L& s9 p$ {, U% T
- module_param(ccnt, int, S_IRUGO);
复制代码
7 W) A( t! Q- ]5 A" ^5 e6 q8 O+ Z( J
: Z+ q& ^0 t: q2 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 _' l: X, I: i6 w/ m0 \. d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; C0 _ z# f# J" K8 l7 n: x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 l! O% O* K+ h# W8 C3 \% h0 z+ H% |5 n# l( x; l) n9 a# {
. h7 _, K1 Q9 H, A4 G9 T' M3 o6 c |
|