|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 s! V7 P) d+ S- P, y; U
- [code]EDMA sample test application+ D) v; T. X2 @& @
- /*. {8 Z3 O4 \0 t A, {
- * edma_test.c/ B& M7 C9 K, S
- *, J1 B& N. @; P9 \- [1 R
- * brief EDMA3 Test Application
3 H( B- E4 ?7 S* _' _7 e3 F9 r - *; f7 p4 Z J Y
- * This file contains EDMA3 Test code.
6 {# ]: W i$ E% _/ @3 Z - *, U- D$ R. x8 z; v! I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 \& i9 o& M- \( U9 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 r4 C9 c6 q: i! n! y - * TO CHANGE.- ^. \/ _7 t2 _5 o, c- M7 w
- *# J$ f6 D' D4 i5 g P3 Z9 x( E- I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; r) G8 Z: W9 T6 C
- *( ?; `# p. k/ @
- * This program is free software; you can redistribute it and/or
) v& k/ D% n4 T6 u# o# ^ - * modify it under the terms of the GNU General Public License as1 u4 z; M+ j) }# v
- * published by the Free Software Foundation version 2.
0 u6 m( y1 \6 I1 @) R: r1 d - *
/ C, ]' ?- r4 f: d0 a7 g( x ^% }" Y$ R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 s+ y, ^7 v. V# p! x# V; c8 g
- * kind, whether express or implied; without even the implied warranty
i& ]5 M# K. Z n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 {8 V5 v& Y" }7 ]5 ?7 ^% Y8 M# } - * GNU General Public License for more details.) ], d6 h) v+ T9 h
- */" H7 b! T3 N+ K2 l0 A+ X
9 x/ _# o/ a+ l# t- #include <linux/module.h>! |3 @! R( U9 C: b
- #include <linux/init.h>9 ] Z# d- d6 r9 @7 e, _
- #include <linux/errno.h>
% o) S8 V# ]2 ]9 M: j - #include <linux/types.h>
5 A1 P% Z4 b+ h* E& i% w6 M6 w - #include <linux/interrupt.h>
5 v5 q ]( {8 _# c. j/ h8 @ - #include <asm/io.h>/ z+ L l- m( X
- #include <linux/moduleparam.h>: A9 L3 {: W* h% X
- #include <linux/sysctl.h>6 J+ Z2 z X8 c
- #include <linux/mm.h>
1 l& }. ~5 L5 ~5 g - #include <linux/dma-mapping.h>
; {/ E, T) e2 a3 s! k2 `$ r: t# i# N - ) q( M: E" \: Q; M* H9 T; n
- #include <mach/memory.h>
. ~& c+ e5 F, C( X) S. x - #include <mach/hardware.h>
+ ^" e% u+ u$ E6 k - #include <mach/irqs.h>2 a8 E: v. g7 i. G5 T2 y5 g; b3 f7 G
- #include <asm/hardware/edma.h>, }, e6 R/ O$ c# F
1 v$ c& P/ X1 g- #undef EDMA3_DEBUG0 b# ^4 b4 V+ t/ w% |4 |, y
- /*#define EDMA3_DEBUG*/4 }- w4 X) _3 ]% F9 P+ [
4 M4 ?' l$ w- D9 b5 W1 l- #ifdef EDMA3_DEBUG
5 r9 I; K6 s& B" C: I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" t1 k- h* \/ D! e0 B6 S& L7 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 [* {/ a9 ^9 N3 m" Y( }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 b- ~, G# W7 ? k/ Y. J, r% E
- #else- f% `0 }4 u6 c# b; j/ {
- #define DMA_PRINTK( x... )! y M+ a$ M. e3 I9 K% Q
- #define DMA_FN_IN0 ^) |% p/ O$ I' h2 }/ }" T
- #define DMA_FN_OUT9 b8 }7 P$ O" y. [
- #endif: \9 a. h' E, u# }3 h
# j0 }" ~& ]( V& N/ D; l( o% ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 X5 K6 ^. w7 b% a# _
- #define STATIC_SHIFT 3
% p% H1 v: n! Q+ s* s, _6 V0 \ - #define TCINTEN_SHIFT 20
5 w& N: W. M7 J7 s - #define ITCINTEN_SHIFT 21& y4 j/ b. b z q' k+ V
- #define TCCHEN_SHIFT 22 M; }. U% X ^) a, j& [
- #define ITCCHEN_SHIFT 23
2 ]) q4 `- |4 _4 g9 }
7 k" j/ |* u F; p" m- static volatile int irqraised1 = 0;$ [/ B' }! L+ P0 q9 O" P( W
- static volatile int irqraised2 = 0;
2 ]) a7 N2 `# d a d9 F8 {! z4 x$ }
: I" ^) y( h% ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Y. p ~ r+ l, D0 G! W+ h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 n; d) p% Q. ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& f# o+ z% Q1 R8 t n9 Z8 _
- 8 S: t2 C0 N W" G4 \
- dma_addr_t dmaphyssrc1 = 0;
6 U! n1 P* _ D" W9 j% H" i; Y" E - dma_addr_t dmaphyssrc2 = 0;8 m( R. ~ D7 @" h/ r
- dma_addr_t dmaphysdest1 = 0;% J7 z' k4 g! J1 G+ |2 A) o
- dma_addr_t dmaphysdest2 = 0;3 |, Z8 h0 H0 s' n6 a4 x- X9 S. ^
: z. T7 T0 d# o. s- char *dmabufsrc1 = NULL;2 e9 W5 T6 M5 ~% Q+ W9 a
- char *dmabufsrc2 = NULL;/ K0 ?8 b8 T9 ]; h h# ]. ?
- char *dmabufdest1 = NULL;
3 h7 N1 t6 L+ _: T - char *dmabufdest2 = NULL;* `; k5 y. [& w/ `# l% N9 q+ G
- 1 |" ]1 }+ ^. A |) Q# F
- static int acnt = 512;
1 A- `1 j# ^& f7 |" v6 g - static int bcnt = 8;' q/ P. d1 Q$ t$ Q9 p
- static int ccnt = 8;& s0 R$ x( w5 R4 h" ^( @' W
2 w }) k+ V7 F O9 K- module_param(acnt, int, S_IRUGO);5 W/ a9 u6 w" v8 W: s2 |6 Y; F4 D
- module_param(bcnt, int, S_IRUGO);
2 R% J3 M, a4 ~+ N/ G - module_param(ccnt, int, S_IRUGO);
复制代码
6 i {) t# ^! T
7 O4 A, a# n0 c; x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ]' o$ b: l6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ P5 X# z3 }! c4 A1 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; W$ W8 J2 U4 r5 g
& x# L! W& {8 X+ I2 W, i( G% T2 n2 i( s% |( U. Q
|
|