|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 S1 [# y R; z
- [code]EDMA sample test application
' A9 n2 N/ h1 S8 k: L S1 P3 \ - /*. I% i6 x$ z- h! t
- * edma_test.c2 D, m1 J5 y; c
- */ ]! a U- f# E9 }8 e( l, R
- * brief EDMA3 Test Application
: @: P6 `8 t) F# ?5 N - *
V6 B/ c: t) u" i; [( L" C - * This file contains EDMA3 Test code.
+ f( B& C+ t0 G, m - *
* Q- Q0 B* \1 x; F) k( ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! _' s9 r3 Q/ U( f0 m, U& T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 M6 D# }- Y& I" u - * TO CHANGE.
y( @4 k/ e0 A" U' v4 E& { - *
$ _+ A4 h' |* Y: B4 H7 c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' @; B3 k& l8 P1 z6 e8 W' W& {
- *3 O! F7 G4 g) ?! d* }' r# g6 e
- * This program is free software; you can redistribute it and/or- |7 e" n- {: I( |( O
- * modify it under the terms of the GNU General Public License as
% l; G% j! s8 L. P$ ]# q. ? - * published by the Free Software Foundation version 2.
" p* j+ q/ O0 V) K3 |5 [ z, h7 Y - * a) L- E1 X. |9 ^5 t+ P/ U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
F2 y. B' B+ I) {$ y - * kind, whether express or implied; without even the implied warranty
" t( n( i$ {, } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. h7 s, j% p8 w
- * GNU General Public License for more details.
- J' M! q- v# v5 X - */
, U) k' }( X1 d- l0 a9 _8 B3 O' ? - * e/ [' b. O( u3 R% _: d5 Q
- #include <linux/module.h>/ d6 H& M! E: b! W8 `- o
- #include <linux/init.h>
6 T5 d" M, @5 {7 y) \( L - #include <linux/errno.h>
- q5 e: h, A* v2 Q& l0 Y - #include <linux/types.h>
/ M7 i% X/ c. N% Y: Y! a* q - #include <linux/interrupt.h>
( T: X+ ~7 X/ R y - #include <asm/io.h>; p0 T' [" P% o- R* ~( F
- #include <linux/moduleparam.h>, \6 V7 a; z3 D) o; P f
- #include <linux/sysctl.h>) P* U4 X! b. k& r1 R
- #include <linux/mm.h>8 h) w0 O. L& w% K
- #include <linux/dma-mapping.h>5 Z$ n' V& n" P4 \
- : X7 O$ J8 n& w! O. `9 n( d
- #include <mach/memory.h>
' Q6 K/ h% o/ l2 U9 W# D$ s; a) N - #include <mach/hardware.h>
1 ^6 j8 p9 \- h* x5 Q8 e - #include <mach/irqs.h>
! E; |8 ~+ G+ S7 O - #include <asm/hardware/edma.h>
- x; o! ^+ F2 k+ N7 O - 1 Y/ a( Q! H; x# }
- #undef EDMA3_DEBUG: ?) \2 ?4 m- W
- /*#define EDMA3_DEBUG*/
7 t, ~/ c! R2 w Z% k0 D+ r
- L/ X: X. N0 Q! f- #ifdef EDMA3_DEBUG, N7 g0 D: x" J4 ~" v1 Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ c0 w v% F$ e- {9 R: U/ b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Z* H7 [2 ~+ N7 s% d6 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 G( v. \6 B1 E- [0 d - #else" ^* J Y9 c# ~- F# e7 \
- #define DMA_PRINTK( x... )$ r: u2 L8 t" ]) {! v2 q
- #define DMA_FN_IN; ^! B- d3 ]5 m5 _ l
- #define DMA_FN_OUT
& H9 d3 ^6 Y( T5 S - #endif
+ \# ]+ |4 q3 M4 a6 M - ' j/ L; j3 ?, B" M+ S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( D% E4 [1 N( n; p, x
- #define STATIC_SHIFT 3
4 [0 _: h b) N+ e0 [1 w8 a - #define TCINTEN_SHIFT 20
0 Z1 v* ] [$ c - #define ITCINTEN_SHIFT 21
4 p; n* s$ b7 T - #define TCCHEN_SHIFT 22
$ j; j% H8 F; @% z% t5 _ - #define ITCCHEN_SHIFT 23
+ q3 k$ l6 ^! g
0 ~, T: @+ ~( ?5 a$ Z" V2 U* v- static volatile int irqraised1 = 0;$ o% O* K' n+ k @4 }# `) g, D
- static volatile int irqraised2 = 0;
: i) U2 F7 h. a - - x) {( E* e1 X8 H# b* O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 o% a9 }3 q, _0 b( Z' {2 b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, p" Z8 n( J3 k" S* c. ^( \5 g& | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 y) L# ]1 c7 y3 \4 H
% m+ G1 U8 P3 m7 }- dma_addr_t dmaphyssrc1 = 0;
B- I- ^' ]3 l9 V, ~0 k - dma_addr_t dmaphyssrc2 = 0;
* C+ `, O& Z( f - dma_addr_t dmaphysdest1 = 0;
# ^$ x- @( M7 k! Y# ] - dma_addr_t dmaphysdest2 = 0;
. P, U/ g/ {9 d2 R& p: I9 w - , V" P ~7 J. y& l' u
- char *dmabufsrc1 = NULL;
/ I8 l4 j5 E+ q - char *dmabufsrc2 = NULL;/ ]' q y y4 ^
- char *dmabufdest1 = NULL;- ?+ }0 H- Z) [) h; i2 u
- char *dmabufdest2 = NULL;
! K$ N+ V3 x0 u$ k - 3 N! M2 v& Q& J; k. M5 b' L* s
- static int acnt = 512;
" j* s( f) y/ }3 H2 u - static int bcnt = 8;
: E+ r7 H7 C& z - static int ccnt = 8;
4 j' H9 ~' ]. V1 z9 E* N - ( y4 g( Y1 E' u/ C% N9 }
- module_param(acnt, int, S_IRUGO);
2 g! ^% C9 w% P - module_param(bcnt, int, S_IRUGO);: s! ]5 Y9 R- a! V- _
- module_param(ccnt, int, S_IRUGO);
复制代码 2 K8 ^4 U; h1 K
/ u, `+ j1 U+ b" ^2 j' m& T/ Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 ^2 f. j W( e1 m; X; garm-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 g& z5 |; w# a& Y5 [% \# r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 y4 V; ?* }# E2 z( S7 ^
9 D4 |/ y( a( e' D3 v3 M: [, c: [) Y3 A3 ?2 l9 w; N Y; j
|
|