|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# `' C/ @. j0 }8 K% e' u- [code]EDMA sample test application- i9 C, ]7 J; W
- /*
+ S7 A. B4 l4 n9 c3 s4 Y' B - * edma_test.c
! }% k3 u+ S9 \ - *# K0 Z4 |- J; q. S/ I
- * brief EDMA3 Test Application- U9 e' f, {8 ?
- *
: H8 c. ]. s% {9 v) x - * This file contains EDMA3 Test code.' I! ~, ~& b3 ]5 L8 o3 O
- *
( z4 x* ]2 c0 \/ Q1 E5 Y. w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 P, k4 b. h) t2 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 w7 p& H0 Z0 G! [0 B0 p1 I7 |& v - * TO CHANGE.
/ c$ f4 J( T! \4 t6 F, M - *
. ? s( u& T* x" L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ~- P: Y; ~* w, U v) n7 \8 P
- *$ O* R$ q J5 g: E% t9 ?0 q
- * This program is free software; you can redistribute it and/or
" A- R" d! |3 K9 t# m - * modify it under the terms of the GNU General Public License as
! R$ H) @5 R6 b. S1 j - * published by the Free Software Foundation version 2.+ d% V$ S5 t8 d: B- g% L
- *
6 T/ P" A7 b& {! K1 J. b' q" y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 Q8 ?) G$ ^4 Z7 b; {) X4 B - * kind, whether express or implied; without even the implied warranty- k) a3 t; b1 f+ g+ `" l' a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 A, x' [. q: }* k% ` - * GNU General Public License for more details.$ ?" ~7 H3 L- P/ |+ O5 N9 r. K
- */
8 }+ L$ u* _& F
/ F- U2 h1 a+ e; e* k( K) Y- #include <linux/module.h>
8 y. I4 {+ ^3 ?9 [ - #include <linux/init.h>
5 |! \4 N* w/ N- v - #include <linux/errno.h>5 g% J+ J8 n* `. e
- #include <linux/types.h>
, }3 L$ y8 t+ r3 L - #include <linux/interrupt.h>2 g9 b' R+ ]6 B' j0 d
- #include <asm/io.h>
4 D6 t1 n" t2 v" @$ y# H" e - #include <linux/moduleparam.h>
$ z1 \- W+ [/ b% I, B+ M/ z) V& a - #include <linux/sysctl.h>
. X7 k$ J; [+ M - #include <linux/mm.h> U/ C; x% t7 \# Y7 v a# X
- #include <linux/dma-mapping.h>8 W. p; e R" r7 \' L
; X2 B8 m" i! m' n( u9 e. ^+ b* ]1 r- #include <mach/memory.h>
9 |) S4 j6 ^8 G - #include <mach/hardware.h># O" W, n3 g" u+ ]+ `
- #include <mach/irqs.h>% Y; R3 ^% n/ P% o/ @
- #include <asm/hardware/edma.h>6 C0 r/ z5 O2 |+ I2 k g, I
- . T+ |% t% N( d8 I4 K
- #undef EDMA3_DEBUG
) E! L+ a' ^# X& x - /*#define EDMA3_DEBUG*/
. q9 k% t+ D( ]- g
: \. V8 x/ h" u8 q/ Y/ m H3 v- #ifdef EDMA3_DEBUG
& _' L- p, w+ b" O2 A1 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ a) V/ d/ h; W. Z i& z$ G( X- ?% b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ A; l5 h8 C4 T" L, S5 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) T- d) r; S2 w+ H! I
- #else' p$ g* U7 `3 J, e/ |' t
- #define DMA_PRINTK( x... ) @! `' H, a4 w
- #define DMA_FN_IN
$ h" R6 r' S1 d3 F/ } - #define DMA_FN_OUT
6 o+ @: O, w& i5 Q: F o - #endif
9 u u* n$ h! g8 N" |% N - + t9 N4 |7 Y m) r G5 W: P d0 m1 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 v( y( s% ]4 L0 H+ z - #define STATIC_SHIFT 3
, {" O! L4 n7 ]3 Y" R5 H- @# t1 t - #define TCINTEN_SHIFT 20
6 g% S1 l) S, ]' S+ t4 @/ d - #define ITCINTEN_SHIFT 21) u# a# {' X; U0 y8 q- Y
- #define TCCHEN_SHIFT 223 Q. o8 N8 }0 X3 s6 ` s
- #define ITCCHEN_SHIFT 23
, _5 R' o# m6 H8 x - 0 s+ A: k& _; O2 |8 q
- static volatile int irqraised1 = 0;% h, b$ q6 Z& K9 j
- static volatile int irqraised2 = 0;3 i. ]) M- c1 y* I& z
- 9 D4 H1 ~, ^( z/ B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) f/ k8 y# Z9 n: V, A8 d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 r( O1 ?4 |5 M. V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; L; e ^! x, E0 h1 G" z4 z
( l) H( t) f/ R; b) `- dma_addr_t dmaphyssrc1 = 0;
$ R9 H9 x8 K6 R% w$ Z3 {, E$ K - dma_addr_t dmaphyssrc2 = 0;
9 K2 h. i# `0 y3 J: A) A - dma_addr_t dmaphysdest1 = 0;4 Q/ \- g: s$ g
- dma_addr_t dmaphysdest2 = 0;
. ^- J/ Z" G; a! ]7 @; C+ j0 \
& K, A1 C- y& w c* N4 M2 {- char *dmabufsrc1 = NULL;
' O4 @: Q' \* j - char *dmabufsrc2 = NULL;# W% y9 B/ b; s6 R/ d" C) O" r
- char *dmabufdest1 = NULL;2 m4 O, c# _- t: o6 [
- char *dmabufdest2 = NULL;, X3 w' k9 u- g' H* |9 V9 _' Z4 s
) K0 t) O4 Q- z' ?- static int acnt = 512;1 C, [' D+ T" z3 U. ~+ I
- static int bcnt = 8;
# d0 n( y4 c/ Y3 U0 s Q3 Y2 v - static int ccnt = 8;
. p5 R6 ^% W4 ^' y
$ @4 { Q }- X# o5 o. O- module_param(acnt, int, S_IRUGO);9 L3 D2 Y: H6 Q7 v+ H
- module_param(bcnt, int, S_IRUGO);7 H4 [5 Y2 {. {1 U
- module_param(ccnt, int, S_IRUGO);
复制代码
M- j: i/ }% ^$ r% B ?* R7 l8 O, c0 v' k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% c% B- ? U6 m0 @* E% Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, u N; S& h S4 o$ E( B$ g( j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 O" A6 |6 t. J4 ~: i% C. M
/ d4 u. y5 d1 \3 [
4 b5 t3 w8 q# z, M& [8 Z |
|