|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 l8 W& P% c% x- a) F7 J
- [code]EDMA sample test application7 C+ \6 u# X0 Y) G" \
- /*
7 ]6 S+ ] ~$ l* v4 R, M" W - * edma_test.c6 O$ e( }. h0 m0 Z4 j+ X
- *
8 ?0 [$ i E6 U- V, U - * brief EDMA3 Test Application) M% V" M/ x! u: M
- ** {! o$ B' f" ~0 r( u, A) o2 ~2 E
- * This file contains EDMA3 Test code.
+ S( Q* p. i$ a6 e% \( i) e1 L: L6 q - *5 S( j! `' P$ R& u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 D( k: T, r; i. ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 T! q3 V& h d9 ^; x% h7 g, z ^6 A
- * TO CHANGE., W7 x% B7 z# v& P* D2 C) T7 \7 j
- *. Q" U9 v4 `# Q7 d( E/ K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! R0 d- z7 }9 `4 Q# j
- *% d1 V3 _( Q( L+ _# |9 T4 z9 j& D
- * This program is free software; you can redistribute it and/or: C' q" n( T3 f. P! F
- * modify it under the terms of the GNU General Public License as
+ u) v9 S1 ]5 P% f6 |+ ? - * published by the Free Software Foundation version 2.
7 m3 l* W! o9 M) a a# A - *) s. [. h3 A: ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& H. g; n' A) e; l3 X' @8 Q3 [% B: r - * kind, whether express or implied; without even the implied warranty7 f i$ M- H1 I y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 E) ^4 b( v* ~7 i% f) K
- * GNU General Public License for more details.
$ _3 F* _, \ C" I0 X6 h0 C, ` - */
3 p- Q; U) V- t% C: \; s) M - - x; t8 @# D- G. W
- #include <linux/module.h>
; z6 C5 K) P' C - #include <linux/init.h>
8 u3 Y! l6 F" r- C. ` r7 U- Y - #include <linux/errno.h>
! E$ W* P1 p/ F& r( C1 J8 w - #include <linux/types.h>7 e* v4 b% B8 x; H% @% J
- #include <linux/interrupt.h>2 G# D: f+ C8 H: h
- #include <asm/io.h>, }/ h# i8 ^# k
- #include <linux/moduleparam.h>
$ [5 O7 j* l+ f6 ~) }) o6 ` - #include <linux/sysctl.h>/ B+ j- R U) s) z
- #include <linux/mm.h>, g+ l1 w# J' {& p* K
- #include <linux/dma-mapping.h>. C+ F+ G" o4 l' u; f# B- N0 g
: q/ b) n# o+ e* x+ v, \. j- #include <mach/memory.h>0 a8 m/ `" t- ~' a3 ?1 S, T5 V
- #include <mach/hardware.h>
3 `) T: R+ H& h0 O, S% i6 @ - #include <mach/irqs.h>
4 k) O$ Q2 g# N; S; N; f - #include <asm/hardware/edma.h>" o! y# p1 w1 m0 E0 p% n4 D
7 A+ A1 T9 B/ u5 f- #undef EDMA3_DEBUG5 ?( f+ S; Q, U: \- Y6 I
- /*#define EDMA3_DEBUG*/
* x6 {2 |4 c$ Z& E* h; ? - % p3 p' U) y6 k- | Y
- #ifdef EDMA3_DEBUG
2 P3 e! N3 p! Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 L) A, M' F h( U/ S! l( J! i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- i0 z! z7 ?% k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! O$ @5 x+ _5 j- g7 ^0 p; [1 n - #else" d4 ^+ k# B- U% T f% k
- #define DMA_PRINTK( x... )1 q4 W6 o) g% ~; W# I+ Y
- #define DMA_FN_IN
$ ?9 q1 _. i5 m( J+ c) M" H - #define DMA_FN_OUT4 H' s1 [3 x- F9 r9 n% e
- #endif
6 a1 i6 I" ~. B+ E/ Z - $ S+ \0 V% p0 o% ]5 |( ~6 Z5 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! N/ H4 [' v$ t - #define STATIC_SHIFT 36 X2 N$ A$ Z0 X% }7 v
- #define TCINTEN_SHIFT 203 R; j: i/ U: ?$ \
- #define ITCINTEN_SHIFT 21
: |9 W; x$ [3 l. T5 `( q - #define TCCHEN_SHIFT 22; G5 A: R6 q; E9 L x' J( ]7 [
- #define ITCCHEN_SHIFT 23
- M: V1 S& G7 |& E
- [8 X5 {# w/ h' g- static volatile int irqraised1 = 0;
3 b9 D2 F* U I - static volatile int irqraised2 = 0;) E9 D4 i7 S5 @% h7 y$ x
- 7 k& H6 F- B0 L7 F h+ f: f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 q) u: G' s6 I! }, O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, q' G( u2 M# i U+ @: J0 P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, [% R8 O3 E2 I9 k5 }) V' `, o
- 2 b0 p; [0 p B4 |- P
- dma_addr_t dmaphyssrc1 = 0;
7 X. s( ], n `' t0 T8 s - dma_addr_t dmaphyssrc2 = 0;! n) c ~( T- X3 r
- dma_addr_t dmaphysdest1 = 0;
; k. |7 e' e- o, M# x# E - dma_addr_t dmaphysdest2 = 0;5 E$ ?0 t' V+ I7 m9 C
- ' H' |4 {6 w/ j& T/ p
- char *dmabufsrc1 = NULL;: Y2 P: U* z2 @9 m
- char *dmabufsrc2 = NULL;
3 O* v/ P7 a3 {" Q8 F" b - char *dmabufdest1 = NULL;
! Z' b9 \5 _ D1 A9 ?1 N% E- a - char *dmabufdest2 = NULL;3 |/ s% p( P/ W; q- \9 m- H- m" L
0 l% W9 C2 v& z7 K+ p1 C. q3 F- static int acnt = 512;$ i+ ~0 _+ z$ o+ e) ^) P8 c3 r
- static int bcnt = 8;
5 H4 F4 p$ B2 J- |% J - static int ccnt = 8;
1 _" X4 |) G) g* H
& }; H* m) W$ i, |8 U- module_param(acnt, int, S_IRUGO);3 U1 u' L: h; \: \; s* E3 F
- module_param(bcnt, int, S_IRUGO);" \- F- \& a- u
- module_param(ccnt, int, S_IRUGO);
复制代码 2 ]3 l2 x) i9 X: z
9 s$ H/ I: K- S5 _- H! u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 c d8 A; z& H0 t1 Qarm-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" D2 u% W+ g/ n* S+ Q% W2 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 m$ Q$ _- m4 c3 |5 t& z. R/ z% r
8 F) E; g( o" _! E
$ E3 ]/ C/ c4 F- S+ W n2 @ |
|