|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ S7 R: N9 E: \6 v6 W O/ X& m
- [code]EDMA sample test application8 l5 u( `' D/ {9 O6 O) T
- /*
" @0 @' T$ D' i - * edma_test.c
' `, W: C9 v4 V& {4 J* { - *4 B' B5 {/ c0 A/ W& \. o
- * brief EDMA3 Test Application2 j( K; M: W6 _& H( U- L
- *) b( y, q( |: O9 ]# C3 M X
- * This file contains EDMA3 Test code.) s$ m9 N; X* S
- *. ~& z" d {7 W5 n; V* n/ H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: o% {3 g$ g8 z5 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 g4 @3 f: [ w! c' A - * TO CHANGE.
1 W, j7 P1 i5 c - *, I7 c3 T+ `1 [; M i, |; u5 ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 I7 f# _2 i2 R6 V7 a) j# U. u - *
# C: Y, |3 B7 } - * This program is free software; you can redistribute it and/or$ F/ j8 J; g9 g4 L
- * modify it under the terms of the GNU General Public License as
" L; O9 V6 D4 ` - * published by the Free Software Foundation version 2.! X7 n% `& C8 ?4 g: }& C; x6 |3 L
- *+ l5 S6 C% A9 c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ r8 ^ \4 B4 r* C( @0 B - * kind, whether express or implied; without even the implied warranty
6 t- E0 \7 j3 F; a: A2 t7 X; r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 a4 u1 V3 N: ?9 c* z - * GNU General Public License for more details., j1 F% [1 R* n( t0 d% h* u: `" C
- */
1 @+ Q3 m! ^9 a8 F, K - " e% q d+ f! g# a
- #include <linux/module.h>
- H8 V' U7 u6 Z# |& r# |; p - #include <linux/init.h>) A2 y- V6 G8 w. O. v/ F
- #include <linux/errno.h>
, `/ n( D: m2 m3 h - #include <linux/types.h>: ]$ `3 m) z# r
- #include <linux/interrupt.h>
! Q8 Y3 u# J0 b) a9 e - #include <asm/io.h>9 n3 w7 \# {0 [
- #include <linux/moduleparam.h>
' x9 ~, v$ U% C3 @- x5 P, E9 E) z - #include <linux/sysctl.h>, ]$ y3 i ]& ]( r; Y% \5 L; V
- #include <linux/mm.h>
0 ?# T3 v& }) m* i - #include <linux/dma-mapping.h>
9 Y1 \% {- ]0 x9 h8 ]& H. @ - : ]# p* y }4 F
- #include <mach/memory.h>
) r4 `$ l* C+ Y& Z) r* d - #include <mach/hardware.h>
) d9 i) n, e9 P7 @/ \3 ^% p" l - #include <mach/irqs.h>" G/ D) ]7 I/ k% S. p# ^$ u4 p
- #include <asm/hardware/edma.h>% J. `, f- v0 l' j% ]
7 r$ I0 T' L9 C7 ]' @8 x$ J& t7 A- #undef EDMA3_DEBUG
7 C* f& R3 U% O# ?8 v - /*#define EDMA3_DEBUG*/
* f9 B( ~* k6 F5 m5 @6 }5 b - " I; q3 }2 B+ D Q/ e3 [; ^
- #ifdef EDMA3_DEBUG; j: ]5 u: i0 e; |- \+ V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): n! g* P" f# L5 I/ g( k- Q5 D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 v. G6 H$ V. Y! O& S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! R! n4 ]8 Y# `0 T' b
- #else! t& s, C% y8 c8 o0 n7 \6 ?
- #define DMA_PRINTK( x... )7 v+ ~+ n7 V# |7 ]9 U
- #define DMA_FN_IN+ o# n m: m4 d
- #define DMA_FN_OUT
2 b8 n+ N' W. ?+ U4 Q4 n - #endif8 o% [" A) g [6 L
0 g( p _. `: L! Z; k% E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. o% X7 R! i* `/ k# y+ N/ f9 V" O - #define STATIC_SHIFT 3
7 E) a' v, [) f - #define TCINTEN_SHIFT 209 u7 w( h; U" `' p8 R" u: m+ i
- #define ITCINTEN_SHIFT 21
. i$ b. h4 U3 d - #define TCCHEN_SHIFT 22+ G1 A5 v S0 Q
- #define ITCCHEN_SHIFT 23) [1 y* I5 w% k# U
- Z1 O3 C5 R4 K
- static volatile int irqraised1 = 0;
' ^, S# c2 ~" s, K4 T z - static volatile int irqraised2 = 0;
& I" h7 c5 F5 W4 f: v. P - 3 C1 e h* }. O4 X2 H; }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 q! ^ H x! y9 q+ h$ v( r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N% z- d5 ~. ?2 ~& \7 j7 G" Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 K# M* u B+ ]6 M8 D, ?6 f2 v
& u7 g, H& s+ ~2 h1 w2 b2 s8 ^2 h# x- dma_addr_t dmaphyssrc1 = 0;0 C# M0 h/ ~ N, a
- dma_addr_t dmaphyssrc2 = 0;
# ^, [; O+ Q ]+ O: e+ Z - dma_addr_t dmaphysdest1 = 0;6 t/ E# U7 e/ C* x6 j. \# c3 z
- dma_addr_t dmaphysdest2 = 0;/ C' ~- ]: J7 x) x" a3 g. v
- . W# o* c6 c4 h4 P
- char *dmabufsrc1 = NULL;
; D. r* d' o' ?% z - char *dmabufsrc2 = NULL;
* S6 H5 A* R7 \) g- Y% g - char *dmabufdest1 = NULL;
! m- w4 x9 f+ {# S9 L4 O - char *dmabufdest2 = NULL;
$ s2 T0 }6 j, W+ s* x6 [7 M2 { - 7 ?4 x5 r1 k5 R
- static int acnt = 512;
J, H3 Y3 p, \; p' S- w - static int bcnt = 8;* V5 u3 Q0 U. x1 g* p1 F) H% w
- static int ccnt = 8;( Y8 _, ?+ d) |6 V4 c& A% L* H
- f R G6 K9 C6 J+ K
- module_param(acnt, int, S_IRUGO);; M( |$ ~/ _, r3 T
- module_param(bcnt, int, S_IRUGO);
- w3 y8 G( h6 v( G - module_param(ccnt, int, S_IRUGO);
复制代码 6 e( | [1 h# D
, m( z* Q5 c7 {' {- l# Y+ @4 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 K2 I! y3 e! [+ _0 l: l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( z% J: K4 ] g4 \3 f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) Z3 F7 F" r. b" l X$ j& F% ^7 w; D* d* A4 ^
: g6 o4 Y) J+ W# h/ \6 b |
|