|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 \: Y2 a; k$ v- [code]EDMA sample test application5 x" n$ @# A ]- a8 b$ t2 s% W* E
- /*
0 e: }1 C; K( T$ C7 W" ^) P - * edma_test.c
" B- W' p! y7 l* B; e0 L - *
9 R. {% V" V) B: B8 K$ T - * brief EDMA3 Test Application7 G0 J8 g7 U. W# n0 f6 E
- *
! \$ {6 ?5 K4 }' u4 j& L7 Y# n - * This file contains EDMA3 Test code.
5 g4 K% F9 |/ ^. ?+ S6 | - *
! Y, {* g' P! p: z, X8 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& ]" j: M$ R7 ~- d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. Q; {/ Y* {% e
- * TO CHANGE.
# e$ X$ a$ \9 g" ~9 s; O - *# _ _, @+ Q* X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' @" Q4 v2 s+ s - *& T1 W. X! b: }" [
- * This program is free software; you can redistribute it and/or" q2 x# F8 O3 q5 l, E% a
- * modify it under the terms of the GNU General Public License as' N: Y; z3 d8 B
- * published by the Free Software Foundation version 2. c( | H+ Y6 q" H: ?1 P7 k
- *
; f, W* Y1 ^4 Y' |6 F: L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 \" r. R5 M c. G% C
- * kind, whether express or implied; without even the implied warranty; n& x" n' L5 N. d! n' Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 s1 A- P4 i) g8 q& _4 O
- * GNU General Public License for more details.
: k9 b+ e' Y" ? - */
, w" G; F* u4 K% G& ^* \ - 6 X5 _$ P) ]! D2 S' f& V
- #include <linux/module.h>
7 i% Y6 i6 `4 s8 P4 ?4 V7 h. `9 X5 d - #include <linux/init.h>% I4 \4 q0 t* q
- #include <linux/errno.h>7 n s1 T$ S% M2 ?
- #include <linux/types.h>
' N7 Q. K: Z) @- W+ |3 X - #include <linux/interrupt.h> ]; \, A) O3 S. i
- #include <asm/io.h>
; u( G( a. u) X! H: ^ - #include <linux/moduleparam.h>. j: x0 o5 ]' t% G) S
- #include <linux/sysctl.h>
5 `! {5 q O( s, D y9 t) O - #include <linux/mm.h>
, X3 o* J+ _* l# L0 {+ W6 N) O - #include <linux/dma-mapping.h>
, Z O8 ] I! T5 R# L
* `+ _7 Z8 |* k; t: l3 e& Q% \* m/ h- #include <mach/memory.h>3 X) M) ?! `7 M, Z/ a
- #include <mach/hardware.h>+ w* Y' {& j( f8 t" ^
- #include <mach/irqs.h>0 t3 }& p/ _( N8 m" r0 p
- #include <asm/hardware/edma.h>4 }3 @8 u% d7 `5 K" O3 T& j% [
; s1 m, R- u# @/ Y5 u- #undef EDMA3_DEBUG
7 G+ p: B8 h+ v% B1 q# n7 ^2 ]% A - /*#define EDMA3_DEBUG*/' S2 K$ ?% G# ~% a Y/ d- r
- $ P* f& w/ v* Z' ~0 _. E
- #ifdef EDMA3_DEBUG
: _/ H/ O& K. w0 T+ Q) K9 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' G5 W" b/ I* w/ |' h' ]$ S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). H; R. r4 W( ?2 w* Q6 ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) c4 L; v& X, v5 D+ C. n - #else
+ z# `; m/ ~7 x! W - #define DMA_PRINTK( x... )
: O& F" C0 Z5 Q& d5 B& o3 }: P5 D - #define DMA_FN_IN. @% e C; A, C8 W3 v
- #define DMA_FN_OUT' ^% @ H! @" B
- #endif
1 T P3 U% q7 u# B2 O) g
H1 Y' G9 f( ^, }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 J& j- G" G1 h+ ~' A - #define STATIC_SHIFT 3" G$ n; U/ _" o0 A
- #define TCINTEN_SHIFT 20
' d" X: Q/ I1 I8 Q8 _, D) p8 d4 v - #define ITCINTEN_SHIFT 217 T$ I, W7 i& P9 J C% j
- #define TCCHEN_SHIFT 221 w+ A: g( ^8 \6 @0 {. o" U1 [, C
- #define ITCCHEN_SHIFT 234 [8 p* \7 O; g+ A. n& @- w/ }
3 i* t+ c7 I8 ]2 B# T6 Q- static volatile int irqraised1 = 0;
+ i3 K0 M& V: k - static volatile int irqraised2 = 0;
. }* N! U# \: p0 h
2 e0 i: z$ f9 W% a* O# n3 x( S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) k& C0 C' G0 `& m5 H; F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a2 i1 R/ c) G+ L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' P8 `! h1 Q1 {) Z - ' Q) ]4 N- W- ?, D
- dma_addr_t dmaphyssrc1 = 0;
8 R$ y0 |+ f( P P2 T. i - dma_addr_t dmaphyssrc2 = 0;
0 F3 d! P% w" |) U6 K8 E - dma_addr_t dmaphysdest1 = 0;
9 ^ G7 c9 i' Z& z4 q8 V& p - dma_addr_t dmaphysdest2 = 0;6 b# `& J8 G2 O5 T9 V7 F* \' c
- 3 f3 _) [& ] a; @0 r
- char *dmabufsrc1 = NULL;
8 z- M) B1 d3 ~; E" ]' l( }% M - char *dmabufsrc2 = NULL;
: y% P H8 \; j - char *dmabufdest1 = NULL;
% l/ o$ p- K* i- H - char *dmabufdest2 = NULL;/ O" S; u/ D$ C
- , N5 \, t9 @" S/ w8 s
- static int acnt = 512;
8 W+ j) _3 @. g7 t6 b1 s( ]1 g W/ R - static int bcnt = 8;
0 g0 R+ ^6 X3 x: X4 ?% [, s - static int ccnt = 8;
3 L" c0 ?3 y4 m5 P8 }7 F' s - 8 S9 I' y7 w2 m, u$ Y
- module_param(acnt, int, S_IRUGO);
( z' r" w+ ?' ~ - module_param(bcnt, int, S_IRUGO);
3 G$ G6 G8 S& I$ U& C2 s& e; J - module_param(ccnt, int, S_IRUGO);
复制代码 / G8 E7 D1 T. f/ B
9 z5 l% O4 t5 u7 R, o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ?' @6 N. }4 Q Z' F7 t$ f( w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ l% O8 Q, j5 d9 O+ J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, m5 l, R# J# H& }& ], R: @* d
8 |1 y! z5 k6 \: e8 ~7 E9 v W( @5 q; w+ l+ ~; X
|
|