|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 }( R8 X0 @6 c- [code]EDMA sample test application
1 U' l' T5 Z- f - /*: k% a; [4 i; q9 ` |8 h! f
- * edma_test.c
2 k5 d4 s* g3 u9 P6 j. O2 i& ~ - * h' H( [! U7 j0 h, `- P. j, K
- * brief EDMA3 Test Application# b# R) \) e+ w; d8 H
- *% Q1 }* A' ` h7 S$ b/ b) g
- * This file contains EDMA3 Test code.
, L* v4 z4 C; i0 M& f) Q6 K - *
4 Z, e0 u+ t! T8 U6 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, p% m4 h: D% i/ ~ x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, [1 Y5 S+ S" p: F
- * TO CHANGE.5 V8 }1 \- }% c- s
- *
$ J d; M0 @- c/ G9 b e! h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 l0 a% ~- U/ `: M& p \ - *
0 \7 W9 M5 o3 Z( ?, B* Z# J9 s - * This program is free software; you can redistribute it and/or$ f. ]: ~. f0 \$ s* L; Z5 g
- * modify it under the terms of the GNU General Public License as. C1 H! P" H( f7 d, K, {" ?
- * published by the Free Software Foundation version 2.: p( L4 \9 s" }3 n7 g( O. c0 M
- *+ t4 r$ q( C0 u' K- X2 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 S9 [$ e3 E) M" Q' Q& s" ~
- * kind, whether express or implied; without even the implied warranty9 f6 ]: `* t2 t! f' C' X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" t% W0 _& A* ]9 |7 W1 u7 G: v - * GNU General Public License for more details.
0 j7 d; X+ f& n T0 L - */
4 C1 |; A+ A5 m8 _/ r
5 V% ]+ X: v f! P( m# _- #include <linux/module.h>
8 Z, a$ Q- |* f$ r% G9 F: G* E& x3 u - #include <linux/init.h>' j. p3 O% J: U3 ] @
- #include <linux/errno.h>) s5 r$ |; g; L$ _! S/ ?4 y
- #include <linux/types.h>
# X) ~) w4 x( g* [1 [ - #include <linux/interrupt.h>
/ q3 \: H+ h6 x; N - #include <asm/io.h>, D1 J/ ]: e8 e/ ?. P
- #include <linux/moduleparam.h>
9 `/ d5 O# m U W& H/ b5 P - #include <linux/sysctl.h>
% G2 P6 U% Z# F( U! I0 z1 ~5 c - #include <linux/mm.h>; }- s, e L% v& X0 o, h
- #include <linux/dma-mapping.h>
5 t7 i) R3 q5 ?$ W$ X, g1 w - . { e$ x- j7 k y5 m
- #include <mach/memory.h>; x- q: l9 B( P, |* G' L
- #include <mach/hardware.h>1 D \: M# j! m) }( I1 e9 W! g
- #include <mach/irqs.h>
: t5 c& V1 Z& y$ t4 m - #include <asm/hardware/edma.h>4 n6 `1 L( j5 T0 d: B* W' A
- - {, I$ b1 Z7 O; r
- #undef EDMA3_DEBUG" R5 l+ j) c* |7 W4 j& o% @
- /*#define EDMA3_DEBUG*/
. v3 B. R( ~( H8 M - ( L2 u* i8 f% O& _; e
- #ifdef EDMA3_DEBUG& S" v9 f$ e, C' P* I8 K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 m' d4 m' J; o' i n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( t" _9 b) e( ^# s3 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) K# f) S1 H# e g. t
- #else
$ p$ a5 p0 ^) {5 F, k( Q# w# c - #define DMA_PRINTK( x... )- {2 c) L; ]/ Y3 h
- #define DMA_FN_IN
% t# x. O: N1 { V - #define DMA_FN_OUT
. `; T9 N9 k8 o+ [! R - #endif
* q/ h: g9 N- K9 F; w# X; t9 x; R% k - 0 `) C/ n! d9 W1 W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ O1 T5 y& X# {- j# ]; K! r
- #define STATIC_SHIFT 3
$ f5 j4 |1 u- K; s# A - #define TCINTEN_SHIFT 20# l7 G! ?" B' f# Q Q4 r' i; o
- #define ITCINTEN_SHIFT 21
4 K2 P5 e- _( l6 T - #define TCCHEN_SHIFT 22+ J/ L) ], R. j3 m |/ q, X H$ g: l
- #define ITCCHEN_SHIFT 23
9 a, n( ]. ], D( U0 Q& W - + y* Z& c5 c) H: t, Y. f# q% f
- static volatile int irqraised1 = 0;
& s8 P& k4 z/ D( L; i - static volatile int irqraised2 = 0;
* M- M/ w& C6 P6 [ - 8 ^, l5 }- A# {1 @3 S0 S. o W1 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M+ Q w' q: l$ {( S$ }% J9 z1 ]1 D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: K1 a! @# Z" R" S& {3 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 O7 Q$ s& n2 S+ N% b
: \2 O% \- W! l* z% u) e- W- dma_addr_t dmaphyssrc1 = 0;
1 X. r% p& Q0 X) t0 X" T - dma_addr_t dmaphyssrc2 = 0;
4 \9 P, H9 O! |) D - dma_addr_t dmaphysdest1 = 0;2 t, ?5 w3 r) D. \5 n+ \4 A, D
- dma_addr_t dmaphysdest2 = 0;: x' H& R0 c2 e. \8 `' o
- m# b0 V3 `- | h* B2 j& Q
- char *dmabufsrc1 = NULL;
$ @% c: `) p8 ], Q: T, d0 {# O - char *dmabufsrc2 = NULL;9 U4 z" d+ D2 O; r: g. @; u
- char *dmabufdest1 = NULL;
" ? [. J! `4 m: B - char *dmabufdest2 = NULL;
L0 L& c4 D" q0 ^ - % J! H6 x/ \; ?
- static int acnt = 512;. z Q5 D5 B- m2 y$ D" U: X
- static int bcnt = 8;
1 o' q/ V! F+ r% q! \ - static int ccnt = 8;2 m, m: N) ~+ p/ P
2 ]: W6 o) j* B: d( n! r- module_param(acnt, int, S_IRUGO);% u1 t6 P+ E& M$ m7 J; a0 D
- module_param(bcnt, int, S_IRUGO);
2 Y- y& z1 m$ [" s7 w - module_param(ccnt, int, S_IRUGO);
复制代码
( ~$ a$ c& W: k# _0 a' t
& P% U4 `+ Z3 J& _, } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# B6 a& M6 n& J/ L& j9 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% Q$ Q: A# y- V* J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 n- @. } y$ C0 o: ^; h$ k
: J+ ?) |# \! [, J. @ _; F; G9 c9 p& \
|
|