|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 t/ N$ _4 G( L% u- L- [code]EDMA sample test application: a1 }( o4 H5 p; b# z
- /*$ p% m& _/ V& o6 o# Q- g; B
- * edma_test.c
% H: o: d( N, {3 [5 W# x: u - *: n9 j- e; {5 w. h# X
- * brief EDMA3 Test Application/ g l5 q) h0 B
- *
! e& K) l! B& v+ Z; ]! [- p# U. C - * This file contains EDMA3 Test code.+ r/ }; W8 k+ x( b
- *# Y/ r1 R1 r* z9 r, D5 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 w. C, x( C8 {7 R0 {3 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. {- {( x2 D4 n7 M& X& G7 h
- * TO CHANGE.0 z& P$ }3 S7 n, a, A m
- *$ h$ |+ I( B( p0 O! |2 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 k+ a' e6 ]% E$ h" |
- *& j" W2 X7 A; @2 L
- * This program is free software; you can redistribute it and/or8 t7 O2 J7 {! }9 Q1 f0 e
- * modify it under the terms of the GNU General Public License as
, W4 \2 f5 \3 ]2 _5 I* F - * published by the Free Software Foundation version 2.5 z" f$ g8 C! K- t- z! h
- *- ]/ R3 Z% |7 _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, Y, O+ ^" X6 v' ?1 g( }! w1 s
- * kind, whether express or implied; without even the implied warranty
/ N2 R7 q, N. _0 K! p/ z- i# K" p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 X1 s: q6 N% E& l4 M. s+ V
- * GNU General Public License for more details.3 b% v1 Z3 B$ a& c" B
- */
7 `' J0 w$ m( i% d f t+ K i, f - % z2 D( n- n' D; @5 `5 V
- #include <linux/module.h>
# W' a7 a5 e5 p. x - #include <linux/init.h>
* n p( F/ ~# ]: |8 K! O- l - #include <linux/errno.h>
w* |) ]$ ?( Q. \# U& e) `5 S - #include <linux/types.h>* S% B8 ~, | Q. F& ?3 G5 S& }
- #include <linux/interrupt.h>
. C; J B7 g& ^$ A. z - #include <asm/io.h>0 }* V1 r% x/ d8 r# K0 `1 q6 L4 Q8 B/ }
- #include <linux/moduleparam.h>$ z* h& `1 a; {! o9 |9 K/ j( U4 }
- #include <linux/sysctl.h>
' i) B, l9 f) f$ b. a' G - #include <linux/mm.h>
( n+ B% Y; _! P& r" d - #include <linux/dma-mapping.h># B, E$ G$ c% f3 m- T& e. j( a
- ( O6 `3 M/ N l; T
- #include <mach/memory.h>
+ k( B/ {: g) a7 H% S8 v - #include <mach/hardware.h>6 v4 c6 }( Y" s1 p8 A- g
- #include <mach/irqs.h>
6 t" g3 g- ] \/ K+ Y) d - #include <asm/hardware/edma.h>6 ?% p4 S% s9 ]+ w8 \7 t$ ^9 x' q
- & V- P- {* H+ P* C9 i" ^6 f0 s
- #undef EDMA3_DEBUG
8 k! K( o% P! p3 l - /*#define EDMA3_DEBUG*/+ q! D) ]/ |% D. U- O2 }' p
- $ m9 ~4 h( u5 r
- #ifdef EDMA3_DEBUG
2 ^8 W) K0 }/ b; J2 `$ h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 y4 k' S, [1 U3 I1 w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* p& [' e w4 s) u& W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. ]/ P. p" p% ]! ~ - #else# Z- B" h3 j m3 f: t3 h
- #define DMA_PRINTK( x... )
% q* O5 U7 I0 U i9 y - #define DMA_FN_IN
% Z ^; }" S. ?4 @. K M9 U2 \. O - #define DMA_FN_OUT+ \. D% \; H7 E
- #endif6 _6 e$ W" E: K- Y8 K0 U% u9 l
9 P1 q; J7 D$ [* c1 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 U, k6 b9 Y" N$ I, [0 R9 o* o - #define STATIC_SHIFT 34 ^; r2 y& ]" g. b' r5 ]% B. R2 E T# W
- #define TCINTEN_SHIFT 201 X9 m( I' t& ~! S, D f, L
- #define ITCINTEN_SHIFT 218 I6 S2 B% B6 z; _
- #define TCCHEN_SHIFT 22
( Q k6 Q3 G, ~* C/ r3 w J3 V - #define ITCCHEN_SHIFT 23
" O) K2 }3 n1 {1 _' e - ) ?. _' N- ]& T8 z8 x
- static volatile int irqraised1 = 0;3 q8 X# I# i1 O+ f A0 M
- static volatile int irqraised2 = 0;* e: u; u+ z0 H
- 4 c2 O/ A/ d* j& l+ t+ w0 u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ I7 W" q* f5 U$ n+ l5 `) c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 A8 X1 d6 X8 [/ h# A; F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ H# s% C* j( X( b I
/ x7 \- T" Q- X* Q) P- l9 k- dma_addr_t dmaphyssrc1 = 0;
7 s1 ?& l# j7 j, a1 E' x$ G - dma_addr_t dmaphyssrc2 = 0;
: M9 a: Q8 I8 F X# k" t - dma_addr_t dmaphysdest1 = 0;/ p5 o9 T# \2 G# i
- dma_addr_t dmaphysdest2 = 0;6 `" o- @8 b+ c9 M! Q7 Q
- $ b/ ~( m; o' i% n; h) W" [* z
- char *dmabufsrc1 = NULL;
1 \7 S1 R$ P8 E# i& r+ n& `7 X - char *dmabufsrc2 = NULL;0 [# i# q: B, y5 d+ d1 M
- char *dmabufdest1 = NULL;
" M& _% |4 j6 M4 G& P; f0 O - char *dmabufdest2 = NULL;
. z. v$ L o1 l" I3 p3 h - ) m }3 E/ M- L; P' {" [
- static int acnt = 512;2 ~$ I" l0 j+ g" i( W7 H/ i
- static int bcnt = 8;2 i1 x8 q3 e/ `
- static int ccnt = 8;3 F( t* W3 }: M6 p9 V# Y
; K4 Y& v3 J' ~2 w+ W! E% u- module_param(acnt, int, S_IRUGO);
9 W+ {# R; o s; I6 E - module_param(bcnt, int, S_IRUGO);
% b* A' M- {* Q1 M* M1 x7 C - module_param(ccnt, int, S_IRUGO);
复制代码
1 B7 q; U0 B, u! o
( a8 b/ G+ z, k1 |8 [$ a0 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' Z2 z& m; P6 H/ S* C* warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, b2 ^! U \! f" ~8 b. ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" v6 Z. a% R- ^) C. q9 }2 d) g% b
1 b3 S; q3 i3 c. P. a6 u3 u1 G J0 f5 }. m) V1 \" ?1 x' q4 k
|
|