|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Z4 s2 W8 n3 Q0 W3 u! }1 {* l
- [code]EDMA sample test application1 G7 V" H# o/ C
- /*
7 v( k% l. T7 B) z - * edma_test.c( L( l8 Q% h) t" i z
- *7 C/ V1 @& K; E. A! k# n
- * brief EDMA3 Test Application4 A7 M( v+ b8 n) ]. d
- */ ]: g T: X' d; R
- * This file contains EDMA3 Test code.% s6 h9 R1 @) k9 H. i6 Q% L7 E( q
- */ h; p+ ?1 Q$ T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ |: C% w2 V5 U- h% x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# n1 G- |& a$ T5 D - * TO CHANGE.
) c" n4 ^6 B+ C6 X+ G - *
) r3 K3 u) `* Z. E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, `, t1 R. S6 }
- *
2 ^) l: b! c/ d$ v; X* b - * This program is free software; you can redistribute it and/or, k" O& T8 ^; Q4 A
- * modify it under the terms of the GNU General Public License as$ d. R: _# B& P! y% {0 g" G! X
- * published by the Free Software Foundation version 2.
# w8 e5 a0 [; Y2 a# J1 @: p - *
: p4 T( ]5 C) ^4 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* }0 L3 }; D) ^7 e
- * kind, whether express or implied; without even the implied warranty: {& b) r( p8 C/ G$ r% ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ \! r$ M* {- ~- F2 \1 @ - * GNU General Public License for more details.& t3 T5 n# O% |# j1 ` P
- */
# y# y* v" P$ e c/ v4 P, l - / a4 R+ P' w( w0 w/ T! J' M+ Q
- #include <linux/module.h>8 @ j9 \ W6 Q g
- #include <linux/init.h>, E0 j- b/ v2 M. J* c2 A
- #include <linux/errno.h>$ c: T. `3 \+ C( [1 p9 ]
- #include <linux/types.h>
3 |5 v' {/ D( ?3 W! | - #include <linux/interrupt.h>. X( `1 H w0 A1 i7 @! w" e7 G) {
- #include <asm/io.h>: }. A1 w7 ?- P9 i0 Z- @
- #include <linux/moduleparam.h>
9 B( _% o+ ^& U! _& `+ f E1 I% W - #include <linux/sysctl.h>- ^* j( F; ^% \- p$ m) i/ c' {+ I
- #include <linux/mm.h>
. h9 h- ]6 y6 F - #include <linux/dma-mapping.h>) @) E, Q$ T* w: N' R. H/ e! z. Z. C
7 a3 s1 d4 U7 S3 T. N6 {- #include <mach/memory.h>
4 d3 I% n% ^2 M - #include <mach/hardware.h>9 C' N3 S3 N I$ x
- #include <mach/irqs.h>! T" y& g9 P& j) d
- #include <asm/hardware/edma.h>
" @; A& _" V+ Z8 N- Z
4 p. S: n M/ X- #undef EDMA3_DEBUG
8 w2 \' y: q& n! s( E - /*#define EDMA3_DEBUG*/
# v) D" P+ x$ s$ K& Q" o9 Z - , ~9 L" D; ]& O0 a: O2 p3 Q9 m
- #ifdef EDMA3_DEBUG! }% x" S: F1 _: p, p' X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 ]$ V. ^0 v- B* F: h- J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' Q2 h, J* q/ [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 U& q ^1 k3 s ?& q, w8 O- [
- #else- r' J4 |& f2 J+ F8 y& [+ G$ l; E* ~
- #define DMA_PRINTK( x... )% J0 W2 ~9 ?) x3 P& t
- #define DMA_FN_IN
0 Y( i% Y$ E# e - #define DMA_FN_OUT; Q# C i. B. A, k7 H1 w
- #endif3 ]8 A) |2 E- Q7 C# A9 B
- U5 E( j- z; a- #define MAX_DMA_TRANSFER_IN_BYTES (32768): v- x& l2 r9 Y7 H5 f5 A; Y
- #define STATIC_SHIFT 3# a' f. M$ W4 L5 w) B
- #define TCINTEN_SHIFT 20
+ K& D* N! Q$ g% F0 } - #define ITCINTEN_SHIFT 217 ~6 F- T# f5 @" n$ N7 ]
- #define TCCHEN_SHIFT 22' w9 D8 s; ?. \8 c p$ w% s5 y
- #define ITCCHEN_SHIFT 23
# i+ A0 T- Z Y$ \$ o" g
; R! a+ Q0 y5 S6 c$ f3 g! Y. R$ {- static volatile int irqraised1 = 0;& n6 \! J) k0 s6 V4 T
- static volatile int irqraised2 = 0;
0 V. g( h9 f6 ?0 K - $ _! M7 d" B% m6 p# Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 E, _' S. k+ m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ X+ j g- }+ G9 E% r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) i$ O$ y8 Q' ^
- . V) q9 j! ^+ v+ U' R
- dma_addr_t dmaphyssrc1 = 0;( U' ~- I6 t2 S) ]- J: S% L
- dma_addr_t dmaphyssrc2 = 0;
1 w5 V3 x$ O& y% r* m - dma_addr_t dmaphysdest1 = 0;
/ A, l8 b p" x- O3 b - dma_addr_t dmaphysdest2 = 0;: x& V' w8 y. l# A9 |2 ^" [
- - a. v$ g$ }' A
- char *dmabufsrc1 = NULL;
: z# x( I2 P5 } - char *dmabufsrc2 = NULL;, Z& x3 c6 {) [2 ?' l
- char *dmabufdest1 = NULL;
( M: Y, Y3 ~" I; Y% U: Q* P2 c - char *dmabufdest2 = NULL;" F5 j G7 i1 L. n* p
- / P l+ G+ v3 D& P! Z
- static int acnt = 512;, L0 B: h# B6 E( Q8 {
- static int bcnt = 8; z! s2 E: C" X' t4 p- V0 l! E3 o
- static int ccnt = 8;
0 s7 ?* s9 [. Z2 I( a
# @4 s- J2 R; I) D- module_param(acnt, int, S_IRUGO);9 D. d' T: A+ b9 S: u0 Q8 `
- module_param(bcnt, int, S_IRUGO);* P9 a& y- S. h2 x, V, |) {* u! V
- module_param(ccnt, int, S_IRUGO);
复制代码
6 ?3 [" h0 `/ g- J$ [! G0 M7 V% L" Z+ z8 j& {# a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% k/ U5 i- b* {% y, C! Narm-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 ^1 W# M/ a7 x) v: o, @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ ]" S# @- A* ]' R# P% u V5 e
- R# p! F9 R/ a2 O' ~ F7 |! v& N4 B y
|
|