|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- E/ `: ]( y* v' T2 S- [code]EDMA sample test application
' W8 M1 ?( A" b3 a1 g - /*# O% P! l. x" b. n. A+ E
- * edma_test.c
1 @7 ?/ T/ [3 | R# L1 X; s D3 { - *
6 _' y7 P; c- `1 M - * brief EDMA3 Test Application
; q4 S, \! ?& ~7 Q# H& a* I - *0 f( p1 W- _& _' ~# }8 \
- * This file contains EDMA3 Test code.
. F0 T: ~. |, A- }8 ~6 S - *
9 X& N0 Q9 K5 ] @$ h: \' q& F8 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 p$ `! J/ e# J# |2 I2 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) m6 W2 S; v5 B
- * TO CHANGE.; c2 n; S2 e9 ], a
- *. ^9 X' k! k3 Q- u9 y0 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( V4 M8 b! l1 ]" P9 l' t
- *! Q6 N) Q! a; e
- * This program is free software; you can redistribute it and/or
- B: u @, K4 z - * modify it under the terms of the GNU General Public License as$ l- o' {/ [5 Y, ?4 _
- * published by the Free Software Foundation version 2.
& }% {- K; C) N - *: [2 J% l/ ^% U7 q) q& a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; a, V# |% L0 h7 d
- * kind, whether express or implied; without even the implied warranty
) l' Q4 K r) u) n3 _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# v8 T5 R5 C; W0 K" m B
- * GNU General Public License for more details.
) f4 R- U3 k$ N - */$ a5 {6 a2 P5 P/ s1 z. E" K
& B! Y2 z, O# ?- #include <linux/module.h>
% F$ Q( `/ r, y6 o - #include <linux/init.h>3 s9 q4 w& F* c, Y" E2 d8 S2 p
- #include <linux/errno.h> h$ \% d) @! f- p6 i
- #include <linux/types.h>* ?) }. s2 j, e! S! z
- #include <linux/interrupt.h>7 G/ L: t' @ B/ \) b
- #include <asm/io.h>
6 T8 x) C3 _6 k& [ - #include <linux/moduleparam.h>/ o' t/ ^- Z3 u8 E
- #include <linux/sysctl.h>/ G: G- B7 i6 O+ {" S" }
- #include <linux/mm.h>
+ h8 \4 }, j) ?. p - #include <linux/dma-mapping.h>
6 K6 D* s* B/ G# g1 q# {( K
. e* Y" I/ }9 d. @; E2 @/ D- #include <mach/memory.h>) M) C' c: }9 m. H7 } Q
- #include <mach/hardware.h>
) W- v( y7 c* K3 E" S/ h% k- c - #include <mach/irqs.h>% N; m& Z8 T! S8 x
- #include <asm/hardware/edma.h>
3 W6 Z) i% ~3 z/ E9 ?/ k - # H, f) V& U5 f( f
- #undef EDMA3_DEBUG
% A$ P% C5 A$ r - /*#define EDMA3_DEBUG*/* o/ F$ O: Z' ?: O
' k9 A, [ p/ H3 f- #ifdef EDMA3_DEBUG+ T: P8 M6 z1 O5 k( s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% x B' s/ X( V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' |& G( ~( l# o$ e, e& ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* [' ]4 V% m3 i+ ^8 x: |3 m - #else; s1 B1 G k; J: @+ {6 k
- #define DMA_PRINTK( x... )/ j" b, L2 @. L4 V
- #define DMA_FN_IN8 e- \+ j; B! o, K' j* L$ S
- #define DMA_FN_OUT
# i/ f' g8 R8 e# k. [ - #endif: X; B( k9 y' W5 E
- . U9 o) Y' Y2 {/ L5 a* o; p. D+ L2 Z9 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( C! v7 [' u) K4 g+ o) S
- #define STATIC_SHIFT 3
4 ]8 T% C0 K" B& ^7 y - #define TCINTEN_SHIFT 20
! n# j$ w6 O0 F" u" R) ?# Z - #define ITCINTEN_SHIFT 219 T; \: P& R/ A6 D1 E4 e
- #define TCCHEN_SHIFT 22
% [2 j' c" P m+ P# A [1 r - #define ITCCHEN_SHIFT 23
+ R' \4 z3 c3 m2 z - , D4 {- R1 T2 i4 X
- static volatile int irqraised1 = 0;
7 s0 Y( ^- [2 b; E - static volatile int irqraised2 = 0;1 b) f. I+ r7 b; I$ M! c
7 @* {6 w" K& d; a+ o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); S2 f$ s4 a6 a+ i( ]& s: X1 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ?7 G' X4 ]3 O% Q! g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' \8 X7 l2 K% i8 R% Q* f' o - 8 @1 T0 W, ?+ T
- dma_addr_t dmaphyssrc1 = 0;
! v9 F" r9 ~, u4 a1 j5 H2 ]8 c9 `7 s - dma_addr_t dmaphyssrc2 = 0;( t! U! ]0 v% `5 x
- dma_addr_t dmaphysdest1 = 0;
( [4 \) F, W0 q9 I4 A - dma_addr_t dmaphysdest2 = 0;4 D; G2 i1 i. C2 W0 X; J v
- + W6 V$ ?/ a5 }" ]- ^
- char *dmabufsrc1 = NULL;* E$ b- S( |+ e7 b; f
- char *dmabufsrc2 = NULL;# T, S1 x! V# _( U
- char *dmabufdest1 = NULL;: j3 i2 d/ U! y" _4 B
- char *dmabufdest2 = NULL;
2 k. g; I# n1 \/ ~" p - + [6 ], s% k7 U3 F5 @' |; ]
- static int acnt = 512;0 h o) K! D7 [9 S2 [; b
- static int bcnt = 8;
8 @% k6 g% V; Z: u: k) O - static int ccnt = 8;1 D/ R' J- g- X- q, R0 e+ Q
3 n" e& I- x$ R" u- module_param(acnt, int, S_IRUGO);
; i0 w# g( T' B/ W( s& X2 m# [ - module_param(bcnt, int, S_IRUGO);
& ^8 S i& F5 n! Y - module_param(ccnt, int, S_IRUGO);
复制代码
% k, c2 O, s' g3 T& x3 ]- o( M' H( V+ g, o& d+ P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 _/ X! s7 T; I8 B/ _4 M+ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( V' a8 N4 O, w U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 R3 x3 a7 e# U K8 w. G
3 {% D' @. q- P
1 ?0 ?, h( ?# F [, c& M7 q
|
|