|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# d6 Z! U- a' _& ?6 W) ~- [code]EDMA sample test application
$ D8 w7 d2 d" w: G: ?& k {; j. @& Q - /*4 _6 c, f }3 n
- * edma_test.c& L1 u3 G+ }- B8 O6 W Z
- *
/ x7 G& K& S. M1 c/ \* C - * brief EDMA3 Test Application
. q6 q0 [# z) G - *
+ T9 @9 F2 g$ u1 |) E& z* Q- `4 N - * This file contains EDMA3 Test code.
& f% W8 D$ a; E2 |8 h: N1 e - *. C+ x7 i3 t1 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% v: j b% o3 Z6 D+ M% D) Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 W5 D3 C) ~2 ?
- * TO CHANGE.
9 \( x) f3 J* j; O - *
- G# x* n; z& n' ^8 X7 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: I+ B$ C" t# l' \5 M
- *2 \/ L8 r5 W. b/ f% V8 H4 x
- * This program is free software; you can redistribute it and/or3 i1 f6 ~2 K3 [/ ^' x
- * modify it under the terms of the GNU General Public License as% R6 w$ z J6 s" Y- r- N
- * published by the Free Software Foundation version 2.
* Y1 h5 t8 c7 T3 x. C V - *
, m: Y( c C2 t# k$ b6 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# u( `: I% i# w0 c$ O/ l
- * kind, whether express or implied; without even the implied warranty
. O+ \& y2 ~1 }& ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 g& B4 j# a7 _ e" I - * GNU General Public License for more details.
$ f0 f( j- q$ C4 x - */" y2 E0 ^0 B, g8 d. ]
- / X) S2 J- i' j4 ~) Z
- #include <linux/module.h>& R! R8 V8 L" n; m4 h8 I
- #include <linux/init.h>
4 S n; b, u% m - #include <linux/errno.h>
o" r9 i" ?7 o$ X, y# |. }. j/ c - #include <linux/types.h>; y5 b6 D7 y, h! w8 t4 g
- #include <linux/interrupt.h>
5 Z! M" U) V7 |( R0 \. ]) [8 K - #include <asm/io.h>
% s5 m+ O# E/ \) @0 z8 { - #include <linux/moduleparam.h>6 a- a% x1 M% ?
- #include <linux/sysctl.h>
9 G9 o6 g2 B7 m. V, T9 C8 N% a4 F - #include <linux/mm.h>
# D$ D. z) q* c v: {7 p6 U2 K - #include <linux/dma-mapping.h>1 M+ h8 J) C; L- \2 L) w5 d* g
- 9 h0 t# V# X7 ?: ` q# [3 _. `
- #include <mach/memory.h>
! ^* | g4 n4 T8 v - #include <mach/hardware.h>' c% f3 n% c8 {: X; Q3 }+ k' ~5 a
- #include <mach/irqs.h>
2 B7 I9 Y3 q& H/ x1 j - #include <asm/hardware/edma.h>
; M' I& K4 g, ^1 @' \& N3 O1 A - l1 K+ Q( S& o7 C g& a
- #undef EDMA3_DEBUG$ [; P2 k- Y8 f" l) o4 j! u
- /*#define EDMA3_DEBUG*/8 a6 {, X8 h$ X4 K+ U6 z
- 8 S. k) }7 |4 R2 x- p2 x
- #ifdef EDMA3_DEBUG3 X, e+ @( }1 D" P6 x8 A8 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 b0 N3 \% X5 D" O, w, I! M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" f2 h0 u6 A& [& h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 ~8 o5 \$ M7 E" X. y0 [, I, [ - #else. @/ c, r4 f4 v7 r7 |, F$ [
- #define DMA_PRINTK( x... )2 y& @( A4 E4 l! A( ?9 p( |
- #define DMA_FN_IN
5 H2 h, J/ |$ y( ~9 N - #define DMA_FN_OUT9 X9 B1 W: Z+ Y" n
- #endif
7 \, c6 k* l- i% @4 ?1 O& Y* V. s
9 ?7 G. T- R$ v' u s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ P" Y: W% H2 W5 F& {; K" `
- #define STATIC_SHIFT 3) W( [9 p, n3 e/ ~% U* E
- #define TCINTEN_SHIFT 20
, u9 t4 O( @, K - #define ITCINTEN_SHIFT 213 o# @9 y' P: x9 n
- #define TCCHEN_SHIFT 22( M9 \- x8 L7 j q, H
- #define ITCCHEN_SHIFT 23' m9 e j& o# K/ t. Z7 d
8 g! i y& l& ^ m! O- static volatile int irqraised1 = 0;5 x7 D5 b& L4 `8 b2 f: u( _4 M
- static volatile int irqraised2 = 0;* q& m4 l0 Q7 U/ N+ y
9 H" ?0 N0 a9 k4 k3 K% f! f( I& H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 U& b5 Z8 ]! u' r+ T& g5 ]) U4 z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. H8 J* d" d, x* e2 [' g5 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: j' u8 }' }$ V. _+ N1 W7 G8 \
$ k; k/ S7 n# H- dma_addr_t dmaphyssrc1 = 0;* F6 ?6 L1 ?% ~( O' U1 P
- dma_addr_t dmaphyssrc2 = 0;
4 p1 n& ?! e% S \- P4 \" @1 s8 J - dma_addr_t dmaphysdest1 = 0;
& S9 i* K+ A! q - dma_addr_t dmaphysdest2 = 0;% E- Q$ \. D$ ?
& o, ]1 ^6 L' H( u7 h. H- char *dmabufsrc1 = NULL;
) v( }" `" F" h' W9 X/ G) r - char *dmabufsrc2 = NULL;
' [+ ~) K3 R1 Z$ O& t9 D# t* m - char *dmabufdest1 = NULL;, i1 g- ]- {4 ~( f0 l) A* r
- char *dmabufdest2 = NULL;
% S( g" \9 I: y' G! i - 8 c) Q) R5 t. C0 X, P! S
- static int acnt = 512;. ]" a5 v6 [0 m8 o% t
- static int bcnt = 8;8 J, t2 c7 m0 O( l) n
- static int ccnt = 8;
0 j% e. M7 f5 t
& F6 ? [0 O: E$ N4 u5 m+ a- module_param(acnt, int, S_IRUGO);1 k* G7 G2 X- \, {
- module_param(bcnt, int, S_IRUGO); C5 e! h9 A/ Q+ v7 v- N
- module_param(ccnt, int, S_IRUGO);
复制代码
- \; f% p/ l- T; g7 N
7 R( H. N. ]$ @; Y7 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& U: r+ z0 @: X2 R9 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' Q- e5 d# d$ G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: k: p5 ?( w* c1 F' G: E& \ J& n+ ]# Q" r n6 M$ A6 q. k( I
5 v3 j/ L1 W, B |
|