|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Z/ U( _6 F$ g3 h) S4 s- [code]EDMA sample test application" l3 r0 h# i6 [; I" p/ y! n5 V
- /* ?3 L' L R- ]+ M
- * edma_test.c, Z' C' m4 L: x$ h: E
- *0 U. L: k1 \' t
- * brief EDMA3 Test Application1 p) W2 D& N$ g! \( p1 r: b$ \
- * a4 Q* i/ i* a& c3 M) x4 n
- * This file contains EDMA3 Test code.! p4 @' d: V' {+ l) r6 ?5 C4 i
- *' C0 y3 P+ e8 W4 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, H5 Y% o7 [* `# `- U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. V0 A0 n3 w* M1 D) E/ L. k5 l - * TO CHANGE.
( i9 W6 a; q: g. p" { - *, u* E' u% P! P5 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% @5 j9 A; j+ T5 A8 Q
- *
/ P6 F% N" V. x# } - * This program is free software; you can redistribute it and/or( Y: {$ X6 \8 ~* x' p- O0 ~
- * modify it under the terms of the GNU General Public License as4 u3 y) q( E5 t2 G
- * published by the Free Software Foundation version 2.; }& K2 C- Y5 D; r
- *
4 b( i1 w l# p7 `% F/ M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! l5 J/ c7 w V5 x; ]/ [9 f - * kind, whether express or implied; without even the implied warranty, l6 {2 c9 Z# s1 C' K& y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ A0 T% V# L; R' q5 X) M1 e - * GNU General Public License for more details.! p. K* o7 |* Q* B! i/ i1 J* A: v+ K
- */+ i4 }! H2 ~0 j. W0 K
- # t O) c' Z. [
- #include <linux/module.h>- r9 B) \6 i6 L: O- K7 ]
- #include <linux/init.h>
! ?1 ^3 c, u- J( R$ ?5 d7 E, i8 n - #include <linux/errno.h>5 _8 u' [, i* t1 d# f m
- #include <linux/types.h>8 @$ s" W; ? U; J
- #include <linux/interrupt.h>1 w9 Q9 F; [; ~0 s+ N# ~
- #include <asm/io.h>' J O4 r/ P+ C! X6 Z
- #include <linux/moduleparam.h>
. p+ t: Y1 R$ o }" F2 P5 M - #include <linux/sysctl.h>
$ D1 q- x h2 ^$ a/ { Y - #include <linux/mm.h>
- y7 b, Y: \9 J2 ]3 S8 q, O" v - #include <linux/dma-mapping.h>
8 k2 ~; d* `) v2 M - , K+ Y, M8 D# K H
- #include <mach/memory.h>
- a! F+ o: B$ y+ M - #include <mach/hardware.h>
/ K- ?7 d; i& @" R) R7 T - #include <mach/irqs.h>7 f8 N0 D( z$ E* p2 g. b2 f
- #include <asm/hardware/edma.h>/ g @3 W6 o; K$ G
- 5 I; ~. ?) T4 w$ |* J
- #undef EDMA3_DEBUG6 D! ~1 ]& B" { k) A' E% L
- /*#define EDMA3_DEBUG*/8 G, G" b n$ U6 B& K$ G
/ j& t9 A9 R6 |" r# u# W/ Q ?- #ifdef EDMA3_DEBUG
6 s# N9 a0 P! ?2 W4 J7 z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 w1 i' }. s5 a* k7 y7 g2 _" _# u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 ^- Y/ t9 L' t% z! ^; C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) b/ Q0 K3 t) q6 b
- #else% V3 o4 A) Z$ \8 D0 w' E9 J# y9 H
- #define DMA_PRINTK( x... )
7 y- |) k0 ^) p. y/ c - #define DMA_FN_IN; @8 |. b$ e! y+ K* f( r# l
- #define DMA_FN_OUT
+ F! N( P/ X) b2 _; b, ]5 S$ ~4 y - #endif
( u+ j2 r5 l0 @, T3 |( h
8 h% {2 E+ R% u( u1 p) C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 j1 G1 s2 N$ h2 S/ s* D
- #define STATIC_SHIFT 37 Q% m0 u- Q, f, \( k
- #define TCINTEN_SHIFT 205 G, [; w+ V: u; }
- #define ITCINTEN_SHIFT 21
2 N3 f6 K |& S% K& m, x2 q - #define TCCHEN_SHIFT 22- s' u6 K" G1 y* m3 E+ x6 s3 G
- #define ITCCHEN_SHIFT 23 B3 |5 A s3 H$ T
7 F% n5 g) v' u" T3 f& K1 s- static volatile int irqraised1 = 0;
. R+ W5 R6 B, Z* S - static volatile int irqraised2 = 0;
9 m6 x/ a( K/ O$ S - , ~8 K" D! X6 a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 u4 ` }) }2 b: v, Q/ H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 f0 Q7 p/ o* w" P* ~3 Q: W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ x% W$ W+ F$ t0 l. X. x; }
v) E {* O6 f8 H* e" p- dma_addr_t dmaphyssrc1 = 0;8 d0 D1 ^6 | N3 |
- dma_addr_t dmaphyssrc2 = 0;0 V0 U0 f& X3 I9 o$ W
- dma_addr_t dmaphysdest1 = 0;3 \ }4 o, P3 g0 X$ Z
- dma_addr_t dmaphysdest2 = 0;
8 x2 _: {2 x9 V' p) @+ Q. c2 |7 D/ j
0 u! c7 D: K2 ]! J# F. o0 r, F- char *dmabufsrc1 = NULL;1 f( i m* }6 y% Q
- char *dmabufsrc2 = NULL;
. i4 i# t8 }# e# i6 p- B - char *dmabufdest1 = NULL;0 K1 y& c- O% D7 V1 `5 m3 c
- char *dmabufdest2 = NULL;# Y8 c1 ]* L6 D: F; A5 j* B
- - X9 A8 j" r2 D% u) [ ~
- static int acnt = 512;
& M, T5 ?3 g) t! e7 a8 u - static int bcnt = 8;) G" L; {4 F8 n3 }5 [3 `3 n- y
- static int ccnt = 8;
* J& h: u* s* j. w5 y
) L" O5 z( J; M- module_param(acnt, int, S_IRUGO);
( \9 Q6 B4 U* R - module_param(bcnt, int, S_IRUGO);
. r; a, `: t5 _) l* F - module_param(ccnt, int, S_IRUGO);
复制代码
; D X- v/ B5 \5 m' J2 O/ g- i- g" T1 a; ?" P% V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. u. a8 b4 f& e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% B3 P2 e- L5 l; l1 i& b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 Q6 D/ }7 `# n
: M6 _; t; _! R% A6 W1 e% _7 X
2 X6 y* m0 _1 {: U4 I6 ]7 v |
|