|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 m1 C8 x8 |: J- [code]EDMA sample test application `7 a/ G5 F# O$ O% l- d0 i. F
- /*
) j, C1 Y2 k6 f3 C6 m* d - * edma_test.c
0 k; v$ d! M N; r1 u" r+ @ - *6 ?2 w* D) b( E9 ]# B% J8 ? K
- * brief EDMA3 Test Application
3 l- i; M# T1 v& L - *" R+ G. M ~9 N$ F* e' ^
- * This file contains EDMA3 Test code.# v) m7 b1 G1 |9 P2 ~$ Y
- *% H0 W$ a. X% e0 u3 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 i: c, W5 Y4 ~5 r% \1 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) d: P ^; C8 f& L) j/ |4 y) I% s: v
- * TO CHANGE.+ i. Z* {5 V) T- ~, O9 l9 d
- *; l0 D* V" U) r H. w. s+ r4 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 D: ?4 H) N- i/ N( L - *
* Y, p0 h( S& z5 M1 X. i' I& ` - * This program is free software; you can redistribute it and/or+ N2 U# l& D" h: g' U
- * modify it under the terms of the GNU General Public License as, z% ^ N" S! l8 n
- * published by the Free Software Foundation version 2.5 G% S( Q: }; V
- *- F' X9 N; `: \4 {# d8 K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 C8 G, j+ y% |6 b: \ - * kind, whether express or implied; without even the implied warranty
0 C& p- D2 u( L/ p0 I* { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: s! X6 x2 h/ | G4 K2 j( `
- * GNU General Public License for more details." l$ T0 j, X+ i# j6 N
- */
$ e$ L4 K1 V8 P - ; [# q& i" ]5 n( L* n' a
- #include <linux/module.h>
+ Z' I3 D* ^6 U2 B( {) L0 \ - #include <linux/init.h>
% n, ^' a, o1 ^/ C# t2 y9 C1 k$ M% S3 T - #include <linux/errno.h>
; }. b. f9 W- P5 o4 U - #include <linux/types.h>( B/ e9 T3 m# @7 g# ]# y
- #include <linux/interrupt.h>. T: l- U r3 x) d6 w) R2 b
- #include <asm/io.h>; ?$ f: }! G4 O6 x7 @+ j
- #include <linux/moduleparam.h>* `" ~% \+ l3 Z( F# r# l
- #include <linux/sysctl.h>
5 ?' b G. s" u. R. Q. R - #include <linux/mm.h>' v& |1 b5 K: _. i) E
- #include <linux/dma-mapping.h>
# G6 R# C5 f7 }, V1 X
& |/ Y. \" `$ {5 i. P- #include <mach/memory.h>5 @) }* I6 L- W
- #include <mach/hardware.h>
+ s6 g3 U: J. m( m0 u8 F* _ - #include <mach/irqs.h>
7 k8 z* v6 n& L/ U/ `8 R - #include <asm/hardware/edma.h>8 h+ u7 |/ b* @( u
- * g" J+ c' S! s" t) J5 E- j
- #undef EDMA3_DEBUG
0 I* a8 w( P/ ]$ p$ V; R - /*#define EDMA3_DEBUG*/) Q0 n) G. B# }4 [) L+ O, N* ^
- 5 G* v4 c* S- j( \
- #ifdef EDMA3_DEBUG+ c* |2 y: S& M6 n+ Q3 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). B' P# J F K3 r. ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): r9 { O! e! p+ p4 f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); o* b, A8 c. P9 J( e; C
- #else" ^7 W, `' |- }% r& ]- I- B' S
- #define DMA_PRINTK( x... )
: h) D1 k$ x. q! T+ s - #define DMA_FN_IN) e( |; X; [: Q, G( C! T) R; |' }8 r
- #define DMA_FN_OUT6 d% J( R7 P, \7 }% ~
- #endif
; R6 G7 A- M- o/ y1 x - 6 d5 A7 h. D+ A9 }+ Z; F+ x$ `" a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ @! ]* _/ [4 ~: w
- #define STATIC_SHIFT 3
0 p' R0 A: _5 t - #define TCINTEN_SHIFT 20
$ Y; k% m2 b$ C! U" _/ B( J - #define ITCINTEN_SHIFT 216 V! f: o: r1 W& P$ r% Y/ W
- #define TCCHEN_SHIFT 22
# L2 @ l- W* d2 N - #define ITCCHEN_SHIFT 23
6 ?- ^" Y$ I9 R' J$ h% [ - ' H9 W5 `7 I0 \ c3 i
- static volatile int irqraised1 = 0;
0 H) ^% M% @, S/ y. P- D - static volatile int irqraised2 = 0;* a( r5 w( {; j9 C
0 _4 ~) ]. g. c" i( c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& w0 p- }7 V# p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ u- G6 T5 z2 p/ q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) K. g9 i" p; X
- - }# C* R7 k& h! a4 \5 Z& w/ u
- dma_addr_t dmaphyssrc1 = 0;7 S) k! \' U+ x A' D; X( H
- dma_addr_t dmaphyssrc2 = 0;' E* S9 b* `( C0 j) o
- dma_addr_t dmaphysdest1 = 0;2 U! j$ ]1 G% s, j) s+ H+ g
- dma_addr_t dmaphysdest2 = 0;5 g$ v) H" T% G4 M
- ) l! R+ h" H" c0 F, L: y
- char *dmabufsrc1 = NULL;2 \+ I9 x U3 z: V. \ Z% R
- char *dmabufsrc2 = NULL;
, _3 b- Q3 a6 w q7 i8 [) Q3 [ - char *dmabufdest1 = NULL;
0 S- j- Q i: w% n; H7 b; J5 G - char *dmabufdest2 = NULL;9 K8 M1 _; H$ J6 q
& e$ U4 M+ e C- static int acnt = 512;8 ?" d% `& V% [6 M
- static int bcnt = 8;/ n% v+ f) p/ l, i5 o! N
- static int ccnt = 8;
8 _0 N( ?1 e& R8 t$ v
: U/ |. N$ J# |0 p3 |# _) u- module_param(acnt, int, S_IRUGO);
+ m3 B m0 j. _( h2 x$ u# ?$ {6 L - module_param(bcnt, int, S_IRUGO);
( A4 p6 p) T0 Z% l3 N - module_param(ccnt, int, S_IRUGO);
复制代码 + H. h7 @. j/ x4 a" O
4 A3 B; O" U. S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# X0 \, W5 S% W+ W# g4 ^# ?& [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 A! ?1 n) \) M X$ o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 `9 j; r" B# T9 c* r7 K
( I: z _+ T! b; g5 ^
+ p3 G) H6 f& I3 K* ` |
|