|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # K9 I' Y. m( \8 g, {
- [code]EDMA sample test application& \, e9 H3 R1 |3 F, S% [
- /*
% `5 F% L7 C2 Y9 \ - * edma_test.c: @! ^# m; q, r w$ v
- *3 h. g1 y0 Y: R# i( G
- * brief EDMA3 Test Application/ O/ m& }1 }9 X; g- t5 X; {
- *
; J0 P0 s) {6 i- m - * This file contains EDMA3 Test code.
, J6 |" }0 E8 J. J. k" f8 ]' j1 v" g - *. Y% G! n$ Z9 ]3 ?: Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 h: F6 a+ I! s6 r9 I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, S \5 L1 B/ e$ x - * TO CHANGE.' s, x- A+ G" v) ]1 Y& H' H
- *
. [4 Q% W( g6 j U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 n) L. O8 f1 U5 d* m9 k8 f7 y! P - *6 n7 d |' g& t u) G
- * This program is free software; you can redistribute it and/or$ n. d: J0 @+ ^8 r. b6 b- N; z
- * modify it under the terms of the GNU General Public License as: U4 |) D# y1 g
- * published by the Free Software Foundation version 2.0 N5 A+ v j! X8 {: m0 |' y5 [
- *+ `7 u" t) C: |2 \. `# N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 a: o3 Q7 k1 _( i6 O7 W1 [. U
- * kind, whether express or implied; without even the implied warranty# E6 n2 i/ `& @ t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 f" t Y9 C1 ?. J/ L( W6 K V - * GNU General Public License for more details.
2 I% d" z8 C. W! H2 ~ - */, {4 C5 A9 `8 b/ s/ M, Q
9 j1 p( L" T/ n8 C& n- #include <linux/module.h>' l F9 b4 W. p% j0 Y
- #include <linux/init.h>
1 w/ p! M$ R) g. Q9 [& g - #include <linux/errno.h>
2 O& }7 ~# |" g/ ~7 ^4 h. ^3 l - #include <linux/types.h>
7 Q) U$ \. K" F - #include <linux/interrupt.h>
" C1 w2 F P4 [7 \8 Z1 b, o - #include <asm/io.h>5 s" ]" t2 m* T6 m/ A! u0 Z( P4 h! E
- #include <linux/moduleparam.h>3 v J6 P$ u6 E! ]( h
- #include <linux/sysctl.h>
3 m0 V" {( Q1 b" A0 n, R - #include <linux/mm.h>
! f0 ?1 b7 a" w+ v7 I0 Z - #include <linux/dma-mapping.h>
8 D! G/ v) F2 S2 A6 ^- r - 9 s' U) U6 s6 N
- #include <mach/memory.h>
}2 L- h0 U$ E& j - #include <mach/hardware.h>
' l. i( [5 i. @6 ]" J0 D - #include <mach/irqs.h>8 u- G7 I' ^- ~! B4 R+ |
- #include <asm/hardware/edma.h>, U% Y% C2 s1 ~8 D* y0 E1 V9 ]
& X9 l' C- H* v$ t- #undef EDMA3_DEBUG1 k4 t7 p! [+ ]) w* w
- /*#define EDMA3_DEBUG*/, G, ^% W7 H4 k+ t
( w6 Z; z a3 f+ Y& Q _- #ifdef EDMA3_DEBUG
& I7 V& V! J6 g$ l# Q5 W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# I. h" A& t! L) S6 }; Y1 M) |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! l6 E. m8 E' }* v. u# e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 R7 C: B( k6 h7 T
- #else
6 X$ } R. X( c X3 Q+ X, Z1 p- l - #define DMA_PRINTK( x... )
/ \, ]1 x6 @% r1 G - #define DMA_FN_IN
' Z. o+ G8 q h" | - #define DMA_FN_OUT
% s4 _! F0 h5 f$ J7 }- D - #endif2 \/ v' D. s$ s( Z6 K$ j% `
( V) }( }6 l& F* n( Z4 Q) n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) B9 L* B& _' @' z - #define STATIC_SHIFT 31 }$ i+ j- @1 y; ^3 K" j
- #define TCINTEN_SHIFT 20 j* n& E2 c0 G! f
- #define ITCINTEN_SHIFT 21
- h9 ] G% l7 D8 y1 N/ |$ y - #define TCCHEN_SHIFT 227 ?* z' x2 V3 L9 C
- #define ITCCHEN_SHIFT 238 v: N1 ?9 Z) p6 E+ K( K
- ( o) s% F. c. W& ?
- static volatile int irqraised1 = 0;
* W% ~3 x- \% {. }- Y: B - static volatile int irqraised2 = 0;
$ P8 M/ `0 V6 r1 N" P: }) ~- y
2 Z' D& L8 R# U: k+ y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); N7 A+ P7 L% ?, V0 _, l, X( ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 j( q2 s3 K+ Z( z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 S0 u3 z' H8 v6 j
8 K3 n/ x! _! ~' G' W- dma_addr_t dmaphyssrc1 = 0;3 H6 `+ `# A4 `# \! J: u
- dma_addr_t dmaphyssrc2 = 0;
$ D0 C: F; p* Y: Q - dma_addr_t dmaphysdest1 = 0;' L' N1 H: u1 n: A) \6 G: N
- dma_addr_t dmaphysdest2 = 0;
4 d% C' t9 E9 B) E2 g& ?: k - / H' F& m5 O3 f0 t5 h0 W
- char *dmabufsrc1 = NULL;) _! }: Q2 n$ i4 s4 y( N
- char *dmabufsrc2 = NULL;
9 d+ y) ?; r: O0 z7 o2 S. R - char *dmabufdest1 = NULL;1 z7 u, g, d2 {+ z5 S
- char *dmabufdest2 = NULL;
7 M7 x" t9 `3 u( S! v
& }$ v3 y1 j9 e& k" ]" _: q# l4 I- static int acnt = 512;# Q2 S0 X8 k- a& J
- static int bcnt = 8;0 i9 ?9 B" l( x% v
- static int ccnt = 8;
7 g* `( L$ v+ }" `: q - * z9 w8 r" O/ C: @0 ?
- module_param(acnt, int, S_IRUGO);1 `& F( m6 E# s. o' e
- module_param(bcnt, int, S_IRUGO);
" C5 {0 k6 `! h% l ] - module_param(ccnt, int, S_IRUGO);
复制代码 ) E$ R; P! s. e: i; ~8 p. R8 Q& ^
$ N$ l) T0 V; _) \+ v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 \, @: B9 c; J4 P2 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 D8 L) b. r0 i, P0 v- S w9 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ~7 Z6 D G" F0 ]5 U
; u5 ] A& _6 R6 d _) R
4 W3 w' T: l8 Q' j7 y. i |
|