|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : t* C9 `: k% Y3 O5 H( l
- [code]EDMA sample test application# {* |! b5 |9 O3 |
- /*
; x* K/ q0 b5 ]$ R: p. d - * edma_test.c
`3 q) X- f2 a - *
* \1 Q: M9 ?& ^/ F5 | - * brief EDMA3 Test Application E' a! W7 P- y6 ?
- *6 ^, ?& j/ h" V5 D
- * This file contains EDMA3 Test code.% t5 q$ g# W8 Y! @ D) ^
- *
5 S7 [# D! \6 h' O8 a1 }: \1 Y- D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 S0 Z* p7 o. [+ N7 p4 |- f$ ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 Y7 m. a8 ?. n8 b - * TO CHANGE.
( C# W3 X1 K# ^# q Y4 Q- s$ | - *7 S4 B1 b, B! s: c; z1 P" o3 ]( T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, s. o; U8 H3 x$ ^" G A! C2 d
- *
1 d( U1 O/ m9 [: P% x- \2 { - * This program is free software; you can redistribute it and/or
. ~ n/ m5 P% {/ a" ` - * modify it under the terms of the GNU General Public License as, J3 x! G2 G4 C% @" B, Q* Q) D
- * published by the Free Software Foundation version 2.* ?( w2 A h) H1 `: Z. R6 G1 r" ^
- *2 X3 F f1 j* |# N+ ] j9 A' h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ ~% a8 E3 w% i# d
- * kind, whether express or implied; without even the implied warranty
6 {; R o, N: U( V( F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" P, y9 A$ a- s! N' t/ B3 k2 N. g
- * GNU General Public License for more details.1 C6 ]+ C: b, R# ^; u
- */3 n3 w# q! m1 |% T$ W+ \
: h: J: q, _9 b: v5 K. Z- #include <linux/module.h>7 t3 F- D$ h5 J( J# }% R2 T, y! U
- #include <linux/init.h>
$ }+ H- B# u& u7 e' D; D - #include <linux/errno.h>5 {% I- H2 h2 {6 I
- #include <linux/types.h>
1 I* \6 D0 r' L1 M8 S, R - #include <linux/interrupt.h>0 W: i4 p4 o* n
- #include <asm/io.h>5 p! [/ V, s( q: q" a, {6 _
- #include <linux/moduleparam.h>* }- b2 ^* ]9 A: N; p
- #include <linux/sysctl.h> g3 _# x1 o' W7 |8 L. a. }
- #include <linux/mm.h>
* K2 ?0 W$ K5 F! C- D - #include <linux/dma-mapping.h>
; [. F$ Q+ Q" x1 F i" k0 y F - ) Z& o2 I; E2 ~1 w$ C' b% }
- #include <mach/memory.h>
8 x. z6 Z" @4 _; ~) b3 v - #include <mach/hardware.h>' x+ J ~0 K; n4 q
- #include <mach/irqs.h>9 [$ b3 W* b0 {6 H0 Y8 C& I4 y
- #include <asm/hardware/edma.h>' m9 C! J0 F( S6 B
& Q( g1 e- b! G+ Z) I4 e- #undef EDMA3_DEBUG
# {4 `5 C! c8 r4 X3 W! O$ f5 N - /*#define EDMA3_DEBUG*/
5 P: {" K0 m: G7 p# A
" v9 T, y' R. o4 t6 ^- #ifdef EDMA3_DEBUG* t. k( _* Z2 T: {4 |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ h' Z& H0 l8 n& R" N8 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" Y8 D3 u6 o ?9 O! {) K% I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 }3 K8 O$ X# Q/ j
- #else7 w6 m* \, H1 ~, z
- #define DMA_PRINTK( x... )
: E, x9 U9 R/ u, Z - #define DMA_FN_IN! I! T9 r' C d& d4 m/ V
- #define DMA_FN_OUT
( @" \; x" E! X - #endif5 N/ i- @6 Q9 {6 C: W# T
- V8 j; O8 I. p2 k7 t4 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; \5 r3 H% D2 x9 S& ^: d - #define STATIC_SHIFT 3
( Y2 x( [" v, Z. o, A! C. j - #define TCINTEN_SHIFT 20/ V$ l/ ?" Z' N) w3 e7 W
- #define ITCINTEN_SHIFT 21+ M) c c8 R M
- #define TCCHEN_SHIFT 22* j5 F2 \/ k9 j Y# P2 b& l
- #define ITCCHEN_SHIFT 23; u. `# @0 Y/ `! a8 {" m: F
- 6 L# j$ W0 A! ^) u3 x
- static volatile int irqraised1 = 0;
! t# p) g3 i( Y: E) a - static volatile int irqraised2 = 0;! A& M3 G$ ]0 g
- ! @! ]$ G' @" Y$ ?3 b- J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ^) R) y/ }6 j2 e2 P5 u2 i7 a% ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- t' R3 v( q/ F4 i5 h' _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ^- X: C6 o2 T/ b7 q1 h4 l - 7 N, v6 M# N+ z/ b: O
- dma_addr_t dmaphyssrc1 = 0;& i6 U3 P7 K3 t$ x* x, [
- dma_addr_t dmaphyssrc2 = 0;
2 r' I O% j; |; L& J - dma_addr_t dmaphysdest1 = 0;: I, Z; C/ O/ s: d3 M
- dma_addr_t dmaphysdest2 = 0;- k/ D& L- C: y" [8 F* y
- . h+ A0 y1 G% u1 t8 c, ~; ^
- char *dmabufsrc1 = NULL;0 `; L: T5 E$ d% D
- char *dmabufsrc2 = NULL;
/ V7 e L5 K+ j [# p - char *dmabufdest1 = NULL;
F6 o! Q. \9 _9 w - char *dmabufdest2 = NULL;/ S! J/ ?& W7 x$ z4 g' L o
+ k. \$ l% T6 D4 v4 C0 Y- static int acnt = 512;
$ l& X3 ?5 W+ q& s% R% X6 [4 @$ L - static int bcnt = 8;" H; p7 n" ]9 s j8 g8 F
- static int ccnt = 8;- ]: g1 H8 {% G
/ z u- E' }# Y- module_param(acnt, int, S_IRUGO);
5 V9 U: j7 A+ N0 a$ M: y! L% o6 t6 u) V - module_param(bcnt, int, S_IRUGO);
9 T# X( x7 f2 Z0 w) e% ^ - module_param(ccnt, int, S_IRUGO);
复制代码
6 `2 `0 y) G2 z3 i, k5 `$ L% m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! [9 C4 O+ a- K8 V" ~4 D' h" P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 S5 P3 z3 P [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 b& U5 o7 I" C w1 u; J8 d8 p5 s7 d" r7 i! b; @5 ~$ b
3 {' c; d* o6 p' l/ l |
|