|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ F$ o( H" S' y$ `6 |5 a- [code]EDMA sample test application+ D7 B, \3 ~( l- V! q2 Q1 G
- /*
: N5 A0 D; Q6 R/ D+ ~ - * edma_test.c
3 H2 g* B5 }/ W$ d4 Y' r, t' u - *
* Q3 u6 S" [/ R0 F9 o3 L - * brief EDMA3 Test Application
2 y5 T8 }, A+ J$ _/ A9 B0 x- E - *
9 ?7 S. W5 h# k - * This file contains EDMA3 Test code.- g% m; r) U, N9 l- H& ?( r* @6 o
- *
# J+ x' ?8 n0 ?9 A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 Q7 x1 @: a4 u0 r7 t" V, d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' c9 {4 e$ U+ h7 x7 ^
- * TO CHANGE.
4 a" K; n& @- n7 P! R& I/ T" @ - *3 n y B% Z' q( }3 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 {/ {9 K2 l- ?3 G, ` - *
' t. y/ n# K7 L8 T8 B D - * This program is free software; you can redistribute it and/or
! L. f3 O2 v& g5 { - * modify it under the terms of the GNU General Public License as# V. @8 Y0 J; ]0 M# @3 B
- * published by the Free Software Foundation version 2.
% J6 ^, h) n: g0 p0 I* ~ - *
d8 x; `4 p8 y5 l, Z9 s P3 } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 \9 T0 {) p, s* Y- H/ O9 @
- * kind, whether express or implied; without even the implied warranty; l0 x. C/ R3 e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: S3 ?8 O D _+ u& ?
- * GNU General Public License for more details.
1 ]' S3 ~9 z" V! B- P - */8 t: t" C# l7 N) X
! `* T- ?, W" L- #include <linux/module.h>
" U8 ?+ N" {+ `3 p" y- r/ L' v - #include <linux/init.h>
( L. I: Y) C1 W0 ?! J9 n - #include <linux/errno.h>& o- I/ S- o, u" a* F! S
- #include <linux/types.h>% w2 \) X6 y0 {5 u0 p6 _
- #include <linux/interrupt.h>0 W( i# A8 L+ ]7 k. D
- #include <asm/io.h>
# v# F0 |- M- K/ J" o4 { - #include <linux/moduleparam.h>+ B) l. r- f- I+ ~; t c
- #include <linux/sysctl.h>6 X a' t8 V c
- #include <linux/mm.h>- p, s) ~3 t1 M9 M b" k6 G
- #include <linux/dma-mapping.h>2 w9 f+ b3 V: H) s% v
- 8 A9 {6 A2 x" I0 v+ T
- #include <mach/memory.h>
% ~1 ^! I Q s5 q& |/ c' b# q - #include <mach/hardware.h>4 B4 N/ r# B0 v/ L" F& g) b
- #include <mach/irqs.h>* _- p+ A: R: W+ I
- #include <asm/hardware/edma.h>9 Z2 b3 b. D' N7 R3 t; u+ i
- ]9 n& }9 g- e+ E3 C- #undef EDMA3_DEBUG" `7 N5 f8 E% R6 N y% c8 m2 [3 d
- /*#define EDMA3_DEBUG*/
% m2 W+ ?7 ?, Z4 | T) |$ D! Q
3 Z8 x' u8 E, {8 N! s6 D2 ]- #ifdef EDMA3_DEBUG' d/ Z6 b+ v B2 H2 R8 u9 J5 ]4 ~" C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& b; ~! J; R: M2 F: E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 F- ~. |: Q8 y5 [0 z2 g+ G$ p6 J! m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" O) v$ I& D$ L - #else
* C6 \& s$ s7 o1 X% p* e0 { - #define DMA_PRINTK( x... )
# ` y; `1 U/ o3 o! @( t - #define DMA_FN_IN
~' N: p |# } - #define DMA_FN_OUT# N5 p5 c+ [5 }
- #endif+ C: b( W5 |+ u; Y& { r
) s" J0 w2 e0 X1 H! b* m/ F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# W, v d9 E/ k
- #define STATIC_SHIFT 3
9 ?8 U3 _) E6 X' T L/ x% p" Y - #define TCINTEN_SHIFT 20
5 q) \& `8 q( E( W* W - #define ITCINTEN_SHIFT 21
6 `, m$ Q& h j( S# E( t" {% u5 C - #define TCCHEN_SHIFT 22, T- M1 I& @7 I, P
- #define ITCCHEN_SHIFT 23$ N) Y7 \& {+ w. Z
- $ l! A) Q1 q. _; |5 {: i
- static volatile int irqraised1 = 0;" t6 H. q/ m6 X* D$ P
- static volatile int irqraised2 = 0;. ?4 I' @" S k5 \2 Q3 q. B; e5 L5 [" O
. b/ G; P4 K( Q! t% }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 F- g( \& W5 J( H* ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 y, J) T* H0 i% ?1 a" e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ? G1 D) u8 v S
- 6 R8 i! }, ]- S5 u L2 |# K7 ]
- dma_addr_t dmaphyssrc1 = 0;
0 f$ H1 @# R: o2 B3 o' z - dma_addr_t dmaphyssrc2 = 0;
9 P' e3 Q' O7 F0 w- g - dma_addr_t dmaphysdest1 = 0;
, U! `- V6 `, g `; y7 J - dma_addr_t dmaphysdest2 = 0;7 O1 C, h1 \2 K9 D
- 0 P2 w* H' p3 s4 s/ t. h1 o
- char *dmabufsrc1 = NULL;
/ g6 t# o; T& I0 W - char *dmabufsrc2 = NULL;+ H# b3 G& E& B# h
- char *dmabufdest1 = NULL;" S/ ]4 h+ P) E2 r* i4 C
- char *dmabufdest2 = NULL; n2 S G( `5 q' O: Y
- - Z% y. a( q9 D3 O+ z" K: d
- static int acnt = 512;
9 M: A4 S& F- z' e: i4 A - static int bcnt = 8;% p* p' S9 z) L7 T) Y$ K$ t7 p
- static int ccnt = 8;
1 K# f$ m5 z- A3 @' |# J5 \ - / v8 }' Q+ N% n4 ]- w8 `- w: i
- module_param(acnt, int, S_IRUGO);' d! \. g. I2 A
- module_param(bcnt, int, S_IRUGO);
% I& t8 o, ?7 h - module_param(ccnt, int, S_IRUGO);
复制代码 7 A f' c7 r+ k1 T; s: ?$ C
7 I% V% n( t9 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 V& x# k" M. L7 [3 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! k8 |4 M9 {8 g" S& W; h0 a4 E4 o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% O. M Y, T) f" ^$ T5 H$ C& V( t( X, Q" m
9 w6 o& m# g6 W2 Y
|
|