|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 u* ~" h: `; V- J% `- [code]EDMA sample test application
+ B3 y3 X9 B- c* K7 @7 I& N - /*
R8 \5 K( q) c$ H - * edma_test.c
+ }% a+ R) n9 H% M8 \ - *
- q4 m- P- a8 U" u/ e% z - * brief EDMA3 Test Application
3 ~ a5 }) H) l; F - *
" m) Q8 t( L4 [1 L- Z - * This file contains EDMA3 Test code.
; B3 L1 y; {+ @- a( S% T - *
- `0 C/ B( S' j- E2 Q: F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 g: c. a5 z# v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ I2 X, `3 h0 Q) o8 D
- * TO CHANGE.
- v0 G9 i* O, J - *
7 J' x9 \! v1 N9 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. k. c$ K7 A7 Q5 D9 t
- *1 s4 W4 u, Q$ B. {( A! u
- * This program is free software; you can redistribute it and/or K5 A- Z' g4 D3 n
- * modify it under the terms of the GNU General Public License as: U3 k; z8 R. _
- * published by the Free Software Foundation version 2.( ?. e( F0 Z3 W2 p5 e% r4 U0 ^, R
- *, I5 s9 B) `2 u" E; F) t, Y5 z4 ]$ K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: y1 a. |+ r; k8 M
- * kind, whether express or implied; without even the implied warranty o" f5 y1 P9 R7 ?2 M- y6 q' y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" g# P0 d( A; c) l7 C - * GNU General Public License for more details.7 M! o$ G' P, o9 x6 _
- */
% k2 N1 C. b* G. {0 C- w6 } - % r& y" U( ^" _4 p# x9 ]0 w% W3 q
- #include <linux/module.h>
$ e) T% ?2 A. B9 n; y% S( J - #include <linux/init.h>
. n {" |9 {0 j1 Y6 [# d/ [9 C - #include <linux/errno.h>- d2 ]9 c9 C) S+ V% ~
- #include <linux/types.h>
) w2 m( u/ A7 C5 X1 t9 h - #include <linux/interrupt.h>1 t3 _! x# Q: a0 M) L
- #include <asm/io.h>& p$ W T6 `( B- h
- #include <linux/moduleparam.h># z5 m; W9 L) J. [3 h# B
- #include <linux/sysctl.h>* U4 l& n% ~0 I0 R( R. J& c8 {
- #include <linux/mm.h>
8 Y8 Y- m2 A8 ^) P( K# n( r - #include <linux/dma-mapping.h>
$ h( G0 }& S7 ]# E; q; R
6 H: K, T+ j$ z" i j: o! ^- #include <mach/memory.h>) `" O" s8 s/ X. E5 }7 y
- #include <mach/hardware.h>
& v. _) D& R' v( ^/ F; A - #include <mach/irqs.h>
4 u. Q; Q- H+ Y: E" d$ r - #include <asm/hardware/edma.h>
/ e m/ @* i5 i$ m5 o - , z" I; ~; C) l/ u8 r
- #undef EDMA3_DEBUG
3 ~; o9 O7 G7 Y* { - /*#define EDMA3_DEBUG*/
+ `0 n4 n" J/ A
5 }3 f8 a6 h, W' `$ I6 u ~' E8 E- #ifdef EDMA3_DEBUG
% ^. g6 n; i- ^/ I4 x% l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( _- a$ p3 E9 \8 \8 D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 m# ]: e" E% p! e8 j: r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ^* l4 P6 s9 Q) I. u s
- #else
5 C! M$ f1 J: V - #define DMA_PRINTK( x... )' y6 t1 W- _1 t m: f
- #define DMA_FN_IN
- J$ P% [$ D/ m. G1 M% u - #define DMA_FN_OUT; E9 Q6 f' u" C
- #endif' {) f0 h% ?0 t
- ) a+ G2 s7 I- V( ]! g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 d/ G2 y+ b) o9 ^ - #define STATIC_SHIFT 3$ L; I2 W3 y' ?; r+ S
- #define TCINTEN_SHIFT 20
. ~) G3 q" H* l) ?3 _7 R) f - #define ITCINTEN_SHIFT 21
5 u( l' K1 ]% f' C% V$ J+ c4 f @ - #define TCCHEN_SHIFT 22# O0 w% E9 Q) S7 T- H) [$ v7 Q
- #define ITCCHEN_SHIFT 23
& j9 ~7 W6 U8 `1 k; |& O) P8 S
2 M. d2 i5 }0 z+ A- static volatile int irqraised1 = 0;
2 A- `; O) |5 u+ u4 |, J9 ? - static volatile int irqraised2 = 0;4 b7 I0 Y5 V, `8 ~9 z
- 2 o$ R4 I* P) b. n. J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! a& f9 p; M1 l4 c6 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ?" n, Z: e* u$ ^, g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V: s: j+ A r( Q6 j
- : u7 S. r1 P- _ ^/ h4 ~. m
- dma_addr_t dmaphyssrc1 = 0;
9 I; K3 h+ v5 e G1 V - dma_addr_t dmaphyssrc2 = 0;
' a$ x* U1 k3 r' o% g - dma_addr_t dmaphysdest1 = 0;0 X% |1 u( p, X" V
- dma_addr_t dmaphysdest2 = 0;
% M4 Y5 G8 ` t( n+ U$ l - 9 U3 `2 H; W9 W6 k0 _: o
- char *dmabufsrc1 = NULL;9 m! w( p) o9 P' j5 y
- char *dmabufsrc2 = NULL;
$ u/ O2 K, \2 x& Q - char *dmabufdest1 = NULL;3 I+ s3 y: c, q* w0 I
- char *dmabufdest2 = NULL;
; N, J; I( {' Y, |: M - # [$ U1 c) g @! X3 \+ v/ T
- static int acnt = 512;
# }! d% i. H- R+ o% p5 G. c; } - static int bcnt = 8;/ \' O# S4 `+ \; \5 o8 z; L
- static int ccnt = 8;
/ o4 S3 W: U% {2 S% x' E
& B' H2 D7 v" o. b8 a7 N- module_param(acnt, int, S_IRUGO);
8 M3 H2 L; z/ X6 Y - module_param(bcnt, int, S_IRUGO);
/ S C* t: G. s+ t8 X+ I, y0 Z& W - module_param(ccnt, int, S_IRUGO);
复制代码 9 K7 v6 Z# w. U) T* z0 F
( P" q+ ~- m' Z8 }$ [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* {" H4 P9 l& _, B8 s8 }& Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 K' {2 y/ h9 [. F( `2 n* {7 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) l& X9 \ L1 K% f4 @3 W# E9 a7 ~+ F! g l
+ R! [ X& v) l7 `
|
|