|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
q$ v( W. b: T9 h# V- t8 X4 U6 q- [code]EDMA sample test application* L+ A2 i7 E8 T8 Q; `8 g
- /** d8 J, j/ [6 i0 D& X9 E0 Y
- * edma_test.c
+ j/ S2 s9 R; l6 n8 @) Y& r; R - *
6 M% a" m* n; ^! ]3 Q+ d% G - * brief EDMA3 Test Application
1 K. V1 l7 r& M M% @4 D - *) n6 P- X6 Y9 {+ i
- * This file contains EDMA3 Test code.3 d1 e9 g7 ^+ {) s# B0 ]) @
- *3 Z0 r7 f, q1 w% o: f# b6 Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ^, Y9 _' L' L, e' @; H6 X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, D8 y* `7 L/ \9 T6 d - * TO CHANGE.
1 z, d- o) c! M1 } - *
H1 Y" n' @8 C8 N2 c4 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 }: n- E9 f1 O1 ?5 F( C2 n7 z - ** k6 @9 D& X: U: v* B5 Q
- * This program is free software; you can redistribute it and/or& R# l; n$ w; R v. W
- * modify it under the terms of the GNU General Public License as+ D6 _( ~# T# A5 z3 ~
- * published by the Free Software Foundation version 2.
4 \& A% o6 \" c8 Y! ~1 v - *% i- V4 U9 k2 [! N, q4 Z- H2 K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: Z/ }2 ]$ [2 _8 T; m4 m8 e
- * kind, whether express or implied; without even the implied warranty
6 b( j. q3 s$ ?) `1 |, g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( V+ ?( x+ j! ] l
- * GNU General Public License for more details.% J6 R+ l1 `- Z7 p4 }
- */& v9 Z3 N9 \9 y/ P1 Y
- , Y: G1 g% L* R0 f0 F* W- T; n
- #include <linux/module.h>& A M: P8 }* P, a
- #include <linux/init.h>, E5 L6 d2 r$ Q7 }1 u6 t! j+ Z
- #include <linux/errno.h>& p3 S6 v0 v4 H9 } K! d
- #include <linux/types.h>
" O. ?: y4 h: V6 e7 m - #include <linux/interrupt.h>$ M4 c, e- \ l+ D
- #include <asm/io.h>
6 m+ M$ n* C( G" t% k - #include <linux/moduleparam.h>8 s. w$ u: L U
- #include <linux/sysctl.h>; k' o; |' E/ {; e, b! h
- #include <linux/mm.h>9 {; f E6 s# t
- #include <linux/dma-mapping.h>
) S/ n5 B$ Z" A* ^% G3 I
9 J1 k: `- Y9 ?) T4 |" K- #include <mach/memory.h>
% f7 e. r. Q3 @1 o' q - #include <mach/hardware.h>4 B( f+ I2 v6 ? q( d5 W
- #include <mach/irqs.h>* Y6 m# E$ {4 Q% \6 \" m
- #include <asm/hardware/edma.h>
) B) N! t9 c4 h3 j - - R, ]4 `5 P: w4 v
- #undef EDMA3_DEBUG
9 W9 P5 ~( D& _: P8 g - /*#define EDMA3_DEBUG*/
0 N# F ]7 J( @1 R3 E7 L - 7 E" N7 H+ s4 |4 R \
- #ifdef EDMA3_DEBUG' @' Y) D1 B L5 I. L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ p; S J- a: i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 A6 O5 g9 i6 z3 }& N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 o! M) T3 y5 J3 C
- #else. I1 A c0 i- @3 [$ s# _9 i
- #define DMA_PRINTK( x... )
4 ^' Q( `. L/ ^* |8 ^- P' J - #define DMA_FN_IN
6 b7 p7 c- t5 T. v! a - #define DMA_FN_OUT
# W$ M" {6 _" n+ I4 i3 I - #endif* D0 y% Y) M9 i
, Q3 u3 K% D5 [. Z S C1 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# w+ a: \( B6 I1 T* x/ c8 l - #define STATIC_SHIFT 3 q/ v& c* k3 f3 s6 U
- #define TCINTEN_SHIFT 20
8 y6 R* f) E! p+ e+ a - #define ITCINTEN_SHIFT 21
" D3 L6 t# I; c0 m; S) ^ - #define TCCHEN_SHIFT 22/ h& g. Y7 y1 u8 K% `* n
- #define ITCCHEN_SHIFT 233 W( s3 @ n1 `, U( d/ f% \
0 t2 ]' x: U; d ?1 o; `) t, U _- static volatile int irqraised1 = 0;, t. Z' X" g; A# J( G9 v
- static volatile int irqraised2 = 0;. h3 o7 C+ K) v& D }; K& ~& Q
+ {) e+ C) f2 g% k, \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 k: X' Q" l6 V2 K% a2 r6 p. h9 r3 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 s1 m E Q2 Q: s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. e8 b- ]8 A3 A3 J* u( P& M
* b& ?: f8 _3 e" j- f1 @- dma_addr_t dmaphyssrc1 = 0;/ ~* i" ^! i7 y2 [
- dma_addr_t dmaphyssrc2 = 0;
! H. ]% L: E a - dma_addr_t dmaphysdest1 = 0;: s W' x- _" _) B0 Y$ @1 X2 i
- dma_addr_t dmaphysdest2 = 0;
' u0 o- l0 C9 F7 f: w4 S. }- w0 X - # M. @ _ T4 S1 V9 Q: I/ b
- char *dmabufsrc1 = NULL;" ~) A+ p. ~& h( l0 N$ Q }
- char *dmabufsrc2 = NULL;3 s7 H' S. W5 o/ K- x
- char *dmabufdest1 = NULL;# Y+ B8 p6 w# s2 \: b5 X
- char *dmabufdest2 = NULL;
+ F" `& B9 ~3 Y. z( l- `' N4 L
3 v+ O! ?2 B& ]5 w b8 U; I- static int acnt = 512; j* \& p$ v3 O% M' i6 b
- static int bcnt = 8;9 ?- B4 I" y- v* Z9 @) p7 x2 x5 l% {! }
- static int ccnt = 8;. j8 U; b( Z# {2 h
- 7 B' u) z l! u2 r$ m( i7 U4 l
- module_param(acnt, int, S_IRUGO);
' J! n. s$ d G. j, O( U# X4 P7 L - module_param(bcnt, int, S_IRUGO);
7 O9 Z" Y' O0 d; { R6 _3 e; @3 x - module_param(ccnt, int, S_IRUGO);
复制代码 9 t( ~1 |2 y0 Y9 h% K, c
9 e. h8 r J! Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) n: d" _- [: }9 r& d* S4 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# D5 h7 W" ?6 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& b, N6 B B; @6 J. L/ g# W$ k
5 B2 C3 u1 a B7 H/ a
8 ]# k2 I* H8 k: f* o& B
|
|