|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ J* v! N/ j. d8 I! d- [code]EDMA sample test application
7 E: L8 R+ L: @0 i8 `2 m - /*6 Y7 C2 t& l) S* J) }, [ i( |8 u
- * edma_test.c
; e- V* G- _9 [$ ~3 M3 d - *
8 b" ]+ ~5 ^7 `3 i- h& e' I - * brief EDMA3 Test Application
, ^1 t4 F! c! {" g/ ^ - *# |3 {" F# a( P% `: I) @/ V2 W
- * This file contains EDMA3 Test code.
! K6 M; F/ }# W" n4 {! G - *
; K v* _" {: R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( l! Z% H" G% Q) C" H( [, u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# Y# a `5 ?) Q - * TO CHANGE.
8 r" N* h* C, j$ O- y4 u- @ - *
a3 p0 e: E+ V5 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 g% N- w( G$ ^ L4 ^' G7 Z
- *) b( A7 X$ C, ]0 d# d7 y6 t
- * This program is free software; you can redistribute it and/or
p5 t% t; u7 t5 U/ j! R( K - * modify it under the terms of the GNU General Public License as
# w- j4 Y2 ` N* Q0 r - * published by the Free Software Foundation version 2.' a2 F& Z6 i- M+ q+ g! ~
- *; ` }8 a9 |; Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, d% I; n8 x, L& q1 K( F. k- I
- * kind, whether express or implied; without even the implied warranty
8 J/ F4 O# D' ]0 `; l3 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: j& n: C" W2 L7 ^: L: L. A# @ - * GNU General Public License for more details.0 E1 l+ m. @9 H! _: h9 b9 Y! ]# K$ |
- */
4 B) D! S. G' }- N) o9 ^ - - {4 ?. E" E5 t J
- #include <linux/module.h>
) b+ a4 d2 a: m Y - #include <linux/init.h>0 x; C8 A' ^" Z, k1 z0 Q5 m
- #include <linux/errno.h>
! o. j7 |( r) n* `9 y/ v - #include <linux/types.h>
- y2 M5 \4 q7 u - #include <linux/interrupt.h>( X2 t: Y$ s4 m3 w- T( a
- #include <asm/io.h>
# j+ Y% Q: z- F8 {/ n - #include <linux/moduleparam.h>4 x- a0 Y* m: E- K9 C
- #include <linux/sysctl.h>
7 s# g( d% O: H. `; a - #include <linux/mm.h>" X" H' J. _( N# v! l( X2 L* Q
- #include <linux/dma-mapping.h>
) q# d2 \- U1 {7 D% w3 `# _( i
( i/ B& ~4 V3 c. d O6 \- #include <mach/memory.h>. C+ C1 e6 a; @! a6 u
- #include <mach/hardware.h> H4 n+ `0 N% t0 Z, p
- #include <mach/irqs.h>
+ n; K. Q( y) G3 g0 H - #include <asm/hardware/edma.h>
/ M$ |* _3 S# G j - 6 M7 V' f# I) c; k3 |+ Q$ }5 b
- #undef EDMA3_DEBUG$ b; y" a3 V' v$ P
- /*#define EDMA3_DEBUG*/
0 W I" Y9 z: n8 j - & v" A6 X/ z6 |3 G# X& K; z3 z
- #ifdef EDMA3_DEBUG) J0 X5 c! t T6 `* I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 ]6 p8 Y: R# j- M0 z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 U1 {! C1 ]7 r6 E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 i+ |& c7 F# R7 B; U7 e
- #else
" d4 e1 C$ ?" }9 b M; a/ P - #define DMA_PRINTK( x... )" \4 z5 a( C# k: S
- #define DMA_FN_IN
$ `2 a; x/ ^9 v, d0 v - #define DMA_FN_OUT
# Z6 O1 |9 L" V) K* T8 D9 m - #endif
# P5 n0 a, ]7 B3 {# O
) x: m$ Q% A, b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 A; E& ^4 W2 K* }" ~ - #define STATIC_SHIFT 3
9 a% x6 [0 i1 J; s" E. M1 g$ o - #define TCINTEN_SHIFT 20
8 S$ X* Y- a. Z1 w/ C2 u - #define ITCINTEN_SHIFT 214 |* L) m* J" H8 V6 [1 y
- #define TCCHEN_SHIFT 22% D" s0 a* C8 d
- #define ITCCHEN_SHIFT 23
: q d0 G |5 T3 a& |& Y! Z/ A: } - 0 z0 d* v( L* G% o* X) W5 ~' t4 h
- static volatile int irqraised1 = 0;. X+ y* E8 ^' B# b2 o3 o
- static volatile int irqraised2 = 0;
, g* y: U, F2 X/ w ?, _ - 6 |6 a; c, ?- R ?% O; ~& b: @& A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- w$ w- b3 E: U Y: p6 R- L% x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ?' F) s: e; w2 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 T3 S ]7 E/ F
- + V# f6 z' V* ]9 L; z) Z ~
- dma_addr_t dmaphyssrc1 = 0;
- I' c+ Z+ L. g3 b1 s5 z! r - dma_addr_t dmaphyssrc2 = 0;% Y; f2 X) K k- X
- dma_addr_t dmaphysdest1 = 0;
# j$ X& o$ w& o! z$ g3 [ - dma_addr_t dmaphysdest2 = 0;
2 X, Q8 x& J& b" o3 k. q
2 a" o; v5 ~4 {8 P- char *dmabufsrc1 = NULL;
7 X9 c% y1 o! ]$ | A- @ - char *dmabufsrc2 = NULL;
8 r7 N4 e2 d/ ~4 j; Z! O - char *dmabufdest1 = NULL;
* O* [( x6 B% C' N! S - char *dmabufdest2 = NULL;, j% E/ D& r8 w% ~
- 0 w! \3 A% L4 A, h9 U, |
- static int acnt = 512;# Q3 n* W2 K; e' M2 U4 S s2 n" k
- static int bcnt = 8;
( A2 [7 ]9 Z; d | L' k - static int ccnt = 8;, |7 e3 r2 C) c1 }4 U
: t; D- n8 h/ s( w0 E F- module_param(acnt, int, S_IRUGO);; _, R+ y$ I3 @0 C
- module_param(bcnt, int, S_IRUGO);+ ^( I+ l0 U: c5 }: n
- module_param(ccnt, int, S_IRUGO);
复制代码 " Y2 Z9 ^' ^* x* d( Y6 r, ^* a
+ q3 L( D8 [' Z( `( ]: L' K& ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
G* Z6 o2 g. S. N; m9 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: N4 a# \: @# E3 E4 B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: h$ n0 t6 F) O+ I) G6 R2 o+ v+ X! [" ]" E$ C
$ D, b, X& Y y9 c" q) O; l |
|