|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* } g% G7 Y5 L: J! y v- [code]EDMA sample test application( M6 i2 ?5 ]/ [* U
- /*1 p5 S3 n) j9 M) m4 R# t+ C6 [
- * edma_test.c
+ D0 V7 B/ y/ w$ E - *
H: P; j5 S' J$ L8 P - * brief EDMA3 Test Application$ v8 v/ b9 N& w! f2 I6 S
- *$ J' a1 P4 |: o- P% n w: j
- * This file contains EDMA3 Test code.
9 F% h1 J G' x& u4 T0 b - *
1 P# d! _- R1 t+ x- e/ _' Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- H" V- c& y# ]6 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# \' h$ C( b* p0 `( T/ x) z
- * TO CHANGE.
5 p8 e7 o+ P+ X* d - *) k4 f) _. e7 [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. e8 g: P0 t- f: S: k' R7 m
- *
4 g7 T8 i; a" u0 W - * This program is free software; you can redistribute it and/or6 `1 r8 m5 |) a$ S; t9 ?1 e' I
- * modify it under the terms of the GNU General Public License as
6 S+ M- y+ r4 O% g" U; ]9 I - * published by the Free Software Foundation version 2.
$ ?) k; g- @# s5 y - *- F! N- O/ _: l- c1 _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) Y: P3 Q6 j% `& n8 c
- * kind, whether express or implied; without even the implied warranty3 Q- W! {( ]; a1 J# D: d$ {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 n- }& C% @$ t O
- * GNU General Public License for more details.
2 f7 D; e' i4 C+ j* h - */6 `0 [) d3 K$ n% i. U' K
: z; c3 _/ q" K0 n# C- #include <linux/module.h>
3 `' g0 L6 x: E - #include <linux/init.h>! H. v6 h6 b2 C' i! |7 v
- #include <linux/errno.h>* ~ `- P3 l" ~2 D) o
- #include <linux/types.h>
; G. E5 q9 L. c$ o: m! C' _# a5 ` m - #include <linux/interrupt.h>
* {, T# l& v! ?1 b) ~9 L: ~) j+ Y - #include <asm/io.h>. K; P4 [$ r9 ~; w) u( N+ W* N& S6 C
- #include <linux/moduleparam.h>
! c" V! U5 Q) E8 P: `3 m - #include <linux/sysctl.h>5 ]4 t2 r1 V0 E1 e5 c5 U
- #include <linux/mm.h>
. B6 Z/ ^* S' s; C - #include <linux/dma-mapping.h>
+ m* ?% [! g+ L. f
% V) V; ~ h/ J- #include <mach/memory.h>
" x7 W+ F M% p$ r/ { - #include <mach/hardware.h>
( h U; l7 Y2 i# l' E; ^$ o5 S - #include <mach/irqs.h>- U5 D1 m6 `$ W6 ^ W6 u
- #include <asm/hardware/edma.h>
! Q9 G- L+ T) \
8 ]2 c& k6 R" T- #undef EDMA3_DEBUG. `( T8 b8 @* P8 j$ b/ X
- /*#define EDMA3_DEBUG*/8 g/ m; L+ _+ R' M
- ) W- {9 M/ K8 }7 J. d
- #ifdef EDMA3_DEBUG+ A2 [ E- ]- g" \ d9 x9 D. x$ c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! S0 T) _1 ~* h+ |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 e5 i/ O, Q: Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 O! i/ `$ p- m+ [ - #else
0 W! ]4 H9 L* W( A" B3 D8 ` - #define DMA_PRINTK( x... )
d2 {1 t& B( o! p$ e* Q+ ~, S6 I, t - #define DMA_FN_IN
1 B* q5 I. \/ f! f7 u& `0 E - #define DMA_FN_OUT D: X1 J z; S; a( F! [( R9 o
- #endif
1 r( W: T) ?* r9 S
) d2 d$ a+ j% {/ L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" K5 `& ~$ d) V* A - #define STATIC_SHIFT 3
# O7 g$ ?6 {. ?( D - #define TCINTEN_SHIFT 20* |+ q( r6 f6 a: ^+ g ?' r Y
- #define ITCINTEN_SHIFT 21
1 y$ N# Q5 b. H2 q; t! u X: E - #define TCCHEN_SHIFT 22
$ ^$ W) T. H. a* Y - #define ITCCHEN_SHIFT 238 E# U) t" F) E- P% o" T
- 4 w" n' Z( }3 ~
- static volatile int irqraised1 = 0;
4 |7 B- u- W X - static volatile int irqraised2 = 0;
( L+ A8 _" D6 S
; T6 D! C: L2 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l/ _/ ~/ K4 X- t4 J7 Q2 k. |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 c8 a& w. j8 K* \& }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 a. Q6 g. [8 R4 r7 |! \* K
- $ b3 e4 j2 _. g( o8 d
- dma_addr_t dmaphyssrc1 = 0;
# w& u( Q1 `* \1 ~/ R. A - dma_addr_t dmaphyssrc2 = 0;
! Z% J/ P, C3 d1 U5 D - dma_addr_t dmaphysdest1 = 0;
8 y7 I4 y I5 C+ z8 O' d - dma_addr_t dmaphysdest2 = 0;
8 ?6 y( J; ?* i( ~% A - 2 K- ` {% d/ F
- char *dmabufsrc1 = NULL;
0 ]* K4 d% q" s# y( q - char *dmabufsrc2 = NULL;, S0 m8 z0 L5 e* x" x
- char *dmabufdest1 = NULL;
+ I: Z8 ]7 V) k3 n& N& N7 B7 d - char *dmabufdest2 = NULL;
- z! x) V- @. d4 N4 ~ d - . f4 j- U4 L7 d$ ^, }
- static int acnt = 512;
$ I$ A2 \# T, d* a4 } D) q% |2 T - static int bcnt = 8;6 y: {% I V/ {
- static int ccnt = 8;1 O6 u/ `8 X S Y' m4 _* G8 s
- * T: ?9 i, |; T1 y2 P
- module_param(acnt, int, S_IRUGO);# U: N$ z% L$ P( A
- module_param(bcnt, int, S_IRUGO);
% ^0 ~" J9 @: M S. v- m - module_param(ccnt, int, S_IRUGO);
复制代码
3 W+ h. k3 y5 X' P$ A( D) S2 T# b- s9 g: y' e, \: H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 a: ]7 Z0 E; o, ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# C8 j& r. d. i0 K+ |3 y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 v- X0 j: S4 @, O+ h1 b% [
' F' L" ]4 C! U+ T. I* g: U3 g; L
0 C! s$ h2 ]9 L9 E* C |
|