|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ^" s3 ?+ n( p) r1 J1 k! L
- [code]EDMA sample test application
, d) v3 I2 z% s, C2 @ - /*
' v, S0 {2 _+ B0 N* N( Q9 g0 S - * edma_test.c
! o- S: o' F, q( B) @! T7 w" b - *) S$ W2 T% s$ H
- * brief EDMA3 Test Application, p8 |5 O! d3 G3 p8 A. U
- *
/ ^9 T' @6 R; |8 f - * This file contains EDMA3 Test code.
& v. u. D9 I- e, E W1 R - *
4 j2 ?4 `; t' y- D, s/ F0 ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 I. v1 j6 ]1 W$ A* J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) @. n ], U% J; g9 ?6 [8 r k% L7 v - * TO CHANGE.3 D( ]5 i. N# {6 I" U
- *
- R0 P( d5 K/ G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 p* L5 |9 i* |7 C - *
2 m3 |9 s# ?0 F! D; W2 V# ?; k - * This program is free software; you can redistribute it and/or
: s) e" `) O7 z X: R0 d - * modify it under the terms of the GNU General Public License as
0 w Q$ [) k* ^4 S- \ - * published by the Free Software Foundation version 2./ F% L7 j+ Z5 r
- *
2 y% r( K; q# t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 D. Y5 c5 F/ r - * kind, whether express or implied; without even the implied warranty
/ m& H2 v+ f8 M* f5 L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ a* D0 V w5 e
- * GNU General Public License for more details.$ H) b7 ~6 _. B
- */
1 V7 h2 Y) J: ^; t6 X& C2 k
, X3 e) b0 p3 K. S- #include <linux/module.h>! j" ?% v) G' e. w
- #include <linux/init.h>
# P+ r2 w) u$ U" S# n) ~ - #include <linux/errno.h>/ g7 o" S6 W+ n3 S8 S
- #include <linux/types.h>
6 S9 L# Z i7 I1 f, F) v: M - #include <linux/interrupt.h>
3 g4 U$ ]* w6 p& x7 a4 v - #include <asm/io.h>
, c( J7 I( E3 h7 _% I( p; T - #include <linux/moduleparam.h>7 I+ a5 W: G0 c# Q6 f
- #include <linux/sysctl.h>
+ \" M+ M, ~0 _1 x& o' ] - #include <linux/mm.h>) P6 i8 {! b1 B# u8 C6 ~8 C
- #include <linux/dma-mapping.h>
( E: w% i3 ^$ ?& `$ G. ?, ~; V( T
# k9 [3 U. W) I" u- #include <mach/memory.h>
" g$ v3 w7 D* Q8 } - #include <mach/hardware.h>+ H- O9 v2 F. E8 U) q' f2 }9 z) I
- #include <mach/irqs.h>
6 Y1 `4 `! e6 ?6 v) X9 `# Y" f - #include <asm/hardware/edma.h># q5 Y( T |0 S1 X8 y$ ]
- 0 `6 g" e1 g: ?# c) e3 R
- #undef EDMA3_DEBUG
' q6 c& C! ?) j4 o - /*#define EDMA3_DEBUG*/7 ], d" ^; c( _
- 9 j4 [2 U8 g6 |. h
- #ifdef EDMA3_DEBUG
$ ]" \& n7 _: R$ c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) B6 X4 O) K7 [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 H- F0 c; i$ v- D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ F+ @8 d; C; u: K6 y; u/ P/ Z
- #else
4 [2 x. S3 l5 f8 x; P3 c( M - #define DMA_PRINTK( x... ): m, w% O* A' F% m1 Z; D V, y3 f6 v
- #define DMA_FN_IN" o% i% {1 V$ Y# e
- #define DMA_FN_OUT3 I3 I- e: \/ h$ w9 j0 z
- #endif5 u- o5 d1 X1 p% Q. S/ G8 ]
- ) l. j; {# [0 }7 _5 O% h( R. @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 O1 o0 G/ b3 {) v5 \* U, l - #define STATIC_SHIFT 3/ m# I! }8 P5 Z- y: ?
- #define TCINTEN_SHIFT 209 w2 p- _, q3 b
- #define ITCINTEN_SHIFT 213 h E* B, Y f& b
- #define TCCHEN_SHIFT 22& m9 q6 i( f9 n) J& g1 C- T
- #define ITCCHEN_SHIFT 23
8 @( O8 W/ I! o
" x, h E7 K3 z: H0 X! _- static volatile int irqraised1 = 0;* g3 x6 ]; x1 y+ s
- static volatile int irqraised2 = 0;
% M+ x. K7 z) M$ d0 ^! S0 H% ~ - 4 Z* T; ?) ?0 L' W+ i( T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 F" v2 u5 U, q( X7 @" C" Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 U' P* Q0 n2 f3 O7 I$ b% R* S2 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); s; j6 V- i e y1 w( g
- ; H# { ^8 }2 y) s9 C& [6 a
- dma_addr_t dmaphyssrc1 = 0;
H5 b+ p4 [; u9 h - dma_addr_t dmaphyssrc2 = 0;3 }8 p( y5 I1 V. k! b ?! }
- dma_addr_t dmaphysdest1 = 0;
, q7 y: l$ c m9 A, q3 X - dma_addr_t dmaphysdest2 = 0;
8 W8 e1 G9 A3 |1 v
?' q# t& V/ L1 B% s- char *dmabufsrc1 = NULL;; G) W/ D7 l; e6 t6 {) z1 E" ~: ^' J
- char *dmabufsrc2 = NULL;: s. _+ @! }( Y! T( h @9 V
- char *dmabufdest1 = NULL;, P) {" O% k) G( [# ~
- char *dmabufdest2 = NULL;5 }$ F$ H+ A- T
6 J( g& W* c) S3 s/ e; h, M- static int acnt = 512;
4 u S0 z. s$ p1 {9 h7 `, u - static int bcnt = 8;
- q8 z* O! c" l) l8 S - static int ccnt = 8;
' M0 P7 P" G! a! B - ) [( \3 \1 b7 n+ L) W( y
- module_param(acnt, int, S_IRUGO);' O q0 @! Z8 L# i3 ^! D
- module_param(bcnt, int, S_IRUGO);: y" i, _+ o$ A
- module_param(ccnt, int, S_IRUGO);
复制代码
$ e- m5 u3 w: X' n2 m/ h& y1 p4 J& W) K1 Y4 G' U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' s1 C( [ f i: d; e0 @' i" Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 }" r8 @% K, e( K7 @' R, o# A! ~) t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 t0 Z2 ]- `/ Z1 [, e/ C
: E# u9 x: [2 r) O9 @) ~% C7 e
+ N7 r6 l1 \: R |
|