|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' G6 T" q: n4 D, G+ U
- [code]EDMA sample test application7 |) E6 q: }9 M; P2 n0 a0 d' l
- /*
. T+ D% ^7 I# O, z8 T) @ - * edma_test.c
% _: d5 D0 h$ l9 m& M$ v - *
4 s# l8 X% V! V - * brief EDMA3 Test Application1 y& r! g8 H& c
- *' q6 @( _4 N$ ~0 k( B- [+ a+ k( c
- * This file contains EDMA3 Test code.
& O7 U* m+ r9 @7 R$ J. i - *
; P* Z4 ?: K# q" S( p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# d5 W- Y* C' i6 ^* |. C' ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, [! g6 `# [6 B- c& c7 s# L% u# w - * TO CHANGE.
# W, s2 A/ q# s- E1 @" G - *
& m$ r2 E! ]+ n% z$ x8 q( _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ K; ^6 I- t. h% u& p
- *% ^+ b1 A# L, e" |$ `4 Q2 h
- * This program is free software; you can redistribute it and/or0 W& y( [4 y' W8 [1 t! T
- * modify it under the terms of the GNU General Public License as
6 \% t. w* p5 ]; X - * published by the Free Software Foundation version 2.
9 l# |5 h' [/ V - *. ]' v9 S( l4 R! N/ L4 a& P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 _2 w: ^( x X6 E }
- * kind, whether express or implied; without even the implied warranty7 ~. I: @8 S) a# k0 X# V5 N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* M7 W$ E& P8 f/ {! m- x- q - * GNU General Public License for more details.
% O( R4 d' C2 B( \ W& s2 k - */& r* c* R# ~ V1 M. [) ]) G
- - N- w- r1 x) G" x% N# X
- #include <linux/module.h>3 s& U7 D6 z' o, |8 [
- #include <linux/init.h>5 v5 e/ E0 L: W* Q
- #include <linux/errno.h>
h }# k u$ r" B6 ]+ }1 K - #include <linux/types.h>: D- T! t" ]1 I3 R5 e4 q
- #include <linux/interrupt.h>
- s: u, f5 w0 X% M - #include <asm/io.h>
$ o, W7 [& V9 D# {% K - #include <linux/moduleparam.h>9 Q5 ]) [* m" b. e2 S
- #include <linux/sysctl.h>
5 v! X/ _9 c, t/ h - #include <linux/mm.h>
0 _5 r) L: w+ q3 H- V0 s- x - #include <linux/dma-mapping.h>! I; Q6 W$ ^! A! v8 m
[' W* y& ^4 w- |% n- #include <mach/memory.h>/ v5 y [8 f# K' ?/ f- i8 s
- #include <mach/hardware.h>" o/ C3 O' R" M7 `# y
- #include <mach/irqs.h>
6 Z5 D/ q# u1 m; w. Z& C* J$ f O' Q - #include <asm/hardware/edma.h>& ~ q( K9 K. ]; b& J0 `
- t3 A+ r- d) W4 b
- #undef EDMA3_DEBUG
# ~& G; e3 z# g2 V, _8 J& K - /*#define EDMA3_DEBUG*/
* I5 }6 B) O) _4 W2 M4 ~: j
J6 O8 p1 U1 l2 W8 U( A$ e/ A- #ifdef EDMA3_DEBUG! Q, i. B( o6 K) H4 N# s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; Y: [6 K. p. {5 b! }% Y8 t7 v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* o$ g) p/ ^4 c! h& t% p: | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- [5 O# ^) n3 Q1 Y# g7 {. b
- #else
+ y- J3 C G, X* Y% [ - #define DMA_PRINTK( x... )
) \( o z! V, H |. D( f0 @& y - #define DMA_FN_IN
: Z7 U4 _ ?6 g - #define DMA_FN_OUT. _& g0 u* {( E# O* Z( G/ d% D
- #endif" |9 m/ U S3 t. [" a2 V8 i
& H) U1 e; a3 ^. i" l& l' C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 `+ I( _+ t! _' C
- #define STATIC_SHIFT 30 r$ ?5 B3 u+ S$ _4 p0 Q
- #define TCINTEN_SHIFT 20
5 x1 Y( l3 _/ Z# S8 F' s - #define ITCINTEN_SHIFT 21$ ^% u _; ^# a
- #define TCCHEN_SHIFT 227 ^# Z. k- K5 x& q! r% J+ C
- #define ITCCHEN_SHIFT 23
8 j) N: ]) ]0 w( V g - " S- P' l M, f' O: a7 p/ u
- static volatile int irqraised1 = 0;
1 @4 i/ I6 ] N8 Y2 u - static volatile int irqraised2 = 0;: `* H" h3 f3 N$ ^5 H7 r9 d9 }
B1 i/ S2 Y) n, }0 L4 Y# R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; _3 n! h7 |7 Y* M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 q: o, r0 M0 m- L3 ]! X7 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ p$ h! D' r+ T* |9 {
% e/ _8 s# j3 A' [" p( Z! g- dma_addr_t dmaphyssrc1 = 0;' S: f. G3 X% ] I2 P
- dma_addr_t dmaphyssrc2 = 0;
2 m+ A: t4 f! G/ M, h$ _4 k7 k - dma_addr_t dmaphysdest1 = 0;3 t# ?: \1 `3 W- D
- dma_addr_t dmaphysdest2 = 0;
% b w( D2 @! S3 }, H1 I1 d6 w
. O0 w! \+ k2 X _6 D9 v- char *dmabufsrc1 = NULL;7 [2 s' ^& W5 `5 q3 A; N0 J
- char *dmabufsrc2 = NULL;
. j% T( K3 F* _- f$ v - char *dmabufdest1 = NULL;/ \9 V& [; H% c0 h# q" R, w9 j" b
- char *dmabufdest2 = NULL;
) P# K7 }9 {& A
% U% j+ t: F( I( l6 b/ ~2 Q3 |- static int acnt = 512;5 U4 j4 E1 `9 G1 x: T6 ]0 L
- static int bcnt = 8;+ A6 v0 X* E. G( H# ~: G0 f
- static int ccnt = 8;0 P+ E W# F7 {+ k+ `6 _) l
- H1 \: x0 s0 A% P6 S4 c5 ]! q- module_param(acnt, int, S_IRUGO);
3 Y) Z( @, M, B - module_param(bcnt, int, S_IRUGO);* g3 E6 n+ y! A1 M. f( }
- module_param(ccnt, int, S_IRUGO);
复制代码 2 F& c& V5 l4 k5 ?& `
3 W( v. Q' H' c* D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 L# N8 Q% D% s# ^5 ^7 [# zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# V: n: Z; j. H0 D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# f9 S, Y! s0 M4 @& Y5 K
, h& X2 T2 q* h" _
) O2 T3 S, T" b( q
|
|