|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 W% ^. T0 k& v
- [code]EDMA sample test application
- D2 I7 W: V( c) s0 K - /*& v- I- h: [+ p3 C1 r, T
- * edma_test.c
- `$ ?2 ?* b0 z9 H+ _( X# I' q - *
& }3 ]+ G9 E/ O: T - * brief EDMA3 Test Application T% u8 c: _( x) M: f% c& D
- *) E1 E. h1 F9 ]* d( O
- * This file contains EDMA3 Test code.$ w( b2 @& m A. O+ u$ H7 }5 B
- *' f& P1 j( w. x9 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 \- L1 \' A- {0 ?7 P0 D8 @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. S0 [8 _% A8 w% ?9 Q2 I- K - * TO CHANGE.
' ^: B8 p0 `( R: W7 i+ U2 a2 e - *
+ i g, _) L" z0 }& Q4 c8 I& R# f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% _# l. m9 F7 s1 k% J; ^ - *( B; v: [5 I3 k/ s5 w1 ?4 E
- * This program is free software; you can redistribute it and/or R' v Z9 C& U8 [+ x+ U1 Y
- * modify it under the terms of the GNU General Public License as
! m1 V; d9 U1 E2 f3 m! Y - * published by the Free Software Foundation version 2.
+ M+ m% k O" y: a, e - * b7 X* d( A! ?& L' c# X! M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( ?4 {4 u. |5 N6 x+ K - * kind, whether express or implied; without even the implied warranty
6 C' l& p8 z }) x# \- e0 a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ N, Q. N+ C. y3 I+ w& s1 ]0 r2 J" B - * GNU General Public License for more details.3 Y* w/ u# |9 z5 o
- */* e, O- ~/ i4 X |; B
- ) J/ w3 W0 v6 W3 u) L0 B2 z! K v
- #include <linux/module.h>: c1 w1 ?; V# K) [/ \/ }
- #include <linux/init.h>
0 l7 c$ w/ p, S& B! X8 a7 l0 F - #include <linux/errno.h>) k( ?0 w- e" _4 @- V* r
- #include <linux/types.h>, S, h, ~4 Z/ X. v1 z! o
- #include <linux/interrupt.h>1 D+ D8 H+ l9 F. ]4 J3 [) h: z6 L
- #include <asm/io.h>
, o! M. `# D& b T- I - #include <linux/moduleparam.h>
$ a T* z: |. F* x# H2 I8 d - #include <linux/sysctl.h>
5 x% O) Y2 e* j8 i! Q+ d - #include <linux/mm.h>% r. M( U# a& \5 T5 z8 ~
- #include <linux/dma-mapping.h>
. k: Y0 J* K; L, `! t! a3 ^- V - + F1 X, o* W9 U3 w; s' Q% t5 C$ k
- #include <mach/memory.h>8 y. |. e5 a9 S; U" G
- #include <mach/hardware.h>. ] N, [5 D3 e' x" X0 P& @5 R
- #include <mach/irqs.h>
! ^9 d- j1 y. M4 c4 b" r( W - #include <asm/hardware/edma.h>6 ?8 L; t$ n5 W( d) i- q& q
- ; [" t& n& s/ s0 u7 b/ }5 ]
- #undef EDMA3_DEBUG6 [3 b, ~* P- U" g5 N' i f3 x2 M0 Q
- /*#define EDMA3_DEBUG*/
6 |9 c7 {6 r, l- E - 2 F# ?% j2 d$ b7 Q6 n2 V; g; `: T
- #ifdef EDMA3_DEBUG
4 R+ s/ y! e9 \8 I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), P+ ~& q" L' M2 a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! H: K: S6 z3 _# p# R! U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 i6 h" ^1 H3 O0 P- m$ G' @( b - #else
/ l) U" x, E2 M1 k - #define DMA_PRINTK( x... )) C! b" k/ _' A7 z6 G3 s' K
- #define DMA_FN_IN1 D* f8 ~4 v- d Y" \3 V0 q
- #define DMA_FN_OUT
/ T9 s" }: G7 y4 W0 h - #endif$ h- X% N2 s% b% }
- : j5 B7 c& F e0 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* L5 B; \+ y. y
- #define STATIC_SHIFT 30 {2 V1 I6 ]6 e4 C% ?0 g
- #define TCINTEN_SHIFT 20
0 p9 C$ {$ M8 X, J - #define ITCINTEN_SHIFT 211 ]5 a% g& x5 u' J8 |! @1 R( f
- #define TCCHEN_SHIFT 22+ j9 s% m5 E4 [ x
- #define ITCCHEN_SHIFT 23
# i. k: ~3 ]# v) R, _0 y4 \
8 M8 R8 d0 p1 h H2 L( i- static volatile int irqraised1 = 0;
$ I. p6 W" [; h( l - static volatile int irqraised2 = 0;( w+ o: o/ K; ~( @1 r& I
" c! K+ O/ d! _' |2 g9 L0 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, A3 y5 m( Y8 N n) l" M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Y" p6 F v6 ~; E$ q! O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) N+ S$ s7 e7 [( L4 B: G }
) o( e2 y5 R5 @# V- dma_addr_t dmaphyssrc1 = 0;
& a1 Y& p. l) T9 w0 R - dma_addr_t dmaphyssrc2 = 0;
6 Y/ ]+ |2 _5 n/ K% v/ e - dma_addr_t dmaphysdest1 = 0;+ q2 f( f/ c# ]: g D
- dma_addr_t dmaphysdest2 = 0;' z5 e3 R5 T" Y2 V% S
" T: r3 y1 `4 j6 ], d/ K- char *dmabufsrc1 = NULL;+ d* Y- D* H5 @% _) D0 _
- char *dmabufsrc2 = NULL;2 X* e- A; o) x6 R
- char *dmabufdest1 = NULL;
: N, N# Y$ ~/ D. G8 H - char *dmabufdest2 = NULL;" k& w% X' |, o0 }4 L
3 G+ B4 R5 K# N; \- static int acnt = 512;
* E p; H7 i3 F2 Z - static int bcnt = 8;9 b4 b7 n. E. P0 Q) n f6 @/ E
- static int ccnt = 8;
5 X" [: s- }0 ?" e0 }0 ^ - " w5 `+ T+ b1 x7 i
- module_param(acnt, int, S_IRUGO);$ _' b! L% e0 w- S
- module_param(bcnt, int, S_IRUGO);$ z0 j3 J% w# z7 O: F/ Y/ `
- module_param(ccnt, int, S_IRUGO);
复制代码
9 Y0 m. ~/ D- d$ ?0 ]3 D/ T' k6 N
$ s( x+ A9 S" r4 f1 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% V/ [7 L/ ?/ h* e- B1 q6 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ |$ n E+ X o# e g# l2 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 v' V3 R& p1 o( w! g; S9 u( d
" X0 s1 L: q( l( n2 g' j5 b7 e5 @& P
; Z- v7 B1 l9 \" ~# P |
|