|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! ~: Q0 ~9 P8 h( A; `% l- [code]EDMA sample test application
$ x9 u3 P+ p( q) x - /*1 @/ P: ?8 j, K9 p8 K# C
- * edma_test.c2 \( h6 V o7 d9 X
- */ o w5 n+ q2 A# Y& `5 }8 z
- * brief EDMA3 Test Application8 f, z$ E8 a1 Z. }& t
- *
+ i$ ?0 V! O" A! X - * This file contains EDMA3 Test code.5 x" U6 O7 X# O v- {: V
- *
* p7 p( C X' l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* W3 R9 r' t2 o& }- k. h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 h% ?0 F, h" O) S) e
- * TO CHANGE.* ?# x5 t! \4 ^4 i& [/ m
- *
+ A7 m. h0 h/ e9 O' O& z- Q# g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
i8 r8 W E& V - *1 t! p; P0 v/ k# u
- * This program is free software; you can redistribute it and/or. T) f- o- n4 Y: B; e# M4 r
- * modify it under the terms of the GNU General Public License as
4 D1 w' ~ v, W6 V9 Q - * published by the Free Software Foundation version 2.
* A2 m/ g' {, j1 D5 {& I R - *
" q) g& L2 U& y! J8 \& }" Z3 o. T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, s1 V3 g$ E- `9 j. v7 f' i - * kind, whether express or implied; without even the implied warranty9 O+ p* f. d$ w2 `: T4 P/ M$ w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 q+ F% j8 F9 a3 A% M - * GNU General Public License for more details.
' `2 b# H* s# ^9 p - */
u7 H9 s0 g8 n( [+ ]
% W& q" _5 @. ?' p0 k- w- #include <linux/module.h>1 L1 ~8 e4 V! f6 q* \) t
- #include <linux/init.h>2 B5 V$ H2 {! P( ^3 K8 w( [ J
- #include <linux/errno.h>
+ K) `+ m* z1 j7 s% y - #include <linux/types.h>4 I. q) F4 D7 `7 n
- #include <linux/interrupt.h>
. d( s6 k! V- J9 d9 L+ N+ _3 Y - #include <asm/io.h>
0 ?# j, ~0 J' e! r+ { - #include <linux/moduleparam.h>: |- s6 H& n, v( P- t* G
- #include <linux/sysctl.h>/ \, e( d2 o* o& Q P
- #include <linux/mm.h>
- W' G3 l( j2 I$ X! q' e - #include <linux/dma-mapping.h>
% W @0 k6 ]; o. x [
" {& p$ G% o: U2 [$ H8 }) x- #include <mach/memory.h>
! a" j- p% \! X0 {. I9 k# } - #include <mach/hardware.h>
5 _/ E6 |0 N6 S7 G( ]0 D# o - #include <mach/irqs.h>
# Z% |& u0 [ u: T' g - #include <asm/hardware/edma.h>
6 t0 ]$ P z' D+ k - 5 y" v! p U8 U; b& Q
- #undef EDMA3_DEBUG
3 H, @8 ^7 t: S - /*#define EDMA3_DEBUG*/
) R- Y7 d: g# F$ E; P, v t4 L& U
; r9 L7 j, M. H. |0 A! U- #ifdef EDMA3_DEBUG
' v% ?, e, _. C4 c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( t7 t' o& Y% b: f+ F( O, O. N/ e+ S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( t0 c7 R5 [' \( t% b- K: C4 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! Q. I0 x! F* `- Q6 c. X! b/ }& A - #else9 {( j8 d* A5 E! K5 o( @
- #define DMA_PRINTK( x... )
% C) T. B1 w8 `* C4 L5 q# A - #define DMA_FN_IN
1 Z, S# ~- c5 B) \ - #define DMA_FN_OUT7 d7 \* k4 m ?
- #endif7 V, @9 j3 ?$ E1 g9 ~# P% {4 q
- 4 E) K- b, r- ~% p" A( J4 k- |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ T C8 Y. E, p* Q7 P S - #define STATIC_SHIFT 37 H x5 Q# \7 N0 C6 j/ L) ~
- #define TCINTEN_SHIFT 20
. m1 p- `6 R# [" O1 r - #define ITCINTEN_SHIFT 21
5 y* q! V! w+ \! f - #define TCCHEN_SHIFT 223 [! C: E' P- \5 |( T7 b" H
- #define ITCCHEN_SHIFT 23% u( X4 R8 {0 E+ _0 l
$ L9 Z0 `7 }' r3 n: I$ h- static volatile int irqraised1 = 0;
7 c. H- h6 _9 |9 g& o7 X - static volatile int irqraised2 = 0;4 R( l' L* X& Q; C$ j7 W! D
0 G8 X) M) I/ T& g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ]% e: M4 d7 [- l0 X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% r. ~" P+ h% W. ^3 M) K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); j7 ^$ g8 [6 y1 Z! e3 P/ E
2 a/ n& d7 t2 J' Q- dma_addr_t dmaphyssrc1 = 0;
* q) ]( I+ B0 q- J2 B - dma_addr_t dmaphyssrc2 = 0;3 H9 \3 X+ _. b
- dma_addr_t dmaphysdest1 = 0;
# X$ X% K4 q5 ~8 ~) ~; ] - dma_addr_t dmaphysdest2 = 0;$ v8 l9 y" }0 Q2 Y7 v- G f
8 F8 v6 U. _* P5 H/ D- g7 c- char *dmabufsrc1 = NULL;
7 F4 T# [* _% A7 K/ M( A. o. { - char *dmabufsrc2 = NULL;# M! D; Q9 w# J: I* @
- char *dmabufdest1 = NULL;
, T0 N+ h& H& d2 N. S - char *dmabufdest2 = NULL;
+ T2 _: p" k: C* Q G
7 l$ E: ^: { B- static int acnt = 512;
3 L, K x' q0 g# h. o& j9 y - static int bcnt = 8;( W1 l/ r, x- I7 d& K0 A/ o3 X( B3 i
- static int ccnt = 8;7 e. \& s# s" O5 q4 H
- % C9 Y( t5 j! V' l# q. F
- module_param(acnt, int, S_IRUGO);. M6 k( t- Q, v" {
- module_param(bcnt, int, S_IRUGO);/ b' @. I" n/ M& t
- module_param(ccnt, int, S_IRUGO);
复制代码 2 s+ B/ `7 I/ o- P
: V2 L% I+ o- { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# J% n6 z: d9 B7 J/ P1 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: [% k0 y ^0 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. [) \+ [3 _, V5 E- a G& M6 ^
2 g' p& X( ~# E0 \
( q% U7 I: z% l7 A' K# M7 z
|
|