|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; f+ J7 w) z' z3 b# X) x E- [code]EDMA sample test application
1 K' X6 u, i# {) e1 I% m: p$ ~ - /*2 g3 l9 p; B# _/ \& j7 M
- * edma_test.c- _' C7 h; w1 a1 C/ b
- * f% N8 }2 p) W- w. g
- * brief EDMA3 Test Application+ S/ P; m" `4 p; R+ X V
- *+ ]1 C% B) _+ E [; j
- * This file contains EDMA3 Test code.
' m2 C" L- b( T1 @+ S7 i7 u$ R - *
; [3 ~( [" p5 h2 u8 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' x( ]! A# t. D/ n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, \4 ?! D2 j6 v% ` - * TO CHANGE.5 o7 ?, V5 y$ V; u
- *; h7 \1 N4 M+ d$ N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ K& k9 s0 m5 Q( v/ v - *
0 ^* T6 `5 s/ |; d; v2 L) F - * This program is free software; you can redistribute it and/or
; ]6 \2 H% @. O% U( U - * modify it under the terms of the GNU General Public License as
3 b& M8 \8 [ G0 S2 ?/ e! a( y - * published by the Free Software Foundation version 2.
* c. X6 a" a5 ]6 t - *
+ R8 J$ E. M* K6 z. e3 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 }: G1 S2 Z& F+ n# c% l) K - * kind, whether express or implied; without even the implied warranty. D/ B- T. i. k+ B& o, }. U: C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 i, }+ z3 T% o. _ N, Q: | - * GNU General Public License for more details.7 c1 k5 e2 l4 [* k; M
- */
1 ^% {0 b2 {4 u
; \' q- g k- x7 P: o- #include <linux/module.h>
8 j( K+ `, S5 c- P - #include <linux/init.h>- y& Q. E0 m7 K7 r0 T
- #include <linux/errno.h>3 x' P/ K& Y3 n9 h! B
- #include <linux/types.h>1 O1 U3 z B" P0 q' X/ g- j$ V
- #include <linux/interrupt.h>
3 [: H: U, W/ U' c - #include <asm/io.h>
. }, R! x' b$ S4 u( y! v - #include <linux/moduleparam.h>
1 v6 a' P; `6 S8 F, |/ I# K - #include <linux/sysctl.h>
4 r% x+ v. L9 t6 ~3 S$ p - #include <linux/mm.h>
3 g% X2 E S( ^, l - #include <linux/dma-mapping.h>
/ o" f& Y7 D3 |8 O4 J* K4 y% p
& c' A% l. s' ^" {& T" A- #include <mach/memory.h>, b W, i' m! m3 k- c0 K& l
- #include <mach/hardware.h>! B3 T) T8 y: x% ^9 _5 ?
- #include <mach/irqs.h>8 y) {! y& h! C
- #include <asm/hardware/edma.h>
8 R; Y! u2 i% D: G, S, g2 Q+ q - - m& @2 k. [. d, B* }* i O7 L
- #undef EDMA3_DEBUG
" _/ d7 ]8 _( L5 |! ~( \/ E' S ~ - /*#define EDMA3_DEBUG*/
& t. L* X; [3 x: _2 P* R - ' L6 H5 b5 |+ \4 Q. k
- #ifdef EDMA3_DEBUG
' |! t5 o. n; { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( k* G; f C+ N# N9 ?6 d: g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- J# @1 b; s# _% t- i% L/ v2 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 d, t/ Y; l9 D- a9 a3 |. U
- #else
1 E, q: m/ o3 `- b - #define DMA_PRINTK( x... )
# h9 G6 H% r9 k) |7 t X - #define DMA_FN_IN' @9 f, F6 d) W+ b8 E
- #define DMA_FN_OUT5 G+ y7 c2 C6 C
- #endif
# R. B7 i$ J6 h. u# V - / I8 b0 e9 d+ a4 z3 y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 q: B2 ?9 O+ U9 u3 N7 u - #define STATIC_SHIFT 3
. f. g" j+ v' P0 J, U3 J" V% d - #define TCINTEN_SHIFT 20
" w; _# \2 F6 J, Y. }% r8 w - #define ITCINTEN_SHIFT 21
0 c' `8 R+ o+ ~: t* W - #define TCCHEN_SHIFT 22 `6 a) ]. d9 w; D+ }9 z
- #define ITCCHEN_SHIFT 23
( ^: B5 Y# O8 o5 P* b2 M - , P3 u# U d: r* @: f" X# J
- static volatile int irqraised1 = 0;. \. o2 v; ^: c1 d6 f. [, c/ q
- static volatile int irqraised2 = 0;3 O( w# ^6 y" e4 p
6 H d& H- N2 F e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 z, p+ A, O! X. n8 V+ x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 [& ]) O/ e! x; P. n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 \/ U6 _# u6 b. c3 c - 8 ? n" }& `" d# u& z, w
- dma_addr_t dmaphyssrc1 = 0;
' ^5 c# C8 K9 V! J8 v4 @ - dma_addr_t dmaphyssrc2 = 0;# `2 r. v, C4 \2 }) k8 y2 j3 V6 r5 {
- dma_addr_t dmaphysdest1 = 0;
2 V& n; {- T7 p - dma_addr_t dmaphysdest2 = 0;
0 g2 r ^9 H/ c1 o - # y3 t7 ~% V& M4 I8 Y3 W
- char *dmabufsrc1 = NULL;
) H* ~% L( {! N- D/ Z; N - char *dmabufsrc2 = NULL; E; s" q& q, F' M) }/ |
- char *dmabufdest1 = NULL;2 R3 }( o9 l( s+ m7 B+ k2 R
- char *dmabufdest2 = NULL;
; v4 l; T! ^' g2 X- Z
) |% [6 i9 t) U+ _- static int acnt = 512;
$ Q% P( p( Q6 F - static int bcnt = 8;! x8 s8 F. [9 L3 [" ]8 `9 {; l
- static int ccnt = 8;
9 u ~3 q% J8 t) L: w- A$ R - * j0 @; s* c- a1 p% I7 l( @* T
- module_param(acnt, int, S_IRUGO);
/ ~( i6 k$ R! O. w% k - module_param(bcnt, int, S_IRUGO);
6 u9 A: f+ g" N" a% ?$ C2 h6 ` - module_param(ccnt, int, S_IRUGO);
复制代码
" ]) b1 W6 l0 }2 B: i2 w
. {4 G. G2 j9 u; q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 b9 o" M, d s tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 I- Y M, K$ q- X5 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. L: p: y& ^* f2 ?+ ?4 P
' C9 \6 |! a6 J7 a' a# X
" P6 k& s0 d1 e% k j |
|