|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 o4 l+ _1 L, r# p6 r7 e( I2 D
- [code]EDMA sample test application- i) n$ u i+ E, @
- /*
# v7 F( N3 c5 `/ _9 e! s W - * edma_test.c
" G. A$ I8 n8 w, G+ L5 n- N6 g - *
& l8 M. z: f ^* W, h1 g3 q - * brief EDMA3 Test Application% p6 R4 f9 K7 H* [3 l9 J' W
- *
! p" d2 I; c+ W - * This file contains EDMA3 Test code.
: @ f; r6 A# T - */ R5 {7 r3 x- X5 T. z5 `8 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! s% ?' n. O4 n1 @/ n7 f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* J3 ]3 m1 Q" j" c/ ?8 Z - * TO CHANGE.
6 b' ^" S& Y. j4 z: b' f - *$ ]/ |8 s2 R( P+ h! K8 t* Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 E! z' C$ e) A: y8 T - *
' S; F' e$ y$ u/ k0 B6 t - * This program is free software; you can redistribute it and/or
. l2 }/ v$ w1 s' X7 x& z - * modify it under the terms of the GNU General Public License as* U" ]7 \* {6 c' G- I# t \
- * published by the Free Software Foundation version 2.' n' _; y+ g! p! c$ ?
- *
: v1 t% _4 A% H: I+ ~3 Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 ^8 L: S1 g9 O6 U; _ - * kind, whether express or implied; without even the implied warranty% c% X9 V- L. R3 ]8 r: B5 ^2 Q0 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 o+ Y, ?4 E& s, Z7 S) o - * GNU General Public License for more details.
1 l7 X, T- a- I8 E5 ~- u% m - */* n4 f! @3 p- S4 c
; K t( m# a+ S1 P: o6 G$ V- #include <linux/module.h>, n. T, U/ w9 c6 G+ n& V: T
- #include <linux/init.h>
( X+ b+ c7 S( I! }8 G1 j; q. w - #include <linux/errno.h>
1 c: y9 b/ Z6 R# J0 B: q0 v - #include <linux/types.h>
3 P }# X$ d$ d - #include <linux/interrupt.h>8 k5 R7 @: _% A9 L
- #include <asm/io.h>6 Q( p9 F! B, ? `# m
- #include <linux/moduleparam.h>$ ^9 p, x" w/ \7 A" X
- #include <linux/sysctl.h>+ c% C& `' c3 d+ n
- #include <linux/mm.h>
5 j- @' S9 E: R7 ~6 f - #include <linux/dma-mapping.h> z* s1 H9 K R2 f' j" [
- / ?' K0 d, G" f% k9 ~% |; g# j4 w
- #include <mach/memory.h>2 @" i0 {& n( P' h. o( f( V
- #include <mach/hardware.h>* |; c- R+ u( W
- #include <mach/irqs.h>& V1 m5 z+ Q# E
- #include <asm/hardware/edma.h>
6 P9 F6 a( W& w - 7 a# ?5 I3 Y! M7 c7 n. h& ?, n
- #undef EDMA3_DEBUG
: X& x' M8 G- e9 H$ V1 P6 z - /*#define EDMA3_DEBUG*/
7 |+ G3 S; X7 d7 l% H1 }4 A
, W6 e- E4 L8 j- C9 c v; n- #ifdef EDMA3_DEBUG7 w& t( q2 F1 W5 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
|8 x3 \# _# U9 L1 b9 z( ]4 c* C0 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- n2 j: l- h3 e- w, [( C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 ~, A) v$ g4 P - #else5 F7 i2 g% h) Q' x- M/ g" O; {$ R
- #define DMA_PRINTK( x... )& q6 [3 l' k/ h6 W. i
- #define DMA_FN_IN
' @7 O1 I) H* }0 D. s; h" M - #define DMA_FN_OUT
) \- r2 K1 j/ l$ m/ j2 M" H - #endif; s9 }; j4 f1 n I& I
- % ?6 m7 h* Y9 C5 R2 P! V) K$ b% W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, N3 r, C, }/ a% I" A" b f2 D - #define STATIC_SHIFT 3
: y& \& U3 T% H; H/ Q8 c" ^ - #define TCINTEN_SHIFT 20
% b0 T& X& x2 W y( k - #define ITCINTEN_SHIFT 21
0 K# @; t1 t- I5 m4 [ - #define TCCHEN_SHIFT 22/ o4 U/ `, j: A. N7 a; M; Z0 K0 g
- #define ITCCHEN_SHIFT 23
8 A5 U* @# U( q# L' z
1 b/ k5 ]+ a' f, i1 _& e- static volatile int irqraised1 = 0;' f6 B7 o5 x8 d8 |) h; {! X; ]
- static volatile int irqraised2 = 0;
4 j( q. c# f5 U9 Z0 ^; T
# q3 R+ t- O$ f! i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, |# m/ `4 `0 r/ R0 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& @ C5 n% C+ ^) T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P! ]/ w6 d+ ?* K- J
0 B' `" L2 B) T* W$ [. N) G/ @- dma_addr_t dmaphyssrc1 = 0;! C1 B0 m4 U8 `' ~) A2 O7 |4 H
- dma_addr_t dmaphyssrc2 = 0;
: U0 W7 z W9 y& ]5 } - dma_addr_t dmaphysdest1 = 0;, w1 ]0 G: f9 F
- dma_addr_t dmaphysdest2 = 0;; l$ M6 s8 o4 U) Z3 ~7 r
4 s9 J# E! Q/ M* g6 r- char *dmabufsrc1 = NULL;
K$ A( T5 L1 C# W+ ]! ?# ^4 E# W - char *dmabufsrc2 = NULL;0 B! N8 j- [: \6 z8 f
- char *dmabufdest1 = NULL;
. G2 M6 Q7 K( T$ T - char *dmabufdest2 = NULL;2 W3 j; Z5 J3 K! c$ H. ^0 c
- 2 F# ]! p# K3 ?
- static int acnt = 512;
: X* C# M+ g* x' |) ] - static int bcnt = 8;
; B3 L8 L. B/ A( i% T - static int ccnt = 8;3 y I% [. j/ W, K4 |/ b
- 8 _3 [: O! O# I
- module_param(acnt, int, S_IRUGO);
2 S, p' [3 G* I& C" ]) z, }- A - module_param(bcnt, int, S_IRUGO);
* [" Y: M/ N$ {* d7 a( z# D - module_param(ccnt, int, S_IRUGO);
复制代码 . H$ }' H! Z6 L! b, N
, j1 [/ `1 L! |* F4 O* Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 \ w& v* m8 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 t; w4 p% n# R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( I- I& R7 F0 u [6 h" X) g7 S
% E, b/ r0 C: y6 r$ |% _
' p6 m5 W" |0 T& [; ? |
|