|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 m k0 V+ u0 b2 O, V9 Y
- [code]EDMA sample test application8 a. H! }( Q4 k
- /*
) z$ C4 @! F1 b9 T. x; k/ L# ~ - * edma_test.c! M8 _) S9 P% Y) ]4 ~4 P
- *4 J9 H& [" b9 n7 C1 s
- * brief EDMA3 Test Application
D# y/ ^* m: ` - *
1 R1 Z: N- ]. h$ Y* Y6 E. P - * This file contains EDMA3 Test code.
- N; k2 s( ]! ?4 S* T4 P/ P2 Z# |, ` - *
2 b B7 F6 v7 Y4 w. g, b! y+ l" [$ w" h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^5 u3 t1 r8 ? d1 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 O- _, s, f) |& U# f( T
- * TO CHANGE.; P* [+ u8 y# t$ j
- *
2 _$ q. p" T" K+ w% \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- A. S, p/ f9 v% G% |
- *% `) X- q8 p* ^9 {, z
- * This program is free software; you can redistribute it and/or9 U& P: H/ r! t+ H; K* _* I+ ?
- * modify it under the terms of the GNU General Public License as$ B& d9 Z' m. N" [4 r- ~6 A; O
- * published by the Free Software Foundation version 2.
9 V! h- U- ]* S - *! ^6 `5 E6 y) p. h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 G! \( c- J1 N( T) ] - * kind, whether express or implied; without even the implied warranty+ l1 J" [! N9 p0 L6 i1 @/ }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 ?/ J# f$ M2 i - * GNU General Public License for more details.
2 G1 V1 J+ v, U( j6 ~$ ? - */
; c' X0 N# U( g, w8 v1 S6 O. N - ; X I O q* @
- #include <linux/module.h>+ n6 d+ r' K/ D3 ~ n
- #include <linux/init.h>
2 I) R6 H+ O$ X+ [" { - #include <linux/errno.h>
( H0 {. t4 d/ t7 j. g - #include <linux/types.h>
7 V$ ]2 `' U5 X" c9 E - #include <linux/interrupt.h>
3 Z6 Y& W/ {, B3 Z7 ? - #include <asm/io.h>& g) M7 F) e; Q6 c3 J& L+ o6 B; t
- #include <linux/moduleparam.h>
; M% Z# R! \( {% S) ^/ k% H. h - #include <linux/sysctl.h> U3 v2 }( w4 m, y
- #include <linux/mm.h># Z1 I6 \2 F7 A
- #include <linux/dma-mapping.h>8 Q; w! D7 r: @& o' M. Q; b; L% x
- q- e* F$ _! O1 N9 z" i- #include <mach/memory.h>
$ I9 H( W7 Z$ C9 ^" L% C - #include <mach/hardware.h>
% m4 N, \8 M- a# b, ^6 _" I8 M - #include <mach/irqs.h>1 ^$ P( k6 a" P3 ]0 [( ~& G A& ^
- #include <asm/hardware/edma.h>
1 O! o( R0 N5 p( _. x1 f, K - d+ A) l/ o6 p% e
- #undef EDMA3_DEBUG
8 c3 O$ H' V4 y( @ - /*#define EDMA3_DEBUG*/0 c7 Q7 c& P% S& `3 d
- " }' r7 |: V) k) g; }& K& M* f
- #ifdef EDMA3_DEBUG
0 K& e/ l: P# v2 a9 R% J. ]0 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 \& e) q9 V; R8 R9 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* T6 W) G/ D) h+ @& D5 T* Q' e5 y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% p4 I3 u2 W8 z/ d - #else
8 t( f# N; P) S( p' C+ ^: r - #define DMA_PRINTK( x... )
0 ]4 l' ] } E# f; u F - #define DMA_FN_IN
: y6 o4 x" V2 l9 G - #define DMA_FN_OUT' S- P+ c6 R9 g& Z- Q" u1 W
- #endif
- E7 i. ?% I8 w4 v7 V3 h$ ?
3 u. O1 b# [' S" r0 B. I- h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
v: @2 j; Q" Q - #define STATIC_SHIFT 3
9 g& |; O, G+ Y; o7 n - #define TCINTEN_SHIFT 20# A2 D! N) N/ N, @/ f8 t) J
- #define ITCINTEN_SHIFT 215 Y# E2 Z+ A3 t( `4 y: n- G+ i! f
- #define TCCHEN_SHIFT 22
/ `- l, \* h$ A( a: P - #define ITCCHEN_SHIFT 23
. p, b. v& \% W1 a& m: n" ?
V( ^$ Q9 c1 c! m4 c/ c3 X" p. W( h. ~- static volatile int irqraised1 = 0;) D4 c' h* h S5 u; g* s+ b* f0 d8 Y
- static volatile int irqraised2 = 0;
+ Q4 n+ `1 Z( d7 A% J4 Z7 J& u - 5 b6 m Q% E+ L4 _5 w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }8 c2 d4 e4 h0 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ]* I- N* X. Y1 X5 U' N/ f2 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 E4 G3 j) {( ^3 Q/ b. S
- 8 q+ P5 y/ `2 d' @$ Q
- dma_addr_t dmaphyssrc1 = 0;+ M* |* q4 X3 Q2 G% T+ W
- dma_addr_t dmaphyssrc2 = 0;9 L' }8 O! _1 o, o# Q! h
- dma_addr_t dmaphysdest1 = 0;
+ g* u8 [. R7 u* Q% ?- ^ - dma_addr_t dmaphysdest2 = 0;
8 O0 J5 U' {5 w
4 s3 C& [% Q8 G% n# P- char *dmabufsrc1 = NULL;
3 ?- R( n( d% J - char *dmabufsrc2 = NULL;% f& {" A. q1 e. h9 ?: d
- char *dmabufdest1 = NULL;
: f2 y- S! o+ ?/ J& i+ c - char *dmabufdest2 = NULL;
2 r8 B* E0 |3 L; G: k - ; |0 X' M3 S3 X3 q- X0 I7 R9 I! v
- static int acnt = 512;
" h; N" u u/ s+ J% W, z4 | - static int bcnt = 8;2 W* G( z- b7 a+ M; P9 C( D
- static int ccnt = 8;
' f4 U; |' O. t- B! a: B4 ] - ! o7 G; \# p2 C: y o/ _( g+ a; F
- module_param(acnt, int, S_IRUGO);
. H/ K5 C( N9 x; T$ w - module_param(bcnt, int, S_IRUGO);% d+ F }$ B$ y' [& I4 K' Z
- module_param(ccnt, int, S_IRUGO);
复制代码 : Y) R* _# _4 V" ^$ F6 Q7 ]9 l- ~; n" j
. o4 y/ L$ I& w" e! q6 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ y1 ]& B7 t# _/ N/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ Y' v' Z) @& l1 l+ x+ C2 H+ H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ~2 [# J" C% l5 k& O8 w2 i; T& l/ X3 @* L/ S( a
0 x* B7 C/ S' v, V
|
|