|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 I( l* S4 i) D. i* h
- [code]EDMA sample test application
6 h7 `1 S1 A3 P' M8 X, C% W - /*0 ~9 s; K* G4 S
- * edma_test.c
0 a7 h+ u e9 { - *
; T# P( \1 E5 P' m) H, R - * brief EDMA3 Test Application
* O3 ]+ | ^4 C5 F- L5 y - *" w' E% d: Q' o( `8 u6 ]
- * This file contains EDMA3 Test code., P( G. v$ l: D, ?' s( N$ C9 n
- *
* J9 h1 t( Z8 q1 l9 d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, V. w( l% K5 {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 ?4 f4 S8 A0 s: ^8 G
- * TO CHANGE.0 v* }/ H, m( B7 @6 }4 \- w& i
- *' c) q6 C/ G6 M$ a0 Y# \3 ^% ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 i' }& f4 F' h% q - *
7 P" C1 ~: G$ O7 _: o% T6 \ - * This program is free software; you can redistribute it and/or
; ]$ |. r/ y1 V4 v4 f% n - * modify it under the terms of the GNU General Public License as
8 a5 ?( A# B) J' p' J8 F - * published by the Free Software Foundation version 2.1 b% ~5 U$ V, ^4 o5 ?" v# R. E* ^
- *9 Z0 L; g2 w! G+ b7 K1 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- F. h/ ^( d8 N- \+ T& s
- * kind, whether express or implied; without even the implied warranty3 N4 g! S' A5 }% A+ n. o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 }3 ~5 l, f4 H, m- s6 @$ t l: S; r - * GNU General Public License for more details. m, T/ A/ a( c' n- v
- */
) W+ J2 a, b- F% J - & D8 \* r; B8 q% r. I
- #include <linux/module.h>4 A- m. Q. `/ @8 _
- #include <linux/init.h>0 J- U% P: z: ]$ Y# D
- #include <linux/errno.h>+ G4 @' S6 p5 \( n" W8 w6 G
- #include <linux/types.h>/ J! U$ K/ |% b* o
- #include <linux/interrupt.h>3 v/ q: k" C; p3 w7 c# _
- #include <asm/io.h>& m' s8 R+ J; E% L
- #include <linux/moduleparam.h>
9 C3 L1 Q( R6 J& X% k% B - #include <linux/sysctl.h>* @7 p+ V: p+ q" G8 Y$ v: {( j
- #include <linux/mm.h>+ I) _3 o- p* r
- #include <linux/dma-mapping.h>9 B0 \0 ^ B3 c7 E2 h
; h. c% r9 g0 r# ^- #include <mach/memory.h>% Y) H5 k8 w5 H
- #include <mach/hardware.h>
8 c1 `, l& B% l' k - #include <mach/irqs.h>0 K' |. ?& P7 u( H! c% j4 ?$ U
- #include <asm/hardware/edma.h>1 {; V# {( p' g1 \+ `
( ]- p3 J4 `2 j; B- #undef EDMA3_DEBUG' ]: B( q% ?# ]2 C/ y3 s# o
- /*#define EDMA3_DEBUG*/; M. q9 k0 d, w; U# n5 h
- 3 ]9 y) k. }7 N9 {8 \9 x- R
- #ifdef EDMA3_DEBUG
( A6 K1 V/ D0 @- G: \( [4 r! { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( D' k7 Y+ s4 V" {% O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 t8 P6 B* d: Y, U" r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). m% U5 n1 {9 Z: y/ a; n! y# O
- #else3 _" ^) Y+ y+ m8 b" W
- #define DMA_PRINTK( x... )
% |) N) D$ V0 w2 M( R - #define DMA_FN_IN
" ^0 O1 A$ `! Y3 g$ u - #define DMA_FN_OUT9 w2 O& K/ v4 }( s* X$ I! `
- #endif
# w4 N8 H* p' g" F7 |; h
a, w; Q$ P! }( C. s$ E; I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% z) l% C7 t+ a# ]$ I& j" q
- #define STATIC_SHIFT 3
- B, M8 @& @. q+ L, U0 S* I - #define TCINTEN_SHIFT 206 s, o4 u: s4 a- {/ {5 f1 u
- #define ITCINTEN_SHIFT 21- K) e$ l% {4 N% j: e
- #define TCCHEN_SHIFT 22& E4 ^0 D5 ?7 h) _7 M+ z8 N/ x
- #define ITCCHEN_SHIFT 23/ ^+ v& F& n, f; O. T! `
9 Y ^/ {2 p' r( [. _& q$ E3 ]- static volatile int irqraised1 = 0;
5 y9 N7 ^* C0 x9 n - static volatile int irqraised2 = 0;
2 n( l; s% v0 [" a# E - % s y% y8 P }5 [- R" G) Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 _1 x+ M9 [0 B* p' @: F3 k/ q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. P2 ?% V3 K) `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ | k4 ^$ K, B; Q - * ?/ K' F8 A9 b7 `2 ]- [; p
- dma_addr_t dmaphyssrc1 = 0;
+ a# r9 r) z. D. [% n - dma_addr_t dmaphyssrc2 = 0;$ c( M! _0 ~( i4 X8 ]+ T
- dma_addr_t dmaphysdest1 = 0;3 z. K+ m2 i, R& A/ |3 F7 G
- dma_addr_t dmaphysdest2 = 0;
4 r$ S) ^% k) J B4 Y - 2 l) u+ B* ?) F W
- char *dmabufsrc1 = NULL;
) T* i* _' o. |, e& F0 O6 [5 ~ - char *dmabufsrc2 = NULL;
: e* ?% Q. o' q$ B - char *dmabufdest1 = NULL;
6 o; D2 H7 x: Q4 S! j - char *dmabufdest2 = NULL;6 w# ?% O% l3 u Y+ b& a
- 0 ~8 |9 u/ w$ Z8 w0 @% R
- static int acnt = 512;
: w+ m& J5 g1 w1 q - static int bcnt = 8;
; M. C# V9 Z( q - static int ccnt = 8;5 J% N9 X- K3 N7 | ]# h3 ]; k
- * V4 ^8 T1 ^, ^7 F5 a3 K3 I
- module_param(acnt, int, S_IRUGO);- [. F2 N6 @* C& f' X9 }
- module_param(bcnt, int, S_IRUGO);' H9 C) r/ G& K; Z9 O
- module_param(ccnt, int, S_IRUGO);
复制代码 6 r& i1 b" k- ?# h
1 B( E1 l8 s' Z9 F& y6 X. y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 l/ ^0 Y+ R: Z/ barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% o! F( b6 X* O6 U9 ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) C* @/ `2 @/ ]6 B; X7 `5 Q
- p: n) e; V8 ]6 f* e
" _! E4 C# l8 K! d
|
|