|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& y2 c+ M& `3 C. q' j1 i- [code]EDMA sample test application' N" w; n# y- |# }
- /*
7 m' Y& u/ w7 L - * edma_test.c
" B7 w6 V) }' @4 p" x+ I+ w - *) u! K: c6 X* X M2 Z& |
- * brief EDMA3 Test Application
7 s- \( S! r8 |% ~+ p - *
; G- ^* c. ^0 Q& u4 x' P) K2 T - * This file contains EDMA3 Test code.1 K, W# ]' ^9 U7 F
- *
8 M3 K9 W+ x4 [# o0 {, c, Q0 K3 I2 Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 b. @0 w+ B9 J$ w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 h/ P* Q% [2 X9 @
- * TO CHANGE.: w5 n \+ v8 s3 i6 t! Y
- *: h' ] J3 d5 l; K* G3 z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ x. y, j' A1 @' ?
- ** _1 w% {; Z- T; |0 o" V" x
- * This program is free software; you can redistribute it and/or
- ^! `0 U. U* V5 g4 W0 } - * modify it under the terms of the GNU General Public License as2 S+ S1 C+ L; `$ S' y: ^$ {
- * published by the Free Software Foundation version 2.4 E }- X; o3 K3 e* S
- *4 G: {4 i8 j/ L, Z0 F1 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! J% Y3 v7 E" o
- * kind, whether express or implied; without even the implied warranty
2 e: L% l6 V/ B% V$ J, k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 F6 {. M! W7 b( h5 X - * GNU General Public License for more details.- G" r: B2 ]' I3 r. W k
- */3 Z2 J( j* C2 J2 U- v. Q0 x. z
* k% i5 v; L5 V2 r- #include <linux/module.h>
* X+ ]9 K1 O& y: M; L - #include <linux/init.h>9 r: }+ E8 g4 K2 G/ `, w% F5 E0 G
- #include <linux/errno.h>
- b8 d. X7 E+ @& T8 Q, k' C - #include <linux/types.h>- C) {0 n* Z7 I2 u0 B$ P1 h
- #include <linux/interrupt.h>
; q, y, Z' d4 w$ e: E6 u/ i - #include <asm/io.h>' ~& [$ \% P; ?. J9 M8 H9 ~
- #include <linux/moduleparam.h>
; E* w$ ?0 H# H( \% O! N9 ]& T - #include <linux/sysctl.h>, n+ x0 B1 `5 p6 u$ @8 Y
- #include <linux/mm.h>
/ A d/ I" O) s" T, j% | - #include <linux/dma-mapping.h>
4 `+ U8 b7 n7 Z2 f( t9 v. r/ B - ) @( ?: P& ^7 V) W$ _+ o4 h
- #include <mach/memory.h>
1 u3 L/ p- e1 s3 a - #include <mach/hardware.h>
{" _% \( ^2 k l! l - #include <mach/irqs.h>
) z; o. Z0 r \/ j - #include <asm/hardware/edma.h>1 d2 e' w6 n5 V7 |0 c# g
$ u0 U/ q0 E3 U- #undef EDMA3_DEBUG% |. A% _3 m; Z
- /*#define EDMA3_DEBUG*/
: g5 ^- W% C. m9 m6 U
7 W6 v C! Q% m {2 E9 I8 o/ @1 A- #ifdef EDMA3_DEBUG
# s$ N+ V% y+ V0 { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. Q; y" I4 N. E K2 E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ g. Q" a* v) S( ?3 E' e( a; g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 @, u6 u' t* ~0 [7 X7 }4 L" l - #else
( W' S: u4 ]8 _3 G) y8 {; ]9 g - #define DMA_PRINTK( x... )
7 M# V: r2 [3 p1 c+ O- P - #define DMA_FN_IN
/ G3 M, i0 }* Y7 V - #define DMA_FN_OUT/ f/ G) |/ J! g% a" S" n, i x
- #endif2 v1 k1 S4 G; u+ H9 c l7 _: X' W
2 U% X; _/ s; o* t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( w2 K) r6 o% k
- #define STATIC_SHIFT 3
5 }% P4 Q8 O$ M' ?6 B* R+ f - #define TCINTEN_SHIFT 20& z+ D5 C8 V/ }" f" q* t4 j; N9 d ^# d
- #define ITCINTEN_SHIFT 21- p# e% E; B3 t, E& E
- #define TCCHEN_SHIFT 22
* s2 v, r8 Y# d4 }: G4 ^! r - #define ITCCHEN_SHIFT 23
4 h# Y: y* J& Q
& B) r+ t# i" |2 g$ e- static volatile int irqraised1 = 0;* h8 W( C# w; m" i; w6 @& U# b+ o; e) }
- static volatile int irqraised2 = 0;2 G' l, r7 s" f1 k( W( Z. U
- $ A0 d. X. S9 y+ q0 `1 @# L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 K$ p1 c& M" p, Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 S6 `6 ?+ z: Y+ J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: w5 Y' B C$ ~) e6 j& {0 }
5 P) i( a6 b0 v3 y2 p/ l) i- dma_addr_t dmaphyssrc1 = 0;& e$ \- X: J& J7 q' ]5 |5 s
- dma_addr_t dmaphyssrc2 = 0;
1 i0 i2 i: i# }& q - dma_addr_t dmaphysdest1 = 0;0 _, J4 n: w! r/ z. b' B
- dma_addr_t dmaphysdest2 = 0;, O. g* y5 z3 h3 t" {0 V
+ f* {# V( Y$ v) a; `5 b+ a- char *dmabufsrc1 = NULL;
/ c5 W+ H1 ~/ [# P6 a5 b - char *dmabufsrc2 = NULL;
- E K( P: c0 P; q0 Q - char *dmabufdest1 = NULL;9 i( } Y6 h; H6 x( [6 e% |# k
- char *dmabufdest2 = NULL;
+ @9 I" E; Y' B' N$ w. K
, V2 x% h& N2 G& S; s. N- static int acnt = 512;, {9 F. v* X! P& i+ V
- static int bcnt = 8; c7 A* t6 Q1 @$ t. S4 W
- static int ccnt = 8;& q7 ~3 e& I$ r& [! P4 x
0 Q* @$ _2 l' Z1 \- module_param(acnt, int, S_IRUGO);
; Q( z$ }7 @1 M/ q7 ^ - module_param(bcnt, int, S_IRUGO);5 C- V7 N! C: {6 ?
- module_param(ccnt, int, S_IRUGO);
复制代码
, q. [$ k \) U/ `2 ]0 ? |/ H& {8 h1 p& p% C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' O; T# p5 k3 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- a! t# n' T# S6 @& ]- b' Y; a. X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# a9 S+ J$ h" y- d7 l0 L* Z( {2 V8 @7 z$ [! O
: q' Z, l) C- y; G5 S |
|