|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 ^: E+ i" t7 E( w" M R& G- [code]EDMA sample test application% A* K# s+ ^+ l% S
- /*. F5 r# z5 |" T
- * edma_test.c# A6 k+ z/ \' q% P& B; E
- */ G ~8 y& i2 t. M
- * brief EDMA3 Test Application1 Q- Y/ \: K9 Y! E. v
- *
, ]" ~) e) v5 j# S; |6 H - * This file contains EDMA3 Test code.2 m9 _" k; [8 C0 \% l7 B
- */ g2 k9 k: G3 D1 D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% M0 [7 W( k! p5 p; J. j5 y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& z2 l+ _6 ?$ A; { - * TO CHANGE.
3 m3 h1 [$ S& ? {% d/ D% w - *& v8 s: N. h+ ^+ |" ^) i) V1 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 j( [3 t1 V% a
- ** i3 B8 K: S4 k3 j2 F
- * This program is free software; you can redistribute it and/or
+ K& r8 l% X. D6 c) E3 v+ i - * modify it under the terms of the GNU General Public License as
X% W! A. \* Y9 @ - * published by the Free Software Foundation version 2.+ X9 q+ w( C6 q3 u* [
- *# b7 V: W( @5 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: S& G6 |# U5 o" O$ l
- * kind, whether express or implied; without even the implied warranty5 N; R+ k! w( J7 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# V Q) Q# @+ S$ M& @
- * GNU General Public License for more details.
' t# p! P& d+ ]. w6 V* M - */, X; M3 A" Q* F* A' B
* }" \ _9 k2 ~5 N- #include <linux/module.h>7 I, q' M% l3 B+ K& T4 @
- #include <linux/init.h>
' P" f d/ |' N5 T - #include <linux/errno.h>
+ _) t$ T$ N8 H% M3 a7 g - #include <linux/types.h>
) K/ Q0 I8 U9 r) U - #include <linux/interrupt.h>3 q4 z: z g! ~. M+ N9 v; h/ [# H
- #include <asm/io.h>4 c( l8 X) ~( C- S% _4 [7 d( N! s
- #include <linux/moduleparam.h>
5 e, C5 b& s# w& u% B! M( } - #include <linux/sysctl.h>
! {5 @* v( E. O& t; z1 n3 J - #include <linux/mm.h>& A: A0 A# g2 l. w: v/ {4 Y1 m$ ?
- #include <linux/dma-mapping.h>
1 z4 N- D6 f: C - 4 M% b; a1 l) a6 X# h0 [5 e
- #include <mach/memory.h>
% B9 ]6 I7 r- R. ` C) `/ m1 r - #include <mach/hardware.h>1 }' P% B' m5 c! K) d5 l, g2 T
- #include <mach/irqs.h>
1 @8 T- d( ]2 X7 @" f6 H7 T0 Z# @ - #include <asm/hardware/edma.h>% A0 S& x. {9 g. d
: n/ `6 p T, v2 x5 j+ H1 {' C* }- #undef EDMA3_DEBUG: U0 J# u. i0 U4 l+ R+ F) C
- /*#define EDMA3_DEBUG*/
. Z* v6 a) e' t( ~2 p, x4 Y& d - * q. ~3 {, [9 N0 Y, D
- #ifdef EDMA3_DEBUG/ i5 U y. z1 d) s" G8 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) s" ?0 u- D8 h) }2 w2 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 @2 t' R0 E9 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% q" w4 {5 }7 e$ t {( V; f% q
- #else- g9 E$ y# D: ^( ~' H3 [) g
- #define DMA_PRINTK( x... )% k$ M' C8 j( _/ N' {4 u3 N( ^
- #define DMA_FN_IN' g n( m2 l+ v
- #define DMA_FN_OUT
. d& y9 W. |) ]5 H - #endif
$ c8 Y* }9 p; p
; _; c/ U" x$ R3 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 ~" [7 b/ \6 ?
- #define STATIC_SHIFT 3
, W0 Y; \9 x$ Z) b% x2 b9 Z - #define TCINTEN_SHIFT 20
* y% T- `7 ~& T: s - #define ITCINTEN_SHIFT 21
( f% K7 S2 r) e' B0 g. G4 V6 n - #define TCCHEN_SHIFT 22
, V Y" R+ M5 b0 l9 ^ - #define ITCCHEN_SHIFT 23
: P: Z4 U) g3 W8 x3 U2 J
- e2 `3 T0 C) U- static volatile int irqraised1 = 0;
A. d" q. G4 k- l" O - static volatile int irqraised2 = 0;6 L. H4 u+ a# Z Q
- 0 T* e' x% t9 J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) u [8 v0 Y) b/ A5 C9 Y$ ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: o9 {7 Q3 m1 k6 H0 W9 S- H) G+ J. D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 g4 G2 S2 T# Y$ P3 e* V
7 d1 [* N$ U) n5 h- dma_addr_t dmaphyssrc1 = 0;) \, k F5 r& E) A* W& d- U' P
- dma_addr_t dmaphyssrc2 = 0;
k) W- }( S* k - dma_addr_t dmaphysdest1 = 0;) |: q- z$ x& ?+ V" Z' M( ]
- dma_addr_t dmaphysdest2 = 0;
% c0 U; v6 C8 k
+ L+ D! e/ M1 [3 O' D* |- char *dmabufsrc1 = NULL;
/ N1 o, R9 ]+ L' M - char *dmabufsrc2 = NULL;8 u7 o' F/ _5 T; E
- char *dmabufdest1 = NULL;
' x+ k" O- [7 a `$ [, w( G: H" I - char *dmabufdest2 = NULL;+ [/ I& S2 i0 k- A* s! J
' _; }, p" n7 ^$ F3 N- static int acnt = 512;
6 a9 u" m z4 s4 y - static int bcnt = 8;& g4 k9 e, `: _" [: l' |" f) s
- static int ccnt = 8;
/ u) K4 u! p0 _9 R# i, o - & d0 Z& i6 s& f0 B! T2 @1 E
- module_param(acnt, int, S_IRUGO);, }/ U7 }3 f" L' o5 W/ {4 G
- module_param(bcnt, int, S_IRUGO);
N' A) L) G+ y" F# H - module_param(ccnt, int, S_IRUGO);
复制代码
$ g- }% L5 I# q4 z' M: b& I6 n9 F# `9 `
( [: r% M7 `3 v7 R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ f& L9 ]. X7 ]3 U: k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; n7 Z0 U9 R; A6 a0 t' E( T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 Q. \8 v" P, x
9 @+ v0 B3 ^' y6 } z2 L, P# x2 ~2 s
9 ?2 Z1 |8 o7 U4 n& j" f4 x
|
|