|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) ]. W. ^3 b% Y' ?6 R- [code]EDMA sample test application
% Y8 `9 H1 }6 U# g& ~7 S' _2 E: { - /*8 t8 b% D: S% V' K' w
- * edma_test.c+ `: J' b+ K+ ?. {9 W$ j: a6 c2 G
- *
2 N& E2 N) K, j - * brief EDMA3 Test Application% V& K3 V O4 P9 H" |
- *
2 T2 P6 V/ s; w' e+ }$ c - * This file contains EDMA3 Test code.1 o x: ~8 D+ c0 U8 b6 H
- *0 n f, B5 u% e0 \2 J6 c. ~* K5 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; c3 }! K# ~" ]8 {- e: Y$ r# L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 J, v( h' X% }- V
- * TO CHANGE.* W# T( `9 s. a s
- *# @: {0 k- y5 o' ^& @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, x9 t+ w) D/ {
- *
- N& {: i) S8 Z# x( ^3 X - * This program is free software; you can redistribute it and/or. U! }7 [. n3 ?0 U1 C# f ^4 C
- * modify it under the terms of the GNU General Public License as* x0 {9 j: x: v! c, Q+ N4 |
- * published by the Free Software Foundation version 2." u6 m; a0 @7 W: T; m' t: W
- *' [5 |, a# Y1 Q( z6 I2 ~. f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 B" p$ r3 k5 e) U# u - * kind, whether express or implied; without even the implied warranty) m9 x0 I7 I3 f7 r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 w" j6 ~$ q0 k' m
- * GNU General Public License for more details.9 c; B9 J3 }) U* P7 Q
- */
$ R" m3 O: l7 r2 Q# L
$ F; T( K A% K4 N, R& k- #include <linux/module.h>/ t7 w7 R9 s( u. }
- #include <linux/init.h>
+ D( _0 a0 H: L; M - #include <linux/errno.h>( [2 B4 O3 H$ H& u& {# P
- #include <linux/types.h>- W5 x+ h% W+ U! e8 J
- #include <linux/interrupt.h>
8 g- D0 d; i- o* Q" ]' d) [- W - #include <asm/io.h>5 E/ ~$ \& T- d" e
- #include <linux/moduleparam.h>
( [" v! W1 v4 [ - #include <linux/sysctl.h>& |6 N9 f; i8 Q: ]" S. T
- #include <linux/mm.h>" D- b. `4 N" y M' d
- #include <linux/dma-mapping.h>2 x& y/ t, o- W/ ]/ s
- : d, I8 G9 a0 G2 }3 Q" `+ ?9 q
- #include <mach/memory.h>: N1 O+ R" P b/ z6 z0 K# m
- #include <mach/hardware.h>
; T( m0 T$ B2 Z1 @% o0 M* P - #include <mach/irqs.h>7 x0 e; @5 }' w8 b% T* j
- #include <asm/hardware/edma.h>2 t: y8 J$ I! d$ `$ Z# b+ o( J8 k/ ]( r
- 0 ?9 u( e( g3 v( O5 I
- #undef EDMA3_DEBUG& P; s k- q, y' _7 t
- /*#define EDMA3_DEBUG*/5 K+ _8 A7 k% l1 j
- * a) g5 R. H* Z( U" x1 k" [
- #ifdef EDMA3_DEBUG
S/ {5 {% ~* @( \7 x9 M! } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Z4 H! F0 C, l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 A6 ?% z! y$ P' E( O4 L7 a( C- G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
q! c9 f' W3 ~: c - #else
8 s4 f* f! y4 ]4 ~; h# j. d; V( h; D - #define DMA_PRINTK( x... )
. ^0 p9 u/ |# x9 h+ c2 n - #define DMA_FN_IN$ T2 j: S! h. v- P# W, A
- #define DMA_FN_OUT; `. y- E% D( O- P' k
- #endif
6 E4 u- y/ _: E0 i3 c; v
& e+ W) H& T' g7 D8 |- e& K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 [# S0 ?; I2 t6 G# v
- #define STATIC_SHIFT 3; M+ l. M5 u* ^7 [, d" f) D; J
- #define TCINTEN_SHIFT 206 T( T# `7 M2 D; h' R+ F/ ~. m
- #define ITCINTEN_SHIFT 21
. Z9 o% p8 E U2 t A+ K% k% ^ - #define TCCHEN_SHIFT 22
) m$ k" ^, ]1 g/ a* z - #define ITCCHEN_SHIFT 238 M. |/ N4 f0 n# p! z4 |" u& g+ P
- A5 H: v8 k5 I7 j& P( d
- static volatile int irqraised1 = 0;0 @) O5 d" M G& i
- static volatile int irqraised2 = 0;
" h. @; S: Z3 k( Y0 d - " O7 s5 \( r; S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ C# c( s1 [ R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 V& g9 X+ x0 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) r1 d9 N8 R9 K8 J- ^! s$ {: Z
- ' w$ g6 ]& i* q
- dma_addr_t dmaphyssrc1 = 0;
$ h5 c/ N4 L( S' [6 T8 W5 e2 g) Q1 Y - dma_addr_t dmaphyssrc2 = 0;5 z3 m2 i* H7 t; ?8 Z5 D7 @1 L! w
- dma_addr_t dmaphysdest1 = 0;
- g/ M, j) f9 b# M, p - dma_addr_t dmaphysdest2 = 0;% _7 w/ e8 R7 V
; d. U- f# Z* }4 a5 v- char *dmabufsrc1 = NULL;: @/ O- r- ~: g
- char *dmabufsrc2 = NULL;: U2 e" X3 k/ ?# e0 z3 h* o
- char *dmabufdest1 = NULL;
$ Q5 X# Z: z& V! e( }$ G - char *dmabufdest2 = NULL;9 ]! G) U7 m7 ^8 {# M. N5 f
- 9 ^) l* |$ a1 U" N1 _
- static int acnt = 512;9 a) c7 {, D' X" X
- static int bcnt = 8;
5 c4 |. ]. |& B: ~2 d2 t - static int ccnt = 8;
. t3 _9 w% y& y
$ ^; }: t( t" @6 Q& v/ G k4 Q- module_param(acnt, int, S_IRUGO);
' J0 b) ^% I* C* N/ { - module_param(bcnt, int, S_IRUGO);
( X. K- g1 A, `8 N - module_param(ccnt, int, S_IRUGO);
复制代码 ) l4 M1 @+ D5 u$ E
/ d* f- ?" G0 C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; ^8 q5 V/ u6 Y+ e, A( G' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( `' r3 e- Y D7 R2 |# O$ r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( J$ U. s$ s0 [3 o. q
/ b4 ~" O, V- ]8 T
5 B7 ?3 x- n# F6 P. R
|
|