|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 L3 G& \4 O+ |# E; Y+ H6 n8 |- [code]EDMA sample test application
( F' {. x: ^, t+ R - /*2 _' g' E$ f1 I& _7 _
- * edma_test.c
4 K# C/ M# ]: d - *' c3 H0 e8 M. r( W4 J5 c$ I
- * brief EDMA3 Test Application$ D5 p- G. u" ?2 k9 J D% T% ^
- *% k( M5 E6 @0 V! v: {
- * This file contains EDMA3 Test code.
) M# Z! R; O; k! A5 c - *' O( p0 Y" x# _, S( V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 f/ V( p6 c2 w* w' B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 a* v, {2 q$ A7 D9 [! ]: W
- * TO CHANGE.
$ D' K" X" ?8 I) g+ p' K# @ - *
8 U: k, h, |1 ~( p% s% d5 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( X0 y5 K: o6 I0 G5 P/ ] - *% i; J" k6 v4 L2 c7 p
- * This program is free software; you can redistribute it and/or
@. @7 y/ s( Y6 }5 f* Z - * modify it under the terms of the GNU General Public License as
3 G& ^9 ^$ k* C$ X5 a - * published by the Free Software Foundation version 2.
% b4 B( ?9 Y0 @! B7 y - *) o& d1 o2 _- j" @3 m! o5 w6 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- X* i7 G3 q0 r' u
- * kind, whether express or implied; without even the implied warranty. e0 q5 e2 W/ o% X( U2 j0 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) d7 C. w: l7 ]
- * GNU General Public License for more details.
" y$ c+ S7 ]' ]4 h9 i - */
8 s3 I2 z. h1 V' S; S7 J - & z4 j% D+ ?( w. s5 [6 R! _7 |
- #include <linux/module.h>
l3 m4 h9 q8 j5 U - #include <linux/init.h>
% Z8 V# c0 V0 y - #include <linux/errno.h>4 w5 U( k* \+ t( ^! s, W1 V
- #include <linux/types.h>
2 E+ G1 E& G2 t, p, q* V& K5 n$ i+ V - #include <linux/interrupt.h>
$ ~5 @; S9 n* r) i3 K - #include <asm/io.h>
1 f7 C6 T O& z$ X9 S- E% w - #include <linux/moduleparam.h>" Z: ?: [4 T. @/ O; d
- #include <linux/sysctl.h>
6 A5 `& k7 ?7 s5 i - #include <linux/mm.h>8 X% m1 O" A+ L5 S$ C
- #include <linux/dma-mapping.h>
k# P6 h& U* y( B - + w. D+ U2 e" Q7 q; g( f2 S' J- ^
- #include <mach/memory.h>
& Y2 ?. L4 i6 _$ W8 d - #include <mach/hardware.h>
" q! _' |' _) _5 P! V) j - #include <mach/irqs.h>
/ K6 U Z' J6 @. S4 [( t' {9 W/ E8 @ - #include <asm/hardware/edma.h>- x. z0 n7 H. m! d
9 F5 N1 G* k: a+ R! v- #undef EDMA3_DEBUG
n- b( D1 @9 \9 b% `; ~, p - /*#define EDMA3_DEBUG*/
+ T, U, n5 L) v/ Y) g# C5 n9 q
2 ~9 q0 T2 K" {. v- L8 Y- #ifdef EDMA3_DEBUG
( R) Y; V7 e" Y0 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' D: d4 W/ k5 o( X1 ^" Z! b d: K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% |/ B6 d) h( U! g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). o( t# z% S6 s" E# K: x
- #else' x4 B+ b- X3 T7 e# B* D7 n
- #define DMA_PRINTK( x... )- R( J; y9 a$ {8 {4 V' ]
- #define DMA_FN_IN( I- \ b) p7 a+ f7 I# U
- #define DMA_FN_OUT
6 U4 C, V8 u2 J0 d8 R' } - #endif4 V; w( c( L% ]/ I2 F: e, c
- 0 A# W8 C3 \ K$ ?4 ~. E" U. z3 H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' _/ D) _* ]4 N/ K6 i# A6 A7 { - #define STATIC_SHIFT 37 K( K3 E! W: b" c2 A
- #define TCINTEN_SHIFT 20' U, F, t7 P' ?. K9 G! k' E* Y
- #define ITCINTEN_SHIFT 21
( J( K' |& R1 E - #define TCCHEN_SHIFT 22
( |3 c9 _& N6 w0 |: D - #define ITCCHEN_SHIFT 23 W% z) f) P8 u$ ~* m0 u2 c: {
2 t9 I0 m; Q( b% L& G) }. ~- static volatile int irqraised1 = 0;' U) }! C2 B9 v# Z+ r
- static volatile int irqraised2 = 0;
- X, X# U1 b9 k4 I - $ u9 Z2 c P8 @# L% g7 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 |+ r( G4 b% N- L K9 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* h; \- o, ` u8 }& }7 g1 Y4 W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, y ?; E9 s5 U+ T+ j
5 t7 [, w' }# j2 q# v( D- dma_addr_t dmaphyssrc1 = 0;
. K) `3 \" K$ }, F" [) @ - dma_addr_t dmaphyssrc2 = 0;8 ?. N5 \2 u! S& e
- dma_addr_t dmaphysdest1 = 0;
, @6 g) ~( U9 R, C2 P7 [ - dma_addr_t dmaphysdest2 = 0;- c& j+ B+ ~5 x5 i
* [, K& F& o& b; t7 p- P; Z3 |- char *dmabufsrc1 = NULL;# R+ [# U! N/ ^) i. m
- char *dmabufsrc2 = NULL;2 R1 i" O0 C$ n! m# J
- char *dmabufdest1 = NULL;, j$ ^ N6 ~: m1 f6 ^" ?
- char *dmabufdest2 = NULL;
8 D$ u1 N( X" P- i( O
+ s# b' n% [, H- static int acnt = 512;& H2 J. K5 D: ?) g
- static int bcnt = 8;
' `! K& } Y* W - static int ccnt = 8;
9 f* y' V6 s0 C L! }( @( J
3 C; P# v! D: F- module_param(acnt, int, S_IRUGO);
0 C: I( U: P& u9 ~$ V' T8 G9 M) o - module_param(bcnt, int, S_IRUGO);' B! M$ M# r5 F$ G. i9 [
- module_param(ccnt, int, S_IRUGO);
复制代码
+ p0 @( e! Z" o3 y# v; t' M6 z) a( L
' @! K1 T/ {7 x* B# k2 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, e9 r& R' U6 x/ A& ]( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- p- j/ \8 Z9 W E* F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; q$ v3 @5 ^3 |2 N/ l# J3 s2 L$ X
7 v) |# {/ |8 N2 a" N8 d, v/ W/ V5 _2 P8 Q- E. f
|
|