|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 R+ ~8 }2 S+ w8 z9 N8 O' u
- [code]EDMA sample test application+ a" ?8 e8 v8 v/ E- e$ `
- /*7 y+ {. h/ S" N, q- q8 ~
- * edma_test.c
) b( K, i. W9 g6 K' M - *
5 s- `1 ?9 B) o) f; j2 } - * brief EDMA3 Test Application
) p3 r% q& }4 d& z5 D% R# M6 F - *2 x: \9 l1 {2 A$ S0 M) [3 C; p* y1 I
- * This file contains EDMA3 Test code.
$ J2 d- C& D: ?% m/ N+ F. X; N - *
' u% Y1 f( N i/ l* v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 n' s% u0 ^* ?5 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 E" e+ D( J3 X: v& Y: _- }
- * TO CHANGE.; b8 @& o0 @! |6 @7 R
- *
8 i- P: }( \5 l8 T2 N" \) u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
M: W! e( A$ _, V - *
1 q- A9 N0 L9 P/ L2 O) I3 g8 q - * This program is free software; you can redistribute it and/or& ]' X% r* V$ E: P& {- m- ?! T- x
- * modify it under the terms of the GNU General Public License as! ?9 `3 Z, S% p0 K1 ~6 p( h
- * published by the Free Software Foundation version 2.
7 t" v8 V! z2 F2 r4 c" Y - *& r+ @6 K- t7 V( ~; {* [& N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, }( e7 d! e6 Y! j- Z
- * kind, whether express or implied; without even the implied warranty( Y V' s' E$ Z) }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 b% r1 ~! W n, E - * GNU General Public License for more details.
1 i9 A& g0 U6 p1 b; D9 ^; n+ M9 k8 u - */4 C; x( g+ v5 M- a- q
* T' g3 ]5 D! A/ }2 d; k- #include <linux/module.h>0 f. O5 v, Z& B c
- #include <linux/init.h>
( h1 d6 ^& g8 @- \! C- D - #include <linux/errno.h>4 o0 ^$ F6 b6 X1 x/ R9 O; K
- #include <linux/types.h>( x/ p0 X7 v1 X
- #include <linux/interrupt.h>2 n8 R/ z) @& l) |. ?; Y
- #include <asm/io.h> t3 R9 p& I; F3 `( S) ]2 F. U
- #include <linux/moduleparam.h>, o. }+ k7 k4 V( n, a
- #include <linux/sysctl.h>
" _$ \, @% }2 R: K; [5 Z* d - #include <linux/mm.h>6 u9 j3 E. J; c9 c
- #include <linux/dma-mapping.h>+ l8 [/ d7 M+ q7 k: f
( n* Q7 c3 M0 n; l5 r- #include <mach/memory.h>
% C' y* q% f* G9 C, Y - #include <mach/hardware.h>* t! M& d! }; j, r
- #include <mach/irqs.h>
/ j: i; X H- g% c: l - #include <asm/hardware/edma.h>
0 Y; f8 ^' S3 ?2 S9 J
a2 K9 W2 j" C' C# [ H5 \# S- #undef EDMA3_DEBUG( @8 U; M4 p+ ^/ C5 J! ]0 ]
- /*#define EDMA3_DEBUG*/
7 C: [% S+ h7 \# Y8 ?) z
5 U- I. Q5 Z# F2 h- #ifdef EDMA3_DEBUG. ^3 e& I: s4 `, f' T, r% U. V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: c* [% l' o& R2 ~% b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# n+ k# I$ C% ^) q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) w2 z# `: O! M2 h, a! R
- #else
, R4 J8 Y% D" P - #define DMA_PRINTK( x... ): E( o! q2 U# n$ v4 J
- #define DMA_FN_IN
, U; w( |# w# h1 `3 I: V) z - #define DMA_FN_OUT
: E: n2 E4 y/ q& B: o' J W5 b! X8 x - #endif& b" @1 Z- H$ q! Z% S9 m/ ?
- _" K2 R9 q+ y' ~3 x4 Y4 k7 U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' T2 x3 [8 ?1 K$ R9 M0 z8 |. } - #define STATIC_SHIFT 3
; K9 N9 X1 k9 P' ~" h - #define TCINTEN_SHIFT 20
, @; ?+ Y! c- R+ l6 Z - #define ITCINTEN_SHIFT 214 _6 T2 h- n7 Q- M9 u+ _( U
- #define TCCHEN_SHIFT 22' ~0 m% d! s: w2 O
- #define ITCCHEN_SHIFT 23- |; C$ c I9 @# X! G
- : P6 A* W3 m! q4 L# s
- static volatile int irqraised1 = 0;
% f$ b7 e% l, y+ V) A - static volatile int irqraised2 = 0;4 V2 x h; l1 C. T4 w
: A* \+ w7 Z+ T8 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a6 `2 v1 C9 D6 v0 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); i* F+ c `/ e$ R5 E0 L% R4 _$ k" l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 W) Z% H+ x: i+ u2 Q) N& O' B; d
+ g7 ~; c `6 D O- dma_addr_t dmaphyssrc1 = 0;, |6 m! F. c7 V3 ]9 O2 ~) t# D, z
- dma_addr_t dmaphyssrc2 = 0;
4 }# b) T6 k/ z- N Z( [ - dma_addr_t dmaphysdest1 = 0;8 D, m, ^& K. n! K! y
- dma_addr_t dmaphysdest2 = 0;
& v6 j, g/ I4 A& C
: ~, ^6 P+ ^, o& \3 ?6 _- char *dmabufsrc1 = NULL;9 T; t! u- W G1 Q* X
- char *dmabufsrc2 = NULL;
6 J& E) P/ a( q7 i# M9 o; ?" K - char *dmabufdest1 = NULL;
$ l; e h% A9 N; O( t% u$ U - char *dmabufdest2 = NULL;% x4 R4 r7 z; a! i1 U
s# I q4 _/ e4 | N& `- static int acnt = 512; D$ Y J& ?( f' ~) N/ ~& L; _5 V
- static int bcnt = 8;
# e- s q% Y3 @( U+ \7 W0 Z) j - static int ccnt = 8;
. v; r4 P# [8 Q0 G b- r2 E - 9 h) [6 w5 i* t; d
- module_param(acnt, int, S_IRUGO);" m( p( @ f, B) n: A& J
- module_param(bcnt, int, S_IRUGO);
( ^5 D. {' G5 G' T* r% i% K - module_param(ccnt, int, S_IRUGO);
复制代码
$ Y0 S5 p, j9 @6 `) y4 O3 `/ s) x: a; T' K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ A. _6 \. i- m3 g- Q3 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Y; r/ Y) L& w9 }. r7 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# x6 D9 b6 R, f5 W0 d* i! n
3 d; B) [& e; ?; K% h7 d. ^; b! X* Y8 U i: p1 h0 @
|
|