|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 Z/ }* W8 b1 C# \- [code]EDMA sample test application
& ]3 V4 c3 e/ z5 P - /*6 _& ]+ c0 s) b
- * edma_test.c" S& j9 }& d. ?2 F4 ]
- */ O% d0 p) J+ M9 S
- * brief EDMA3 Test Application
; G1 Y6 U. D E# I. O, j - *
9 _: Z8 t9 O; F - * This file contains EDMA3 Test code.( w* p1 A" ~3 h- E
- *! ?& {; K) Y! O( M' U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ K* r: I( g' u3 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- r8 C* |( X7 p; C6 l' r. a
- * TO CHANGE.
' O; x% p; C) m, H r% K; M: m" M - *
- \7 f f: V7 E& H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 [9 t) q P) E: ]) k
- *& |- n! R2 C0 J1 H1 i
- * This program is free software; you can redistribute it and/or7 E5 M" Z8 ]0 K
- * modify it under the terms of the GNU General Public License as3 W, f% G' `; r8 ^
- * published by the Free Software Foundation version 2.
) w( P- @' d- ~4 ^% C9 _ - *1 V* _# ^9 V. j9 {# ]+ j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* o( U$ o! [. ]9 i! C, F2 J - * kind, whether express or implied; without even the implied warranty$ b" \2 h- P" o/ m; H3 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) j+ x" [9 e6 Q& m# M4 b - * GNU General Public License for more details.3 k- a: g0 x. G* O2 L: g V4 T( y
- */
9 q1 i* n: I# k0 Z/ L - / S$ m% e/ G9 @- V( _
- #include <linux/module.h>
) g4 g% A6 k+ [0 U* Y$ I( \1 x - #include <linux/init.h>) l/ @6 k! ]! o
- #include <linux/errno.h>
9 M' q; O- o) a# r# U6 a - #include <linux/types.h>! t* @9 A+ U5 k( M4 f* Y' ]
- #include <linux/interrupt.h>% N5 T% H) T1 u# W+ C" w6 P
- #include <asm/io.h>$ E5 Q; a; }' E: s6 a
- #include <linux/moduleparam.h>8 c4 C9 m) p4 l, b$ t8 f, E; C5 V% p
- #include <linux/sysctl.h>
4 i0 a. k& b8 c- H4 D& f0 k - #include <linux/mm.h>
6 T8 h; o" Y. Z$ n" N - #include <linux/dma-mapping.h>" H! \7 o- Q* G1 g% V$ Z8 i6 J1 B
( q( x! t* m Q% w/ O* L8 v0 R- #include <mach/memory.h>
9 \3 X5 |9 E+ A6 v - #include <mach/hardware.h>
# s2 Z- F3 y; q6 @# k - #include <mach/irqs.h>
' P! Y. B5 y! y$ D - #include <asm/hardware/edma.h>; V) l5 o( R) W
6 R, ]) C" d1 T. T: N- #undef EDMA3_DEBUG
) X8 L i% V O: D8 S - /*#define EDMA3_DEBUG*/, X" G- C P1 Y7 y
- 4 x* m) t( z6 K. p7 z7 C
- #ifdef EDMA3_DEBUG
+ D8 s# V7 U' H, G/ S/ X' } ^: [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
y. g6 O0 Q5 B& f* o. E3 w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- g& k: a0 c% q& N& U" |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 K* e$ W @: g - #else
) {) v+ a7 i+ k" O9 ^1 C - #define DMA_PRINTK( x... )3 k1 d% O2 T+ k U- E; q& e5 S" ?* I
- #define DMA_FN_IN* I! p: V; O: P
- #define DMA_FN_OUT/ t, N X+ ^" E. f& W" h
- #endif* L& a3 }% O, P' g
- 9 ] y+ c% a/ J' T- |- H0 e. P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) W/ G' O! z4 x) D- Z' S - #define STATIC_SHIFT 3
9 T" F& H# y1 q - #define TCINTEN_SHIFT 20, p1 o. w9 D: P% k) D
- #define ITCINTEN_SHIFT 21
0 m! P3 ?9 g/ x - #define TCCHEN_SHIFT 22
5 @- B" V F9 C& R - #define ITCCHEN_SHIFT 23. R8 I1 R" D( W6 s% o+ u
- 5 e& T- K# e+ F! F2 e: V8 A1 G: I
- static volatile int irqraised1 = 0;! |& ^4 x% O1 n' ~7 q0 g8 `8 C1 s1 n M
- static volatile int irqraised2 = 0;
' l' ?. z7 x) K4 P# {$ T' n - 7 O" _7 H2 `& b$ e2 m4 J! i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ~' ?: M+ t6 N3 v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d* K0 v4 s5 R# m1 {( h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! x0 D1 W5 o* S* P" J
3 K1 a6 |. M/ C& f: i: j1 P$ G1 s% G- dma_addr_t dmaphyssrc1 = 0;: H& R' N& ?; H: P
- dma_addr_t dmaphyssrc2 = 0;
$ d" N) j& \# W2 } - dma_addr_t dmaphysdest1 = 0;- [! m5 _; c( s7 I. C8 g
- dma_addr_t dmaphysdest2 = 0;
t. `9 D0 P* y. C
( O j1 a+ V& \/ X) O- char *dmabufsrc1 = NULL;
6 t5 c: z+ c5 p$ S - char *dmabufsrc2 = NULL;5 ?/ m$ i1 W8 x! g. _0 X' p
- char *dmabufdest1 = NULL;
?& K$ Z/ E2 U J2 i: O - char *dmabufdest2 = NULL;
1 }/ H7 a2 {) [6 o1 h: X: W - 9 ?- B2 v' X& W8 G" S* R
- static int acnt = 512;
* ]8 G5 k# j. W# _1 Y; x - static int bcnt = 8;
# b* k! V2 w7 B6 m0 D6 ` - static int ccnt = 8;& H& ^$ A! A" c8 q* t! p
" R+ n( k7 {2 R0 T- module_param(acnt, int, S_IRUGO);4 ^+ U. ]1 r& {) L- k
- module_param(bcnt, int, S_IRUGO);( y, y) h; Z) r7 u0 [* M
- module_param(ccnt, int, S_IRUGO);
复制代码 8 Y, Q$ Q3 i. \: l
# Y2 q9 i. g% [/ I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 N9 `6 p; Z4 R: Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. n# @- ~, u1 m0 ~* ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 T- u$ P/ X& w# p) D( ~ }; C2 [! S5 c4 L8 S/ h7 e
4 u$ e6 v2 T' b
|
|