|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ b) d7 w/ ~2 q: M
- [code]EDMA sample test application
( [1 S4 i. E* L, F) j; s - /*
I* R1 Y9 T% H/ _& ]; } - * edma_test.c; X; b* N5 B, k2 h4 K( B, m
- *
; C# \3 }" x' M( G7 H% \ - * brief EDMA3 Test Application
* K3 D0 H$ s' ]1 V4 r - *5 h; e* y k# Q& J/ ~9 R0 v
- * This file contains EDMA3 Test code.
8 D1 b& b7 ?+ \# l. R - *
) [5 ]( q# \; c5 [( Z4 o- p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 b' `% o# o9 |8 B6 Q/ h$ R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ ^/ x8 f6 k8 N7 b) _' c
- * TO CHANGE.
! N! m7 ^: j7 E, \ - *
6 h1 i8 {" i4 o9 D& v, S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ L' G3 \1 |7 ?- G/ \ - *3 m$ y- d# S3 s* ^; d
- * This program is free software; you can redistribute it and/or
3 X1 j8 D+ B) M" q4 E - * modify it under the terms of the GNU General Public License as
" q3 u% ]8 g$ ~8 s5 m, A4 x - * published by the Free Software Foundation version 2.
4 R* d; R. _' y5 o0 k - *
( ~& n+ |' [. |8 k, n" m3 ]9 b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! Y) q* p( I/ Y4 I& D2 r( o
- * kind, whether express or implied; without even the implied warranty
7 W# n6 N2 K8 M1 n) V. p7 g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 `7 b- h# k3 ]* z+ _ - * GNU General Public License for more details.
. n; G/ I/ [4 \4 |- G$ @. v - */
- L* Q, @8 _& C1 o) N. F: x# g - 4 J5 h* U' N1 q0 Y
- #include <linux/module.h>
/ H( \( t' C+ s- M& ]1 D - #include <linux/init.h>
0 V4 v# a7 ]* z1 `/ `, [ - #include <linux/errno.h>5 q9 @. G7 j( s) Y; F" ?
- #include <linux/types.h>. `( f7 A* k$ z( o c/ e
- #include <linux/interrupt.h>+ S# v* D+ O: W( i8 ?0 k
- #include <asm/io.h>
; q8 {' k7 w- y3 B9 Q5 E. B' s - #include <linux/moduleparam.h>
1 U( @6 G/ y. q - #include <linux/sysctl.h>; G: M( Y7 O0 R$ A2 B9 o) `
- #include <linux/mm.h>, w* k- c. e3 ^7 p# E0 T
- #include <linux/dma-mapping.h>5 a. ?0 T' I$ e- [% z
- . z6 g. {2 B5 I$ D
- #include <mach/memory.h>' M' R& O% }+ S. b
- #include <mach/hardware.h>
5 a5 |. G# S! f) m/ P$ M0 q - #include <mach/irqs.h>0 ~6 \* K1 |2 t v
- #include <asm/hardware/edma.h>3 u* _ b' k6 R* W( h! i+ C
- % v5 g5 b7 a' O2 Q
- #undef EDMA3_DEBUG
g0 Y- a; {1 g4 q& n; {) S - /*#define EDMA3_DEBUG*/+ W7 P6 Z1 {1 F; P
; c2 M$ z$ P8 _1 i$ `8 L& {" v- #ifdef EDMA3_DEBUG, \8 H' D/ `- w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& K- i$ J2 W8 F6 h- K0 j3 G8 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% W* k; \1 H! K& f6 g% N; @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ V: P0 b8 ~- f3 _ - #else
; O! z4 D2 W" i+ g+ I - #define DMA_PRINTK( x... ): E% k1 P/ v8 W& M, R8 T4 c \
- #define DMA_FN_IN; \1 K1 h; |9 A' K/ e2 m
- #define DMA_FN_OUT0 d. @- V! [! p" r; ^0 p4 @( G
- #endif
; Z. }. e9 K2 `! ?9 o& _
! @# ~) Y) b0 s. B; ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) c5 x" {4 A/ N2 H$ |
- #define STATIC_SHIFT 3 p" y/ A4 b$ q5 v6 \+ m
- #define TCINTEN_SHIFT 20
# ~0 N D0 Y/ b4 `6 c( H: f5 m - #define ITCINTEN_SHIFT 212 v7 T3 S$ l; T0 Z
- #define TCCHEN_SHIFT 223 ~; \- e! ]5 \$ p' l9 H
- #define ITCCHEN_SHIFT 23
7 i' |* S, u k7 e7 [3 ? - 0 t5 P2 v6 `1 F
- static volatile int irqraised1 = 0;
: X2 s/ }2 O) S l/ Q. v; V - static volatile int irqraised2 = 0;
2 ?3 T( L7 g1 ~$ {8 M
9 w: Q/ A8 f& F } d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* x, b* m7 w; p' N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. A3 [0 ?* @0 n" B6 h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 F* l& I! W2 ]0 H$ _6 C
- / Y( O4 g' o. z- Q- z; C3 n
- dma_addr_t dmaphyssrc1 = 0;
. ~8 f0 s0 { o' ?; n/ ?+ N - dma_addr_t dmaphyssrc2 = 0;4 s. n9 e7 A5 ]: A
- dma_addr_t dmaphysdest1 = 0;; S7 M& ]8 u V/ p
- dma_addr_t dmaphysdest2 = 0;
9 U) g- U3 Y* F- ~0 T0 J& @2 K- M
4 S$ L3 H" P7 k0 ^/ H- char *dmabufsrc1 = NULL;
# s9 n I" a3 o - char *dmabufsrc2 = NULL;
% S2 x0 C5 R5 T; E p. Y2 M4 n- p3 B - char *dmabufdest1 = NULL;
; Q c& C% V6 F9 T - char *dmabufdest2 = NULL;9 e5 \7 L' y7 `' N- B/ d9 p
. q! S" ^) V$ G* e- static int acnt = 512;2 M) I2 H& v( J
- static int bcnt = 8;9 ^* _# w- l) |$ {7 A5 t
- static int ccnt = 8;( L, P* B- R# e) s
; I' L5 X" {7 E, ^9 X- module_param(acnt, int, S_IRUGO);
# H% S0 _ T3 D - module_param(bcnt, int, S_IRUGO);
& N+ I7 Z, G; x' u7 K3 a8 A9 } - module_param(ccnt, int, S_IRUGO);
复制代码 $ M. P; g: ?6 u. j
6 f1 ?! V& F) N3 l# J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( t5 w+ w7 r( D4 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ y( j; \( B/ V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, t7 _! ], I6 y/ @8 ^" F+ L; o2 U' X/ m9 `
+ c- D2 _$ `+ t" i$ ` |
|