|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 M d D! J5 J5 O# V
- [code]EDMA sample test application+ t! {5 H; Z; ^/ ?% l1 k& O$ M
- /*$ {* z+ B5 ~& h. a4 z1 S5 \8 z- L1 ?
- * edma_test.c2 u: v4 u, @/ M' ]
- *# w( E6 G# L+ M9 J! G
- * brief EDMA3 Test Application* ~0 Q$ l- a) V2 K
- *. r9 {% p3 x6 m- U
- * This file contains EDMA3 Test code.
6 y: M+ j0 C; h* X( w/ Q - *3 Y, w* l. H% Q( r6 t+ g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 e+ z2 r, u/ J' e( [. D! [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% S% Y) n; v* p( `2 [! I$ T4 f - * TO CHANGE.
: g7 p* e' ^4 |' g$ V' b1 | - *
: W3 p2 X2 f" S. ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ T% }# _/ u5 W - *8 c9 B; x2 h# a7 g E% m5 }% \, n
- * This program is free software; you can redistribute it and/or+ K+ d: Q, }, P7 c( Y
- * modify it under the terms of the GNU General Public License as
: e0 h0 ]% X7 v% k7 J4 p2 f - * published by the Free Software Foundation version 2.: p6 h7 g# v6 a: w( o1 J
- *6 ?5 ?- h: W4 S j2 C" |( q+ B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- T( z, B4 B0 G& X/ X+ x9 v
- * kind, whether express or implied; without even the implied warranty1 m& C: A" v# c+ l) S/ S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 ?0 e! r. ^; `2 B0 m' v; n% k/ n7 j - * GNU General Public License for more details.
2 v2 F W- Y7 M - */
) `$ S% \+ M. S- j - ( _, W9 N: `1 \( A7 O/ {9 o
- #include <linux/module.h>
8 ^& c8 Q& V( L7 R0 w - #include <linux/init.h>
P5 W. [+ Y r4 p - #include <linux/errno.h> g, s7 X+ o4 Y8 g6 m: D
- #include <linux/types.h>
; U- }7 Y' @& [3 x' J* M: p - #include <linux/interrupt.h>9 {2 v( D, B$ L- `5 `
- #include <asm/io.h>% U j9 u! K( a" ?8 f
- #include <linux/moduleparam.h>5 O# B3 ~/ y- D/ n6 f _
- #include <linux/sysctl.h>
}' ?/ o) K( g+ {' ` - #include <linux/mm.h>, z/ z6 a& Z- i' L, b
- #include <linux/dma-mapping.h>
* }' k$ z8 w$ J( | - 4 |4 g$ W: b6 a
- #include <mach/memory.h>
8 u( s( h' G f; Q - #include <mach/hardware.h>
$ }' D8 ]& K* j4 q - #include <mach/irqs.h>
* k! X. N% g) v9 H3 [: p k - #include <asm/hardware/edma.h>
* ?' v5 n) f% ~. L( U0 | - 7 s, c& O/ h4 A: a, [6 r* f& L
- #undef EDMA3_DEBUG& P8 u9 y A7 s: ?3 P$ M& o
- /*#define EDMA3_DEBUG*/
4 B( A7 Y7 E1 z
' j+ ^. x6 n& K1 }+ B9 O {2 H- #ifdef EDMA3_DEBUG! ~3 E; D8 W {0 t1 `9 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 A% G0 B& @% U7 A& L. u6 Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( \7 H+ p( m6 r! I: s! @" a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 I I1 j0 i! f5 q% T) E - #else* y; g$ o" J( o" O' O
- #define DMA_PRINTK( x... )0 G8 |" M* Q! m- }1 D
- #define DMA_FN_IN
" G5 ]( m3 v9 _8 \( o( G3 o - #define DMA_FN_OUT* ?$ @3 m/ e, w
- #endif
7 ]( H( b1 R; {/ ?" ?9 ~1 a
8 ` v" M" Y6 {9 t- c. z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 i" P& ], P. O. P4 k6 v& \) D8 @ - #define STATIC_SHIFT 32 q5 s: g% u5 z6 E
- #define TCINTEN_SHIFT 20
$ x+ U) R1 ]# R9 |0 I6 m8 f - #define ITCINTEN_SHIFT 21
- s: F) S6 V K- S. y - #define TCCHEN_SHIFT 22
$ h7 T4 |& i e4 } - #define ITCCHEN_SHIFT 23
6 e& a, B5 w* ]1 F& o - 1 u7 U# ^ s2 @+ d7 z' l
- static volatile int irqraised1 = 0;
$ c P% s' _" I - static volatile int irqraised2 = 0;/ _5 Q$ \+ W+ J2 y& o
1 c& y" z* m( d, H+ \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 P# G( M. l+ Q- G# c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# W7 ~4 v9 A3 ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ k( E W* k, Q& E- O4 q1 Z5 p - $ a L# g) [( c( t9 k) @
- dma_addr_t dmaphyssrc1 = 0;2 T+ m8 {+ G( a- t9 t0 H
- dma_addr_t dmaphyssrc2 = 0; p; R8 _+ i) @0 G' \
- dma_addr_t dmaphysdest1 = 0;3 B& j: H# t N. ~
- dma_addr_t dmaphysdest2 = 0;
! [+ m" A. A0 ^; F - + @' M% f" e0 f C9 T. ~' [3 }
- char *dmabufsrc1 = NULL;& n o1 I; l) O/ i! ]
- char *dmabufsrc2 = NULL;* o' ?9 ?9 h1 W" y
- char *dmabufdest1 = NULL;: p* Q: s) n3 w- Q2 a- G6 ]
- char *dmabufdest2 = NULL;
8 l7 n' K$ N6 a% }6 `# [. t5 w8 Y; P
- L4 U5 \; T V9 y! r2 D- static int acnt = 512;: `! b5 _0 R1 m5 Q0 H% u2 W
- static int bcnt = 8;
9 }5 K( ?; g7 W5 y! A" R4 J - static int ccnt = 8;2 x, U" l5 K7 D3 y5 Q" U8 w
- z( R6 _4 e0 P
- module_param(acnt, int, S_IRUGO);
5 T" a/ ?/ R! @) _ F - module_param(bcnt, int, S_IRUGO);
% \( a+ H) i/ c) J9 U$ ~ - module_param(ccnt, int, S_IRUGO);
复制代码
. S- s2 l( M2 F- n; E% j" t% F$ ]% u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 k; z2 W% A0 C. l- ]7 h1 _% J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% T( x! i l* S G. u/ C* q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 g! a2 Y$ ^! G9 l. Q4 T h
6 _& S% w7 a" J! ]$ d
( L9 ]' e9 F4 L; j' U; w |
|