|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% o- `# X T3 M* B- [code]EDMA sample test application
' ]5 F" q: K* a1 y7 h5 Z - /*
$ ?( h$ N& c+ {# w& X - * edma_test.c
- m5 e T! v H - *
% |2 c; P7 ?. P$ v- O - * brief EDMA3 Test Application' g. Y) k, A; K* a6 Q/ g: [
- */ }3 h' @9 O7 K
- * This file contains EDMA3 Test code.
* x0 u' a6 `/ y% v# h) z8 s1 W, x+ v ] - *! A9 F9 U' Z T; S) L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% M; s9 S3 b# a" Z3 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. B$ [" p* {3 a8 L% k7 T
- * TO CHANGE." b) O/ X8 l* [* ]. V( a
- *2 O! j# o$ [' r3 A9 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 u9 F. H x7 ]7 `
- *4 R& N, C' q% r1 u/ R. @
- * This program is free software; you can redistribute it and/or+ B' W y8 {4 H5 \
- * modify it under the terms of the GNU General Public License as% g. V# e$ p4 M0 j
- * published by the Free Software Foundation version 2.2 T- }1 F; b$ ^* N7 {7 _6 a
- *
% d8 A, [ O3 v, S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! {& V8 _) s) G; _/ M7 ^
- * kind, whether express or implied; without even the implied warranty5 s$ o& Z) j* ?: U" @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& v+ A1 w& |- i9 v. {" g* h
- * GNU General Public License for more details.
9 E% @0 \/ { Q$ G. J - */
& v( a! [' j" o. B) o+ l - ' Y' h! v& O1 K- e* Z* r! p8 c
- #include <linux/module.h>1 x- W, y, T" n3 T6 O
- #include <linux/init.h>( F# S0 _3 p0 z# }5 ~+ @2 ~
- #include <linux/errno.h>
4 P$ z% R3 e. b, ?# D1 P& L6 \ T - #include <linux/types.h>
0 C" `" ^6 l: B# L& D - #include <linux/interrupt.h> w) w- P/ b" f( C
- #include <asm/io.h>
" b4 r M+ k2 A7 j - #include <linux/moduleparam.h>: e: }4 N$ K7 T! ^5 o+ U" m
- #include <linux/sysctl.h>
4 `# x5 H& i7 f8 [$ z u& H' i - #include <linux/mm.h>
0 U: ^9 P% d% {9 G) x( _ - #include <linux/dma-mapping.h>- T' c. o- L# w- H% c, M/ n
' d$ k. x9 B x3 g& M/ p; f( V- #include <mach/memory.h>4 l) a! x2 |7 l5 r
- #include <mach/hardware.h>2 e( [* V+ Z2 O% c" `6 z. ^
- #include <mach/irqs.h>2 t' b5 }9 }/ M, M0 a
- #include <asm/hardware/edma.h>
0 q# z- W0 o8 X. k
" {2 R2 n; m& S- ^6 R- #undef EDMA3_DEBUG
$ T# n1 B. `, y, l - /*#define EDMA3_DEBUG*/
3 s% U! n- A! J1 _+ }3 `: S
+ j( J }$ |- `& ]- #ifdef EDMA3_DEBUG0 v! _+ f) O& r. G# n% u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 }( X+ J* l8 T V1 L" H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& S* \8 |% m# O5 H( b5 D% ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 a7 R0 s, y! t* e: C; l; ~
- #else/ l( n3 V3 M( T6 U9 ~
- #define DMA_PRINTK( x... )
2 Z( v# ^4 }, y" ? - #define DMA_FN_IN
: C q5 E4 z" G; X4 x - #define DMA_FN_OUT
; G6 I/ e; E8 _+ m8 m% b( q - #endif
, C& l2 l* I) F
3 v/ H, ^- d% L, ?' K. h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 g9 ^/ x0 g. ~" q" P; e8 _1 G
- #define STATIC_SHIFT 30 A4 C. q, h5 @. Y5 j+ D
- #define TCINTEN_SHIFT 20
1 w- x0 g" T6 V - #define ITCINTEN_SHIFT 21
: v% Y, k4 A4 V9 Z! t0 k8 \ - #define TCCHEN_SHIFT 22+ ]3 ~+ p1 d O1 o4 q
- #define ITCCHEN_SHIFT 23
! H4 M" F* p( r( ?# ]9 X7 o# P" N - / l& Q- t; ~( q) [
- static volatile int irqraised1 = 0;
, M; e: _1 o. ?" q9 I( E4 P/ A - static volatile int irqraised2 = 0;: _& \1 T: J) [; c6 L, O/ a
. B! F5 B( ^/ x' P. V$ x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 x9 i) b- r3 `7 p9 j. Y6 V4 W0 G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 m' \0 O% g" ^4 x2 O0 y% c# j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( S& Z) E& N& ^) v# j
) ~: I- [1 q Q$ a% |- dma_addr_t dmaphyssrc1 = 0;
& r/ S6 h( e4 @! J0 `( P4 }3 F6 A+ Z - dma_addr_t dmaphyssrc2 = 0;8 ]0 G* _9 c+ |+ b7 I( ?& W1 g/ ]- g
- dma_addr_t dmaphysdest1 = 0;" q2 A9 N/ {! d% d4 t' m
- dma_addr_t dmaphysdest2 = 0;$ C& a, O( h* F- L, d$ U: d, i
$ P* h% Z6 u1 O" |5 {5 _- char *dmabufsrc1 = NULL;8 q& I, \$ ]0 a' p/ E% h" c8 q+ \
- char *dmabufsrc2 = NULL;/ @0 ~! ? V9 ]. f; q' _
- char *dmabufdest1 = NULL; O. F) q9 n; g0 M( a3 k
- char *dmabufdest2 = NULL;
0 p* L) V+ _& J. U - $ ^# Y0 a1 P- c: l) Y! R
- static int acnt = 512;
# }' x) S/ n: C0 p& `# L- p: I - static int bcnt = 8;
/ z; x; S( Z- P6 }1 u7 ^ - static int ccnt = 8; {* J4 V1 ]( D" h) H- a
2 ^6 X9 o& q% Y- module_param(acnt, int, S_IRUGO);
- v) E; t+ G* C' | - module_param(bcnt, int, S_IRUGO);' k8 t* ]9 u7 E3 C, y
- module_param(ccnt, int, S_IRUGO);
复制代码 # A, _+ w- N+ {/ _) H9 y
5 E" a9 k0 m5 }( a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 W5 P- `7 I1 W h; J7 G5 I) x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! V9 Z0 ~5 T& c% S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ I! C- r. \) @+ j" h8 u P
; i+ r6 r$ g2 ?2 @" V; a5 P& \8 q
9 k0 T! o$ o: Z c1 \
|
|