|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 b' r. k# H# c" `4 @& g
- [code]EDMA sample test application/ v; J! w. f2 Q8 d2 B. ]1 q% ?$ O2 l
- /*8 c* q" `% g3 O: M/ v3 T* |
- * edma_test.c5 E9 M4 Y# O% e/ ^/ B; F/ U
- *) |4 L" S+ G$ _) O: I, L
- * brief EDMA3 Test Application! m t( d+ t" H- T' B$ M
- *7 j5 \. u6 [) P4 E' X
- * This file contains EDMA3 Test code.4 ^, B( G0 L f8 R
- *
/ d2 M1 {, S) V# ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ P3 D$ s. R* Q) { }2 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 Y3 D0 X, k' E. O" l
- * TO CHANGE.
7 V# Z% N0 E z - *
6 L1 F! _( g( t6 h6 W" R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 \. v& P! Z/ [- c! _$ L
- *5 T) [5 o2 a3 g" N! v; \0 c9 b
- * This program is free software; you can redistribute it and/or
8 |2 ~, U6 {8 f( L - * modify it under the terms of the GNU General Public License as* l) {; p; J. U( n. B0 m+ ]
- * published by the Free Software Foundation version 2.
- I ]0 U4 B; r v, k2 u; M" d- x - *6 v8 j7 N7 ~, n$ D( g @) a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 y- I+ t4 X* b7 p* ?
- * kind, whether express or implied; without even the implied warranty! M. q4 x, G1 s8 q8 i9 O) u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 e8 ^; _" P: M+ b% w- z
- * GNU General Public License for more details.# u# D- Y/ |: R8 G4 x3 t) b- x
- */+ }) I' J, q) U$ L" p. Q
/ b7 d ]! j8 j9 U) \3 Z- #include <linux/module.h>
4 p% B2 T& U, R0 X$ { - #include <linux/init.h>& y9 N8 X5 v0 @, u8 T9 Z5 D% x9 t
- #include <linux/errno.h>
1 p$ `# F" H$ c( T - #include <linux/types.h>6 V4 h. O7 j B3 J4 L
- #include <linux/interrupt.h>. z; j# p7 F& z. [; y& `+ y
- #include <asm/io.h>, \: {1 R3 |1 }1 A! r
- #include <linux/moduleparam.h>" ^7 U; t% @8 L) ~7 n o$ @1 ~1 n
- #include <linux/sysctl.h>
0 e, j. j4 U$ Y. b; R4 |" z& M - #include <linux/mm.h>
; ^! S' L# P$ W% g0 B% x/ C - #include <linux/dma-mapping.h>+ C. E/ a# A" o* ^1 A$ h
- # x9 p. A4 F* A# U
- #include <mach/memory.h>& \* u% u' U* k& L3 Y- U+ i
- #include <mach/hardware.h>- L: K0 t5 }9 ~1 u2 _
- #include <mach/irqs.h>2 M8 h6 u7 X1 `% E
- #include <asm/hardware/edma.h>
; j! m" m+ {' J* q$ f2 t# H - $ m0 B' Q7 ^4 d" p
- #undef EDMA3_DEBUG' i" ^ d6 l6 ^% i- v/ k( E4 f
- /*#define EDMA3_DEBUG*/: U$ ^1 h& A6 T, B9 p
- : E" {! Q& ?& c3 i3 u* I7 |2 ?
- #ifdef EDMA3_DEBUG
- z, i1 H/ H$ n$ G M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- E6 S* J( {4 [5 E d+ ^& D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 f! o3 P. U4 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 v4 |$ V% s5 H$ v
- #else9 ?' u/ _. i9 _: i: I* N* h# g5 J
- #define DMA_PRINTK( x... )
$ J/ C4 G" o- K7 k+ w - #define DMA_FN_IN
& A* U; H6 u7 ?2 \6 G8 C - #define DMA_FN_OUT
2 R' @, l5 u' k - #endif2 s" l" n9 t& W3 O$ v$ B# @6 f
- . N) d- ~5 t) I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ Q" Z) r' Y+ v7 J v6 F - #define STATIC_SHIFT 3
' K/ ]3 p- b, w% v- Z0 p+ i - #define TCINTEN_SHIFT 20: D. _! B7 Q/ |: f
- #define ITCINTEN_SHIFT 21
. V- X3 `1 ]- c8 h2 [. S, F8 T' I - #define TCCHEN_SHIFT 22
/ U1 j6 C' l: T1 Q; p1 x - #define ITCCHEN_SHIFT 23( ?' b+ d! |; E
- 4 {/ y0 H! ^2 l( d2 W+ C9 L
- static volatile int irqraised1 = 0;
7 P8 r. p: h% X7 x - static volatile int irqraised2 = 0;' K/ g: E, O/ U; M( ?
- W% k' x- L' ^; D- [- c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) j. U5 J, ]# G; F. V" C M; L2 ?7 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) C8 W# E `, U. o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, O9 h+ J, J6 ?) X0 Q3 i1 K7 o - ) I% i0 ]6 f2 t" ~
- dma_addr_t dmaphyssrc1 = 0;2 K3 n" H( f+ Y: R
- dma_addr_t dmaphyssrc2 = 0;
+ u; i( c; D. t - dma_addr_t dmaphysdest1 = 0;
0 {/ H. q3 d: M @! f3 k( ` - dma_addr_t dmaphysdest2 = 0;& i! v! j0 E* C+ K
; r7 X% K, V# J% w/ G; \. i- char *dmabufsrc1 = NULL;" W: C. h5 H5 v7 }8 k5 B' k M! K
- char *dmabufsrc2 = NULL;
3 P( V. w9 m$ {1 O - char *dmabufdest1 = NULL;/ g$ o3 l" s7 m2 S1 z
- char *dmabufdest2 = NULL;1 o2 b, J* h/ e' ~$ P" L0 I
% _5 L; M1 v' f) F- static int acnt = 512;
# {/ X/ m6 ~5 p, a& v6 P1 q - static int bcnt = 8;6 Z" K4 _& {; C* U1 M# V c0 M
- static int ccnt = 8;
. v+ H+ E; t5 [9 e
& G6 E4 b" b. u( S- module_param(acnt, int, S_IRUGO); ]: v. @; @- u6 `+ H
- module_param(bcnt, int, S_IRUGO);
. K( p, J! W$ P - module_param(ccnt, int, S_IRUGO);
复制代码 8 m1 D$ B& K" d7 ~2 V7 b' L
$ J5 N3 o* z0 ?% ~" u9 y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 f$ r5 w; B* g4 @/ D2 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! L( s% D5 k, O t; H( s7 A6 U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 M1 T1 h' X* K3 r0 U- o' q, [7 V% d
: h6 w5 g) T$ q9 n( K
|
|