|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 v7 T4 _8 x8 b
- [code]EDMA sample test application1 V# c6 K) ^6 k+ M8 P. S! d
- /*
. N7 e: [% T9 F4 W' m - * edma_test.c
" L$ m. A6 f; b- j - *; B* m0 b1 X5 w* F* F0 s e
- * brief EDMA3 Test Application
3 u* E* R/ u6 {5 I7 l - *% y7 i2 r. ?* a
- * This file contains EDMA3 Test code.
, F2 M9 I7 `! ?' h2 G, ]7 m - *' W- Y& ?( G8 |+ _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. Q' ?+ x8 P, E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& B& |; E4 c$ f6 W) \! i+ m - * TO CHANGE.
& M. {- _6 @4 s: @) E$ z5 Y - *
0 J9 Z5 C) y, r. E v0 I! m' L! m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 y. \. G* V; ]6 \, C$ K
- *
" A8 X# N y, m" ^9 V, e - * This program is free software; you can redistribute it and/or
- t1 l& P* P. F% Z+ O - * modify it under the terms of the GNU General Public License as8 f) y) u3 [7 X; I! \8 D
- * published by the Free Software Foundation version 2.
1 k4 G* \" }3 {( ~% A/ c. `( Z0 g - *1 g3 u1 b# Z" o% L. R+ n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" d4 G* W+ G* L
- * kind, whether express or implied; without even the implied warranty
2 H. G3 c% f, h1 V" E1 @- w0 N9 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" Y2 `4 M; H3 x o3 S# i. m- M6 ?3 I
- * GNU General Public License for more details.
4 A0 c, [1 ~1 X4 H) O - */# h7 r- W& t N$ K# |. X
; [( L c2 y1 s- #include <linux/module.h>2 {4 v" o J0 b: |% I/ r3 R
- #include <linux/init.h>
. y6 O' _- u% ~5 f" U/ S1 u" S - #include <linux/errno.h>
. ?& P8 q" B' b - #include <linux/types.h>( P2 n8 W& I; x5 h
- #include <linux/interrupt.h>/ n7 y4 ^, O6 i3 ]0 ~
- #include <asm/io.h>' h b3 _% u7 M! G: p) G
- #include <linux/moduleparam.h>) Z7 V$ w! `6 L( t" d$ h
- #include <linux/sysctl.h>, h/ X4 @% I) W' o3 W- G8 b* U6 `5 C
- #include <linux/mm.h>0 q! ], k/ }* F& F2 [! y
- #include <linux/dma-mapping.h>
- C5 x: I- q [$ u5 X _' v - Y2 y7 s8 J$ R4 f/ Y$ p0 u
- #include <mach/memory.h>
" W. t, @7 L5 c" O - #include <mach/hardware.h>
/ `$ {5 n u% L, x7 M - #include <mach/irqs.h>: ]' M4 R2 k5 l4 b0 y; @
- #include <asm/hardware/edma.h>
1 k6 x+ g- Y; i/ T i1 R) a* f - / z4 p+ Z* U4 B9 {% K
- #undef EDMA3_DEBUG( Y; Y) \7 `8 e7 F2 F
- /*#define EDMA3_DEBUG*/7 r! c6 f% ~( p I
- - j! J" d+ E. p C# ^/ }& [! ^
- #ifdef EDMA3_DEBUG( _& e7 _" x1 U4 `3 ]5 C) ~/ b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), m/ y8 Z& @7 d" L5 ~2 K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), u8 l4 d7 ?) E O2 e8 [! C2 M" w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ U- V& C- ^, h" @9 v7 |# y
- #else- g/ S6 K1 Q% j7 a% ^. h" l" T2 u3 M
- #define DMA_PRINTK( x... )
) y4 D. k8 p( s8 q9 v# t9 B - #define DMA_FN_IN5 }: Y6 |! h! N) C3 A
- #define DMA_FN_OUT
3 M V& X' i8 |- u, f; }$ [ - #endif1 S0 F7 J: I9 _8 ]6 G8 |- a0 \
- ' A8 `$ _2 G6 a+ t8 v$ J2 L8 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 z; d; S) c! m* W- |
- #define STATIC_SHIFT 3; H y0 q3 c4 g% p$ w! ]
- #define TCINTEN_SHIFT 203 y/ q' d; `1 e9 ?% C/ e2 C' K. I: `! I
- #define ITCINTEN_SHIFT 21! t1 j% N5 Q$ k, J8 K4 ~+ z4 I
- #define TCCHEN_SHIFT 22
5 j ~6 ~4 g1 [& u3 C! o9 ?! b$ m - #define ITCCHEN_SHIFT 23
7 L; S0 X$ y& r8 C
n- N. K4 ^2 h$ v0 |' g- static volatile int irqraised1 = 0;
) U! [ u& n- o% w8 m u" m4 ] - static volatile int irqraised2 = 0;
0 a1 V* V4 k& U1 s& F: a5 w
* {- O1 ?' S. s3 c! X; x/ m! T8 ?) o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) T; Q4 F8 R5 z) e: h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c: K4 h# r1 C" t9 L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d5 k$ M; o9 ]* m% F6 U
- ; K- r! S) K) x* q3 f9 }+ e% w `! }
- dma_addr_t dmaphyssrc1 = 0;
! k- ]6 e7 W; }& {: h - dma_addr_t dmaphyssrc2 = 0;8 |5 P$ e K* A# v2 j. M5 A0 U0 Y" P
- dma_addr_t dmaphysdest1 = 0;
' s1 D0 m/ @! l6 O# @ - dma_addr_t dmaphysdest2 = 0;
2 ~4 R: m/ d- E7 ^8 H - " \' H1 O5 R C: ^
- char *dmabufsrc1 = NULL;: T" O9 u8 ^% W: S! s. C: _- D
- char *dmabufsrc2 = NULL;, L$ y- N9 j. o$ m2 Q) A( f
- char *dmabufdest1 = NULL;
; F; h" E0 F* }5 M - char *dmabufdest2 = NULL;
; ]2 l* f; \8 _) K" p" Y
9 h; \% J* w; y* n- static int acnt = 512;: W/ X2 G6 {, ~" v% _% m' y
- static int bcnt = 8;
' h! s: L6 e4 z, P& b, [# m - static int ccnt = 8;
: u, ~) T9 B' {/ I1 c; u: b - 5 W# W1 A9 g/ |+ b& Q
- module_param(acnt, int, S_IRUGO);
; o2 h3 h8 s+ L - module_param(bcnt, int, S_IRUGO);+ l* a6 q. q9 {) Y. R5 V2 s ~. [
- module_param(ccnt, int, S_IRUGO);
复制代码 $ j, c: `- ^: G7 ?) Q$ @
; p6 r, G) [6 ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& }* C O( x o7 Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 J7 |8 I1 Q! F! ^7 K9 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 y ?6 E# R# m/ X1 t
6 j3 g9 g& ^8 f7 w: p1 q. F* J& s0 X8 @. `6 O4 n
|
|