|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ s2 S* y( G$ u( y4 d# B" q( W- [code]EDMA sample test application
% s) `) @3 f* a7 ?" e3 ] - /*1 I1 X" g3 O& |& z2 R; l! k' G9 m& p
- * edma_test.c" M5 ~. }, K* Y" l
- *6 S8 g1 z) g/ F; p
- * brief EDMA3 Test Application
6 a" n( d8 |& G$ d - *
I; n/ }0 C' r" b% D - * This file contains EDMA3 Test code.
# N$ y: x8 d1 ?7 r: f+ X - *& m2 P |/ Q4 {3 g* e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
N5 d' y) v* @8 H) @ v% v' d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 ?* \$ Y! V& ~7 ]6 ?7 x
- * TO CHANGE.
% x9 a4 `5 N7 Q: e - *2 j& W6 j4 r& H4 G1 N7 t% ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- ^+ u" B" h# l8 b9 e0 k. E% q) S' @& y
- *2 f) ?- u) S# y& X% M x
- * This program is free software; you can redistribute it and/or$ H" R2 b: P& t$ s
- * modify it under the terms of the GNU General Public License as. b/ f1 T n! t+ j
- * published by the Free Software Foundation version 2." Q1 W. {' M; i) ?1 _4 }0 P: b
- *" N/ M1 h+ i6 C! y; W2 S7 V1 r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 P1 D5 P6 e1 ^7 G H
- * kind, whether express or implied; without even the implied warranty) l$ d% @- X) ^# N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. m4 V0 @$ v0 t! [ - * GNU General Public License for more details.9 ^& m1 V( S* C" y- I& I
- */- h5 c# G6 e1 A, m; j* z$ X% [
9 ?; [. A' ^7 z8 H- #include <linux/module.h>
$ R" |: A6 g5 w, q9 s - #include <linux/init.h>
" o- C. q" ?; b" s( J# c& m x - #include <linux/errno.h>
+ {0 [. T$ C/ h ^- b$ `( J - #include <linux/types.h>
' R" k" I5 b" t0 Y) \ - #include <linux/interrupt.h>
; I* x2 z' q! L8 r$ H - #include <asm/io.h>
" y3 E7 f8 `4 ~8 N2 l+ _, G - #include <linux/moduleparam.h>& X, M( @' \" `+ W. v; u
- #include <linux/sysctl.h>
* w, @* _5 \ a3 G; U1 E - #include <linux/mm.h>3 c/ F8 u2 _, X$ h, y, C
- #include <linux/dma-mapping.h>2 A; t. t5 R! Q7 V$ \/ \/ X' x. k
- 0 [3 g0 {% m0 _( ?" Q+ ^
- #include <mach/memory.h>
) l: p4 `2 _( W4 K0 H2 e1 A W - #include <mach/hardware.h>
4 }% [9 {# I! Y E: o - #include <mach/irqs.h>
+ [- n# N a: G% u( I" m; Y - #include <asm/hardware/edma.h>2 i7 w0 L/ N6 P/ w* T
- x7 ]8 c" B/ [* N. @& h& e- ]
- #undef EDMA3_DEBUG
9 q( J! ~) r R2 c/ ]0 q - /*#define EDMA3_DEBUG*/4 Y# n6 y( }, g6 i
- 4 O2 d6 f2 k5 P' \9 G
- #ifdef EDMA3_DEBUG% q: L$ n* r! O7 N7 i# r! v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- o5 X3 {2 q& a. ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ X3 R2 h& G& {! ~6 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): J" J, R& X0 u+ o7 i U
- #else0 Q; e; J4 Z% }" s/ r
- #define DMA_PRINTK( x... )
1 ?$ }1 m" T, w* Q - #define DMA_FN_IN1 s( {0 k' F8 l% {; H: C8 c' u/ d+ T
- #define DMA_FN_OUT
) ^5 e" N4 H6 i ~. F, L- Y - #endif
e8 L' S- I" `
5 T5 x9 M( `7 r" Y3 F- #define MAX_DMA_TRANSFER_IN_BYTES (32768) N# m$ W; z1 B& ^1 z8 h; Q, ~. n& n
- #define STATIC_SHIFT 3* k7 a8 O) T- O6 m7 k/ ]( e3 m
- #define TCINTEN_SHIFT 20
' \& X3 n2 a4 T6 s' ? - #define ITCINTEN_SHIFT 21& H2 }% H5 W# E$ z* @
- #define TCCHEN_SHIFT 22
2 M2 d3 Q# \9 W$ j8 v" S - #define ITCCHEN_SHIFT 238 ]; [7 y1 K. N
- 5 d J3 c4 E" G5 a) _; H o. H# c
- static volatile int irqraised1 = 0;- ]+ C1 j4 G, D5 [0 q3 q) e& \
- static volatile int irqraised2 = 0;
- Q P6 m9 ^" r/ F
, e" O: u1 b" h) _& T4 A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
V# X9 F* C/ l0 R) W# c3 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* u$ e; ~- Y0 E$ s8 {+ ]7 { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 n1 ~: _- f6 ?
9 C$ l% S5 ]. {- dma_addr_t dmaphyssrc1 = 0;, u6 H, t& j4 G A3 q5 U
- dma_addr_t dmaphyssrc2 = 0;. m& s' n& @6 T) r, G r
- dma_addr_t dmaphysdest1 = 0;4 S9 E, h; k. {" z
- dma_addr_t dmaphysdest2 = 0;6 W: G7 ]4 L/ o2 b5 X
; B0 u* M$ W; u# i$ ]* f- char *dmabufsrc1 = NULL;% M% u& j" E/ O2 W& x, g
- char *dmabufsrc2 = NULL;3 C: O, A7 D# F1 r9 \
- char *dmabufdest1 = NULL;9 H3 e# |3 t* J
- char *dmabufdest2 = NULL;! L2 R. x8 }& F) Z( G; Y$ T6 ?% a
- ! m ^* y3 X$ K/ N
- static int acnt = 512;. o+ S: ~* S* K0 \9 s* m2 Q! @
- static int bcnt = 8;9 {5 R! @' u4 C
- static int ccnt = 8;
( ?0 K9 p+ o. v; O% l- K
! \8 j* i+ B5 Y- module_param(acnt, int, S_IRUGO);1 H( l4 z, h w, U- i" `
- module_param(bcnt, int, S_IRUGO);" s c( d( @' e. V
- module_param(ccnt, int, S_IRUGO);
复制代码
; ^" Z" `- a, d; J" a' ^% N
7 T1 n, V* G+ k( k5 z, K( S8 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ E( ~, W$ ~- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' B3 ^4 b( r4 |( ]* P i( M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% `5 j/ p, E* x$ n9 c
& M2 }0 |7 R* }4 V# k
6 `) L2 t# ?4 P% q- u6 U |
|