|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 v8 Q% ?3 L, k$ z4 V& @" i- [code]EDMA sample test application: w8 z9 ]3 d `+ h% [- m- O
- /*
z4 C* o& k5 k) ?: h - * edma_test.c
) n: M: W% ~# [5 V% {) j' m - *: p0 f/ a" Y X M
- * brief EDMA3 Test Application+ n' v- a8 i! d* S
- *3 q( k+ X9 g% ]' [
- * This file contains EDMA3 Test code.+ e5 n, H: A; c0 F
- *8 L, T; r+ W+ l0 S" I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 F$ r' n1 ?5 s: y" h( z, J2 `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% z8 o3 U: M4 h. ? - * TO CHANGE.
2 `5 W2 L& d" B2 m/ `3 @ - *
" Z4 t3 [! K& x. w9 u! a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 g3 L6 Z; ^' E# [& S
- *
5 g& @' b t; |; | - * This program is free software; you can redistribute it and/or V$ k9 v3 F9 l4 s# I
- * modify it under the terms of the GNU General Public License as. o" ~% s5 y* P! P
- * published by the Free Software Foundation version 2.
& m! v6 K! W* y" _ M1 }5 Z - *4 B' ~' C/ M, R# J& T9 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 f6 F0 _/ h' U' m R8 z( @' w' b
- * kind, whether express or implied; without even the implied warranty
8 f+ G& g# d4 i2 B6 P. N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- }/ g# V* \7 f7 v- U0 C% R- g) K - * GNU General Public License for more details.. l0 U4 z: R( X% u$ D0 ]5 b5 ~. M+ D
- */
6 c! Y& `& ~! A/ n
2 I/ Q# u8 c8 f7 ]: `$ ^- #include <linux/module.h>
% A9 v! G! G% s; z - #include <linux/init.h>; ?6 X. [: i( R0 {5 R
- #include <linux/errno.h>8 v9 o8 U: P9 B9 ~) I# }4 K
- #include <linux/types.h>, \* L7 R( y* G( |
- #include <linux/interrupt.h>, a8 g+ `# M) }2 k4 ?
- #include <asm/io.h>
. W! K4 U; Q' `8 S6 a - #include <linux/moduleparam.h>
+ _/ c1 W' m- G {3 x - #include <linux/sysctl.h>7 g/ J+ W8 Q% E6 F
- #include <linux/mm.h>' G9 ?: |' S; s$ G+ g7 p
- #include <linux/dma-mapping.h>
* g- z" t" V8 S" g( }6 t! N
3 p; U% m& a+ }: o2 S" ~7 C7 ]- #include <mach/memory.h>
$ n+ f" d! S. P( l% J& C4 A+ V - #include <mach/hardware.h>9 M( h4 n' R9 j. W) g& z+ f; Y2 y2 S8 c
- #include <mach/irqs.h>2 Q! v) J9 U% j j! p1 |2 F
- #include <asm/hardware/edma.h>1 l) F' W$ _1 e8 }" c+ M
' n. }3 E ?! y0 o! v, r: d- #undef EDMA3_DEBUG
$ |& x& C' x# N" t( m8 ~ - /*#define EDMA3_DEBUG*/7 P: ?+ x" `" N4 ` }/ x
9 V8 u! o1 q1 t- F6 k- #ifdef EDMA3_DEBUG
6 N8 z/ E% X+ Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 G8 @. u0 g' r6 @$ q: G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 \/ m1 c5 v" |2 K; c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), }" G" F3 T3 e8 Z6 E( B
- #else3 t' D# P e2 B' m; S \/ p) C8 S
- #define DMA_PRINTK( x... )* V! H7 M S* k9 g
- #define DMA_FN_IN
# T# t4 l! m- Q# e - #define DMA_FN_OUT. q- c" C: T: s! Q0 R( ^" j
- #endif
- k5 J/ o- m" Q$ V, P7 {- ~2 G1 Z( s% d
) i+ d6 N$ Q3 O* i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, w, m( |( C) ^( L: J8 C - #define STATIC_SHIFT 38 ?5 o" `1 o4 ~- C9 g. }
- #define TCINTEN_SHIFT 20
7 c7 \( K5 j% J" U - #define ITCINTEN_SHIFT 21
# V0 r5 W7 J7 [" K4 [* j - #define TCCHEN_SHIFT 22
( `/ W' [% R" M% \ - #define ITCCHEN_SHIFT 23/ D0 w5 x& ~/ r5 V
- ' Z2 X( c7 P5 V3 k! |& a! V
- static volatile int irqraised1 = 0;
+ W3 _( z5 A" O5 a# E/ c0 d - static volatile int irqraised2 = 0;
C& z" z d4 m: ?
; k$ q( r' |$ b. C: r& B3 J( u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 O1 q$ N% C- ~# q2 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 d* q- J: J; p8 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( }" k8 ~5 z- B q) Q
- 8 H% S3 f) C. L% Z7 b: s
- dma_addr_t dmaphyssrc1 = 0;
- s: T4 c4 T6 y4 Z - dma_addr_t dmaphyssrc2 = 0;* {1 s) Z3 Y$ b! e: Z
- dma_addr_t dmaphysdest1 = 0;
! e2 y( {6 s. g) } - dma_addr_t dmaphysdest2 = 0;
, S: S8 u3 V8 d5 D; A - 0 A, G# m+ H% }
- char *dmabufsrc1 = NULL;; K8 n7 [ L" p& N- ~1 a3 K
- char *dmabufsrc2 = NULL;
% F+ ]9 o0 X. j3 T7 f! ~. X - char *dmabufdest1 = NULL;
: {# g2 w5 i- E5 v - char *dmabufdest2 = NULL; i$ u6 s4 H3 X) p% G6 q& N
" }4 B2 L! x; |+ L# `- static int acnt = 512;
- a! F1 I2 U3 k; e2 c, \5 }) B% e1 }7 ~4 F - static int bcnt = 8;9 V; z( ^3 E1 ]* @" Y9 \9 c$ I- z% O
- static int ccnt = 8;6 _0 b/ N6 U1 U5 u
5 H- @% L2 V* l& I% N- module_param(acnt, int, S_IRUGO);# h* ^" H6 Q3 x) c. j. H' g
- module_param(bcnt, int, S_IRUGO);' v8 o. R L# ~% W* [" T
- module_param(ccnt, int, S_IRUGO);
复制代码 " @) T1 z* M6 N
, r( E/ p" }; y2 l1 V( M/ l* a8 k/ t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 ^9 B- q' x! S' r5 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ E, ?; N" V. s4 n7 a) g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) a; a; |8 d; x( l. _- e3 n/ J1 r: {9 T2 p& P
* f6 Q1 l& y; q# v' ] C1 P |
|