|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , L3 ~* ?- Q/ R: N/ T
- [code]EDMA sample test application
" R; b z5 |0 k- N$ X - /*
: ]' Y8 l2 n2 Z9 d! t( L. P! o( b - * edma_test.c
0 L, z0 A, `) O! F+ N1 w6 T - *# v: _+ s; s4 P- H$ x! v
- * brief EDMA3 Test Application) @, J* [6 Y' T' z% d+ q6 _, C4 w- q
- *
, O8 c( O8 o2 Y4 j$ |( V+ }; h - * This file contains EDMA3 Test code.
) ?' ~4 R- S$ j - *! U* x0 p8 g# g" @" g$ \- V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ y6 _6 X3 r y0 ]/ M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) V. G! i8 M/ U- [, \: p4 m - * TO CHANGE.
1 W/ O3 B9 z* Q3 {+ r - *
! D( M; R4 u" P! R4 u8 u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ ` N* n3 ]5 t
- *
, J! H o% U3 p. J - * This program is free software; you can redistribute it and/or
+ y$ d% F. k0 Q2 y/ e3 | - * modify it under the terms of the GNU General Public License as) e2 |9 u& t, r9 \' {
- * published by the Free Software Foundation version 2.
/ r. U3 G) M8 x8 Z - *
5 d3 ^( W) a& ~7 H5 U. G! @) t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ {3 X* l2 Z' Z- t6 l4 `
- * kind, whether express or implied; without even the implied warranty6 p$ R1 q/ J# h% m4 j8 z) o( z* [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% w9 r9 y) b4 w. t' ]% v7 f) ?8 ? - * GNU General Public License for more details.
& z: {* G! {8 v$ u t) M q- U8 Z - */
: }. r% T( O2 x# W) a3 W O8 a3 g - + b/ K' l! y0 D( ^* T
- #include <linux/module.h>
# }2 K9 p& w n% @; d8 A* L* G/ W a - #include <linux/init.h>) d* W# e! I: }. I) R7 D
- #include <linux/errno.h>
& J. m, B7 v! C/ {; @ - #include <linux/types.h>* Q- u8 B/ H1 y
- #include <linux/interrupt.h>0 z z- |" \4 i; y" o
- #include <asm/io.h>
4 X. o9 y4 K3 B3 [* z) u - #include <linux/moduleparam.h>% W' Q5 y) d$ M
- #include <linux/sysctl.h>
# m, [: @7 ]$ q4 p; m7 f) z2 W* r) K - #include <linux/mm.h>0 }; w; F* @; A, a; ~
- #include <linux/dma-mapping.h>: T% ]- `! u' ^" Z! A
+ \4 s; Y' u: Y& E" w' n2 w4 j" P- #include <mach/memory.h>, V2 M- [% Q L5 G8 Q
- #include <mach/hardware.h>
9 Q# q( P" |# l( M2 k+ p - #include <mach/irqs.h>4 A) d7 J Y& E
- #include <asm/hardware/edma.h>7 Q: U2 g+ g/ u l Q" v
; k, ^4 B- b( b. }- #undef EDMA3_DEBUG
" \: }$ F0 V( I+ y8 f7 h. _ - /*#define EDMA3_DEBUG*/$ r; o8 b' L, k1 i9 H1 g/ w# h- X
- 3 c# _" J$ M3 M2 J3 ]2 V
- #ifdef EDMA3_DEBUG
* e' d$ a4 ?: D. M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( M6 D p& M3 P, B& u0 [" Z" D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; R7 I$ H* T) r: o. Z- k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ j* a' x: s* P4 e% |8 P2 w
- #else
& @# k L, t' x) K - #define DMA_PRINTK( x... )/ W7 Y1 Z# M5 b0 w! W
- #define DMA_FN_IN
2 H: L% T# t' {9 G- | - #define DMA_FN_OUT
) [$ q, Z1 \& @' [, |' |( k - #endif$ U% a3 j1 d9 H) ?% l; U; C% |
0 \. v& r' w- j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* m _- o! [) l0 ^8 g - #define STATIC_SHIFT 3* W9 O0 s+ i+ H
- #define TCINTEN_SHIFT 20
" x" e) M. I$ v) x7 M - #define ITCINTEN_SHIFT 21
1 k6 Y. k& c8 ~ - #define TCCHEN_SHIFT 22
1 j7 D+ i5 l- e6 t9 V) q r - #define ITCCHEN_SHIFT 23
3 N$ c' Y+ c J3 U9 b% V
8 \& [# D: ]0 x& d8 q- static volatile int irqraised1 = 0;) i' L, c9 `* y% Y& H
- static volatile int irqraised2 = 0;# h& o- o, I: i0 w/ [# M1 D1 s* i
- ' A, K+ M* N8 [2 p& J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. g$ |% R6 L. W: Q" _7 n9 u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ?+ X& O2 O4 b2 c5 h' _% P8 `1 t3 e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N7 `5 B: Q( H8 Q- n
d0 S& u: u+ A, N6 I6 ?- dma_addr_t dmaphyssrc1 = 0;( B/ S' g* |) |6 ? \+ e' q
- dma_addr_t dmaphyssrc2 = 0;
/ j x. r! v/ u+ { - dma_addr_t dmaphysdest1 = 0;
. W. H# T B% K& d# B D7 Z/ }6 X - dma_addr_t dmaphysdest2 = 0;
; Z! O5 n7 W1 R6 P I9 ^2 h
+ `4 l( M+ X, Z8 g f- char *dmabufsrc1 = NULL;3 m& O9 O+ a/ Z5 Z7 f8 t& G- K
- char *dmabufsrc2 = NULL;% X$ q9 z" C/ C$ Y
- char *dmabufdest1 = NULL;5 {6 ]5 f! N! _) V; ^
- char *dmabufdest2 = NULL;0 s: M' M3 a# I' j8 j1 \2 v
; f. p0 N, Y" A9 v' s. D, ?% ?- static int acnt = 512;: `9 w- {. h5 D" f9 v% Q
- static int bcnt = 8;
5 z" f' m4 _# n4 }, d2 K; q0 R: \4 `" y - static int ccnt = 8;* p2 N& N6 S9 }, I% b
- 6 r5 Y! ]5 x! p/ x7 |8 x
- module_param(acnt, int, S_IRUGO);
. k _5 `! p I* W1 q# u - module_param(bcnt, int, S_IRUGO);
7 N( |# I7 @! M" N - module_param(ccnt, int, S_IRUGO);
复制代码 L1 ]0 Q/ w' [* V/ c0 J
# a, `" n' b. }" e: _6 T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- {+ _* n2 K: ]( U0 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; f' i7 t& {+ M) q) I" \2 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: s" m" \2 q+ Y+ L& i& Y
7 e+ @- S9 j& F9 ?" L9 x3 g# d6 r! L3 k. r. V4 t6 [- G& y
|
|