|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 A) r/ }2 M* q# y( \0 D2 X2 K( }- [code]EDMA sample test application% W- d! Q' o: s9 I
- /*, e0 h4 V2 {/ U% ^
- * edma_test.c; e( a6 ^; w( m' E" i9 W5 e
- *
* M' i3 X( g" _ - * brief EDMA3 Test Application1 y9 g1 Y* m" C8 u% Y
- *
9 M$ |+ B5 _$ R% B* m9 J' ? - * This file contains EDMA3 Test code.' g8 H" k5 B; I" h9 y m
- *
# d: b& C5 h: |+ V* I( Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 G3 i z8 I* m* `* }7 ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! E0 d T, }7 o) B% c - * TO CHANGE.9 `% L3 r3 u) Z! c/ R3 c" v
- *+ v$ z& _' p# a1 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 P( U+ D0 Z5 D0 `' s
- *
3 P7 K, Q5 M$ A$ ^& Y2 n+ |7 m N/ M - * This program is free software; you can redistribute it and/or& A7 w9 L) ]0 m7 I0 T6 _
- * modify it under the terms of the GNU General Public License as4 d2 x1 Z( {7 w' `- K$ Z& m5 D; l
- * published by the Free Software Foundation version 2.& R+ R$ q& A. k0 T* k
- *4 m1 _4 \2 q( [0 C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 E6 o" l X3 x% R$ a3 e) |+ {! c7 T - * kind, whether express or implied; without even the implied warranty
( c5 g7 f7 E" j4 g/ @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 y5 E2 a# K) O2 P - * GNU General Public License for more details.
6 Y) T% t+ b- `8 i - */
4 L& {0 e* w9 a8 Y# n" @ - 7 C; `+ F8 H3 |6 y9 S6 T
- #include <linux/module.h>1 ~! V# K1 o" T& g7 a T6 N
- #include <linux/init.h>: H9 M1 ` G9 x* {; A- v9 I
- #include <linux/errno.h>2 S! ^) ]# T$ |7 j* U0 K/ C
- #include <linux/types.h>
5 t7 a8 g. Y; G" ]& e - #include <linux/interrupt.h>
, f0 W! a4 _4 _( x) g7 a - #include <asm/io.h>
4 @. i! M3 Z0 C9 r( Y# E) R0 T - #include <linux/moduleparam.h>
/ `7 w1 B7 v L% e/ P1 Q% k' f - #include <linux/sysctl.h>( ^$ ]( G. [1 X' i) `* I$ S. X
- #include <linux/mm.h>
: z" _; ?( e' f2 D5 ^ - #include <linux/dma-mapping.h>
R- E2 }+ k4 ]1 m5 b) o - 4 Q5 C- H+ G8 H% N/ ^( O7 f) |& Y6 @
- #include <mach/memory.h>
2 _4 F, D# K, p/ ~ - #include <mach/hardware.h>6 V% K, @* F8 z& [. h0 ^$ C
- #include <mach/irqs.h> y Y& |/ [( H6 B ~5 O
- #include <asm/hardware/edma.h>
' T) L# R, v/ [8 N% N* N
8 w* [1 v5 ~0 {- #undef EDMA3_DEBUG( @5 M/ P7 d1 y9 G E
- /*#define EDMA3_DEBUG*/! @- { Q+ e# A: l, z! U5 |
4 Z+ y8 M/ ]" X: O5 Y; m2 K/ d- #ifdef EDMA3_DEBUG3 F F/ q, q+ Z- [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 I2 U5 F& L+ d: K; t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 q( T5 k8 J* i5 \3 a$ { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- S1 E" P1 u0 e' O3 N - #else. J, M* Y7 P0 ?7 o2 ^* R0 N+ Q
- #define DMA_PRINTK( x... )
; K5 T& v2 i0 J/ H1 V, j I# k9 r - #define DMA_FN_IN5 T9 K& w) x5 [5 z, |
- #define DMA_FN_OUT6 j; q. a+ ?( B. n- Q s: v
- #endif; a( D+ L$ g K# ?
4 {) A6 i i2 _0 ?" v8 O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 G" M2 T4 C- d9 Z
- #define STATIC_SHIFT 36 q; n9 c$ S3 B- c" l( ^/ ^3 _% C
- #define TCINTEN_SHIFT 20
# {& B4 ^5 [7 S! ? - #define ITCINTEN_SHIFT 21) O0 H. X: C8 H9 B$ R
- #define TCCHEN_SHIFT 22
6 Q2 a' C" K: D/ A - #define ITCCHEN_SHIFT 23
3 K" }, J) m- m* G - # _; z# P9 M1 {, L- B0 d
- static volatile int irqraised1 = 0;0 u2 F; J! j5 |6 ~* u+ x% Z
- static volatile int irqraised2 = 0;
! y, Q2 R: b6 B* \: M4 M
; H; h' {0 ]8 [/ I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& H; ^5 e' `7 q" \" W) f& H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 N- P( [% O+ ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 G$ m6 B/ A4 n( S* p. E" @
. O R' n. w+ z- dma_addr_t dmaphyssrc1 = 0;
9 n4 S3 p; A: c8 f6 @ - dma_addr_t dmaphyssrc2 = 0;& c) u4 @5 a- V0 T: s2 U5 z
- dma_addr_t dmaphysdest1 = 0;" O: P* j9 y6 C2 h/ I+ R- f
- dma_addr_t dmaphysdest2 = 0;
y! o# H; {" V3 | - 8 w& w) B, v1 N2 d ^0 D1 I
- char *dmabufsrc1 = NULL;$ w0 U4 p" T5 y8 n
- char *dmabufsrc2 = NULL;
( n& D( w) b; F) O - char *dmabufdest1 = NULL;; [8 y6 H3 ^. z
- char *dmabufdest2 = NULL;
?0 ^2 c$ R- b( f. e - ) r% E# l( ~; ]
- static int acnt = 512;' H. w# J* R5 v0 q
- static int bcnt = 8;8 q U) _- C( a& [
- static int ccnt = 8;% C* `+ C0 ]( g, [7 i* e* \
4 k" l5 }8 ]3 j1 ]$ W2 t- module_param(acnt, int, S_IRUGO);
4 l% g) ]9 i0 t6 r F6 H - module_param(bcnt, int, S_IRUGO);5 G& @! v/ J6 b3 N( Q' i0 k2 q1 y
- module_param(ccnt, int, S_IRUGO);
复制代码 : |8 g2 h# |# S9 e- G* G9 G* r
7 |3 y/ D( n$ T) ? U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( a1 a( e' C! S ^: L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* A: u; p( k& b. K% j* `3 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! G; v `# ~& _5 ^ t, q3 y( k% u M* T; p
0 S& G* e0 L2 d% P1 r& J5 W
|
|