|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & w0 W, ^1 Q0 W4 v# y
- [code]EDMA sample test application+ |; o4 C: ^! D% w) V. p
- /*# W: d/ ^# L8 F" Y+ {# e- W8 o' {
- * edma_test.c
( N+ `0 W/ Z& B - *
) l. p1 A% o6 r7 R' g( Q - * brief EDMA3 Test Application& A3 k1 \4 K. A% j9 P6 B" r
- *
# h; D1 C1 x# L3 d( I" f - * This file contains EDMA3 Test code.
# I& L( Q @6 X4 ]6 ? - *
! o5 B2 j3 ]( [, n o% s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ E( o, T+ ~/ C0 [) F' p, b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ X+ D9 u1 d& e. C2 K - * TO CHANGE.& O7 D2 x# V: i8 b. P8 c6 n
- *
( a C( N1 R% q7 r4 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. B4 J, F, w2 }/ i( m
- *0 ?& m5 m! J* l3 B a
- * This program is free software; you can redistribute it and/or
) N; [4 O% `( P3 O$ s - * modify it under the terms of the GNU General Public License as
. I8 }: Y1 e3 j' S0 v8 ~' O" X8 V - * published by the Free Software Foundation version 2. Q' W' N' a& Y. b( a+ M, H
- *$ j4 G& L' f1 f% }$ o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 p1 F8 W6 S$ k - * kind, whether express or implied; without even the implied warranty5 X$ N3 p x+ Q2 O6 c$ g! j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ i0 l& ?# |* k! P R( j# d - * GNU General Public License for more details.# a) l+ P! {; e7 R+ }% C
- */
5 N; j5 m- ~( [& w4 y6 L" x: [! O - + Q. {; |/ O9 N
- #include <linux/module.h>
% q3 n- D' X2 L4 `' {9 M+ \ - #include <linux/init.h>7 {* C% m" i# G2 i- a( u
- #include <linux/errno.h>
2 e. N7 ~; C/ v# L* I- P - #include <linux/types.h>
6 m3 l: y. I: }6 [8 p - #include <linux/interrupt.h>
1 N) c. y- t1 P6 J. ^ - #include <asm/io.h>
) Q, g0 F! v2 E9 y8 J - #include <linux/moduleparam.h>6 ~" V8 v; L; t9 E$ w
- #include <linux/sysctl.h>
$ N: p; a& \5 I% q - #include <linux/mm.h>& U# Y, w8 e/ Q+ c
- #include <linux/dma-mapping.h>, n: L- F# j4 K6 Q+ ^* C) D4 |
- & m( I4 N4 S4 Q# [2 p: W$ l$ V8 n& ~) ]/ |
- #include <mach/memory.h>
' S: H/ ^7 V b - #include <mach/hardware.h>) G0 g1 `& ?0 c' V; E
- #include <mach/irqs.h>9 Z! g) L5 {) B3 E) [+ {* q* J
- #include <asm/hardware/edma.h>
4 ^' D% w% A# K8 e1 \ - ' h$ [2 \ P6 T& E
- #undef EDMA3_DEBUG1 q/ ^" N4 {9 x7 M; k, u7 b& K! A+ N
- /*#define EDMA3_DEBUG*/, V/ V) n/ o4 b/ }
! } e! j. _ @/ ?- #ifdef EDMA3_DEBUG
; `6 G6 f _: }7 \) z1 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Y' n: E+ R3 k; `! Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' b% i. e9 S: U0 Q3 Y8 U6 ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 L% m0 {- d! B$ |3 @# W F7 }$ f - #else3 I# T% v; K3 ]1 d- {
- #define DMA_PRINTK( x... )8 B L4 C! ^2 w% E6 N" Z) r
- #define DMA_FN_IN
8 z; H4 [7 f. j( f. H - #define DMA_FN_OUT2 E/ u3 t* d. ?5 [; ~$ s* V
- #endif
: O# g& B5 `/ u) W2 b' R& k - 6 {1 ^4 k, I: y' K' C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); i: L9 C% e: j1 n. h
- #define STATIC_SHIFT 34 W" O9 v* W# Y- C1 t
- #define TCINTEN_SHIFT 209 p0 v# K3 Y1 Q
- #define ITCINTEN_SHIFT 218 `1 T5 \! X! L8 g' D
- #define TCCHEN_SHIFT 22
2 C" |5 w; v& G2 ~! P0 ]8 P - #define ITCCHEN_SHIFT 23
. p) o( r" I! n y: z
+ k F' A* N5 v. k- static volatile int irqraised1 = 0;$ U2 O( U; l; B, e
- static volatile int irqraised2 = 0;7 ]1 _7 v" G$ P% z( U7 D, e
' x0 K0 a% j0 N7 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ M5 q, r7 P d' `" ?0 K/ p2 d1 `+ c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) O2 m; |5 O7 L s( ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 i% q r8 h8 o0 E2 g% d
9 v$ z8 c, I! A1 X( H3 h- dma_addr_t dmaphyssrc1 = 0;1 B0 W' L& j* ~( \3 N
- dma_addr_t dmaphyssrc2 = 0;2 N' `, G! ^; A% g9 m; L
- dma_addr_t dmaphysdest1 = 0;* x- r- m) Z4 l! T
- dma_addr_t dmaphysdest2 = 0;( X' B0 c6 P n) d, {
! N: [ i8 _4 }. v! \7 D- char *dmabufsrc1 = NULL;
# x5 \6 }/ H7 p9 `! D" U - char *dmabufsrc2 = NULL;
2 }: M# W7 h c8 I" r - char *dmabufdest1 = NULL;
1 H: T$ u% n4 M0 V# O/ Z$ q" L; o - char *dmabufdest2 = NULL;. _+ }: T/ c1 v3 Z- p2 b5 W
9 g5 s4 y; _# x- static int acnt = 512; ^5 x4 Z; j6 ?
- static int bcnt = 8;
4 {( h6 f3 N7 m" r - static int ccnt = 8;0 I% C+ K0 g( w3 _- O! T
9 \% t( ~6 Z7 T9 I$ g. t$ |8 z- module_param(acnt, int, S_IRUGO);
( O. J z( s& }5 f3 }- y - module_param(bcnt, int, S_IRUGO);
3 ^! P9 K1 l+ T) h3 _' ?" Y - module_param(ccnt, int, S_IRUGO);
复制代码 ( x0 b4 D# C6 e2 a7 ]9 ?9 Q
7 a$ I& J! y5 R+ @" }( ~1 F8 o6 Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& Z. b! f* ?3 X4 H( V7 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" x0 B$ G' O2 [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: e$ r( i% U" H0 Q
6 s- I! z% k9 H7 `' I; L% L9 s: q; y! R L7 v2 R
|
|