|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 Z1 F. s: X) D: x- [code]EDMA sample test application
. I5 k0 \8 u/ e* D0 t - /*5 `2 M0 {- X8 t8 s) R
- * edma_test.c2 Q5 y) Y3 V, l, p
- *3 h4 a+ r; q5 ^+ R
- * brief EDMA3 Test Application; D/ |/ L& B. c7 K+ c. {
- *
: p% E8 s( }$ Y8 s0 h; y - * This file contains EDMA3 Test code.5 ?2 {, F2 z. L+ ? s
- *
1 x2 k O0 C0 W& S/ Y* x7 i+ ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 {% X' Y% |% g+ j+ U' u" N8 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 w0 L) m/ W, o0 R* l - * TO CHANGE., _, f# Z0 C4 c2 \- w3 Y) J$ u, {# V
- *
, G, @ t# i4 Y1 W& A* l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 r" a9 }' D- w4 R
- *
1 |& {( u1 j: p5 ^ - * This program is free software; you can redistribute it and/or. I( ?- C" N$ Z* f# [
- * modify it under the terms of the GNU General Public License as% @ N+ }; ~. u' D9 X( J; `% Q
- * published by the Free Software Foundation version 2.2 \ {; K+ V1 p5 M! }6 f" M; d
- *
$ b* t6 o g, g; p/ ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! Z8 Q, R# I# u1 I$ n - * kind, whether express or implied; without even the implied warranty: V; g, x1 ^/ k4 X4 W! x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( b' k4 A `( m6 ]) l7 }
- * GNU General Public License for more details.* ?5 x% i$ l m; q* I; V3 b( y6 C
- */
# k. O7 K: ~- Y6 |0 d. }. @ - ; V/ v- r0 O6 W" s
- #include <linux/module.h>
2 W9 x) \* Q" Z - #include <linux/init.h>1 M. g& G9 X; R$ e$ v9 E
- #include <linux/errno.h>: |7 `7 _1 M% }2 z6 S9 ~9 T/ q
- #include <linux/types.h>
X' a4 V }+ K: ] - #include <linux/interrupt.h>- j, |5 f# `3 t% Z4 d
- #include <asm/io.h>: `1 g7 k8 {$ T' O
- #include <linux/moduleparam.h>7 R9 H" x. X1 x
- #include <linux/sysctl.h>- O& M2 D( x1 o0 Z+ H; @8 `; y' B
- #include <linux/mm.h>+ v) [. S# ~# C2 J" c
- #include <linux/dma-mapping.h>' q& {7 \0 i- ?6 h' a
5 a" x( e& e& Q( c+ i+ ~# D- #include <mach/memory.h>
2 y8 W5 c2 B2 H' z& P* @ - #include <mach/hardware.h>
0 W+ p7 \. ~. o, _ - #include <mach/irqs.h>
1 B. X& R4 \; z: _$ P6 j - #include <asm/hardware/edma.h>! ^5 ^" B( l0 x
7 a/ e3 T q2 a- q% J( `- #undef EDMA3_DEBUG) o9 q! J- ?( D- g& N
- /*#define EDMA3_DEBUG*/4 |' C1 E3 d6 l& n9 Z7 @
5 R" P5 b- W8 D/ h) s- #ifdef EDMA3_DEBUG
9 q" p2 C+ V* Y# E; P) w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) \& S0 u% J; A8 c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 T, l, s4 ?, v4 U* n" ?( Q8 @- Q% e o2 B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 v3 a' d$ s8 i* R2 O$ A - #else
7 f! h. M; G9 K2 M3 B9 y8 d - #define DMA_PRINTK( x... )
/ r2 v/ a: Z% J6 i7 f" A; t - #define DMA_FN_IN
+ G, Y4 y- X, p) }& A4 t0 ] - #define DMA_FN_OUT E2 R7 w* }- r0 ?
- #endif* c- d$ ]2 T( O2 I
% t+ ]" F+ ]: M% t) f% Z9 ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 X3 D* Q2 d! l3 I
- #define STATIC_SHIFT 3+ {+ L3 C4 W1 c C/ ?$ w) d
- #define TCINTEN_SHIFT 20
" m- D$ P/ h" G# Z+ T - #define ITCINTEN_SHIFT 21 y& d' `* Z2 m' c- \" v9 A
- #define TCCHEN_SHIFT 22+ W$ l& Z( L3 r! [
- #define ITCCHEN_SHIFT 23
% K5 K" P3 `6 _$ H& V* x! U$ I/ ? - + ^) X; E" y5 r2 B
- static volatile int irqraised1 = 0;: p( i' D9 I R5 g4 V3 E& M8 j
- static volatile int irqraised2 = 0;
) J3 S# g3 l( D. w - 6 d$ Y5 G q! N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 R9 O8 a8 G- q- \$ Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 V K: n1 T" n! p# I, c# M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% P6 L) W. _* A9 J0 u1 Z* a3 I - - y; m U0 W. w8 C4 y0 {
- dma_addr_t dmaphyssrc1 = 0;. u; |) ?1 u' x% ?
- dma_addr_t dmaphyssrc2 = 0;
4 Z( ^) B- n# ]/ X8 ?9 h6 I - dma_addr_t dmaphysdest1 = 0;& \/ W# L% c* E1 I8 J
- dma_addr_t dmaphysdest2 = 0;8 U, C& l/ q1 M3 @" l6 b! a
1 l% p |( q0 d( ~1 \' G$ r- char *dmabufsrc1 = NULL;
+ I* r/ y( F( T- |' q2 z! t$ |! h - char *dmabufsrc2 = NULL;
6 i5 a! @4 H3 V - char *dmabufdest1 = NULL;! a+ t. b- U' q5 v" z
- char *dmabufdest2 = NULL;5 I9 T D( e! ^1 r4 z v9 c; [; {6 D
- + k5 u6 C; h4 [1 R0 W% v6 Q/ L
- static int acnt = 512;/ E0 a# w- M8 |
- static int bcnt = 8;1 q1 a) X4 q7 `# C* r
- static int ccnt = 8;
- u U3 @# q. j
- ` ~: R, o q z) F- module_param(acnt, int, S_IRUGO);
w2 ]% H8 c1 N: F P - module_param(bcnt, int, S_IRUGO);
3 K& \+ C f6 d/ |- l5 u# C+ b - module_param(ccnt, int, S_IRUGO);
复制代码 0 L) W9 H& s/ W- b
% z) Q0 c0 Y5 y0 ^, ~+ x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Q0 t2 n! V8 K2 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. p7 S h6 t- ~! b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 m" v# [ x, _5 [6 e8 E
! \' I( y" R7 h# }( a
6 r- [" k0 i, C- c4 C, Q% A |
|