|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 r' Q" T& Z) P
- [code]EDMA sample test application8 D& A4 r+ t1 E9 b- [
- /*! m( r9 l5 [+ z
- * edma_test.c
: h5 P9 }8 M4 M: C4 h - *
+ h# t! Q5 a! y" Q6 l - * brief EDMA3 Test Application& j9 i- H5 s) t8 Z2 m
- *
0 J1 V6 l7 I# s( j( @8 F6 ^7 B - * This file contains EDMA3 Test code.
/ z# P& }0 |% I( `: b% x* T m9 b. p - * {+ z4 G( p4 W; k; }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( u5 Y. L" _) f- w. C3 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ h7 C8 Z0 z$ B/ f2 u - * TO CHANGE.( g* T! r5 y7 |$ m: {2 [, T/ `
- *
: R8 S* p: b/ i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, H* R) s# }. D - *
3 w4 D. d2 G4 A4 V: R - * This program is free software; you can redistribute it and/or
/ O# I2 l& L6 J1 f0 q - * modify it under the terms of the GNU General Public License as
5 `2 f& A: [; T$ x0 o* x% l4 a8 @ - * published by the Free Software Foundation version 2.
" B0 [9 e6 n. b4 [ - *3 J: l+ O. f' j4 C( t$ J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 r+ M) k4 X8 b7 X: g! T( K
- * kind, whether express or implied; without even the implied warranty9 l4 _) C' P: x. q5 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 D4 w5 `1 `% J6 w& d - * GNU General Public License for more details.
9 U0 n& j5 Q% U* Q% x" y - */
8 ?* C- v4 W! X8 E! L
5 k+ D @" A% |# O- #include <linux/module.h>
$ Z, N4 h7 o: v - #include <linux/init.h>1 W/ E& b* @/ K: T6 G
- #include <linux/errno.h>
! g0 l/ ^+ [# g! _2 e, T$ v: _ - #include <linux/types.h>
5 ~& q' N! Z. C( _ - #include <linux/interrupt.h>
7 r0 Q/ K5 r# @) I* K! p# ?, W - #include <asm/io.h>
9 U c5 V& a1 G" J* v5 F - #include <linux/moduleparam.h>( V9 r- v+ y7 G( H* l: w; z
- #include <linux/sysctl.h>
& o! X- N E9 V1 t9 p - #include <linux/mm.h> t) C1 z( |- z
- #include <linux/dma-mapping.h>( f7 P$ _# d! \0 S
- % I# @! A6 b0 w
- #include <mach/memory.h>! ~+ @& _* ?7 C! @! X
- #include <mach/hardware.h>
6 X) R% u" w0 ^, `( }+ I$ x! K - #include <mach/irqs.h>
4 D8 J3 Y: V0 C- I5 H/ h9 A2 Q - #include <asm/hardware/edma.h>5 R, Z+ x2 L, `/ P3 i
- ' {( S8 V @# l. e4 S
- #undef EDMA3_DEBUG
+ e9 ?& R, t! {! b O - /*#define EDMA3_DEBUG*/% W' {" I2 z5 t% Y2 R
- & |7 ]) x# ^) Z9 k
- #ifdef EDMA3_DEBUG# b7 a5 L) c) k1 x, I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 J7 r. I: i7 G, }$ A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 n/ i2 g, l. c- d# V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 ~2 O3 \: w$ ] - #else- l' C( { z8 v2 L Z
- #define DMA_PRINTK( x... )
6 D1 w' O3 s' F4 i c, d- @. j - #define DMA_FN_IN8 ] d* K5 e1 u2 z- L* R% i
- #define DMA_FN_OUT
`1 O& r g( | - #endif
" _7 H& J- ~% k& C+ h; Y. g4 Q6 } - 0 l: k M% `0 e/ A+ V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 x; V( f" c" ^- g& x
- #define STATIC_SHIFT 3
& ]# y* K$ k, R+ \1 H3 p - #define TCINTEN_SHIFT 20
1 b; B8 M- [) Z! m# D! Y, S - #define ITCINTEN_SHIFT 219 q9 K/ d4 S. Y1 _: n$ N
- #define TCCHEN_SHIFT 22: f2 ^* C5 @: W1 z8 u. c0 o; d) m
- #define ITCCHEN_SHIFT 23& |7 O0 m; S# ^8 c' ^
- . y7 i$ t$ p {
- static volatile int irqraised1 = 0;& I" w7 i+ A; N* h8 p' Y5 C2 @
- static volatile int irqraised2 = 0;# x, g* g, m4 g0 m
+ g0 h1 ^. t2 ?3 [9 s+ {4 i- F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 S. Y" m% w: G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# M9 L& j- o, K; K% b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- {3 w- v/ ~* S* U) q6 w; r# L/ y - , s a- \) `! F5 E
- dma_addr_t dmaphyssrc1 = 0;
# o! r; \- V { - dma_addr_t dmaphyssrc2 = 0;
7 G5 p- R7 I( p+ t" ~8 P$ R - dma_addr_t dmaphysdest1 = 0;0 k$ @, p+ S& L
- dma_addr_t dmaphysdest2 = 0;
# @( d7 ^% b7 ?
$ @, c# p |) ?. x6 P- char *dmabufsrc1 = NULL;# {$ B7 Z3 b+ n2 R! ~$ \$ }
- char *dmabufsrc2 = NULL;9 ~' q: B z j9 y0 s
- char *dmabufdest1 = NULL;' P. h. i& R9 y7 Z: ]6 Q8 c# A: G
- char *dmabufdest2 = NULL;4 O5 Z5 B# l) ~ \
- . a+ m! G8 a1 {* Q$ F
- static int acnt = 512;8 ]: y7 Q6 ~ i# S2 P# H4 Q2 ?
- static int bcnt = 8;
; B/ D6 {6 L( u* p - static int ccnt = 8;
2 |+ _6 J" A& ?+ }) k/ Q - # {4 X/ w. W( a0 J: r; H8 U
- module_param(acnt, int, S_IRUGO);
6 W7 \3 p; X; T7 M - module_param(bcnt, int, S_IRUGO);3 A- K1 s ?/ f9 e% P& p% ?
- module_param(ccnt, int, S_IRUGO);
复制代码
1 Y8 n) a0 c: x" i8 V5 Y/ ~
) R* C3 ^5 q" y( h0 P( i- C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- V( G, g6 b4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" F8 P2 o, ~, D4 c& \$ j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) t9 F. w" S% ?9 N0 g& H# Y5 P$ V# y' F& c+ @& k" O! P. m
1 I! K6 n" Y1 K4 s |
|