|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) M Z6 o4 S# z v. L- [code]EDMA sample test application5 R& F0 m4 ?* b0 l8 @5 P7 K
- /*
9 c: A0 V \6 A( y - * edma_test.c
# K. C( `& n* x - *
: c' R; X4 d: k2 l8 x$ ^8 Y - * brief EDMA3 Test Application4 s; I8 f, @# ?
- *
) \; n; N+ G/ W. S/ E4 o) s - * This file contains EDMA3 Test code.9 k& o3 X3 O( \
- *
A! G, d; A8 n$ Y+ I2 w& X9 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 {) `: B1 E( A+ P! @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' n3 C) _2 j q# A( D2 I - * TO CHANGE.
( N! P+ l: X% ]4 @9 y7 V: t2 J - *7 `' ]6 |8 k1 m! B8 r6 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) D* b/ W2 d: R1 e3 U! ` - *4 c; K7 ]% Y0 o, O4 p P" q2 D0 W
- * This program is free software; you can redistribute it and/or+ r8 H& _; T0 T3 P
- * modify it under the terms of the GNU General Public License as) t' Z9 M/ {7 v; `' P: q
- * published by the Free Software Foundation version 2.8 J# v/ w' J0 j& u4 i" b
- *
5 f. A7 T7 `) s: K0 _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 c9 `( C& s0 Y) J Q# d - * kind, whether express or implied; without even the implied warranty
' v% F: e7 P9 @; }) J; Q, L! _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: R0 r2 R5 u+ b1 o - * GNU General Public License for more details.
7 R/ Y* B3 U; D) E, A( | - */' R* p# R/ x" M' y
) D; j* W2 x8 m- #include <linux/module.h>1 z% e. C2 ]+ _6 n
- #include <linux/init.h>
& f+ f! i2 g1 F - #include <linux/errno.h>4 w0 Y* _. L9 @9 c8 J! R) v( e& Y
- #include <linux/types.h>; S _ W4 @2 \
- #include <linux/interrupt.h>4 F; A" i! B3 q3 a4 y
- #include <asm/io.h>* _- p% o; O; |
- #include <linux/moduleparam.h>' e& D4 T4 j8 f# S0 F3 n
- #include <linux/sysctl.h>3 b3 `$ U) W# y; d$ f
- #include <linux/mm.h>0 I/ [9 S- E" E, S+ w& V
- #include <linux/dma-mapping.h>2 i0 F9 O* E y# }0 D. y
- # J# @0 K/ Y* d
- #include <mach/memory.h>, y. U! s7 G3 m _& j' m
- #include <mach/hardware.h>
: D# J- S* V/ }) \# j3 R - #include <mach/irqs.h>5 O5 E2 M# k; Z% u
- #include <asm/hardware/edma.h>
9 e+ v$ G% o- [' u7 O( M
9 T/ j+ ?* }% l! M. u2 d- #undef EDMA3_DEBUG
) c" T5 ` X: K1 r8 U0 z1 u - /*#define EDMA3_DEBUG*/
) s% q+ X' B. k. i; y* i. E) y
/ i; f \- M4 l- J/ S1 K B# H- #ifdef EDMA3_DEBUG4 m2 n, `$ G! e1 X4 i5 V) W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
W* Z. C% [2 w( n$ l' U8 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 [3 _# y2 ] P7 @' b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) Q' s: C1 T' f8 \7 b8 Y! J
- #else
$ a* ~- J7 n8 q% ~2 ~ - #define DMA_PRINTK( x... )
+ _8 Y, h b1 `2 k - #define DMA_FN_IN1 Z5 [* F4 v8 h/ X% Q1 e& ~
- #define DMA_FN_OUT
* g: H% _/ R8 n# l# c) v - #endif
) Y4 V' f' s) y( a5 J
3 e" x& c5 h- `8 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& k) g/ `9 o a$ B' N& z* X - #define STATIC_SHIFT 3# X- z/ d) z, v% N; R( N! P0 \& [
- #define TCINTEN_SHIFT 20
+ ^/ p$ b+ r/ b, ^: V! b% y - #define ITCINTEN_SHIFT 215 T; }5 D8 U3 M) {
- #define TCCHEN_SHIFT 22
) f6 B7 K8 o" \6 A4 \& ` - #define ITCCHEN_SHIFT 23
. Z3 o4 I8 }7 v3 N2 S- A
4 h4 P5 u) M9 q( Z- Y% k5 c- static volatile int irqraised1 = 0;$ a5 w2 ?# w! G( h. }: M. B2 m a* n
- static volatile int irqraised2 = 0;
/ v: s) }: ]: ^: Q- Y+ w: C3 o
" k3 e* k$ _+ K* e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 G1 G+ d7 Y$ h6 o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: |+ t1 T/ R3 p, x) I: |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O+ B0 w1 `# W* w* j; y
: H9 ]4 p" o7 P9 A- dma_addr_t dmaphyssrc1 = 0;/ ]+ ?) N l+ y; W) ~
- dma_addr_t dmaphyssrc2 = 0;
$ X1 `" _# L# _' U+ N7 K - dma_addr_t dmaphysdest1 = 0;9 c4 A- h7 |) c, X9 _6 P
- dma_addr_t dmaphysdest2 = 0;9 z- G, V; D0 t
. k/ M$ s z7 c' z- char *dmabufsrc1 = NULL;& ~; A- f$ m/ |
- char *dmabufsrc2 = NULL; l0 x* D; |/ l& w, L: K6 v* d
- char *dmabufdest1 = NULL;
" x5 G5 i# Q7 X! V: B - char *dmabufdest2 = NULL;, D# y! Q) l& t/ K n
1 c5 V$ k; c6 e% P2 d# z5 J- static int acnt = 512;
& J: V* r6 T) g( `$ b0 ?$ ~7 b! { - static int bcnt = 8;
3 A0 y, W+ L( C& t7 ~" h' ~ - static int ccnt = 8;
, o* w. b1 p. Z$ y( B - * p5 x& b1 x2 s! N1 k0 e
- module_param(acnt, int, S_IRUGO);
- \( s: `+ `; h C5 g. p' [ - module_param(bcnt, int, S_IRUGO);
0 m: i$ ~* s4 s! ^- v3 Q) D" p - module_param(ccnt, int, S_IRUGO);
复制代码
8 [% n+ u! E" m; K4 l4 Q; T) q, J6 q6 x1 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ W- b, `0 c4 A7 G/ [1 R- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& d+ u& e; z/ W A! L" v% u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ~. a8 S: Y* N2 L0 S3 v3 J+ B/ _
" ^ h/ W2 ^$ w6 y" I* x
* U4 n+ K. I6 I% R |
|