|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + N% n3 P& }% I
- [code]EDMA sample test application
* g3 p. q3 m, ]4 \( z6 y% ~( o - /*
5 H5 N7 \9 G0 E: t' o8 e - * edma_test.c
5 @7 }- d: U3 t8 P! o: B - *6 c3 x2 l1 b$ s% u" l
- * brief EDMA3 Test Application4 S. O+ I# d$ m: W5 E% I8 J2 @
- *
* u0 h7 |* I; m6 k6 B0 Q9 u$ V - * This file contains EDMA3 Test code./ t- Q( P+ B8 U2 F* ~& v5 C
- *9 B' z% B ?; B) v# j0 L( x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# s* k) S" G5 k z+ e* S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 `+ K0 ~$ x" t" v. m
- * TO CHANGE.+ f/ ^% R8 _/ F( N. Z4 K1 _' ?
- *
8 e8 `$ ]7 b1 M1 \1 o' a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 ^3 c* a% Y6 o' [3 P
- *
2 Z, ]9 {* |1 ~ X/ A9 L$ n - * This program is free software; you can redistribute it and/or
. _* V" N9 j) \& L5 J! [! W: p - * modify it under the terms of the GNU General Public License as
7 \& ?+ ?" s! h - * published by the Free Software Foundation version 2.
3 `0 D: O$ `, b- E( n/ _% \# d5 O - *: ]! K' r( P1 Z9 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" F, c; Y {) n5 Y
- * kind, whether express or implied; without even the implied warranty
/ N8 Z! T g, R0 A9 \; F+ ^; m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 |0 S0 F, E; }9 |$ l
- * GNU General Public License for more details.
7 m$ k; n* y$ n - */
# B% @6 C& c5 i
0 }. I3 B8 C7 D9 q8 i& j$ l- #include <linux/module.h>; S& E2 Y4 }* _9 r( H8 J
- #include <linux/init.h>1 Z- L$ c- U8 `
- #include <linux/errno.h>
' k, i7 n' C) g$ ~5 ` - #include <linux/types.h>
( M; I+ R3 p( ~6 C1 _' ~ - #include <linux/interrupt.h>' l0 E& \- S, ?; j- J0 X
- #include <asm/io.h>0 d1 v3 c+ P% U- [% i
- #include <linux/moduleparam.h>
4 I2 ]( U. f6 j" c4 H3 n - #include <linux/sysctl.h>4 {8 N [8 q+ x2 t- u
- #include <linux/mm.h>
6 E. j& _ ]% ?$ N% ] - #include <linux/dma-mapping.h>
, A, p1 t$ N0 z1 ?1 @ t - % G4 s- T9 O% U
- #include <mach/memory.h>, M) [5 [. i, z4 t. `! n# p
- #include <mach/hardware.h>7 G+ w3 q) L. f' y# y
- #include <mach/irqs.h>
. ^5 Y4 z& W. o2 ^ - #include <asm/hardware/edma.h>
\: R6 A# ^: c: N$ j( b; c1 K - . j) \) D; C. w! r
- #undef EDMA3_DEBUG" Z. u& d+ k% e$ i# K5 [
- /*#define EDMA3_DEBUG*/
$ R5 D0 ?5 L6 d. }/ `8 j e - 7 F- F; Q; `- r+ A% W2 I a
- #ifdef EDMA3_DEBUG
( G0 D) R N8 {2 N' C1 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* Y Z4 E: S% g2 t; o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' \$ x9 ~9 N# n$ y M4 }, e7 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ s7 N( U4 f/ H; ]1 t7 }5 K9 X/ [
- #else
9 K% O$ q; M: k2 I - #define DMA_PRINTK( x... )3 c5 _) K! @; P9 o$ E5 f; |5 p1 e; W
- #define DMA_FN_IN
5 Z8 S: X+ |/ l0 n. Z0 ~* m - #define DMA_FN_OUT
5 l7 f- B i3 Y6 q - #endif
( v' a: a5 t* J" I! a - ( o4 i: u8 z/ I9 i- i: P( Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 G3 Z$ X) v6 W. u9 P/ Y& ~& x5 x
- #define STATIC_SHIFT 3+ T0 K# w A* m( J8 k, t
- #define TCINTEN_SHIFT 20# X# g2 T1 r( ], `) P1 s
- #define ITCINTEN_SHIFT 216 {9 ~" @, J) m* V6 `
- #define TCCHEN_SHIFT 22
- K) u+ D* k+ H - #define ITCCHEN_SHIFT 230 b* F9 p9 q X
! l% f( z% C, y& e( m3 D- static volatile int irqraised1 = 0;
6 l1 W% P4 H4 } - static volatile int irqraised2 = 0;
$ [! {4 d: _6 O1 b! R - 3 s2 \4 j2 D. }3 R, f4 @* _* @- f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% i1 r/ Y8 r& F( D0 H! K3 { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 L. x2 f" L3 r5 _2 X5 s1 f8 }7 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 H% Y t7 x; r. L/ L
- . G: \. |* R& ~0 S- O+ R, _/ X
- dma_addr_t dmaphyssrc1 = 0;
2 W K' m& f E( U. z K - dma_addr_t dmaphyssrc2 = 0;7 _: S$ c& O$ n
- dma_addr_t dmaphysdest1 = 0;; G4 c# J& |3 h; |, s6 W
- dma_addr_t dmaphysdest2 = 0;
7 J" ?( u3 W; x: a, @5 j - 4 _# k$ |/ S0 X! H. |) w" j! R
- char *dmabufsrc1 = NULL;
9 G/ u& d. \* Y" p) [6 N' I - char *dmabufsrc2 = NULL;
9 F/ {& A+ G& } - char *dmabufdest1 = NULL;
+ W( F& z9 X V; ] - char *dmabufdest2 = NULL;. d3 N- X1 |( t+ N6 M& d
- 4 K" S5 t, x: q# S6 e) h
- static int acnt = 512;
0 J. g+ {3 j* m! h6 v - static int bcnt = 8;- I8 ^5 t5 I7 s I: {) U) B' Y
- static int ccnt = 8;
3 o/ J) e9 T' R }
: J; N8 a2 T4 b3 B) z0 z, J- module_param(acnt, int, S_IRUGO);
* l) @4 o, h8 Y4 o - module_param(bcnt, int, S_IRUGO);, N, q u, w3 l( X5 N, Q% F
- module_param(ccnt, int, S_IRUGO);
复制代码
6 w. `1 y! }! M5 P( l# }
0 d8 d) d. b. Q6 K2 ]$ B9 v1 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 S( D+ r# c( z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" W" q5 ]$ r6 n5 m- S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 @6 \( _+ g" V! f
7 ~/ b2 C8 U, H% M" }# K: u4 {2 z/ E! S
3 h; \! Z* T9 `* J) j. J7 i |
|