|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( B4 B6 f, y! E2 ?' R( W
- [code]EDMA sample test application4 m* K5 C7 _. G" Q4 _; A
- /** x& D/ T5 j0 C
- * edma_test.c/ D/ }/ w" A& n5 P* s, B! Q- Y
- *& P1 z- |' y* h$ q$ ? l+ {
- * brief EDMA3 Test Application, b9 e5 `! m( `) o H7 z
- *! J: P* @0 v# ~. k7 N
- * This file contains EDMA3 Test code.
, P+ z# W9 ?5 s+ y, |2 G# d+ I6 U3 u( ? - *
3 Q/ Q3 p" X: a. Q+ Q0 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* L: N3 g9 e: K N8 L4 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 F( l4 ?. a- P7 b) g$ t8 K - * TO CHANGE.! }' |& _* l, r' G$ B
- *8 C$ a0 K6 c7 Y: x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 t4 ]* s, r( s
- *
w# Y8 E3 j% q1 i6 l5 H - * This program is free software; you can redistribute it and/or! q2 Q+ X o$ {, z
- * modify it under the terms of the GNU General Public License as
" L% b: }' ]+ U2 T) h" j B: ?% [! o - * published by the Free Software Foundation version 2.
2 e# C. C. M6 M4 M5 D d: V7 t - *1 T" L( L9 } l' W* p0 [" @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, T7 q# W# U; t9 M1 C2 G
- * kind, whether express or implied; without even the implied warranty
/ ~& j+ J7 T- U6 I* A9 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 J; c$ G5 x! ]& p# \3 r) ~! S - * GNU General Public License for more details.
! o2 v5 e4 F( b6 M, N - */
1 S9 w+ r: H6 V9 q {% Z( t/ a - n, f4 S# ?2 l U* e
- #include <linux/module.h>
7 a9 `% H' Q; ], N7 E - #include <linux/init.h>
+ a6 }5 o% @5 l6 q; ^- T8 l }# w+ { - #include <linux/errno.h>, A/ c/ z' x* k# r# |# L
- #include <linux/types.h>
* J- T% i+ {: Q z9 l5 u' D - #include <linux/interrupt.h>
2 o# l( [: H" c - #include <asm/io.h>
' g% @* D* l" q1 T* f9 y* C6 c - #include <linux/moduleparam.h>/ [! n" T" ^" ]
- #include <linux/sysctl.h>
: ~; M9 [' |! J, c% V, n - #include <linux/mm.h>
( t. O1 u9 x+ u' u6 I5 U - #include <linux/dma-mapping.h>
" Q6 I" J4 |6 _0 |; f; j
. B& n9 k& K, a$ T7 P. ]' s- #include <mach/memory.h>/ H4 n ^! m# F1 A
- #include <mach/hardware.h>
# ?( f [8 d* M' u. |! r/ p - #include <mach/irqs.h>& x! C' p# p" z! N
- #include <asm/hardware/edma.h>5 x/ z$ z3 F, o2 r, E. b
- ! j' h0 M7 ?2 m! J
- #undef EDMA3_DEBUG
4 w+ _% L: h$ Q$ ^6 X4 \ - /*#define EDMA3_DEBUG*/5 |/ F7 C8 Z3 V4 T: A
4 m) p/ m) M% F5 i: F2 z3 |8 q- #ifdef EDMA3_DEBUG
$ b& ~2 c# v/ c4 F/ C* b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ n: q: t: V/ M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 |7 z/ A0 x! L$ C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). Z* F. L# f4 O5 R0 {2 J3 ~
- #else' [' {3 B* ]+ X7 N) V% {5 S6 q, K
- #define DMA_PRINTK( x... )5 Q4 [0 Y$ N( X+ {. |; r
- #define DMA_FN_IN M. I1 `2 K4 @% M$ Q. W/ x
- #define DMA_FN_OUT
5 K( a# L* C R2 { }) n - #endif
1 c. \+ }; c& W - ( N1 [) N2 X' }# Z" t( f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) z9 u! a H; Z6 Y4 r" {6 w) C) L
- #define STATIC_SHIFT 3
( H2 a/ Y/ h8 w - #define TCINTEN_SHIFT 20
5 r' l( Y; {/ q/ t8 i- u9 s1 h - #define ITCINTEN_SHIFT 21
' ^- C0 k: B6 z8 K% N. G& O - #define TCCHEN_SHIFT 22
* _1 p* M( ~, C - #define ITCCHEN_SHIFT 23
$ Z# ?: g, Z* R- ^9 C
; C* J$ k- D# e% I$ r! c- static volatile int irqraised1 = 0;
+ y; }0 Y& [6 M% V1 r2 @, h @ - static volatile int irqraised2 = 0;
3 O: b8 w4 O1 X+ t. e. b
* M" d- K5 j5 e) ]0 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 V! f- D6 G# v+ _2 K4 Q5 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' H0 {: o4 J2 B# G3 \4 l' P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; K0 I) {- o4 y: I9 F- r - 0 r. ~4 G* D& g3 R
- dma_addr_t dmaphyssrc1 = 0;
, ^" ?( h5 k( c% h - dma_addr_t dmaphyssrc2 = 0;: t4 k- I8 V' g- @: z
- dma_addr_t dmaphysdest1 = 0;
5 y& B3 Y* y) H) \ - dma_addr_t dmaphysdest2 = 0;' x$ U5 g+ T: k, y& b8 F
- & f: N) t+ l1 w! m. I$ f
- char *dmabufsrc1 = NULL;
7 R& V' u2 S0 `" w8 z - char *dmabufsrc2 = NULL;% G9 ]( [. J6 m: k" U
- char *dmabufdest1 = NULL;
+ Q; I6 m, T( m+ s - char *dmabufdest2 = NULL;
% F( h' V% J9 }: }5 l7 Q. ?
- v7 W0 W7 P( r- static int acnt = 512;2 q. ` K1 y' i" w3 I6 b* a
- static int bcnt = 8;( l. N/ D( C* J" N* e
- static int ccnt = 8;6 M9 p1 q$ I: }
- c2 `& ^! A, _% L- module_param(acnt, int, S_IRUGO);
1 J& R0 `- l& o# V8 ~ - module_param(bcnt, int, S_IRUGO);
v1 O; i% S. q. V - module_param(ccnt, int, S_IRUGO);
复制代码
# Q, n% f. w5 K* A9 S5 b& a
1 N6 D% ?0 B( ]3 ~4 {# t, _5 g( j: v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ]2 A/ t, x) l" T. n& earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ a6 C; V& I# {3 s' J) y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 z' b% Y2 V6 Y9 Z" G
) f: j9 {2 E0 n, U m9 {
* D- I5 n7 E/ s7 @1 S+ r
|
|