|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 U; |, ]2 w0 ^1 u1 p) x, Y: m: a [7 D- [code]EDMA sample test application
, S; F6 V. l2 |# O - /*
" e# Q: d% x3 c1 h6 b- s - * edma_test.c0 j) O2 V! A8 \, p* s& x* c0 r) L
- *7 b+ g' s( O/ g8 Z0 x
- * brief EDMA3 Test Application. `9 E8 t8 S9 y# ~& F# g) U' w
- *
. x$ m9 {7 y3 u% }7 _ - * This file contains EDMA3 Test code., E2 r) S+ ~/ q/ ~. ^2 G' Y, g
- *: j m. ^4 J, ~2 \* Y2 C, Z% B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 w$ J: u" h0 b7 j) t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ s$ c6 _) u( f3 [
- * TO CHANGE.
, w5 O7 k0 {$ ?/ i' l; i1 | - *3 y# ^: A" I! ]) H+ d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 }: E9 _4 n9 g0 K
- *
9 w. O( S2 @- ] - * This program is free software; you can redistribute it and/or
8 H/ {5 H- F; } - * modify it under the terms of the GNU General Public License as
# k9 Y' r) m4 | - * published by the Free Software Foundation version 2./ u+ Y1 p$ C" I3 D
- *
4 d' W8 E! z: M- ^. q6 X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; t. x; b, a( P6 z7 i+ | - * kind, whether express or implied; without even the implied warranty- U+ f+ G2 l$ O& d9 M- y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( K! o" }& @1 p; p4 k i
- * GNU General Public License for more details.
7 w1 V1 u/ Y0 `/ b& ] - */
6 t# p* ?4 [) r$ b - : ], g9 x3 c5 w3 r
- #include <linux/module.h>8 s0 w2 u3 o/ Q! @0 Q7 j
- #include <linux/init.h>" s1 z# E5 I; U0 t' L
- #include <linux/errno.h>. ?8 S6 [# l2 S4 X+ p- Y
- #include <linux/types.h>
% _0 u( O1 m% \ Z) W - #include <linux/interrupt.h>8 L7 d& N( {7 l' b9 N K
- #include <asm/io.h>
9 y0 L8 f, K! _3 Q - #include <linux/moduleparam.h>
0 \1 ^5 _! ^! _5 E! i2 @6 I - #include <linux/sysctl.h>
! I: A7 ^8 H* U d3 L- X: Y9 E - #include <linux/mm.h># a9 }2 U" r0 X4 ~& _: Y# Q
- #include <linux/dma-mapping.h>) m% i ^. k$ r8 l3 u; N# B- D b
/ _: O! t6 i& |# Q1 |( _( S- #include <mach/memory.h>
/ J `( \% y3 _" x" f - #include <mach/hardware.h>4 V2 A |& z' Z# H9 l
- #include <mach/irqs.h>
9 B' Z5 ?/ ?" k/ s- `# [ - #include <asm/hardware/edma.h>& \/ j5 L, z/ }* P, }
! \9 ~- i+ ]0 g% L6 R" A- #undef EDMA3_DEBUG
# ` ]$ m6 L5 G+ }* A - /*#define EDMA3_DEBUG*/
/ ]' q/ T% J1 ?) R& K. _ - d) ?/ \; Q' }( b( Z+ ~
- #ifdef EDMA3_DEBUG
5 q7 |+ ]. Y: }& x7 m- _" G" r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 l' F' s0 b6 p$ d$ J {4 w: A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 o) r0 G. { F: Y Z0 a. u. h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 Q* [4 k+ H( w2 E - #else, q( c! P8 M, M4 f! l) e! ]* G! w! c
- #define DMA_PRINTK( x... )2 d- F$ G0 s1 M3 h
- #define DMA_FN_IN& A, N% C, }# O9 o# t" X2 V
- #define DMA_FN_OUT
% ?8 d( p, s7 O$ ^ - #endif# r" a% b% G2 t Y5 \
- : s" s7 E1 _. ]) L8 V4 R2 ]' n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) Y# Y, \; { t- f( D X - #define STATIC_SHIFT 3
9 K; X9 T8 n6 |- g, f - #define TCINTEN_SHIFT 20( W; ^6 e5 I+ `5 @. F
- #define ITCINTEN_SHIFT 21
& E9 `. D4 X( r) I) D; H" j8 W. E7 X } - #define TCCHEN_SHIFT 22
. H( J$ ~1 b# k! G- ?) h - #define ITCCHEN_SHIFT 23" N0 z" P; A0 k+ l7 r" O/ D& ]( y/ ?4 j
- ! C; _$ V% E6 D1 Z
- static volatile int irqraised1 = 0;
8 a3 I6 j* D0 D - static volatile int irqraised2 = 0;" s* J% ]/ Z* e& N; U& v- {
) b& l. H! B, x, p1 W& ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o9 t1 g8 m/ Y6 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 [! {. a% A$ v7 l! T6 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! h, c5 p" H; P5 i( U$ I' |$ \
6 i$ k/ y6 Y# x* E9 a- dma_addr_t dmaphyssrc1 = 0;* H# l3 }* Q4 Q1 _
- dma_addr_t dmaphyssrc2 = 0;# A% ]8 B0 _: f9 y
- dma_addr_t dmaphysdest1 = 0;
$ h3 x% s9 t: ?- |! t - dma_addr_t dmaphysdest2 = 0;
! K) G6 C% h1 G9 u - 7 w) w' k9 _" S& g5 c" e# U# q
- char *dmabufsrc1 = NULL;
8 M9 b3 \' E- W# O# M* B# L, j - char *dmabufsrc2 = NULL;
! Y* U2 ?3 [1 ] - char *dmabufdest1 = NULL;
' v+ O: B; ?; o1 R - char *dmabufdest2 = NULL;9 O- C# w# ]8 T! @" B& R
5 C" h8 E% {) s; j6 }- static int acnt = 512;8 y1 T* W3 n8 t. K2 a
- static int bcnt = 8;
0 Y; j' f" B& F# F6 O' y - static int ccnt = 8;( b" H) c9 n( K5 O. ]; ^7 B7 `
: Y1 t; z% ^: P+ P- module_param(acnt, int, S_IRUGO);6 [5 v2 F! ^) T. K% u
- module_param(bcnt, int, S_IRUGO);0 L. X i4 z' t3 V" i# ^
- module_param(ccnt, int, S_IRUGO);
复制代码 , k1 E1 e' Z" h! R6 r: B! c
5 [7 x) j* r0 m- y8 K+ P d6 c5 I& v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 ]$ S+ i% o" G$ {3 K% ^$ Jarm-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 k+ Z! ^6 m, ? y/ t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! M3 Z) ^* s4 V. h; N) S! b2 ]
7 D7 \/ n6 g8 s4 i% r
+ G2 w5 }3 ^: q& h/ w! N2 h' f
|
|