|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& z4 v3 q/ H: Z- [code]EDMA sample test application/ h/ }9 |9 \1 R* {
- /*
4 ^1 I8 ]2 }* D4 X - * edma_test.c
) Y9 h$ _4 k$ o. d - *
. k j) y; ~2 H - * brief EDMA3 Test Application' p1 `+ Z, q4 E% x" A% |' |
- */ t* r' s; n# x! x; R7 x
- * This file contains EDMA3 Test code.% W; Z: ]' h& v W& ~6 T
- */ A$ n# ~2 P$ v! F- f, T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, a, Y" ]! S6 t( y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 N2 G# R5 n& D- J$ `
- * TO CHANGE.
; k1 W ?2 z) _" ? - *
3 y' Q) W% D+ D; }; Y8 ~7 Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& c" V4 q9 Y/ o) P' G* V! X - *% i! F8 ?9 | o2 N7 A3 O, k" A# S3 N
- * This program is free software; you can redistribute it and/or
4 ^% N# @/ j& o - * modify it under the terms of the GNU General Public License as$ [, T3 ?# T t0 @
- * published by the Free Software Foundation version 2.
8 g! m% t7 ?7 p, ]' g - *
: X& ]( ^6 l3 O$ a$ `) [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ E5 C+ D/ {2 L1 @& p9 d - * kind, whether express or implied; without even the implied warranty$ t, l2 e: @; a5 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 g, K# T3 g- s# V! w - * GNU General Public License for more details.
8 o6 l" O- ?$ u6 u5 s' L N - */
# {$ t, C- z* Z1 v& B5 { - 3 c7 c5 u; A! E4 ?+ s' _: v
- #include <linux/module.h>
3 Z( {7 {. P) }" f2 [ - #include <linux/init.h>- t5 z1 `. {& P2 \% e; o& ]
- #include <linux/errno.h>
1 ?0 `4 E& k# N! v& | - #include <linux/types.h>
* `6 B9 m6 g+ B0 Q& L1 w0 \- B - #include <linux/interrupt.h>
3 q# g2 J5 U( x+ o - #include <asm/io.h>) O! q0 Z. ]5 l8 a5 x! O- W
- #include <linux/moduleparam.h>
5 A) v! e/ G5 M" C/ s* _ - #include <linux/sysctl.h>
; t8 ]) z6 V2 s5 ]4 i3 q6 m - #include <linux/mm.h>
6 d- Z& A H J4 R: x* H2 p - #include <linux/dma-mapping.h>
8 K2 B% q# ?& J# k7 ^
, l# k8 S' D( L4 Q$ g- #include <mach/memory.h>4 m' n% A7 X& E# s
- #include <mach/hardware.h>: Z( }( E; B9 A0 M4 X
- #include <mach/irqs.h>
8 N8 g. _0 b3 y3 E1 [ - #include <asm/hardware/edma.h>. @* C* N6 V2 R! Y' S8 J
- 0 K B; }4 P. [1 f* V) x
- #undef EDMA3_DEBUG& |* `/ x6 k: N+ x. T( C/ }" Y! u
- /*#define EDMA3_DEBUG*/9 h- J/ W8 A% B9 h; U
. v2 v6 G2 w# D L! A- #ifdef EDMA3_DEBUG- \- n8 e' a( k/ E/ ~) {- f ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 j! N. C, b n" ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! \9 ?3 o2 L) g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ S' D2 `9 s4 Q; y
- #else9 u0 l( ^2 U' J8 y8 V4 \- V3 o# S
- #define DMA_PRINTK( x... ): a) q4 V5 D0 ~7 t; ]
- #define DMA_FN_IN- E$ b/ C4 e* C+ Z
- #define DMA_FN_OUT
6 L8 s2 v8 I# t! Z - #endif
( J" C7 n- L, O D% T, d. P0 U9 S
/ j5 C6 t* @ M, ^; P; P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 e- r7 b& B$ z" k4 s/ S* ?7 e/ i
- #define STATIC_SHIFT 32 p2 ~- @$ e- J$ H. N! S
- #define TCINTEN_SHIFT 20$ R9 `3 ]1 e+ v
- #define ITCINTEN_SHIFT 21# f/ c, G; U! F5 x( p& V
- #define TCCHEN_SHIFT 22
% I Q/ N9 ?& p* }3 s1 @ - #define ITCCHEN_SHIFT 23! m8 F. b. I& Z! f. X% x0 d
- , }+ O3 A' v! I9 X+ S6 P; B' L8 h
- static volatile int irqraised1 = 0;
; [( g+ W. L3 B4 M& a - static volatile int irqraised2 = 0;
- F( _. g. j) F. Q$ V - : N$ S, y% @# g6 ~: Q( j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 u, c- M! W j& `* _. M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 T) x ~1 y7 _5 ~. o) j4 P3 [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }4 v4 X% H/ ~5 A' O/ |
- " W r: G7 z! ~$ X8 H W6 c
- dma_addr_t dmaphyssrc1 = 0;
. e( `- B4 A2 i/ C9 N& C) }: d - dma_addr_t dmaphyssrc2 = 0;0 s, h& ~- }, R* [
- dma_addr_t dmaphysdest1 = 0;
. t0 T x3 m/ a6 w2 H! @ - dma_addr_t dmaphysdest2 = 0;
0 S- T1 e/ n9 B2 C5 V$ z6 {* p- \
( X! {( P2 Z7 a" g M4 Y% I3 T7 i- char *dmabufsrc1 = NULL;( O* {- J5 k1 E4 X
- char *dmabufsrc2 = NULL;
# w5 z2 Q4 l# c9 ~7 C& Q7 B - char *dmabufdest1 = NULL;& H0 c5 G1 m6 {# k; A5 `
- char *dmabufdest2 = NULL;" _% [' A9 N* u' y. A0 C
- / @( F4 O' {' D
- static int acnt = 512;( D9 ]5 l! o; _
- static int bcnt = 8;
7 o9 _9 u6 J/ g& s5 _, p - static int ccnt = 8;" F3 `# ~* i; _: ?& J2 j- r/ r, Y0 w
- / u' j8 U; u1 W9 T6 C
- module_param(acnt, int, S_IRUGO);# a R' P9 w2 C d, o1 L X. _; `
- module_param(bcnt, int, S_IRUGO);" o. V, c, T0 d- g6 j. R" G
- module_param(ccnt, int, S_IRUGO);
复制代码 * G+ {. R, Y6 l1 @$ e* w" l+ j4 S |
; D6 n3 N g5 I! |7 {) O. A1 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 L+ \/ k8 q& T% }4 t5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! q8 o% Z' G. l( S9 [- y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 l/ A& ^ R3 Z8 {; [+ N8 o; X
B* a: C4 Q. S) ]" M" A! W# a# [" W% h6 f
|
|