|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 T0 y, c* V; k- [code]EDMA sample test application c8 J5 p2 s+ o) L z( G: W
- /*: M8 w0 S/ c3 T% |, ?
- * edma_test.c
9 W7 m1 m2 ?3 C$ M4 @5 E - *
- p0 e- o3 J+ g) i) H. _9 f - * brief EDMA3 Test Application
: v* M* [ E/ L* B, _ - *3 p1 K- w0 s2 X" H
- * This file contains EDMA3 Test code.' _" y2 D/ }, N" D! ^2 A
- *% u6 K" u$ @ ^9 r2 F8 ]+ B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' i1 d9 z) ?0 X/ X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# D8 z% w2 \* i; v# I - * TO CHANGE.3 x* Q1 H) p! u- o$ B1 K
- *
5 b( y& b! S/ I# X& z( x4 B6 x& @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 ~' v7 K. j5 `1 W' d q$ G% L
- *
1 { \( P3 K1 D( i6 D I - * This program is free software; you can redistribute it and/or1 J# \6 g; y! @$ G& `. i% f4 G
- * modify it under the terms of the GNU General Public License as% `* w0 ?1 S. {6 `
- * published by the Free Software Foundation version 2.
4 w3 _ w3 q) y! ]; @. d - *
2 v/ l2 ], z- r; \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' S3 i. P/ @; _! \
- * kind, whether express or implied; without even the implied warranty
9 S2 \0 `" D, }# K! y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 ^' V* ^' g, v4 [# T F! v - * GNU General Public License for more details.% T1 U0 M: E! e6 N3 m
- */
. Z2 @3 V( \3 b0 M
: h/ x) Z$ U- s7 ]1 R% R3 |- #include <linux/module.h>% A& c. X# i6 o
- #include <linux/init.h>
d: a! V: Y3 A) N* t- m. a - #include <linux/errno.h>
8 m( Z. p) Q( J# Z" d6 s+ T - #include <linux/types.h>0 o! w6 K% T1 e% w
- #include <linux/interrupt.h>
! z. j0 R& r+ x$ ]3 W - #include <asm/io.h>) i$ M& u2 u% S" E. g! v
- #include <linux/moduleparam.h>9 s- h3 ]. L, Y4 y9 W
- #include <linux/sysctl.h>& L& [1 b5 |# [# }- a
- #include <linux/mm.h>
, M; |) l/ g* F' \ - #include <linux/dma-mapping.h>( |* m- \' ~' z) R
6 g" k+ W) K( h" s/ b$ u- #include <mach/memory.h>
1 v- p m! H" Z7 f5 q" S, M - #include <mach/hardware.h>/ y( h ], ]+ q" T2 q
- #include <mach/irqs.h>
8 L$ }7 r0 p+ Z - #include <asm/hardware/edma.h>5 L+ M0 z1 ]( S, T) c
( I" M& U+ q3 @! V7 }3 ^: f, `- #undef EDMA3_DEBUG) j6 R4 V1 Z) |+ m- L
- /*#define EDMA3_DEBUG*/
4 t; \* Y4 B" [( ~% d ]1 J
% W( [- e1 d b2 K- #ifdef EDMA3_DEBUG7 U' E2 |5 y x C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 l4 H3 r$ b2 ? p0 J' B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- ^0 }5 m/ a! K8 M& X3 y4 P6 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 S, I2 f, B, u) i
- #else
( Q$ M; d: k! c- D - #define DMA_PRINTK( x... )7 f: _* Q9 N, r) D
- #define DMA_FN_IN
# m' x5 N$ [3 \# x - #define DMA_FN_OUT3 p, d5 i3 T/ Y6 o8 y
- #endif7 n' E* \- F) [4 M: `) c
( S2 ~; z' g8 H" I* I- #define MAX_DMA_TRANSFER_IN_BYTES (32768); c1 [. e8 d5 S9 u$ |! ^; d7 s
- #define STATIC_SHIFT 3
$ u1 M4 e% V9 N1 m - #define TCINTEN_SHIFT 20
$ G& W1 N9 W6 ? o$ D! H' M - #define ITCINTEN_SHIFT 21
: x5 o+ S8 b6 L1 s0 ? - #define TCCHEN_SHIFT 22
' ^0 s5 i$ U, X+ b - #define ITCCHEN_SHIFT 23
; f* f2 @8 S; z: P$ @ - 9 I; b& }, Z" l2 M) i5 P
- static volatile int irqraised1 = 0;7 X! E5 |& S6 \2 D. U1 S; \
- static volatile int irqraised2 = 0;
- g, o% B2 p2 r; i/ i4 ~" H, [ - " X; r4 Y$ e" f5 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 r0 A; v1 e& j! [) B8 _ c# s* D9 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: [& e" z3 g5 t# x- u5 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 M: N; x5 |! Q
- # _8 A2 v. v( Y/ A- k3 C
- dma_addr_t dmaphyssrc1 = 0;
; f4 W$ k2 a/ B% K6 u- |' h" Z ` - dma_addr_t dmaphyssrc2 = 0;8 c8 L- ?# }3 L* | h6 x
- dma_addr_t dmaphysdest1 = 0;/ m! v2 {& U1 S w& [; S
- dma_addr_t dmaphysdest2 = 0;- u2 u6 H+ C: N$ U
- 6 a% B; b) t: p! T
- char *dmabufsrc1 = NULL;1 I, W& w/ _- A w& x& T
- char *dmabufsrc2 = NULL;3 [: ~5 |0 k* @5 r3 Q; }. { U
- char *dmabufdest1 = NULL;
- `. o0 j2 J8 m, C8 N- R( R - char *dmabufdest2 = NULL;2 x: s: A( L& X) U% k2 V
( V# I( q4 y5 ^, \6 Y- static int acnt = 512;
0 @3 M% W) A9 j$ e - static int bcnt = 8;
) M& x) E+ Y' Q M- {, c% a - static int ccnt = 8;
0 u( m, v/ h6 k* e. x5 B - 3 c0 _9 p( w. H4 c$ _, q: f2 K
- module_param(acnt, int, S_IRUGO);
9 r% ~8 ^- n- ]. `; |+ { - module_param(bcnt, int, S_IRUGO);
; c4 H: U7 R0 o - module_param(ccnt, int, S_IRUGO);
复制代码 d: C) r. t v @. a+ [
& a) @/ v9 Q% q" v+ t* {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- h$ F- y$ V) j8 P! o4 ~4 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% V! A7 r2 Y2 x4 j7 B1 a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' x1 E* j1 _- _" ?' V
& }6 m: [! j- V+ l; @3 S" F5 ^2 U& Y7 I6 ~1 j: I- N" \
|
|