|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 H. ?+ I* ?4 u _' e- [code]EDMA sample test application
( x8 f3 [' m, O& b3 K; }/ V# w7 @ - /*/ o/ I$ u+ L7 |3 X
- * edma_test.c
$ a% X2 p9 }& `$ M* L8 }0 Y - *+ W1 }; R# X/ _7 ~5 Y+ X
- * brief EDMA3 Test Application* G! A: w: k9 p7 g P/ Z8 `1 d: q; ~
- *# z7 E; \3 @- q' t$ D$ ~4 E
- * This file contains EDMA3 Test code.# a0 z/ { V3 n+ ?. F
- *
4 \. Z& Z& x0 l& u+ J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. b: h* I" y* ^! S$ ?) t* K' e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT `/ U! {$ {6 O8 V$ p- s; W
- * TO CHANGE.8 Y1 j- G T2 s/ Q3 Y8 R0 ^( s
- *
: }# s( m9 M" T1 F( a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 Y, b2 Q. m4 {& T; t4 d" |7 B
- *
$ x! U7 x1 C/ u8 u* o, b - * This program is free software; you can redistribute it and/or
" l$ e* N$ j' Z' q& s% ]) q - * modify it under the terms of the GNU General Public License as
# n# X$ N% `" o9 X; d% i - * published by the Free Software Foundation version 2.
; c( ]/ Q# _" \9 R! Y - *6 j9 f& \3 V% }9 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- N0 a i3 f7 @3 s, b - * kind, whether express or implied; without even the implied warranty1 ?3 [" m: f: F# D, ]5 p$ d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 Z- k: L. I" O g
- * GNU General Public License for more details.
! f9 o7 `' G6 a% I% ^* Y - */
$ L( _ T, J" J0 C1 P
# e$ j9 o, B u6 R5 d- #include <linux/module.h>
- I( f' C Y0 }4 g8 F, p - #include <linux/init.h>
- ]; e9 v' W8 a$ ?$ t! H - #include <linux/errno.h>
) l# G$ g: f3 R - #include <linux/types.h>
' z) l% v( H2 ?: I9 \: W( ? - #include <linux/interrupt.h>1 \0 T6 M. C9 O" J
- #include <asm/io.h>
1 i9 |. W- v& }# X; b - #include <linux/moduleparam.h> \4 z& ?! e( P0 F
- #include <linux/sysctl.h>
2 S) ^& G, ?% n) f& d - #include <linux/mm.h># K' _ d9 A& Y: ~5 B$ n
- #include <linux/dma-mapping.h>: `* W7 f5 [# ^* L
- ; k% O8 N2 p0 M2 D. `) g
- #include <mach/memory.h>6 e9 _6 I' b6 q; ~. k j
- #include <mach/hardware.h>& H- L% z2 ^* ?* B+ P
- #include <mach/irqs.h>. F9 O% J# }) A+ k8 ^( t6 K
- #include <asm/hardware/edma.h>2 ~( u. v R: s& L
- % o( y7 R2 t* q3 o# }5 a6 R0 ?# s
- #undef EDMA3_DEBUG& h, f; {8 j3 X' I
- /*#define EDMA3_DEBUG*/
. b+ o7 E9 x- r4 A1 H# r: v* c - % Q( ]& l( ?! g
- #ifdef EDMA3_DEBUG
: }0 a) ?( i! u7 [2 b8 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), v) _, G9 _( ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); T- ]! B& Y3 X( W; O) x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). G0 |+ r7 c: S* j
- #else
" R4 ~7 c, a7 d. B9 I& n: C# v - #define DMA_PRINTK( x... )& `/ ^" |0 f& ?% d. k
- #define DMA_FN_IN
m8 a2 w( `9 V w. ~ - #define DMA_FN_OUT' D6 a; U, c$ S
- #endif! T9 T/ x$ I; P' S3 _7 h0 R5 s
0 \, G( @, [! r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 f+ p1 q/ U! @: |! I6 s - #define STATIC_SHIFT 3- k6 @: d& `" ]) B6 v$ x
- #define TCINTEN_SHIFT 20
0 ~, D/ c. E+ H# U$ v4 e - #define ITCINTEN_SHIFT 21
! o! C! C% m( z8 V7 V, d - #define TCCHEN_SHIFT 22
; o- E1 ~+ S; ? H; J - #define ITCCHEN_SHIFT 23
* F+ {6 x. x- j* W9 D% {- \ - ) E4 B P4 x4 } C0 f+ H* ?8 v
- static volatile int irqraised1 = 0;1 v. o2 W6 @3 Y M
- static volatile int irqraised2 = 0;7 C/ \/ v8 K" F& L7 c$ q/ t6 [5 L
4 Y Y% Z; c s8 x( I @, S9 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 f4 w* x# x) Z# M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ E! D( O2 M0 Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ W, O) u4 @' m0 l7 c f
; l8 V/ g: }; V, p- dma_addr_t dmaphyssrc1 = 0;
5 X6 s5 |0 P: _ - dma_addr_t dmaphyssrc2 = 0;
( ^% a4 S/ D, _) l' ] - dma_addr_t dmaphysdest1 = 0;
1 ~: j7 l7 V5 @; A" ~: [, X1 x. \ - dma_addr_t dmaphysdest2 = 0;' L5 ^, J( Y7 l
: H1 `9 y3 D# a$ D8 F0 }; _- char *dmabufsrc1 = NULL;9 t8 B9 h: W/ G7 o* y; k
- char *dmabufsrc2 = NULL;
- b$ U5 }# I9 h2 C/ C; p - char *dmabufdest1 = NULL;
; |( E: K/ a$ V" n" [! q# K - char *dmabufdest2 = NULL;
* Y1 L7 @" j3 _2 B) S - 7 v2 {7 N- K. [: S% z$ a0 Y
- static int acnt = 512; B, Z: w: c# X! x. n
- static int bcnt = 8;5 b) }. a* v! {) [+ Z
- static int ccnt = 8;: U8 X0 j9 J/ }: T8 X9 o# l9 a/ T
, u% {+ A) b8 ^2 |; N$ x6 s, C- module_param(acnt, int, S_IRUGO);% b/ H4 a6 V7 f. ~# x/ o, v
- module_param(bcnt, int, S_IRUGO);
1 A* S. W/ ]7 o1 w% z6 ` - module_param(ccnt, int, S_IRUGO);
复制代码
8 D7 t# }& o- S1 A: F, {# s$ p- s' [. C- n, D1 N& f/ X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 q9 Q3 X) e* c" @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; y) v7 h; O( @; V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 P6 J8 r' c9 d: I$ y0 P
$ e' y. h, n) e& F% T8 Y! F ?8 G5 f0 w
|
|