|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 ]( `8 `3 [' n. r7 \# O1 G( A- [code]EDMA sample test application# I6 {6 l2 l" p/ H3 P- |
- /*
, K# \$ ?4 g5 U4 Z& J. z - * edma_test.c
! E$ t; V. P- } - *
2 F, h. w+ |. F/ S# D2 C( p - * brief EDMA3 Test Application4 F; z% ~% @- y
- *# f3 Z+ d8 V) L8 O1 {
- * This file contains EDMA3 Test code.; H* h# J/ G% p% t
- *
G5 p" l# b3 r) m5 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 i& ]& d, G! ] y- V A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ]7 K4 f/ _4 p
- * TO CHANGE.3 o! X" k: v" _1 y6 _* b N- q
- ** C& {3 d4 f# g2 A5 P _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" h& b$ T% o4 `) q - *& i( k9 Z( J4 g" {+ D( Q" B
- * This program is free software; you can redistribute it and/or
' n/ ^2 E- ~: j0 V+ { - * modify it under the terms of the GNU General Public License as" L* T5 a0 V; k( S: F& z
- * published by the Free Software Foundation version 2.
# ^5 P5 W0 W; T) W( s! R - *, @8 _, I$ t% z" x. x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ ]8 e/ [1 N& H7 p c4 ]
- * kind, whether express or implied; without even the implied warranty
" u/ [- B ~5 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" a6 J, ?% P" K. g
- * GNU General Public License for more details.* p( J9 z+ K4 S3 n
- */: s/ }3 A- v# n; Q( G ^# q
- I9 f) t7 t, J0 l- #include <linux/module.h>3 B' ` P( S% j2 d/ d
- #include <linux/init.h>
; Q$ |+ p- Q5 B6 r' U( d - #include <linux/errno.h>
1 M. H9 R, D6 c- K. O* }! F - #include <linux/types.h>1 M' t1 S8 U9 X
- #include <linux/interrupt.h>6 l0 {; h. l6 A; m
- #include <asm/io.h>5 e/ g# T' R. [( U1 S
- #include <linux/moduleparam.h>& c. v- \6 i) f8 a
- #include <linux/sysctl.h>+ B8 z8 V: a, \+ e% H
- #include <linux/mm.h>( \& t% m! W4 ]. K
- #include <linux/dma-mapping.h>+ \; ~/ B7 E' i7 a* a. e5 q' G
; a- P- W: S8 Q- #include <mach/memory.h>: a6 Z* I- P$ G7 }$ U, t
- #include <mach/hardware.h>
5 [- @0 d% g4 b% e0 T% k' X% { - #include <mach/irqs.h>
' b: i$ G! W" A" G - #include <asm/hardware/edma.h>! q; U: ^; c5 x' T8 |' _
- ' X) I/ s+ ?$ z6 H
- #undef EDMA3_DEBUG; Y+ ^' I7 O+ a6 e4 V
- /*#define EDMA3_DEBUG*/
% s3 _: N A) B* R6 o0 u
. t: b! f W l9 |- t( v- #ifdef EDMA3_DEBUG# r' ^. a3 j) ^' H% a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 W( Y/ a$ o. k! D6 c3 n9 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 p4 k( ]0 h& r8 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 }7 z- a# Q: S7 d2 q7 V5 F - #else7 C& b3 H( G- [
- #define DMA_PRINTK( x... )
' f2 B: C4 A5 Q) l - #define DMA_FN_IN7 V; n5 }. n0 o" T+ _8 V' [ |" P
- #define DMA_FN_OUT4 f. _9 S0 ^* g, ?* c
- #endif
' U* h6 g. H" O0 ]! C& { V+ i) I
9 h! T8 H3 {& P9 X' n$ A; M: R+ S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" Z4 P9 z# r8 _7 z! y1 C+ a, o - #define STATIC_SHIFT 3
/ U3 ]5 C0 K. |" O) B" B' x" R - #define TCINTEN_SHIFT 20
& `: A; M! I& l4 c! z9 g - #define ITCINTEN_SHIFT 21
+ T- f# D* m4 E3 @ - #define TCCHEN_SHIFT 22
( [* L! p, A: T - #define ITCCHEN_SHIFT 23
2 ?, v7 n. N2 ?2 I' ~' g
; R2 o! P( P5 ~0 C& u* }# Q* W- static volatile int irqraised1 = 0;+ Y* n# f6 p$ T: c, a: i3 i
- static volatile int irqraised2 = 0;
4 A9 j: s3 v5 p7 t; g# u7 T
1 m" U. I( H5 \ S8 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% O0 r0 J. N3 c2 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 `' Y+ d- U' u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; V: M- Z. @$ A7 G6 ]9 v
/ A- }% Z: d& B) `/ y+ v2 ]. A- dma_addr_t dmaphyssrc1 = 0;
, s( y; n$ E/ s0 Z$ V6 Z - dma_addr_t dmaphyssrc2 = 0;
; {* _) f' F* U* f - dma_addr_t dmaphysdest1 = 0;& ^, U% C1 B8 W7 b1 _
- dma_addr_t dmaphysdest2 = 0;
$ c+ a, I* d. | \# \! m
+ x: m; m! V3 J1 h, r4 v4 }( T- char *dmabufsrc1 = NULL;
' ~' e- ^# W1 B( C - char *dmabufsrc2 = NULL;
& N$ k0 `& J9 V' u7 P - char *dmabufdest1 = NULL;6 m, R- Y% U" B7 b
- char *dmabufdest2 = NULL;8 _. q2 d# K- Y/ R
- 2 [- d) G* [" u# v/ M$ D
- static int acnt = 512;
7 \( T( Z( {2 {0 n4 }/ ]6 p - static int bcnt = 8;
; f0 H6 O1 }6 R& m) U% f( p - static int ccnt = 8;, g$ j @9 N# j# |' ]& z$ C8 A
- q1 f$ F8 F. J9 r6 f4 l0 B% o- module_param(acnt, int, S_IRUGO);
! p1 C8 K2 D! i) W1 C- e$ a. m! V - module_param(bcnt, int, S_IRUGO);
1 ]' a+ i! N& s; g) L7 b - module_param(ccnt, int, S_IRUGO);
复制代码
4 d1 W4 s. R6 N* g) q" E H& S/ T+ C- P+ ]4 W0 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 n% o0 G: j. o+ \+ w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; }. |" C6 }& i# F( E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 K/ F, Q# _* Y! r& @0 X+ K! y9 N! b, S# T% p3 _& A
, F, @- _9 P1 ?
|
|