|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 ?; F& M% V# h
- [code]EDMA sample test application
( q( f* |' Y' ^3 n# v% k0 r - /*. Z( ?( Z/ J! g0 L7 y
- * edma_test.c
! [5 y$ T+ Q8 s- V - *
! n+ {) v; A- O' X; _$ J - * brief EDMA3 Test Application2 f! h' c3 i! i, V2 e
- *$ i8 Z) h; n5 S) e8 n% }( n
- * This file contains EDMA3 Test code.5 h5 `1 k0 Z- d- l7 b9 D
- *: r; z$ e c( B) A1 M4 v' q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 j, n+ j1 x# `/ l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 G( V2 i7 S, r. A9 k
- * TO CHANGE.
/ E, P/ X2 B4 W% q - *
- L1 k0 h$ K9 n5 |8 E2 _/ Q# w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 o/ g# {# v# S s
- *) Y* p" g% ?- S h7 Y
- * This program is free software; you can redistribute it and/or
- Y5 D; q9 b- r( O; _6 t8 L - * modify it under the terms of the GNU General Public License as6 G: x7 e% G G
- * published by the Free Software Foundation version 2.
+ v% T! e4 d1 w7 c, W - *
' L# T1 N- ~3 }) y/ C7 v# O% n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" u# G* a, E$ w. b9 B( C: X - * kind, whether express or implied; without even the implied warranty" M8 B; N$ S9 E4 Z. R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! F) s0 {, m8 d8 Y. Z9 g- z - * GNU General Public License for more details.
( l; T$ i1 t; V - */
# E- U8 l& {- n) {$ m; I0 X0 S2 }
+ y6 S# X# B8 |- #include <linux/module.h>: Y# D x- u" X5 ~
- #include <linux/init.h>
1 `6 q! F- G# o& X$ Z1 B - #include <linux/errno.h>6 {4 s' t* n% D V/ B5 x) E0 v
- #include <linux/types.h>
) j+ a: K: F5 [ - #include <linux/interrupt.h>
, H+ c3 P7 T w5 K) Y2 ] - #include <asm/io.h># n# o1 [. |0 g: F- R
- #include <linux/moduleparam.h>1 l+ W* @8 c: m
- #include <linux/sysctl.h>
' Q! l4 q! R3 U" d% `* ]+ L - #include <linux/mm.h>) d) e5 v8 }8 L1 K- z
- #include <linux/dma-mapping.h>( j9 c) o0 z3 g1 X- H; O- q
9 f9 p' {# ?6 E- #include <mach/memory.h>
5 _# k9 a8 Q7 `- z; F: t+ [ - #include <mach/hardware.h>/ l3 X- |6 k# l5 y: s( b S8 t$ s
- #include <mach/irqs.h>; e1 l9 n/ ~6 {7 g) L/ U; v
- #include <asm/hardware/edma.h>& a+ a- H8 I# b; W& N3 C4 g
- * S( r( y, ~, M( ?- g: p/ I, b
- #undef EDMA3_DEBUG
4 W9 F2 w" Z6 J. ~' r1 Z0 z H! Q. ] - /*#define EDMA3_DEBUG*/
8 }; E3 ^1 h9 p) w$ ^) o6 s/ V - * c4 q2 D7 s+ {" ]# P' n
- #ifdef EDMA3_DEBUG
2 s4 m d5 i! C( S& W( p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( F! c4 j; ^) D( F& q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 D; S. Y7 p5 { g% F& B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 G! Z: M# U+ N - #else
9 i" U6 _% j- Y6 D% p: p - #define DMA_PRINTK( x... )
* B0 J$ _- u ]& q8 D - #define DMA_FN_IN
/ }: C3 O* `3 L - #define DMA_FN_OUT
* k9 Z- u! F8 Z. A5 Q2 g) x8 F - #endif& h2 d3 z* }! g' R$ d' A; n
1 f& O" a2 ~% S" L( X/ A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- y" W' p& @( W, M/ t. G9 U
- #define STATIC_SHIFT 3
- q4 P9 T, O# o5 u" I - #define TCINTEN_SHIFT 20
5 F# I3 z2 I1 }2 Y1 D - #define ITCINTEN_SHIFT 21
. r$ X4 c" K( c- U; d; I6 \/ B& \ - #define TCCHEN_SHIFT 22
" |2 e$ ?1 {( A6 _5 e - #define ITCCHEN_SHIFT 23
9 G3 O6 y5 X* ^3 m
|: t% ?/ e8 \6 T1 \- static volatile int irqraised1 = 0;; _ A. z b" e( N- @
- static volatile int irqraised2 = 0;
9 h" c! r# o4 Q, p! f; y( c4 k
4 S; P0 b; T5 C5 `, ~" T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 s H# s4 D9 y* ^: I5 Q( m& E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Y- S$ u+ l% h5 I+ H S6 V& l7 F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 E9 y) j2 Q$ |# v, k$ u3 p) V
, S6 B4 O/ D1 ?4 z$ u1 G- dma_addr_t dmaphyssrc1 = 0;* m" H1 E) B: _
- dma_addr_t dmaphyssrc2 = 0;
. ^9 e% r+ P7 B2 V! R. D0 ?% u - dma_addr_t dmaphysdest1 = 0;
6 s" q o) D7 R4 {; o - dma_addr_t dmaphysdest2 = 0;
j9 g8 V. J1 G$ L$ h - 0 g# v" r n5 t2 k
- char *dmabufsrc1 = NULL;' F+ C# G" G4 U# H
- char *dmabufsrc2 = NULL;
: o# J1 U& |/ X I9 p - char *dmabufdest1 = NULL;
+ x" f0 e% A1 z {; r5 S4 a - char *dmabufdest2 = NULL;! k7 b3 Q9 z/ e9 J: A/ z' L
- 4 E& E/ c3 i2 X: u! \/ S
- static int acnt = 512;
5 g0 ~4 b; c& M ^" t9 L' J9 D1 s - static int bcnt = 8;
. g: B+ c% D* B0 |! Y - static int ccnt = 8; i7 f0 m" @7 H3 x$ X
- / j; e* C2 ^! [' Q# W
- module_param(acnt, int, S_IRUGO);
8 C# \/ m* A1 {; k+ I: ? - module_param(bcnt, int, S_IRUGO);( [% R/ W. A# c# ~$ A
- module_param(ccnt, int, S_IRUGO);
复制代码 / w( q3 I6 V% y
( a( O$ C" N4 K4 g, V, s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, L5 E ^/ \2 L4 c" _( R" G; N
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- G; a) t; P( M; v r; g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* D. x3 A- [0 d9 r0 o8 B# {0 c* Z; c$ g! o ^1 f: E/ a1 A
+ ?1 G# Y( g5 b) v4 k' E7 Q2 ? |
|