|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ B# K! m* S. v2 P2 O( _1 J- r- [code]EDMA sample test application! ^: c! l+ ~3 v% Q1 T6 t2 y# h, X
- /*
5 s6 V) l$ u( `- O0 \ - * edma_test.c' x; |- z. R0 H. U0 c
- *
$ w6 Y7 n4 O' ^$ c- m0 _ - * brief EDMA3 Test Application
+ R+ z8 B, n3 x' [1 S' ], A - *) F* ~# G' S( Q* o+ P% a5 U2 v/ }
- * This file contains EDMA3 Test code.4 y6 j/ R5 k: U) k
- *
) h; d/ J. u6 H: y9 C! d3 Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* U2 o% M" z, v* m* [8 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 M; [( W1 t0 N2 B& @; B" ?6 X* H4 M
- * TO CHANGE.6 Z5 F$ _- G5 I% z' O
- *
/ D* o1 ^) l' H' Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' D; B& l3 c5 i+ J' ?' H0 r# I# U8 D - *4 ]4 O; x4 y6 d! h' u& H0 J9 }+ A4 |
- * This program is free software; you can redistribute it and/or
! j! [$ F) z' o1 e( @ - * modify it under the terms of the GNU General Public License as
2 [) _ l1 f5 t - * published by the Free Software Foundation version 2.0 o* W: [/ c" E) T- y; z
- *, J/ R( W0 d4 p8 c! N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 s8 {5 A, _. i2 W& y - * kind, whether express or implied; without even the implied warranty( L) X# f0 q1 C$ C1 x6 j; h2 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( T8 y$ x" t. b& a* F8 n - * GNU General Public License for more details.' x% z8 M9 H9 J/ t, e; M
- */
. ~0 S3 C; P) I( `6 Y
* M/ |* J% N% F! ?- #include <linux/module.h> |: C# K" ^- x4 F2 J- Y& C
- #include <linux/init.h>
: U! z% |: l4 J5 n2 O - #include <linux/errno.h>' E: @ |9 d1 p8 N9 u
- #include <linux/types.h>
+ u) Z( \2 c- o* a - #include <linux/interrupt.h>
& N: ]8 r, X) P2 H y! z# F K. }2 G - #include <asm/io.h>
: d& }7 w+ L; _3 P0 i8 Z. u - #include <linux/moduleparam.h>6 C; g9 q7 O0 f( T
- #include <linux/sysctl.h>
8 B" _2 X( T) W1 { - #include <linux/mm.h>
/ z( Y$ _- g5 R5 M2 ^ - #include <linux/dma-mapping.h>
+ r. N; v' a. l7 B8 U3 J
5 i+ d& l$ p( X; g) }- h, p$ j# g- #include <mach/memory.h>
0 z* S: }# [+ ]4 e6 y9 _+ C - #include <mach/hardware.h>
' n% c# O& ?# B - #include <mach/irqs.h>
8 X: g2 C7 H& W8 [ - #include <asm/hardware/edma.h>! \- Z3 g$ ]& Q% ^+ l+ }4 U0 E* e
- , _! P: {0 u; ?
- #undef EDMA3_DEBUG1 @7 D+ s2 F3 h
- /*#define EDMA3_DEBUG*/
/ z6 b. l( C2 { - $ v" H* k) Y' T0 Y/ Z
- #ifdef EDMA3_DEBUG8 T/ ?/ s; O9 C1 k2 y7 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 ^7 O6 v2 ?! ]% |# s9 J. H3 \7 K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 X* _" r e7 _9 q1 c: k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 F! E6 }: E* a, }( y
- #else
& v2 j. k7 O6 w3 _' x, m a - #define DMA_PRINTK( x... )
0 }) y/ w3 k6 P2 ?/ E" A6 p - #define DMA_FN_IN5 X( ]$ w! n3 n' c
- #define DMA_FN_OUT$ w7 o: j" N: B/ f" E( M
- #endif! g1 u! A$ z4 s6 f$ M2 \( d* V
) \9 _: ^% H0 I: q% ~; |% H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 Y5 J8 ~' N" j- K - #define STATIC_SHIFT 37 Q4 D+ ~/ b0 x) E+ ~
- #define TCINTEN_SHIFT 20
T; o; k i- I- W/ ^ - #define ITCINTEN_SHIFT 21
0 M1 J/ _) @' F1 J6 E4 [ - #define TCCHEN_SHIFT 22
' S. g8 @; j4 N, N; a - #define ITCCHEN_SHIFT 23
# ?+ u% E. p. |& J( s q# P- M* R
: o5 u% U3 y% C) ~& K- static volatile int irqraised1 = 0;
, A6 n! l! S% b9 c+ \8 y7 a) \1 q - static volatile int irqraised2 = 0;
3 F! ^6 c; N3 x3 O0 h" r# W; J - 9 D# m# j+ u" @' Q7 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 w+ }$ X$ H1 s+ `; F. D" I6 ]3 K3 a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& B1 N. F; w9 L' z8 _6 o4 N% ?* h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ k5 q/ S, Q& J$ \+ ~ - ( B7 L/ z" H' o# ^2 @. v1 i
- dma_addr_t dmaphyssrc1 = 0;3 f) ~4 _& s4 {. f0 ]$ G
- dma_addr_t dmaphyssrc2 = 0;
# V% [. J* N Y1 B; w - dma_addr_t dmaphysdest1 = 0;' S% e& t4 m+ w, X
- dma_addr_t dmaphysdest2 = 0;' I2 O( m+ p v/ R/ J
- / s3 x0 a5 v' K" l8 J
- char *dmabufsrc1 = NULL;% i w9 r2 \7 N$ g, o6 L
- char *dmabufsrc2 = NULL;/ n$ `; J1 G6 ^5 t9 J2 v' u) J0 T2 W
- char *dmabufdest1 = NULL;3 u6 a3 w: P9 k4 A) t
- char *dmabufdest2 = NULL;. Y7 B! c) Z) s4 L
- & G) I# w# O" I: S G
- static int acnt = 512;
+ U {! M' E$ T: D# W6 u0 x: q3 U - static int bcnt = 8;
. Z$ D5 B) M5 U4 t% }( }% y. K& m - static int ccnt = 8;
9 H$ f# W0 d, |2 R+ e1 U
9 M# M; _( u- p- module_param(acnt, int, S_IRUGO);( e6 r4 l6 O( U) o+ ]: k
- module_param(bcnt, int, S_IRUGO);$ O+ Z/ B. z5 o D* C5 |: u
- module_param(ccnt, int, S_IRUGO);
复制代码
) h1 u4 t5 p: [1 l; i
, ?7 @3 r$ V; b8 \0 z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) n& R* ~/ e/ A: H7 Y& O! K+ b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 s4 h& l |6 M D8 @, D' c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 b* ~+ S+ T8 f- e. @& Y+ c. b+ T6 y( s) C' R; p
* Q# n3 S" D8 H$ A" a |
|