|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , V+ K$ k: y/ ~' b
- [code]EDMA sample test application
' s! C# G$ s0 N) P+ _. b7 U5 B - /*" R! _% s* I4 n: Q
- * edma_test.c i; E# p. a% ?8 J" S6 a. s
- *' S" S- q3 x3 _/ u! a" D* Y! t( z
- * brief EDMA3 Test Application3 T. v i+ v9 R1 ]! `6 k: c+ L
- ** o& c2 h# X+ k) v8 n4 l
- * This file contains EDMA3 Test code.9 W6 j3 X' I: ~: b* ~
- *- B) M; F) O* v7 C3 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 U* h5 d+ b- K/ |9 u' c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 G% k W* ~& {) |% S
- * TO CHANGE.
( ]7 n/ H/ i1 k9 H E- A - *3 O; ]5 n" z. n: N: b* [& v# s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! P, F+ ^% M8 I; h - *- d+ C1 ?- `0 s% o( _
- * This program is free software; you can redistribute it and/or
/ [3 u) W) Z& e4 P4 |; E. w - * modify it under the terms of the GNU General Public License as' F+ `+ E5 ^7 b; F2 V2 {
- * published by the Free Software Foundation version 2.3 H2 G1 d: ]1 Q9 E5 Y& A m
- *
0 T" E- o& b7 z: w3 F$ s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) {! e* s0 G0 w% A% D
- * kind, whether express or implied; without even the implied warranty) d% _- w: b8 f, k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' R* B/ k* S" u3 d1 C" X3 u
- * GNU General Public License for more details.
9 k3 t2 Y; n8 j6 @& r2 E - */4 I4 F. `1 x- o1 A" q( i1 B
- - H! f: x, u" i6 v1 B' A/ E5 Z
- #include <linux/module.h>
8 k6 Q- }- F4 d0 A - #include <linux/init.h> F6 S7 ?: _8 j2 z; b+ |4 g
- #include <linux/errno.h># A# k" K6 K G7 a# W
- #include <linux/types.h>( k$ t8 @5 G5 k& A0 d
- #include <linux/interrupt.h>3 j2 S p2 I" k; i, O! w
- #include <asm/io.h>7 I% U. o9 s7 b
- #include <linux/moduleparam.h>: X6 \( C% p( y
- #include <linux/sysctl.h>6 U# F" t1 o5 F$ u7 w5 W
- #include <linux/mm.h>& V6 Z2 ]% M2 s% R) t$ ]
- #include <linux/dma-mapping.h>( ?, g4 j0 z9 s/ I8 a# {# n
- 4 B* _6 k( Y+ B
- #include <mach/memory.h>
6 w$ g' m4 i( G% ~ - #include <mach/hardware.h>
6 E/ {3 F, i$ m5 q/ ` - #include <mach/irqs.h>. o$ ]! u1 E* @$ y- o! @; _
- #include <asm/hardware/edma.h>+ h6 n( I2 p3 h) t
- 5 v: y" M! G& x6 m
- #undef EDMA3_DEBUG3 r3 ?% M- d1 S/ q6 @+ J5 T
- /*#define EDMA3_DEBUG*/6 u" A7 H5 g: b7 ]
- $ A: Y( K! |2 s2 z
- #ifdef EDMA3_DEBUG
$ \' Y) M& {3 J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) w( b7 x8 q) X8 o! G% G6 g: ^3 P3 [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ B% @+ k3 j- K! t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- Q& @' u! j+ R, q: G, [4 K/ g
- #else
1 {" J' L+ P; n4 L8 \3 Z& q - #define DMA_PRINTK( x... )
$ \' O5 w7 g! u4 X - #define DMA_FN_IN$ s! U$ n8 }& @) o: r4 y& ~
- #define DMA_FN_OUT6 c& j# T* G; ?. k; x! w
- #endif
7 C% I C' ]2 `* W/ b - % q6 _3 t! n) ?. j, C) y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 |- ^2 N/ I2 {3 K/ a* q' u- @ - #define STATIC_SHIFT 3
* H2 _/ Z- F* U4 ^/ o - #define TCINTEN_SHIFT 20
) W! C# G3 j' I' [7 w% O4 p Z* ]" t - #define ITCINTEN_SHIFT 21
' C6 G( G X9 g2 z# Y" u - #define TCCHEN_SHIFT 22
- @( b" t2 J* | i - #define ITCCHEN_SHIFT 23
' S$ Q. x( F7 V0 [ F# x. U - 8 K0 n, |/ t0 G4 S
- static volatile int irqraised1 = 0;4 w# Z5 I& a- h3 h* G% E9 w& N0 ]
- static volatile int irqraised2 = 0;: w4 b& M2 b) S; o1 F' e4 V
8 K. N/ C# x' g" b) {9 h% h+ G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& `, C! ]. P- ^* c+ \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 Z$ m) [$ w" r" o% V& Z* C# c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 R; d% ^2 l5 D7 {2 |3 F8 `8 ^
- & Z! S, F1 v8 a0 I" D# m$ ~& ^
- dma_addr_t dmaphyssrc1 = 0;3 V; R! X5 L3 V4 R
- dma_addr_t dmaphyssrc2 = 0;9 c6 W4 n) D- t- `) P, P, E
- dma_addr_t dmaphysdest1 = 0;* G# X9 K, h8 ^2 ^( a* X. `& ^4 ?% j
- dma_addr_t dmaphysdest2 = 0;
0 R" @+ B( m5 D; f - 3 j$ H5 W4 _6 A. `; ?7 x
- char *dmabufsrc1 = NULL;! G& G) n* a# u9 g
- char *dmabufsrc2 = NULL;/ [2 r: O6 @3 b$ { z1 w- v8 Z& B3 d2 \
- char *dmabufdest1 = NULL;/ }" c9 m, D& h& k: W# }; C. Q W
- char *dmabufdest2 = NULL;1 y3 w0 Y* q: d! G/ O/ e4 D& G8 ^) Y
6 C2 x. J9 c3 D# B% J% G- static int acnt = 512;4 Q+ V/ d# j4 ^5 Z3 a7 b) r2 J
- static int bcnt = 8;* @, u% e! ]! F. |
- static int ccnt = 8;" y! W- H q% D
) v8 i, k6 N s- module_param(acnt, int, S_IRUGO);
# Z, c5 x& {/ w: t: d2 H/ M/ N - module_param(bcnt, int, S_IRUGO);# J$ \. k: C8 o/ D( ~& o
- module_param(ccnt, int, S_IRUGO);
复制代码 , F% {* X( ^8 U- J
/ V! F. v& j, Q0 X. S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 w a9 `, z }: i1 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! m& q7 r! Z- T+ q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ~. V* ]9 r4 `$ X
$ W/ F* P, j' y5 R/ ]
& r( m5 Q$ I' n" A7 ] |
|