|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! r7 p! l3 C. }: b
- [code]EDMA sample test application+ F0 d7 |+ }4 {+ S. R
- /*
; A$ e3 V( z! O4 k- O: [3 l - * edma_test.c
4 ]8 D! a Q% ?8 `/ |* j6 S/ B4 J - *
$ J2 a8 s! ?$ L$ Q" J - * brief EDMA3 Test Application
) ?3 R9 Y$ l5 S3 ^ - *: d4 @2 @% N7 L- n2 Z; T1 ~: u& ^
- * This file contains EDMA3 Test code.
4 O' }, d, H3 M/ R8 a% O. e - *
, n& G. b" p" C( c& `& W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- w- Z, Y, D% _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# i& k/ I- \1 _* Q - * TO CHANGE.
9 `- O/ O0 x* u( M - *
5 q0 A( Z! @. O: q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 w. `' F. b- z3 T1 c
- *
7 `+ Z ?2 D& I( I' w, w+ W - * This program is free software; you can redistribute it and/or
4 I" A1 k& a, B# @ - * modify it under the terms of the GNU General Public License as! f. ?6 ?# E" w" V' s0 i% R
- * published by the Free Software Foundation version 2.
. a) P3 @/ b: p* f2 G - *
+ U( c0 Z$ H0 w' R3 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {7 l) G) |2 X
- * kind, whether express or implied; without even the implied warranty; [% E- B8 l2 w" B" J6 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& @4 N9 |5 ?, S; }3 }, f( b: B- |& r7 }
- * GNU General Public License for more details.. `8 C5 q3 G; |/ U2 y, a
- */5 m( _; \' y) B
- " l2 F7 z8 l8 T+ F
- #include <linux/module.h>% k T1 V1 ~" ~
- #include <linux/init.h>
. D# C9 V% {) _$ d- x) t - #include <linux/errno.h>* Z+ L/ e1 m" t4 G3 C$ ?
- #include <linux/types.h>
' @' d3 B/ U' t1 W5 `# S. S- W - #include <linux/interrupt.h>5 N4 u% [/ G+ e% p$ y
- #include <asm/io.h>- h+ j; J$ ?, x" x2 R7 f- F$ q' z
- #include <linux/moduleparam.h>
8 D; j$ g$ m: P, E$ x3 x2 s - #include <linux/sysctl.h>' J" ~+ i' }7 I
- #include <linux/mm.h>
8 q, g* |$ F) g4 G4 @ - #include <linux/dma-mapping.h> _0 ^. w3 h/ ~8 r( ^4 L! O8 [
8 H, |. U! o: p2 ?+ a- #include <mach/memory.h>' H8 k, y1 C3 Z9 A/ _/ q7 ?* n
- #include <mach/hardware.h>
- k; K8 A. ?- B - #include <mach/irqs.h>: s. s2 t8 q5 P7 t+ z/ ~1 O& r- v$ G* [
- #include <asm/hardware/edma.h>$ f' S$ |, w7 `) o: P% Q. j, c& s
) W& P" I u- e" X- #undef EDMA3_DEBUG
5 X2 y1 H, \' H9 e9 u% D$ V& T4 N8 { - /*#define EDMA3_DEBUG*/6 G5 A8 E6 p* g/ z j
/ Y, m$ J% E% ~/ `- A; c- #ifdef EDMA3_DEBUG
& n: q9 n# a" o, _+ E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) d& p+ J* N. j( {( r4 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): T0 J' B" J9 x0 ~, ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 q: [1 x( x) L$ m4 x9 i, |) v
- #else3 y# v$ K3 y, M* i
- #define DMA_PRINTK( x... )
5 x; p8 M2 d: ~6 X! r1 r - #define DMA_FN_IN( F& ~9 t; U: j( e
- #define DMA_FN_OUT
. t& u1 _- m, P( g! w8 { - #endif. d# y1 }+ |# E0 J3 J% t
- & Y% z Y0 ]! e: }' u2 a9 x, ^0 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) }; p! c+ g7 ]1 x/ m - #define STATIC_SHIFT 3" S5 j& N7 T; d' F: R8 D# w% D3 U
- #define TCINTEN_SHIFT 20
& Z, v# ^: H1 [! f6 h - #define ITCINTEN_SHIFT 21 O! ]8 U/ I/ F; E# J
- #define TCCHEN_SHIFT 22) K. G5 \9 ]- L i; r) q
- #define ITCCHEN_SHIFT 233 E+ {* {+ s' a B8 y) H$ J8 m M
0 z0 Q: X# F; o2 }6 @3 |8 ~9 _6 {- static volatile int irqraised1 = 0;* V9 v+ e. o4 b2 n0 C+ ~. U
- static volatile int irqraised2 = 0;) S) n5 b* f# \. A8 r$ V
3 R; a" W- a0 L8 b: I8 \) s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 A- x3 y$ n8 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ G' E' X) a, I& j- I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 G! R' t% E$ [& o- m - $ J: T1 t3 J! N2 g
- dma_addr_t dmaphyssrc1 = 0;
0 ` [& C. E) Z8 N3 G - dma_addr_t dmaphyssrc2 = 0;
! v" X8 Z9 M9 W7 p - dma_addr_t dmaphysdest1 = 0;
/ k4 |7 U" @( v }/ M7 H - dma_addr_t dmaphysdest2 = 0;
$ a& S9 y m5 j' g9 B5 @2 k
' J/ K- N6 v4 x- char *dmabufsrc1 = NULL;
, Y5 `- [2 E- \7 M5 I- @ - char *dmabufsrc2 = NULL;
# g7 E9 N% A4 ^; a1 S1 Q" ~- o - char *dmabufdest1 = NULL;
! g+ B N# ?+ x5 \ - char *dmabufdest2 = NULL;" u4 z' e- Y1 q9 a* h
- / J$ Y" L( H J* R. ~' L5 J" }
- static int acnt = 512;6 }) V. [: q# h0 _9 l0 [4 Z* {
- static int bcnt = 8;5 Q* r6 g* H% ^
- static int ccnt = 8;
8 B0 g* d" R6 n" H9 t8 q - : g/ E) \& q& k' H/ \2 ~
- module_param(acnt, int, S_IRUGO);/ ~* r; J, i% [" s! I/ T! I+ q
- module_param(bcnt, int, S_IRUGO);
+ j3 a6 c; A, |5 J - module_param(ccnt, int, S_IRUGO);
复制代码
' P! i# [' m* u: z% G1 O, D- H0 Y1 a- X: J( Q. W& c7 a, M& E5 Y5 ] s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 b! ^3 w+ `5 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ r- ~3 J0 B( Q U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Q$ |- b% u2 w: g3 x2 W3 K
! T+ C# k! [ O5 M1 {3 ~0 z1 O6 e; a- R
|
|