|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 K4 f6 v1 j; ?$ x0 t9 F N
- [code]EDMA sample test application9 K2 t. V1 W4 N7 ?& t
- /*. N$ G, b, d/ R5 H% _4 n* i9 o* x- X
- * edma_test.c0 B* _ o: f, T7 M- r1 B+ c# I' e9 l3 v3 \
- *# f3 {( N2 ~# M' q% {: E
- * brief EDMA3 Test Application
7 R4 L' u! A% k2 { - *
. [7 l& L& o H( x+ i/ G& F% E - * This file contains EDMA3 Test code.
& P7 g& W* t; x' O - ** s" H; z) {+ d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 p7 o, T P" ]7 E" J, l! W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# A) a4 i) ~/ B. D4 I" ~) N
- * TO CHANGE.7 `- Z+ ]. @9 ]& Z: t$ b
- *
0 [+ s7 n+ q9 ^8 [, i8 Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 E# U F# o( u& ], p( w! d: v - *' z, G0 `! _; d: a
- * This program is free software; you can redistribute it and/or' l$ y3 S) L( g7 n7 l3 ?
- * modify it under the terms of the GNU General Public License as! j' \0 Z& h" I2 Z# V& w a" f
- * published by the Free Software Foundation version 2.
/ O( G# ?. v/ K( E6 ? - *
& n2 }( P" r7 |( z4 i% k7 L8 \$ f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* A5 N$ d2 x: H; C/ T& L - * kind, whether express or implied; without even the implied warranty
* M) r# c& N; W4 S; o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; T1 P4 a3 y4 R! A9 _) E
- * GNU General Public License for more details.9 g" d9 w' d7 a" ~: ?% H
- */
7 ?% o; D/ R1 g' C% h; z- X
, z1 ?- }9 I3 u, K- #include <linux/module.h>
7 `" M1 J/ m4 d* M( Q/ ~% m( ~& X% J - #include <linux/init.h>4 k% d' N' L; S
- #include <linux/errno.h>; j4 C% j d: }# p/ W
- #include <linux/types.h>
. B |0 N: k0 B- w - #include <linux/interrupt.h>
" y/ g: Q6 K$ I( {2 {" B" g2 ^ - #include <asm/io.h>$ [, V& j" f, ]) _8 a
- #include <linux/moduleparam.h>$ w1 x) W; s# F
- #include <linux/sysctl.h>
; Q' S# J; u! S) X - #include <linux/mm.h>0 s( R+ P; V- `) K+ Y2 X' x
- #include <linux/dma-mapping.h>
+ b f9 n1 t. H: T
, v) C% _$ e5 T+ G- #include <mach/memory.h>
A) U- u6 Z( P/ H - #include <mach/hardware.h>- T+ [# D( d8 |0 P, K, V
- #include <mach/irqs.h>
5 e$ G+ d* K) t: H3 K - #include <asm/hardware/edma.h>5 G9 g' {. W- _* ^
- $ f" m4 `! r. Q; g
- #undef EDMA3_DEBUG
, R7 N: V% P3 j' W - /*#define EDMA3_DEBUG*/ U* L0 u2 z4 _4 s
, T }" |2 k$ ~" X) Q- #ifdef EDMA3_DEBUG
' J9 N6 t2 L1 M/ J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 }' N Y x& v, y" |. z& q& d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" [- y" ]$ A3 ?6 g( [1 |" H- [" Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) u% v y, N) i1 d* N S* H
- #else
& X A/ b, E/ {5 ?: q. |6 _ - #define DMA_PRINTK( x... )
( [: y% ~4 j5 j. v - #define DMA_FN_IN
; k9 N* [0 F# V3 V$ V - #define DMA_FN_OUT5 q7 w* L5 E- Z* e d
- #endif
5 f' C) u/ _0 ]9 H2 i5 f
$ m; s" K% D; O$ Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. {4 E% B; W8 R) r - #define STATIC_SHIFT 3
7 r3 c) t8 j9 v. e% Q2 H9 T$ c - #define TCINTEN_SHIFT 20
" p. o8 l* R" s, w: F0 E - #define ITCINTEN_SHIFT 213 W7 H( t2 K. z& g3 X: F2 e" R
- #define TCCHEN_SHIFT 22
. p0 Y1 [8 _5 Z7 J& o - #define ITCCHEN_SHIFT 232 x" q, h4 X, u6 z- U% Y) Q$ N/ V! V
, q- [1 Z5 W2 D& o( W! B2 W' q P- static volatile int irqraised1 = 0;
( C! p5 P3 a2 o. v; U( [ - static volatile int irqraised2 = 0;
' A) N' ]" m1 G+ { - % X: Q$ u' ]3 d$ g2 j1 J, L& @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, a* E5 j7 V. \# P; d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% S% e! q% b4 R$ n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 s$ L+ K1 M& Q2 q9 q7 `0 k h
9 N* z8 E6 {) m& F- dma_addr_t dmaphyssrc1 = 0;1 s+ w& H1 N& Z; s! A* g! E
- dma_addr_t dmaphyssrc2 = 0;
1 y, ]7 A3 }. g' J - dma_addr_t dmaphysdest1 = 0;
8 a9 K& ^' g' t - dma_addr_t dmaphysdest2 = 0; ]' A! g% j8 X! \3 h# J/ G
- " n' d3 q% @/ h* X/ p. A
- char *dmabufsrc1 = NULL;+ B/ x% L% w3 l# t; ?; U+ r
- char *dmabufsrc2 = NULL;4 i) S7 }' ~2 n- b
- char *dmabufdest1 = NULL;% j" l6 ?: a6 D; Q2 ?. g J" T$ w
- char *dmabufdest2 = NULL;$ d- R0 n( ?* r n
( W; ?0 E$ k/ ]8 X8 k1 j- static int acnt = 512;0 K8 A# E* z' Q( L. _1 I+ c/ j
- static int bcnt = 8;
A; }, t- B7 [1 \8 H - static int ccnt = 8;, H( p& \0 y% j" q ^
- 8 W" w% n j( e; H6 ^
- module_param(acnt, int, S_IRUGO);" r0 ~8 ]" y3 b& }& `' P' a
- module_param(bcnt, int, S_IRUGO);4 F, ~* p2 c( }0 S! ~' O& `) @
- module_param(ccnt, int, S_IRUGO);
复制代码 / H6 j5 ]6 z6 D% r' x' v1 D
6 W7 ?2 b/ F3 ?( Q+ ^3 ]( t, b! @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# n6 x' [! a, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 ?! c. }, Y! f7 j1 C- t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; H% y* R1 ]7 j! ]+ e: J
! U# v# ?7 t P! j# {
/ j3 E% B D7 \ |
|