|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 I, [$ }$ s6 x/ Z" o
- [code]EDMA sample test application5 l+ X! {3 t* l* i& {
- /*
8 k4 k/ t1 n8 B( t. ` - * edma_test.c& M% y4 ]- S* i' @/ H) h. E4 L
- *
: j) E# `1 I) D: A) a1 \( N - * brief EDMA3 Test Application
2 o3 I" E9 m5 o# E - *
7 D5 E- ~! T ?, F - * This file contains EDMA3 Test code.
) N* C6 j) n& h5 H - *
0 g" ]) r8 p) C: B5 a* K$ T8 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 j) p' |9 g, d3 U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% e8 H4 X( x# H* L8 Y7 L) A4 c
- * TO CHANGE.
" [7 e2 R: N5 j2 f5 l. ?- d. K - *3 _2 M7 k& }$ ^( B1 L5 p; l6 L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# s# [8 o5 R* v; m - *
8 Q: K+ O4 ?2 w9 M - * This program is free software; you can redistribute it and/or
7 E* K. H! }& G8 _0 p - * modify it under the terms of the GNU General Public License as
7 `2 |4 b. B% ? [' y6 X - * published by the Free Software Foundation version 2.+ y9 e3 o4 U) N! N, m
- *
+ s5 n. l) S, K' H8 {2 ?7 B9 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( p E( _+ D, w8 I2 _" V( Z& O
- * kind, whether express or implied; without even the implied warranty; B. V, E1 P4 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ M' `& c, B, ]) P - * GNU General Public License for more details.
$ L+ D ]( J' m4 m0 ~ - */
0 K% `$ E" s( P6 m$ k - 3 |! n7 G) V7 m' B5 q
- #include <linux/module.h>
- w0 H" p- h: v: _- A1 T - #include <linux/init.h>9 j0 v/ v5 ?, c# T; B6 ^
- #include <linux/errno.h>
% r" s, A3 ^* w% F - #include <linux/types.h>
/ m. t, y5 X8 ~3 Z) t - #include <linux/interrupt.h>: m# t1 g; a2 M! `6 }
- #include <asm/io.h>
1 m' T8 M7 H8 M* l5 C% O - #include <linux/moduleparam.h>
+ q0 I6 k; g4 l - #include <linux/sysctl.h>
# q; g7 w. r7 ~1 L7 y - #include <linux/mm.h>
/ f3 j8 |7 [( C/ D& C1 C - #include <linux/dma-mapping.h>7 C: k, a, `9 F/ C
- 9 |& E, n- f$ C
- #include <mach/memory.h>& L( T) R* q/ |
- #include <mach/hardware.h>
% C; a1 F# u8 r7 f/ b - #include <mach/irqs.h>
a9 Y5 p+ m4 C# l: Z$ M1 M% { - #include <asm/hardware/edma.h>. L: b' A2 t" s$ O7 Y' u* r8 ^
- ' I8 D( _1 ~3 [- z/ F
- #undef EDMA3_DEBUG& j# I2 J) C! a# h+ c5 ?5 v
- /*#define EDMA3_DEBUG*/. E9 E- ^1 e, n
8 Y- n5 b% O" y3 \, _- #ifdef EDMA3_DEBUG
" G7 ~& N! Q) U. V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 s' @0 V" J" q, ~/ z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ L, n/ v% x# G! A" s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! w3 u3 s& j7 M2 Q2 N/ Q
- #else
2 }4 | Y! K( f - #define DMA_PRINTK( x... ) G ]. @% @7 L) x; Z( V+ a
- #define DMA_FN_IN `& q! j$ I3 T5 w4 c8 x
- #define DMA_FN_OUT
3 Q D% W! O' D! N& q# x% T. Q \ - #endif
' K- @- P/ A% m/ l - 9 S t d, L' n/ ]9 M% w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ m: O, G1 D$ {3 b* C
- #define STATIC_SHIFT 3
; d4 A* P5 s$ _0 y - #define TCINTEN_SHIFT 20& g: H2 p" }$ o+ p+ E
- #define ITCINTEN_SHIFT 21! D$ Z7 s5 M+ \0 p
- #define TCCHEN_SHIFT 223 F: A. z% A- m
- #define ITCCHEN_SHIFT 23
' |5 H* l0 y' Q+ [5 X+ }
( ^9 Y2 g7 ?( p9 x' |- static volatile int irqraised1 = 0;; f8 N V3 L6 p) r/ _9 g& \
- static volatile int irqraised2 = 0;
1 z9 _5 L: @# _0 t
7 @! X& w& }# q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 V" ], D+ i/ U( \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 A$ P( G% E+ G, U9 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); d) t: O% l; J% `& [* R
- # f# }/ D9 Y- d$ v; s( E( i/ @
- dma_addr_t dmaphyssrc1 = 0;" S$ }& H% ~( j5 B5 e% t8 V
- dma_addr_t dmaphyssrc2 = 0;! E- `# l0 k& }) X6 f$ w0 ? d" J
- dma_addr_t dmaphysdest1 = 0;6 a& h0 G3 V8 g$ n7 c4 {6 T/ k& L2 p
- dma_addr_t dmaphysdest2 = 0;
0 n0 B; i6 }; _: z2 o) e - & f+ a2 t `( u# P; k3 K
- char *dmabufsrc1 = NULL;
# K0 x: N8 ~) [3 F8 U0 D1 g$ t) j - char *dmabufsrc2 = NULL;
1 \) q& d& O) k: n2 h7 C! X - char *dmabufdest1 = NULL;
" C: Z0 a. C u - char *dmabufdest2 = NULL;
4 i: b; i: E, T- @& t
: w! P* a {6 `0 Z- static int acnt = 512;1 R1 c/ b% \ t- |3 Y* L
- static int bcnt = 8;
: i: c4 A4 z& z& Y! L - static int ccnt = 8;
: Z) Q k8 i0 j5 l' M
) O2 a- H1 U2 b& h- ?- module_param(acnt, int, S_IRUGO);. ^2 c3 r& U j D& _
- module_param(bcnt, int, S_IRUGO);! h: A* A# ^+ G" E m$ _, u
- module_param(ccnt, int, S_IRUGO);
复制代码 5 p0 T/ D4 v3 \8 Z( b6 E7 d
0 r2 K6 o% E: m6 }' r5 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, u% G) y" K0 a- o# M& W5 y$ T1 C4 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) \& v( v+ N0 Q: F, W& b# {1 E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 d' s X8 H+ x: n" L9 `3 S- Z7 m
5 \, k/ d, n' T5 A* U( `, l1 H- } E |
|