|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; b8 b6 T ~3 a% q
- [code]EDMA sample test application
/ G) U1 t v8 W - /*
0 g% F4 U/ I( y' e9 Q - * edma_test.c
8 J; _- y8 s4 D) m) z - *$ R6 g! g N- ~$ V; R
- * brief EDMA3 Test Application9 N6 P0 S8 H. H0 t
- *' s& f* G) V- A0 Y7 G* n
- * This file contains EDMA3 Test code.
1 L0 y9 t* }6 s6 u" {4 g& ~6 X - *
( J* p; Y8 v$ h6 n0 G& M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* q% L. Y2 i A' h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# U6 L( E0 E1 u
- * TO CHANGE.3 M2 V# b5 V# ?# \- @6 c8 Q. M
- *. j" ]% k+ {+ `1 a& K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" b% N5 c$ N4 m, j4 D% y) y: z
- *
# S4 |5 e/ i1 J Y/ Z - * This program is free software; you can redistribute it and/or4 B, g: _3 c4 m8 y
- * modify it under the terms of the GNU General Public License as4 ]0 w' e4 `- _# I: G
- * published by the Free Software Foundation version 2.
2 I7 w/ m7 a0 ]3 k5 b - *
; Z% n$ A/ g7 B/ F; z3 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! E5 j/ Z( ~# v" U1 s2 {) [
- * kind, whether express or implied; without even the implied warranty0 [; h/ B$ W) `& g. G0 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 l0 R& D4 `2 m3 T+ R
- * GNU General Public License for more details.: a2 A! G, Y M
- *// w) I' ?2 Z! B; a5 n9 c
3 ~7 u& {7 W. l7 H5 P- #include <linux/module.h>
$ v1 S" x6 ]6 K# w! h( V2 S - #include <linux/init.h>
, Q& b- h& J1 y1 ~( W+ x - #include <linux/errno.h>
n, D; c9 Z R - #include <linux/types.h>
6 f% d/ \$ @ u& ~. g5 h - #include <linux/interrupt.h>' N# b" [4 D7 `+ {
- #include <asm/io.h>: x. |; W( E9 K* Y
- #include <linux/moduleparam.h>: y+ y% s6 B2 ^, [/ x5 r% h
- #include <linux/sysctl.h>8 i, ?6 _0 h$ t# S( m" R
- #include <linux/mm.h> m- M; e: X% s1 J! e
- #include <linux/dma-mapping.h>7 c: g. S/ a( y
- ) n9 D3 T* Y+ W. ^! g% D
- #include <mach/memory.h>
1 y6 z8 G2 t' {8 v. c0 g! i - #include <mach/hardware.h>
4 w! d$ K2 m$ U - #include <mach/irqs.h>
8 |9 ?) B8 I' o - #include <asm/hardware/edma.h>
/ h! s4 k# E6 e7 l- ^
0 V% w3 |) R2 b: x7 S) q* O- #undef EDMA3_DEBUG4 {; k/ e" }9 y& m" s
- /*#define EDMA3_DEBUG*/3 o8 W G! O/ r8 A7 P. J
- * {5 ^2 i# W$ d0 i& z, o4 C# R
- #ifdef EDMA3_DEBUG
0 `. F( c q2 M! G2 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). r' I7 E) v6 T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 J3 i7 ]* L; b. z. M# v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; y" Z1 U. D( ~! f - #else, z4 A% C$ g0 A [: o
- #define DMA_PRINTK( x... )" l( j) Q2 B: N. S' J# ~% Y6 R) _
- #define DMA_FN_IN7 [3 W: {5 ]4 _' ?1 Z$ O
- #define DMA_FN_OUT, W6 M8 l+ ^& _3 r
- #endif0 E* u* a) B! I/ l) B
- / u E) @3 [; u/ j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 W" O# k( @9 w% v
- #define STATIC_SHIFT 3
# W' t1 R! P# o2 [$ a4 I - #define TCINTEN_SHIFT 20
/ H, v0 Z6 H& e' T - #define ITCINTEN_SHIFT 219 G( W3 f, Q' k' w: W
- #define TCCHEN_SHIFT 22
. H0 G- R- |) c$ _: I - #define ITCCHEN_SHIFT 23" C# f7 D* |7 \7 @8 \
- % ~, A2 [7 e, i5 }' T3 ^5 ]
- static volatile int irqraised1 = 0;
( e: T- ^/ s9 c6 Z Q8 K - static volatile int irqraised2 = 0;. f- y# s' R+ K4 V
- ) V5 M! N! a) \* @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 d* x9 o9 c1 v& Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 k( O+ |$ s1 l9 H/ j( n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 M0 O+ y9 j: a* e' ^
- 3 j& _) Z- r: S/ g
- dma_addr_t dmaphyssrc1 = 0;% u* u; R4 @1 Q+ c% D K! `
- dma_addr_t dmaphyssrc2 = 0;
) Y. i2 C2 @- E - dma_addr_t dmaphysdest1 = 0;
: N3 n0 |/ ]1 M - dma_addr_t dmaphysdest2 = 0;
( M/ C+ ~1 S$ \# O$ Z2 U
9 J$ J" F n6 l2 T- char *dmabufsrc1 = NULL;6 g4 B0 ?4 d. J7 h; J: t l
- char *dmabufsrc2 = NULL;
! r) J: v( C; f: F& ]" K4 l: `& @ - char *dmabufdest1 = NULL;
2 e# y+ v) u4 ]; `* B2 A - char *dmabufdest2 = NULL;
* @6 R0 R7 o5 f! g- e$ Z. }% r - j5 q9 ^( U' W i6 E/ |4 R+ L* ~
- static int acnt = 512;
" `+ u+ d4 r" d9 X2 [ - static int bcnt = 8;# w2 D' K% ?; U, x- W$ u/ J
- static int ccnt = 8;
1 i. Q$ }7 k4 d$ f T0 ` - . d$ A8 H6 A& Y1 J4 q! l5 _- o7 z' \6 E
- module_param(acnt, int, S_IRUGO);; g! M5 }. Y& g
- module_param(bcnt, int, S_IRUGO);; w$ M' C* I4 i/ ?* ]* H
- module_param(ccnt, int, S_IRUGO);
复制代码 6 J$ X! x9 A7 j) L! d! ?
7 \4 ?/ @* B6 D3 S8 |- U" T- O/ ^! m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% w% Y; G/ F) C$ g7 t) B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; Z, \! W) Z( q$ i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: C( E- L; c% @. w, e: D8 v. C! b% _
* B7 E4 O1 {6 ?$ z3 p) N1 y" d* V I
; t+ L& b ]2 x) z2 C. ]
|
|