|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; h; R5 C# G$ V" }1 Z2 x" s. I$ I
- [code]EDMA sample test application$ l. O6 R0 W3 g8 P m
- /*8 }6 F {. m, p& t
- * edma_test.c
! `+ }$ o2 Q2 ` - *
6 I' f }* [& c% _+ G - * brief EDMA3 Test Application
) r8 l% f: g! d, ~0 o3 \ - *. h* @/ c7 }* @! r3 `; X; }
- * This file contains EDMA3 Test code.7 g; | Q; p# k$ L
- *
$ {$ V. _0 ^8 p, y9 }7 A3 f# ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 x5 Y- l6 j: \- t% c* ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. n2 d; m, X. p( A" R
- * TO CHANGE.
) d: I/ G, k0 E# L! T - *; ], c5 i7 }5 X$ Y+ S9 z) S# u5 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 d; Z$ u% c! m1 g( g7 I - *% S* N" V$ x( g) s ?! V1 q+ e
- * This program is free software; you can redistribute it and/or' F1 H0 D# `* P' `; r/ Y* w
- * modify it under the terms of the GNU General Public License as
9 R) K( R0 C" ~- Z5 D - * published by the Free Software Foundation version 2.! l. J$ z6 i; U5 ?/ T7 F- m* Q
- *8 K8 A! g' ?/ o) r" Q! K+ E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" C! C" _* h7 I
- * kind, whether express or implied; without even the implied warranty* S+ D! W' ~) o0 B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 u E e& O' J5 u3 z# I( y2 P - * GNU General Public License for more details.: b Q8 }+ N- }- K' o$ F: l0 T
- */
3 w6 j# Y/ P6 k9 q( O, N+ V2 v/ T( ` - 5 s6 @' t# _& w9 x7 A1 E# w
- #include <linux/module.h>
1 z1 r2 i! \# l1 N3 w4 ]) P - #include <linux/init.h>
! e6 [8 i- G" u - #include <linux/errno.h>
6 J- k) H5 a* x% |& n - #include <linux/types.h>, n+ P ^) |! l: D+ b
- #include <linux/interrupt.h>
; D5 x& v0 \' J: T - #include <asm/io.h>, Q+ T3 p! |/ G+ N
- #include <linux/moduleparam.h>4 _, V& u/ J+ V o" x7 {
- #include <linux/sysctl.h>
- F; f( v, T8 M. Q2 C - #include <linux/mm.h>
7 c4 `) u" z }3 q* i; o - #include <linux/dma-mapping.h>5 j: E9 x1 j& }* L
6 W0 g8 V" j1 _* @" D- #include <mach/memory.h>
! y8 }/ S% U+ V Q - #include <mach/hardware.h>
! X7 [% O; @+ ~- Q2 Q - #include <mach/irqs.h>
5 E3 W4 |8 O6 s/ k7 l' |+ j - #include <asm/hardware/edma.h>
: C9 [& ]0 W0 P8 W) f
* E" N. g" e4 ?& |- #undef EDMA3_DEBUG
; V% a: P. \/ a6 @3 n- F - /*#define EDMA3_DEBUG*/
7 } v1 t8 K. ?. s6 R3 ^9 ~$ x
# J3 {5 d4 P+ G8 ?8 d- #ifdef EDMA3_DEBUG, Z' s% z. @6 f% |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ \" ^7 y# h* I3 a( B K3 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
z, {& p- V- I J {, y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), n6 d& F, n$ }& E5 f' a
- #else1 _8 R4 F6 o% d, q n2 i
- #define DMA_PRINTK( x... )
2 N/ ~# U0 l7 Q0 X9 O! l; f N - #define DMA_FN_IN
: F* t' a( _% t- j$ i9 A9 g# X- l - #define DMA_FN_OUT
+ b H4 w. p: N$ d. h; { - #endif
- ?" O n* z- S% l - $ `2 S7 j7 g: s8 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 |: Y& M( ^- k: E: A* j# H - #define STATIC_SHIFT 3' }! j3 v; L8 z8 {; c
- #define TCINTEN_SHIFT 20
" X% z- G# |9 f/ ^4 L6 M - #define ITCINTEN_SHIFT 21
2 X7 g( X3 H. l" h - #define TCCHEN_SHIFT 22
5 v1 }; G) T8 T7 s) {' w' X - #define ITCCHEN_SHIFT 23. Y5 l+ a- F1 Y) [9 X4 J1 V
- " e& S* y" u& }* v% C
- static volatile int irqraised1 = 0;
% X, {7 u3 P1 J1 F0 p" }* S9 w! k - static volatile int irqraised2 = 0;) O# F: R( F4 m
4 v. _ d& k+ q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, p8 ?) ^7 s* }5 H6 \. b- w+ l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- k" s; S; B/ i& J2 d9 f# F, W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 c. B. I: y9 P: R" K+ A5 s
4 }% _6 B% |: R7 ]. J" T, R- dma_addr_t dmaphyssrc1 = 0;
7 i+ J0 _' T9 A! G' S - dma_addr_t dmaphyssrc2 = 0;
% v8 X2 r6 i* `) U$ l - dma_addr_t dmaphysdest1 = 0;2 ?, p9 v6 @2 S' u4 h% V# ?# J
- dma_addr_t dmaphysdest2 = 0;0 a. G- h3 P! ^ J/ A
- * H/ g1 g% ? e: A
- char *dmabufsrc1 = NULL;
: b H7 d; P8 j6 m+ K* S0 Y - char *dmabufsrc2 = NULL;
: q0 r) `% m9 `- [: }$ E" o - char *dmabufdest1 = NULL;3 ]2 t2 s) p, E+ }# v7 d: m
- char *dmabufdest2 = NULL;, g" Y% E9 O' W1 X- ?+ [8 p
6 F; R+ M: B& a% i- ]1 k- static int acnt = 512;
R6 T$ w% l5 s - static int bcnt = 8;
0 T$ h. Z3 q" n ^. c - static int ccnt = 8;4 \* ^/ X* f3 e% f
( `# \' @1 L G' T# V- module_param(acnt, int, S_IRUGO);3 c0 S2 Q9 y# {7 T6 n0 N
- module_param(bcnt, int, S_IRUGO);6 O3 y+ y: [7 Z
- module_param(ccnt, int, S_IRUGO);
复制代码 " P# w$ W; G' u
% o. ] N; L/ a% W+ _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 ]3 j# Z6 i8 u, ?( T2 x5 Z$ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% T( I1 V1 k7 N% O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# P+ n) F \; V0 x1 I
( V% R3 Q" l% }' k* H0 _8 h0 ~2 v# f. a+ l Z* C5 h! \
|
|