|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 y, H: X9 V+ \ f6 U" Y0 }7 i: o
- [code]EDMA sample test application
w# g, V& o% ~6 j2 U - /*
* Q$ A; v9 z) z6 F - * edma_test.c0 |: A8 t5 t, \+ m" p; Q* [" ?
- *' J7 {2 e* J0 D6 W2 @# t
- * brief EDMA3 Test Application
9 K' {6 ^" _5 h0 F% ? - *
$ k' C7 D$ D! @7 d4 @+ { - * This file contains EDMA3 Test code.9 E6 A# R ^9 |! N% y$ c4 F0 i; B
- *4 l6 Z2 `3 C' Y/ p2 v& b- C* x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& ~( l, d x) n1 C) \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 E+ D" u W8 `0 u% ~# h2 M - * TO CHANGE., U X7 X/ T) [+ b
- *1 M9 _; w/ `# Q1 L0 V3 ]& T' v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& y5 k4 n" l* m' D( P7 r( y) ? - *5 E- w, v4 [5 j r' S5 ~' F- s
- * This program is free software; you can redistribute it and/or, {2 v* v8 R8 y/ A
- * modify it under the terms of the GNU General Public License as
! \% N8 y2 U' O7 T - * published by the Free Software Foundation version 2.
6 `# c( v% B, m) G1 k* r - *! [! }4 m B) w$ l9 E6 `) @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" I. @' V$ m) X$ A- d; s' K- |+ S3 w
- * kind, whether express or implied; without even the implied warranty
: l) Z5 ]2 m0 C9 t! A f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 t& k7 T% j" R/ ^
- * GNU General Public License for more details., f+ g1 `, A. o& N5 V; s2 k
- */
[' M) n, K# R9 B$ c8 M - ' N2 P6 [, j( Y+ n, S; N- |
- #include <linux/module.h>
% ?/ o5 m- n& X B! Q - #include <linux/init.h>
0 A* X/ d2 x4 D) L: c- N6 N( R# f - #include <linux/errno.h>2 d" h( G- t8 k( }5 S
- #include <linux/types.h>7 ?( }$ }) [' r+ a1 \; v1 I+ Z* p
- #include <linux/interrupt.h>
: r O3 G. c" y: ^ - #include <asm/io.h>; W9 E R$ V: Y( k
- #include <linux/moduleparam.h>
) E4 }, w4 [" ~; _" s$ H - #include <linux/sysctl.h>
( x* D6 }$ M; P - #include <linux/mm.h>2 L: p( V+ i* s: E/ L# [6 D, |( r
- #include <linux/dma-mapping.h>
. q) F: _. x9 \ h
, A0 l7 a* ]3 _- #include <mach/memory.h>7 L7 f* Q3 S2 [2 ~* z& @& j: O# y, G
- #include <mach/hardware.h>9 n! s; e; {- j; M8 A- q
- #include <mach/irqs.h>
! L: \4 v, z& |$ B0 u& _3 b - #include <asm/hardware/edma.h>. f& R% ]) c- T9 ?$ {+ C9 t' P1 v
- % }" m$ {8 V: `
- #undef EDMA3_DEBUG
, D4 w+ t6 R; l/ A$ H1 J9 F& d - /*#define EDMA3_DEBUG*/
; ~) O8 f, k3 M9 M% f5 b! y
. G( J5 J* w1 |5 C4 q W; p, [- #ifdef EDMA3_DEBUG
. W7 |2 ^3 e* }9 v7 G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 H6 ^8 N4 O8 P% \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
w, P; r& n0 m4 Y. l2 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ s& G6 V( E2 h/ W# e3 B
- #else
% }: L+ h4 W/ C! Z. M - #define DMA_PRINTK( x... )
1 ?* K* a Y& V& u - #define DMA_FN_IN
4 Y7 ^5 Z- P3 x, O# l - #define DMA_FN_OUT( U, W7 L& f9 K# N& F& ]! a2 s
- #endif
- S# @! a" z. y: @
4 t3 `, J/ @3 ^2 r% i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& G9 b {& J2 S" l5 K
- #define STATIC_SHIFT 30 ?" s" C5 \* r2 Q
- #define TCINTEN_SHIFT 20- d5 d) ?; V7 O" S
- #define ITCINTEN_SHIFT 219 c$ f/ X U" S& G2 J. }( _
- #define TCCHEN_SHIFT 22" C7 n/ p0 ^" @- Z' u* d
- #define ITCCHEN_SHIFT 236 D, y) n/ A9 W# e) I
2 T: _( U5 j: x" A0 J- static volatile int irqraised1 = 0;
' ] F- O5 f/ E$ I4 p - static volatile int irqraised2 = 0;
; T; _9 C0 }7 ~3 j$ ^9 P$ u" \
: e1 f) D/ P6 c6 v! B6 Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s: K1 }) x1 s2 M1 t" b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ s0 F2 t5 \( K8 P* D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 S, K' v/ t- N - : c+ Z0 }# `) G" ?/ M( u
- dma_addr_t dmaphyssrc1 = 0;6 o. G1 ?- d7 o! l9 u
- dma_addr_t dmaphyssrc2 = 0;
" h& B) y. b* c2 Z; x4 S3 d - dma_addr_t dmaphysdest1 = 0;
# O e8 w% n* X0 L: S" E - dma_addr_t dmaphysdest2 = 0;* [* K' e! S& M
- 3 o7 B- u$ ?' U/ z5 T7 \1 j
- char *dmabufsrc1 = NULL;% U$ M8 {7 v1 U4 q% {, x( P* V
- char *dmabufsrc2 = NULL;
: X o' {1 S. Q2 d$ j0 A% W - char *dmabufdest1 = NULL; D+ O, u/ e" |: `, [
- char *dmabufdest2 = NULL;
, R1 c6 X" E: O% @
3 B: p2 v' I& n2 _( }- static int acnt = 512;
9 z0 e5 W2 D4 c! W& v% y5 j - static int bcnt = 8;2 Z4 i. z/ A! u1 A5 l+ q8 m' u
- static int ccnt = 8;
* D6 u9 U& O& P7 l5 z - : v: T# X% F0 ]) h" R6 R
- module_param(acnt, int, S_IRUGO);
. N9 G% ^. d" R0 |1 _7 E) J& B - module_param(bcnt, int, S_IRUGO);' I1 s9 x" g' a/ K
- module_param(ccnt, int, S_IRUGO);
复制代码 3 E( v" W; \% J0 y& V0 ?
2 e% w0 E4 E; E! J$ |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 q$ J6 w0 j! V, ^4 w1 `" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 x$ F/ I) f* u8 r6 R9 a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 R, e7 z3 T) X0 w* `% i, |# l: G6 `4 B. a, w( N4 A
8 p6 ?+ B- A6 r6 }
|
|