|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 o) p! F$ h( J- [code]EDMA sample test application5 U, u, ^1 V, D0 _9 U( U2 u
- /*/ M8 `# l4 o& a: m5 b: b& c
- * edma_test.c
{* H U- P+ }/ @ - *; O Y2 W6 n& P! i, z5 t( R4 B& w$ W
- * brief EDMA3 Test Application; G+ P5 s5 { ^
- *
- m$ N* @) ]4 E - * This file contains EDMA3 Test code.
9 Y* \- S* [0 H8 T, n+ ? r - *
7 q1 e5 T# Y. h1 k- \2 r4 @. _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; A' w: w# I4 C" [9 v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 @& Y! ~2 w4 a& c" m
- * TO CHANGE.
5 v3 R$ X. G) \& @ - *5 Y! c7 g. d& C" A8 }2 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 i/ U9 s: H! r: z
- *, [0 W' L8 J3 I, @ h
- * This program is free software; you can redistribute it and/or5 N8 p4 B8 {( o H2 W( \' K
- * modify it under the terms of the GNU General Public License as- U- o. @& O% J+ e- t/ D1 I5 c
- * published by the Free Software Foundation version 2. h# D! y f: a5 e K" u
- *- L: a+ V8 f3 A) W5 u, w& { g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. q# G6 s u) P6 _% D1 ~ - * kind, whether express or implied; without even the implied warranty* }+ W! N& K6 L5 O. p" F4 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! p5 {6 m( @ L0 N9 n4 }( M
- * GNU General Public License for more details./ J% r2 x0 D5 T' w, i B/ ]8 X
- */7 n+ t! Q/ m& d% m6 N
# k0 c4 r. ~3 R% z; i- #include <linux/module.h>0 r" C' [; m( Q# ?2 _) u8 H
- #include <linux/init.h>
. s* r; g ]' y* c+ F - #include <linux/errno.h>
p I" x+ s- U/ y2 a - #include <linux/types.h>
6 r9 a: v0 X0 G - #include <linux/interrupt.h>$ q" U# t4 W% G$ r5 s; E
- #include <asm/io.h>
; v8 \4 V' N# s - #include <linux/moduleparam.h>; s9 h- _7 d9 M3 H: c/ e2 p5 e. o* B
- #include <linux/sysctl.h>
7 `0 R6 {' a& F! A6 F - #include <linux/mm.h>
5 @9 k, ] J5 d0 [: d - #include <linux/dma-mapping.h>* k+ Z( Q5 k- m9 @. m* q/ P
- ! U# f' n; ~' T, O. |& U; C
- #include <mach/memory.h>
' b! d& O( f5 {2 Z - #include <mach/hardware.h>
/ @3 R, N4 n8 m - #include <mach/irqs.h>
* [! L+ G q# r! r- r8 F - #include <asm/hardware/edma.h>
( c2 l, q/ |1 B6 n6 I% I; ] - 0 w" F9 ?7 P, @' I2 }
- #undef EDMA3_DEBUG
% P) ^0 a. }7 {+ y - /*#define EDMA3_DEBUG*/3 S. ~1 y% ]" G4 T6 B
- # J8 O4 ^% a8 W, @
- #ifdef EDMA3_DEBUG, b: D; A8 ]% d; w- |# E6 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 v$ f) }0 T9 R% G& W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( \3 {% c0 y* \/ A. v- J+ J8 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% N8 s: \2 N% H. R$ _
- #else% q: F0 B! H# E" h" s! O8 s
- #define DMA_PRINTK( x... )$ o; N" C/ Y8 u" O# @' M0 W
- #define DMA_FN_IN
* g: q5 ^1 } V$ R# B, w0 K9 A2 p2 I - #define DMA_FN_OUT
2 B- x3 X- a' Q8 t2 R - #endif2 R( O8 J" B( Y, |- z# N& z
- + V# }# o1 X1 n# S* t. F/ H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 `( c8 b! B7 U: O0 b2 U8 p8 _
- #define STATIC_SHIFT 39 @" w, ^: `: w0 d
- #define TCINTEN_SHIFT 20& n( t4 p0 Q) E! A; M1 p) W
- #define ITCINTEN_SHIFT 21
% u* t7 q2 I/ @9 Y9 p- U6 l - #define TCCHEN_SHIFT 22
- N0 G8 y$ ^8 t3 F b8 w! v. N! I - #define ITCCHEN_SHIFT 23
: @. ^% g$ N4 R w - 5 N3 u$ Y0 ?/ N; A0 p) T% [- [
- static volatile int irqraised1 = 0;
- p$ s* c+ q$ k; M) W" h+ Z - static volatile int irqraised2 = 0;
6 T& L; c* K+ b - ; y' _2 k" x. [8 |! k, ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; F4 V; d: G( B! K$ I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' T; d: Y& O/ e- L8 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: T* ?' K4 z3 v( o; C& j/ J
- ( V( q& N4 W+ [! W2 W
- dma_addr_t dmaphyssrc1 = 0;$ M6 ]1 h+ n/ f6 n/ Z" s' G
- dma_addr_t dmaphyssrc2 = 0;. b6 Y& g+ c6 r4 x
- dma_addr_t dmaphysdest1 = 0;) Z, D3 I8 l* L* K$ Y b( m
- dma_addr_t dmaphysdest2 = 0;
! J8 ?/ f/ S% V
4 H/ s8 w6 ?7 t: t' @8 i- char *dmabufsrc1 = NULL;
3 M$ n3 K+ c8 x) U - char *dmabufsrc2 = NULL;
f( l: f) o I c0 Q u - char *dmabufdest1 = NULL;6 z- ^! D& p+ S" v: d
- char *dmabufdest2 = NULL;) y' ^# A: e E$ f& K
5 F3 I8 e& z3 D1 z4 M; J6 u4 w- static int acnt = 512;' i% |# n: c. w" w
- static int bcnt = 8;
+ G% o6 n6 l5 p* L% z7 _ - static int ccnt = 8;
' ]% ]" l: Q" |) A9 B - 5 H, @) ? i5 J- r$ p
- module_param(acnt, int, S_IRUGO);6 F4 Z) ?4 ^7 |( }$ [" c8 u
- module_param(bcnt, int, S_IRUGO);
: I+ [& z7 r$ T6 t) d* _ - module_param(ccnt, int, S_IRUGO);
复制代码 # J: _# L7 ^6 H) A9 t- u
- k- A) L( e% f0 d& `: l) o% X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, s" R. W5 u$ g7 o1 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& R, b# r- v5 [ Y! b/ i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ]& c* ~& k- b% i# _3 g6 C
4 x1 M5 ~+ i5 x# p9 l6 u. A$ D
?3 z( ?- V0 U" z, N |
|