|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; {/ a8 B3 b! Y6 s# q( b% q/ z
- [code]EDMA sample test application
' _: T% ~! {# d% Z* t - /*9 s: z# |, R- u' x6 c! ~, {
- * edma_test.c
0 n l' G+ ~% f# W& [( p/ _ - *' Y$ S1 D1 q& B& {) o
- * brief EDMA3 Test Application( o9 Y1 Q4 a5 z0 R- A5 v* k
- *: }0 _% O( K% k6 S1 n! R
- * This file contains EDMA3 Test code. C ^! @. j, x6 Z7 i: I( O, N' y
- *
$ O. g& u& K3 f! N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; n+ _8 w/ g* g* _- C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 e2 L' o" L9 H# }9 U; A - * TO CHANGE.0 `! F$ K" S7 l& S2 J, m& _
- *1 d8 F" J& L0 A7 \+ W& @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; j3 `- C' B0 ]2 F% b - *8 y! p4 U% U; w3 B# ^
- * This program is free software; you can redistribute it and/or
) i# L% X. f- h$ [ - * modify it under the terms of the GNU General Public License as
# \! j2 {" U) T& e4 o - * published by the Free Software Foundation version 2.7 V* j* R) J% C m4 o/ C4 l
- *
, e. }/ F9 C% |, \. ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 o. I7 Y5 T6 c2 n- D
- * kind, whether express or implied; without even the implied warranty
. C; `2 X( ^, d$ ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the {! a* G& ~1 v; J- b# |# b1 J
- * GNU General Public License for more details.
5 G; m- D+ {2 Z7 t4 Z- l( Z% A - */ k9 S, o3 u% A* }, {: x' |
- 3 g' ~# J1 q( E/ z* s1 Y( e" l/ N$ A0 }
- #include <linux/module.h>1 `8 R' w) z+ x9 |
- #include <linux/init.h>, {; {+ j# u0 B- H0 K' C
- #include <linux/errno.h>4 N0 I7 M4 a) Y/ Y1 ^" s3 D; o
- #include <linux/types.h>0 ?! z& @# W6 I2 C$ j2 m
- #include <linux/interrupt.h>
. j' V- S7 U$ ~4 v7 a - #include <asm/io.h>8 E9 R9 b- v* @) I
- #include <linux/moduleparam.h>
: E% Q! Z6 H5 H" [ S7 h - #include <linux/sysctl.h>% D! n8 r* u) `' ]/ _/ w
- #include <linux/mm.h>9 ]6 L7 T9 U8 l: p, S
- #include <linux/dma-mapping.h>
@4 o' i! X- p) ~
" D1 I% e; D: l2 i/ Z* N4 s, R0 O. s- #include <mach/memory.h>0 R: p, @. x, H
- #include <mach/hardware.h>
0 I5 h4 B4 e8 Y, @1 D/ z. A- B0 } - #include <mach/irqs.h>8 }* a" a8 }2 L( s+ f; S
- #include <asm/hardware/edma.h>
" M+ l1 m3 D5 K. P$ b9 f1 A5 `' o - # l+ E2 u2 _3 N0 A% p* m
- #undef EDMA3_DEBUG0 Q- F6 D, a, v, f% M4 O7 T# ^
- /*#define EDMA3_DEBUG*/: }/ g8 z' g/ m! J
$ @9 |8 s' B; H( }7 y8 `; K M. E, J0 ]- #ifdef EDMA3_DEBUG/ ^! Y, Y. u% a6 P [; ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" D7 a; s/ ?+ N. W: o# k$ \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% g8 s8 }$ [7 l2 n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 K- { O2 u, G/ n3 O. o - #else4 T) n1 U& P2 H I- ^* o7 I% B
- #define DMA_PRINTK( x... )1 H& E' E2 u# w& p( d( _
- #define DMA_FN_IN
5 Q x$ C- {7 g - #define DMA_FN_OUT
. _% a" l U- U" I - #endif2 C4 o; z/ ~0 \ L C* F" L
- & |( ^: \1 M+ ?3 g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- D0 D: X) v) k8 U0 W8 B0 V) P2 ~
- #define STATIC_SHIFT 3
9 A7 ]" G* {' w" i# }2 z, P6 d+ R - #define TCINTEN_SHIFT 20 g: Z5 {4 }" F4 O1 x
- #define ITCINTEN_SHIFT 21 Z# e1 o9 C/ K o' x0 y
- #define TCCHEN_SHIFT 22% A5 `; x D( F7 \# E7 A: P
- #define ITCCHEN_SHIFT 23. f4 K: u0 x- e4 h3 {7 K: W P
- ) I4 \; n4 t q
- static volatile int irqraised1 = 0;
+ z/ k* X$ {) T/ x9 M- } - static volatile int irqraised2 = 0;. t9 ?. L% {/ @7 I
- / [8 L7 Z6 C& u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); ?% O; Z. |- [+ t) @9 {& ]# |8 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); B: [: t+ e% u, h4 w% W/ z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 r6 f0 c) u1 }8 N, H, @
- 9 _" B/ S3 T& V' o6 n
- dma_addr_t dmaphyssrc1 = 0;
2 ~2 ]' l1 I( G/ P# ] - dma_addr_t dmaphyssrc2 = 0;) w( e% E w, T1 h' e! Z7 n
- dma_addr_t dmaphysdest1 = 0;) o5 T6 ?8 T- J: [1 ], a) D8 p
- dma_addr_t dmaphysdest2 = 0;
, a+ Z* z C/ B- Y V! |
# D# r8 q9 J1 \1 z* |- char *dmabufsrc1 = NULL;4 W @6 [) N" n# P1 E! I+ Z1 O
- char *dmabufsrc2 = NULL;
9 w' f3 b1 g$ W4 f: W5 h: q7 u6 n - char *dmabufdest1 = NULL;
: S3 \; c3 x- V( H' V- F3 U - char *dmabufdest2 = NULL;
* ]0 K4 G5 R) G+ E$ j1 R2 o
) l q+ h# i: \4 n$ h% C. b) K- static int acnt = 512;6 v* M! G4 x7 C1 k' |. `# P+ n
- static int bcnt = 8;+ x8 B) v0 N, Q3 y) ?5 ] y2 a
- static int ccnt = 8;
9 w/ I5 k5 p0 s. ^2 b: x - % C/ M9 X6 r! G; i$ v0 C
- module_param(acnt, int, S_IRUGO);
6 r3 D! o) m* O& o# r - module_param(bcnt, int, S_IRUGO);
5 K. E6 Q# ?; B$ c& E2 s - module_param(ccnt, int, S_IRUGO);
复制代码
8 v' |. `. r; F# {% ^# Z1 m( o* j" e* I: R2 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 t) h6 A) D; a" J- Q& C( Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 v* g3 `+ W- h8 G* a j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% R* H3 J, M1 p& [4 u2 `
q$ L: M, c, x# z9 m
, |* x+ ?5 X4 z! Z
|
|