|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 f1 y; K% p- m( v- [code]EDMA sample test application
0 W5 n, v8 S4 Z( N - /*
! E6 a/ m: l/ B, o; [, d8 I2 R - * edma_test.c' C# a$ B9 j9 Q# `+ t9 i( j
- *1 i' r# ?7 L7 Q1 Z
- * brief EDMA3 Test Application
. D: s2 e& M. d9 G4 A2 r - *
, [4 @7 N- _) D - * This file contains EDMA3 Test code.9 Y0 K \" J* E/ z' O# \
- *! T0 v" a. O7 }) M/ Q. A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" ~0 Q/ L# ?8 T2 z/ a |( j0 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. K/ U- l* D2 j5 H
- * TO CHANGE./ ~7 G- F9 P- A" |% S$ `( h
- * @( Y8 |( {& A$ _' u( q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ y p- Q2 o6 I
- *- p( a. v5 _% r5 d, G+ G
- * This program is free software; you can redistribute it and/or
/ ~' q. y- T A6 T- L% k# T - * modify it under the terms of the GNU General Public License as
) l/ o7 z% I+ Y* ~* i5 q+ G - * published by the Free Software Foundation version 2.
- s% S& F6 ~# l. k/ n - *
/ C3 r* t; c6 C/ N9 ]/ | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. v. `$ v; d4 h! _, h* m
- * kind, whether express or implied; without even the implied warranty
) s- R/ B1 C& o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. \0 h' |2 p* H4 g
- * GNU General Public License for more details.
. z, R9 j; Z) P - */
2 b* }& S7 w$ h" D( F
5 a1 l) ^" Z7 R3 D- #include <linux/module.h>
3 v$ C, Q+ R/ Y! R4 E - #include <linux/init.h>
' I/ W' H* B! b& X$ |$ [: N8 A4 J - #include <linux/errno.h>
6 \ k3 T6 ~, m6 D - #include <linux/types.h>
. w6 p" }. [. Y/ N9 B - #include <linux/interrupt.h>. ^2 t2 e; V6 s8 C* t1 l W9 v
- #include <asm/io.h>. N2 F# z: m+ W: T7 B8 o4 y
- #include <linux/moduleparam.h>
& }9 H! G: _% O0 o1 \6 ? - #include <linux/sysctl.h>
) `" a' v+ {5 n- R - #include <linux/mm.h>, p1 Z6 B* B# W6 ]# [& z& t
- #include <linux/dma-mapping.h>% _& v8 j4 L" x, ]
- 0 I2 P% a% t; o, f9 `
- #include <mach/memory.h>
& a$ j5 {: w: K9 y! H - #include <mach/hardware.h>
! v1 C- u0 f3 k - #include <mach/irqs.h>
3 p' r4 W3 d$ H! G! g - #include <asm/hardware/edma.h>0 z! p, K' L, D
* H2 L" u6 ~7 W7 m/ a- #undef EDMA3_DEBUG- q' X, y4 ?5 d8 r* Z' V L& k2 O
- /*#define EDMA3_DEBUG*// l, ^/ r" @: ?8 E
, Y! @$ R4 ~3 h. x: f$ a- #ifdef EDMA3_DEBUG: H4 M0 F8 T/ H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% T/ Q2 d! i) @: c* g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" x" S: Z6 ^. e; g* I5 { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) O6 t, Y) ?4 J. f3 D
- #else! @9 g; W$ o! D- {( p! B8 p9 ^
- #define DMA_PRINTK( x... )
+ k0 y9 r9 d c - #define DMA_FN_IN
! Y9 b) g9 Z9 s8 ]- Y" p6 d - #define DMA_FN_OUT
$ C( E) V: R& K - #endif
( y; u, ?! p1 z& q6 M - 9 `9 O# W0 Q0 o% r3 s6 j% |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) c) Y- W4 K/ J& w
- #define STATIC_SHIFT 3+ i5 ~2 l! Q( f3 M
- #define TCINTEN_SHIFT 20
x: m8 s7 y' B: { - #define ITCINTEN_SHIFT 21! ?5 \2 @( k' ^
- #define TCCHEN_SHIFT 22
( S) x& r0 C6 P8 m - #define ITCCHEN_SHIFT 23
( e) z, t7 t% s
$ i3 ?& M7 ?+ G7 w) t( p- static volatile int irqraised1 = 0;: w* O, E$ p! J9 q) a( b# c% L
- static volatile int irqraised2 = 0;
- J' s3 D/ Z1 J, M) V - ( t) J- |' F/ }% h* D. q' P1 P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* ~ N& e3 R, y l) e9 d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 L8 d( f5 {4 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. [4 z8 Y7 K" y. O7 S5 f
: o2 k+ c [) r) }+ I- dma_addr_t dmaphyssrc1 = 0;* r+ C+ X5 _6 ]+ t; e4 S
- dma_addr_t dmaphyssrc2 = 0;- L5 d" a) c9 E3 y. @ Y
- dma_addr_t dmaphysdest1 = 0;# y# O- w5 I& [6 h2 e3 O/ k+ M
- dma_addr_t dmaphysdest2 = 0;7 W* c6 d: Q! W9 ?$ v
" I. i5 P9 W& ?- char *dmabufsrc1 = NULL;0 l2 U" r: ?) l I4 |) L
- char *dmabufsrc2 = NULL;
2 C: c% U. ?- l" C: Z - char *dmabufdest1 = NULL;
4 q6 V) Q; f- D; k( k% O; y- r8 s - char *dmabufdest2 = NULL;! |% [$ J3 d- H0 @9 h# c8 A/ M4 x
- ! K% j: C6 g8 E& p& K
- static int acnt = 512;
/ q6 X% z V' H - static int bcnt = 8;; O( ]7 f6 x b# p( e$ F, ?1 D
- static int ccnt = 8;
" P9 c, K W' y# y3 Y6 u( `
4 ]) O! U9 H: P) O8 B' H- module_param(acnt, int, S_IRUGO);5 S# F, `) f0 C
- module_param(bcnt, int, S_IRUGO);
% X/ C0 S5 ~0 D0 L - module_param(ccnt, int, S_IRUGO);
复制代码
2 [ V2 n0 H P) Z* I2 O2 v8 `: A0 H/ O# r8 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* A. Q1 h9 U8 F" K! V l+ ?. a# M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' Z8 {0 D5 i2 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ]- i1 a# }# V- j: g( d0 o
: w1 u! f) Z2 ]
9 R1 e5 N0 g4 Q9 z
|
|