|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 z; @; w- i- \4 [
- [code]EDMA sample test application, N- t+ r- j$ R7 d; j
- /*
/ n. W( y& D. P9 m: x! S - * edma_test.c( d7 F) X) D/ A# Q+ j
- *
% Y9 @# e" d* d* B. P - * brief EDMA3 Test Application
2 B6 M0 _" y3 u! u" ^% p - *
6 A1 Y4 c7 K k$ p - * This file contains EDMA3 Test code.- W) p( P5 T6 X* X
- *
0 q% `8 F" t" G4 n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ l6 J" A2 a, r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 R2 V( U2 s: F% m; z - * TO CHANGE.4 G9 Y7 g P1 n5 N( H6 \% X3 W: f
- *
1 t7 ~# k( d) e: U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& v; s: c7 L5 A( G" l
- *
1 f4 r O2 Q6 e( n/ L% e+ v: v - * This program is free software; you can redistribute it and/or
& u# f: ~4 [3 z8 X0 i' w% M - * modify it under the terms of the GNU General Public License as; C8 U( q+ J0 l2 W" }1 s
- * published by the Free Software Foundation version 2.
. O6 a2 o$ \. Q9 F3 F+ Y6 K; G/ Z - *3 y5 ^3 f( y$ r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 i8 a2 @* x7 r3 \% J H5 u - * kind, whether express or implied; without even the implied warranty4 _0 |; M; n' \/ I. ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ b2 b* t$ b3 I, v
- * GNU General Public License for more details.' L% @$ @ c- x+ Y: T( l: }/ G
- */
0 Z8 \, h/ Z, P( z - ) l) x/ J1 k6 ?$ f" Q& c
- #include <linux/module.h>
4 H! k4 z E" P. G9 k) w% p - #include <linux/init.h>* w2 i3 J, h; g3 v+ X$ Q1 K
- #include <linux/errno.h>
7 g8 S |# _& J# }( ` - #include <linux/types.h>- T9 f6 q* L) C) b8 ~1 \, E
- #include <linux/interrupt.h>
; O3 c. C0 k8 l/ E0 |& m - #include <asm/io.h>
5 l# [1 S5 J9 P* U M' B0 V - #include <linux/moduleparam.h>
4 K% ^! x+ m$ {) I - #include <linux/sysctl.h>
) i/ H5 v: Q# A - #include <linux/mm.h>$ k) s# u) _! a) R7 v+ R0 ?
- #include <linux/dma-mapping.h>: c: T, i, G0 a& S
: @5 T% P# j( E7 R. V- [- #include <mach/memory.h>
8 g4 c# I- Z' c) | - #include <mach/hardware.h>5 R- x* w% i0 h
- #include <mach/irqs.h>1 k" ?* @- E% w, {& d$ W
- #include <asm/hardware/edma.h>
! T; W" H: C" E* c( v
7 _9 G/ T; X) O3 Q, ?- #undef EDMA3_DEBUG
3 s4 F2 @0 o' P0 c7 b - /*#define EDMA3_DEBUG*/5 f% c5 v1 `% A1 {" K( E
- ( o G4 s0 ?, }6 _2 @+ D, C' e1 U" c9 G
- #ifdef EDMA3_DEBUG% L4 Q% L9 q |5 a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# R8 ^! h! l4 ~" M+ N4 L) @+ B. s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); r- l6 G, G: F4 |! _) t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) K6 r$ Z" A( V - #else* M0 ~- W/ G% H
- #define DMA_PRINTK( x... )2 C6 ^( l) d/ Y/ `: a
- #define DMA_FN_IN6 W" Q. g( `& M% s
- #define DMA_FN_OUT
7 l+ n4 q( _4 w: P0 w3 C) r - #endif
6 P. P. w0 C1 ? U: |
) g. _/ I. |: }4 y$ A; a, f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; }" T1 q- f5 |6 C2 ] - #define STATIC_SHIFT 3
( i" P" C% f! u8 K' m8 g - #define TCINTEN_SHIFT 20
" _" g/ z1 }* m! @& Y - #define ITCINTEN_SHIFT 217 ` p! {0 W$ A
- #define TCCHEN_SHIFT 222 ?6 _; c% {* P; v4 J/ R1 e* `9 y
- #define ITCCHEN_SHIFT 23! q; K, `# P" s7 G/ N6 F
: C7 a! n. U1 E6 C0 |5 o- static volatile int irqraised1 = 0;
, S! F: b# U E- H( ]% M - static volatile int irqraised2 = 0;, F* t/ {$ O, X9 ~, Z% P6 Y5 Q3 M- A3 D' v
3 @ W" I* I/ G# h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' r Z6 F& f; c3 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 k) n2 E, T, T, h, O& y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 b( {4 O' [; w) K0 t
% F- g2 H# x" u* _. ?- dma_addr_t dmaphyssrc1 = 0;
U0 }; l" H& |! }3 x - dma_addr_t dmaphyssrc2 = 0;9 q/ F. t5 P% J4 u% C3 ~$ r
- dma_addr_t dmaphysdest1 = 0;* z3 ?, w# d. h" X5 d
- dma_addr_t dmaphysdest2 = 0;: u* H$ ?# l z% Z9 K
9 j! a$ b: Y/ K( s* r+ z) n! |8 K- char *dmabufsrc1 = NULL;
& ~/ N3 A I$ A4 g - char *dmabufsrc2 = NULL;
- I% z8 p' [* N& D3 e! [% ~ - char *dmabufdest1 = NULL;) t& V' U; G! F" }% S
- char *dmabufdest2 = NULL;! P: j8 {0 G7 j6 L
9 v! B* o3 [, O8 v; I4 D- static int acnt = 512;
& v$ [! q: h: F+ _ - static int bcnt = 8;
+ [+ m) u# r c8 z: q - static int ccnt = 8;' d. j& n5 M* g7 d2 ?& I
2 E* D) i" o9 ]9 o9 q7 _- module_param(acnt, int, S_IRUGO);4 ~* y' \6 ~& Q3 M
- module_param(bcnt, int, S_IRUGO);* @6 s3 m# q3 z m
- module_param(ccnt, int, S_IRUGO);
复制代码
+ \' ]2 C2 f7 H0 N1 Y' |. F- A1 b4 f: d) P9 i& F3 v0 {" B& w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 F. D6 ^: ?/ x' q( X6 e4 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 }- d2 n* Y6 ^5 K2 _, p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& d$ \! B5 z& S- x H: U8 d
@1 I2 [: d! a0 [3 h$ f9 e5 D: D( Z9 u: [. c9 m, s" g7 L& c- V! S4 l
|
|