|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. G+ u8 S' K* p4 U* s2 W- [code]EDMA sample test application$ I% u" e! I, I
- /*5 e/ P/ ^: S J7 I* ^* j
- * edma_test.c
: T$ x) a4 j- z! d" F8 o' k* I" K - *
2 O# F/ q9 W5 J& Z4 l# N% h$ F - * brief EDMA3 Test Application. U) e4 G) Y4 s5 t/ Z) N4 x- A
- *8 T4 B9 z: L+ s& h& u3 V5 T
- * This file contains EDMA3 Test code.. W- _, C% J! I
- *' p1 _( c$ s3 G/ H! @, h) R! m2 c! a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 k, l$ B% `) o! f& [1 {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 q* W7 L- D8 f( r; F6 J3 O- C - * TO CHANGE.( C* Y+ E/ b1 ]) W k
- *& Q, F1 A" y y/ ^+ n; x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; O1 I- J; z8 U) C3 l8 ] - *
+ O$ S& R& ]2 g* Q3 h. ?) I - * This program is free software; you can redistribute it and/or+ P8 F1 C# v) D( r, F0 c" z z4 ?
- * modify it under the terms of the GNU General Public License as9 J7 T! z9 }$ _# X6 g _" X
- * published by the Free Software Foundation version 2.
( x0 P6 m' \1 S4 T. @ - *
5 ^9 Z+ H: X& s8 h7 \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- }. q9 q1 R& ^/ I2 |6 H' O - * kind, whether express or implied; without even the implied warranty
1 n0 {2 g2 }8 P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 J7 x' r0 J |: s4 ~ - * GNU General Public License for more details.
5 \- w3 G9 v, ]5 U - */3 N: o, x; k( G
- + q6 ^5 D$ j! L) y4 Y- v
- #include <linux/module.h>
4 Q) Z: t' g' V+ o1 C0 C - #include <linux/init.h>
: h a Z8 C) ]0 p+ C: x9 f) L - #include <linux/errno.h>2 _5 n- z# v9 t% `: [$ h
- #include <linux/types.h>0 |- q( o; [# `
- #include <linux/interrupt.h>
! ^6 J2 L+ j) G( Y* |3 v* w, ^ - #include <asm/io.h>
& Y4 j* j' f8 A" n, K' G! f - #include <linux/moduleparam.h>$ f+ z% C" }! z# Q# o2 C) n; X6 |
- #include <linux/sysctl.h>. Z6 Y2 s/ ~4 v1 z; q/ Q2 X
- #include <linux/mm.h>7 [& d+ ~: g! S1 U9 b" G" g
- #include <linux/dma-mapping.h>+ v+ T5 ~# v' D0 `
- 8 X* \ M* P, }& ~1 j* x
- #include <mach/memory.h>0 q, q$ [" v) ^# l8 {. |
- #include <mach/hardware.h>
& m9 M1 z, h; |$ Z - #include <mach/irqs.h># m9 g6 i. l" x* A7 H# t
- #include <asm/hardware/edma.h>7 _, I" w, P/ [3 b& y
+ B" P- n! n- b; t3 |1 ?* W- #undef EDMA3_DEBUG5 p3 [9 e* d0 Q7 n1 @* z- F. c
- /*#define EDMA3_DEBUG*/
- U' U- v+ r/ ^& Z: }3 V6 k - 9 c# h1 q8 P' U& B# c. \+ c1 S' x
- #ifdef EDMA3_DEBUG2 s. q9 h% N' U- R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 {8 y1 d& r. k, k6 E( f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, ?( L" @$ z5 K9 M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 k9 P7 P8 [1 Y, f$ `+ e - #else* a" K; q8 K+ C
- #define DMA_PRINTK( x... )- Z2 {* D& p- p& _2 F W6 N J& v& C
- #define DMA_FN_IN
3 {' J! R, o# z7 o/ o* I6 S - #define DMA_FN_OUT% X( Y* _2 Q* E) ]
- #endif
! ~' y" f# s' n; ~ - ! q U6 `2 L9 i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 K' \' k) P L) z
- #define STATIC_SHIFT 3' |' r4 w2 U4 a! f$ [! t* H( p; L
- #define TCINTEN_SHIFT 20
# N w# X9 M3 r* E6 X - #define ITCINTEN_SHIFT 21! [7 I3 D( {9 g+ |% {
- #define TCCHEN_SHIFT 22
% b; S& p2 G: Z1 A b$ V4 ?) D - #define ITCCHEN_SHIFT 231 [, c7 c+ w2 W7 E) K( |6 P* X
% n6 Z; z* ?+ h5 q# \3 F$ q- static volatile int irqraised1 = 0;
. H @' g( F" C% x' X7 F: N - static volatile int irqraised2 = 0;% ?, W0 H8 {; ~6 s" a2 @4 v
1 ] Y0 \6 o$ Q/ H/ |+ H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V$ b- {* Z( I4 `# @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: A2 T) L9 J: V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 x+ a# _5 Z, _! o, ]
# `' C' _9 T% B9 U0 B3 A" D- O; ^- dma_addr_t dmaphyssrc1 = 0;
& `. Z- w3 n4 Y a& N - dma_addr_t dmaphyssrc2 = 0;
8 `$ ?4 |: m, ^/ z9 l g+ n7 D5 T; n - dma_addr_t dmaphysdest1 = 0;
( ?9 A n. k* m+ q: m5 F - dma_addr_t dmaphysdest2 = 0;$ P3 {$ n6 ~. s: M; D* Q
' f8 \. l# g4 W: T$ c- char *dmabufsrc1 = NULL;% O5 ?" a" N' X+ \3 q
- char *dmabufsrc2 = NULL;
% e4 z& ]5 c1 Y+ _4 }$ s2 p+ G% l - char *dmabufdest1 = NULL;
! `! t" h$ v! ]. M: \/ D; x - char *dmabufdest2 = NULL;& V7 k/ D* {, y q$ ~8 `$ u
* W* V( X- e3 E# S+ L- static int acnt = 512;: a7 G- L X9 ?; L8 _8 f$ W
- static int bcnt = 8;" l" |& ~; E5 ?) l: b0 b
- static int ccnt = 8;
; A+ V4 {+ s6 {" j- \1 {9 a; c - D5 {' Q3 W/ G# u- Z8 ?
- module_param(acnt, int, S_IRUGO);
: l3 D7 y4 i, {3 V* X+ r - module_param(bcnt, int, S_IRUGO);
: [9 K' O1 M% G b% G0 s) Z. v - module_param(ccnt, int, S_IRUGO);
复制代码
$ I# t' b4 | p2 [% f* K
& S0 ?, E- ~9 v& R; m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 b# i/ w7 [( W# e. O! O* N3 e garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ T+ G8 u8 B" ]. G! `: v+ k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
^& a8 L. t0 o* q" F! K) a6 f' I! w$ a: z% V
8 Z) v% j7 G. l4 E/ r0 u7 b5 L; X5 P
|
|