|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 d4 `" m; \# C: I% F
- [code]EDMA sample test application& p8 b( _* J3 U$ H8 |# D0 r1 M+ i
- /*- P0 G8 }4 ?) N: `
- * edma_test.c
' j5 A* N, ?: V p' |8 h' R - *
+ Q) b, k+ t6 b# h7 G6 ? - * brief EDMA3 Test Application
- d- m" |: K6 U - *
2 D* V+ N- Y& O0 O/ B0 s - * This file contains EDMA3 Test code.
* n. j6 q7 _0 N `/ i - *
/ L, B2 [1 t# r' a" x+ N; V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 s$ q5 A) l; D; J; f" B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! z# ? t1 l: J
- * TO CHANGE.* d$ | P4 e/ A$ U
- *6 s" j# d/ F" ^+ A6 J9 c7 R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 W6 W6 ?/ P) ` - *
! k% v. ~4 @2 x: b# o - * This program is free software; you can redistribute it and/or$ `$ M) A3 L v# n, R& {
- * modify it under the terms of the GNU General Public License as
) U2 j' x1 C4 f - * published by the Free Software Foundation version 2.' R9 [: N( q h, O, U
- *) i9 c; P# Y. p$ J& }- i% F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 o& M& ^- T% j% s1 W+ j+ p; r - * kind, whether express or implied; without even the implied warranty
% B/ M+ t, B! V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 n8 b" e a3 M: q
- * GNU General Public License for more details.
% ]8 S. P( \" V8 x# E) l% d - */
% Y |% }4 {7 s* c6 @! a/ N" @ - ' n0 p" E6 p+ o; j( Q8 x' j
- #include <linux/module.h>
( i/ _, l, g( L" \8 W! z - #include <linux/init.h>1 f3 {4 F7 o8 J0 G0 ]) S$ {. X
- #include <linux/errno.h>
! j) x. A$ Y3 u; y% f4 g8 V - #include <linux/types.h>' k( e6 ~2 j% G- p$ I
- #include <linux/interrupt.h>
$ I. w, J8 Y$ z: c. a( z - #include <asm/io.h>
5 G# D" ~, Q1 ]0 }. x. z - #include <linux/moduleparam.h>. R. P* D$ p# h
- #include <linux/sysctl.h>% Y; A4 ^# |: B2 m+ t
- #include <linux/mm.h>
3 q7 K: G6 }/ X" }% v& U( t% v1 t3 Y - #include <linux/dma-mapping.h>4 L% m" R) u- h7 Q6 i; s
- , N/ y$ N2 c4 ^) R6 U) E/ |7 O3 V
- #include <mach/memory.h>6 A; F" e) l4 D2 ~7 K
- #include <mach/hardware.h>- M. j1 t# m4 k' C' o
- #include <mach/irqs.h>& v+ A q" H5 Y
- #include <asm/hardware/edma.h>$ R" ~* ^/ b+ v$ K: t! D
- ) {- i) Q8 Y& d# K8 x. m0 s
- #undef EDMA3_DEBUG
3 ]: }1 c& X+ V( ~& O - /*#define EDMA3_DEBUG*/
2 D, S$ N& ~ Q0 f - 1 ]; M* l5 R) ]* b y
- #ifdef EDMA3_DEBUG* F% h$ \" }7 K9 p' G: w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ J4 {8 H4 {/ m# P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* W: @2 w! w( s; T- ^$ r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 d$ S3 n5 B2 j( B8 X+ e2 g# e
- #else. j4 ]5 G0 y2 W/ ^
- #define DMA_PRINTK( x... )
" |- ^/ s/ B! g: w# ] - #define DMA_FN_IN! [. n' ~/ Z$ D0 w8 g5 t5 W' h
- #define DMA_FN_OUT
8 n5 z4 M4 j8 `( B2 A7 V - #endif
7 ~$ @& O' Q5 K% X: G0 o. o1 Y& G
8 [3 \" M6 s/ ~6 o- E/ i$ [! d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 }! V5 ~7 y5 f
- #define STATIC_SHIFT 3
/ G( T% Q1 d2 u% N' L6 [ - #define TCINTEN_SHIFT 205 P* ~7 t& }3 t9 \
- #define ITCINTEN_SHIFT 21
/ Q M! Z5 e5 K( ]. C) N% J' Y - #define TCCHEN_SHIFT 22. g# ?& n s( K+ e
- #define ITCCHEN_SHIFT 23
" \1 l# E/ L" m% y3 C% G4 J
# p# d; K* U2 w; u) F: R( L- static volatile int irqraised1 = 0;
( b, m1 o/ d% T! o - static volatile int irqraised2 = 0;4 p( {" ]- l) _9 A, t
/ g; V3 n- z6 f. e* u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 P" b5 i1 i: F5 d# G- g7 |( |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 M8 H/ f, U) z, h9 R: ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 G/ v) s& c' a. e" ?$ r1 H
8 b' P+ T: B1 W# O- S- dma_addr_t dmaphyssrc1 = 0;5 C3 T; P `: i- p
- dma_addr_t dmaphyssrc2 = 0;: L9 \+ A- P( F8 b
- dma_addr_t dmaphysdest1 = 0;4 j' Y( w$ q, U7 l2 [
- dma_addr_t dmaphysdest2 = 0;
) n% g( I7 Z# T- \ - j1 c2 j# H' a4 U9 k Z4 \% K
- char *dmabufsrc1 = NULL;! s2 O1 X2 s! x1 o7 b: I
- char *dmabufsrc2 = NULL;* N# b/ K: F' o( A+ F& I
- char *dmabufdest1 = NULL;
( k: B+ g4 J$ U6 K - char *dmabufdest2 = NULL;
! @. W% _$ m7 q/ z - 2 U* T$ _- @8 Y9 C8 g6 N9 t K
- static int acnt = 512;
/ p" G, p$ B" R - static int bcnt = 8;: o, g* s' V; W- J4 a& |+ U
- static int ccnt = 8;
% }1 A$ l/ t; D3 Z% L# i - 2 i7 z+ A \5 z2 L1 t
- module_param(acnt, int, S_IRUGO);
' S- _: B5 k: j0 s5 I - module_param(bcnt, int, S_IRUGO);$ W& R/ o1 f) U5 E( y4 x9 I* k
- module_param(ccnt, int, S_IRUGO);
复制代码
6 m" `# p/ f- o1 g' |6 o& O' L. d8 C- Q a; @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' ?) k# b: U/ X8 ]( Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 D& g+ t9 ^* f, r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 e0 w# t( C0 w$ |. M8 q* D) M+ k. M, M! R2 ^
1 t5 P, P- k. v$ ~
|
|