|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 h' c$ D& ]# S; f9 K
- [code]EDMA sample test application
' b' a: O3 g( m, {9 W! r - /*
5 S5 J" M v8 I( ~ - * edma_test.c
; [% R6 h' [" y1 n7 O/ x - *3 j6 P6 h! P# a/ b/ s
- * brief EDMA3 Test Application$ O# q$ N# x; a
- *# V" C, {' B- u b- w3 y
- * This file contains EDMA3 Test code./ M/ w& d' J: T, C Q
- *
/ g9 s. V+ X2 ]) o# E( p7 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; Z* {/ q& i Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 U7 @- @! t; _4 v7 M6 N" U1 R - * TO CHANGE.
$ u2 x* W, `2 l# W, ~ - *+ B$ J) |+ O: K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# m% w% s5 |0 b, o! Z - *. J) Q7 y5 E6 d8 Q+ f! B; M
- * This program is free software; you can redistribute it and/or! v6 ?0 M$ e& l5 P6 ~1 \' v
- * modify it under the terms of the GNU General Public License as: h6 A: G0 ? S. U/ P3 {; y9 d, S
- * published by the Free Software Foundation version 2.! J) w9 h" ]% C# W) z
- *3 r6 ?) ~/ ^1 [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 s; E, X6 h( @7 P4 c
- * kind, whether express or implied; without even the implied warranty; {- x6 o, k# A5 P% g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 \ L* z6 f5 f2 Q( G - * GNU General Public License for more details.2 z* T3 R; S2 }- M0 |2 [
- */) d/ V, _. X0 S! X
: N [; X! o7 K9 a5 `/ @- #include <linux/module.h>6 R! u: p" O4 ^4 r) k2 U
- #include <linux/init.h>
) h. b0 G' Y+ x | - #include <linux/errno.h>
+ N( Q1 [# O& t8 \4 \2 n% z' ~ - #include <linux/types.h>
; |/ w( y) N! G - #include <linux/interrupt.h>, T' Z3 z9 b+ u
- #include <asm/io.h>; S- h$ U3 r" a7 D2 ?) s
- #include <linux/moduleparam.h>
/ t5 }% S7 S4 s0 }; n. G, X# e - #include <linux/sysctl.h>- I. I* f. C4 c' C6 m( p. {
- #include <linux/mm.h>8 w/ [3 B+ g; ~6 _: F
- #include <linux/dma-mapping.h>
/ d0 N" K b7 }) V( V
$ r0 \0 G5 Q. G- #include <mach/memory.h>
6 q6 t. R9 P" U# A- b* z9 J& d - #include <mach/hardware.h>) d8 r$ l9 |5 v) ?7 j
- #include <mach/irqs.h>8 ^) m5 R( }; n
- #include <asm/hardware/edma.h>2 t7 [, u- O+ Y( }
- 4 e, ]- K u/ V( X' I* d5 o2 H
- #undef EDMA3_DEBUG
9 h# d& E7 g$ [5 r8 F$ X - /*#define EDMA3_DEBUG*/5 P# t/ N f2 n
- , V4 |! I% ?2 M9 ?8 i, J
- #ifdef EDMA3_DEBUG% L( v! z9 x. G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 G6 c; F3 ?" Q' D6 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), l/ Y/ _2 Q" N4 I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 P3 c) R; @# }* T% A" D$ ^1 v - #else
+ l9 w& v2 l. `: h, H+ W - #define DMA_PRINTK( x... )1 M9 N) p+ C" I W
- #define DMA_FN_IN
4 p' u- C1 C0 a! ~; q! z! w - #define DMA_FN_OUT7 Q" ]$ q/ p0 \# e) k( M
- #endif" X# {: x9 A& w: S* j1 {) I: n
- , I7 `* e; t3 B) R. E3 u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ P/ O: ?. V2 D+ H B
- #define STATIC_SHIFT 3+ l% }6 e# h7 x3 q1 H6 K+ D# v( ~
- #define TCINTEN_SHIFT 20
# e' H- O" A' q/ [$ I - #define ITCINTEN_SHIFT 21
2 @; n5 M/ n/ l1 ^, L6 I' T4 _# @ - #define TCCHEN_SHIFT 22
/ y8 c/ c8 _5 Q' M$ m6 ~ - #define ITCCHEN_SHIFT 23
0 K; t: H. Y+ _& j% l5 e% m - & e/ C6 l: Q# y- m! i$ b/ G- e
- static volatile int irqraised1 = 0;
' m$ d; Q% b% J9 e - static volatile int irqraised2 = 0;9 S4 x1 ~9 q: O/ t" l
% z; M+ O4 d4 M* I$ ^6 s' w9 Q0 S; w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" K0 _3 |. K+ D# G8 b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 q- v- z: W4 s+ j9 @" P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: y. c* u/ b# G! \& v; k! r& S
7 }1 `2 k0 @- s- dma_addr_t dmaphyssrc1 = 0;% P1 k9 V! @$ h/ h4 l6 n
- dma_addr_t dmaphyssrc2 = 0;8 m+ n* W( b+ L& C
- dma_addr_t dmaphysdest1 = 0;
$ r& r, J& d3 d8 P - dma_addr_t dmaphysdest2 = 0;- e! U' o) P- ?- E% s. T
- * g$ B6 n+ _+ S' i: \
- char *dmabufsrc1 = NULL;- r& h2 V- b- Z9 m4 H# h" ~
- char *dmabufsrc2 = NULL;) S, G# M& s! b2 F
- char *dmabufdest1 = NULL;- m# y3 A) U% N; q& U. _) d
- char *dmabufdest2 = NULL;
/ g6 k" j Q1 C- V1 D
! L; K* L* p6 U$ {# {- static int acnt = 512;
6 y' [( w' l7 M: Y9 e0 f; t6 o - static int bcnt = 8;5 U9 Q0 U+ R1 w, o
- static int ccnt = 8;
4 I+ X b' W/ L" `
, p: y6 Q% T) i( f4 l# w. i- module_param(acnt, int, S_IRUGO);
$ R, F+ T Z+ d; P+ } - module_param(bcnt, int, S_IRUGO);
( _. O% ?1 n7 z- ]$ [: [, ] - module_param(ccnt, int, S_IRUGO);
复制代码 : q3 `. v: w! X9 K4 Q: `! J
7 C( ^; M% o( i6 ?% _0 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& D, J9 a: u9 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 ], o; v# c6 R$ x9 E: z' w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 L B3 t, p9 m4 n( |0 E- }, Q
& Z# Y9 ~) S! l+ N
' s! Z, i( L! l& ~% j |
|