|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! E0 X8 G8 s4 r3 y5 _5 D: b
- [code]EDMA sample test application) [4 `* `& R: t" |3 S8 Z6 q; C
- /*
# Y" U$ x* r( A" c - * edma_test.c/ P* w7 [! S, J, c, M
- *9 `5 C! x* m8 n$ M$ z) ?
- * brief EDMA3 Test Application
4 B3 Q5 c5 {7 X0 [6 q0 j( | - *
" N# g( q& R+ Z) v; X - * This file contains EDMA3 Test code.
- ?) R% R8 w% M; q) D. U - *
: Y! h& W* e; x4 t# R, B! ~) I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- U5 v, F n6 r2 v1 P4 A" J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! U! X2 Z: p K2 _7 x - * TO CHANGE.
) F+ d/ X! a9 d6 t& w0 H2 P$ d - *6 v% r: ]. D0 h2 E, ~2 d+ Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( @5 {: {( @; k1 W4 T
- *
/ P0 f; ~6 S# Y$ L: A - * This program is free software; you can redistribute it and/or* x3 H: @1 b; a5 J! \
- * modify it under the terms of the GNU General Public License as
; ?2 G8 H% ^2 d+ u9 G" f - * published by the Free Software Foundation version 2.; R! M1 ~. C9 r9 X) @
- *5 W3 v5 {: K8 Y1 O. J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# @4 K. ~( t' ^
- * kind, whether express or implied; without even the implied warranty
' p. `3 M+ H/ P9 t8 o/ F a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the g- q4 j# V# i
- * GNU General Public License for more details.
- m4 X2 k* o0 K( C; }: b# x4 P - */( ?" ]0 s9 O3 S; T7 Y! O
. w2 e0 B3 p2 S0 Q% b- #include <linux/module.h>
/ e% H! m9 F* {5 w2 o6 R2 T6 @- O - #include <linux/init.h>
6 Y* R/ X6 C! r, w" K; a/ Q - #include <linux/errno.h>
/ J5 [7 h3 W; v! g t1 L3 j7 m - #include <linux/types.h>% a3 _% z, t# v, o- `. U8 _7 W
- #include <linux/interrupt.h>( p f. C% [3 ?/ s- x& \0 S
- #include <asm/io.h>* `! ^9 s" p, n$ X2 H2 v: a
- #include <linux/moduleparam.h>
. U- B6 S( {& ?. s$ Q - #include <linux/sysctl.h>
% l! Y- S: I: S0 j3 G4 u - #include <linux/mm.h>- }, `# f8 x/ o( Z x# S
- #include <linux/dma-mapping.h>
) z+ S {6 d' \# u - : I0 h+ q) ^0 Z8 e% I# w) n q
- #include <mach/memory.h>
4 Z) k: x+ Q0 `( E$ c6 c' X. s" m - #include <mach/hardware.h>
' J3 M7 M: E$ {+ A* H. A/ y - #include <mach/irqs.h>
0 B* i4 t% M5 ], t# M - #include <asm/hardware/edma.h>
3 ^& u/ t$ c) j2 o* b. ~7 S; L - ; K- O9 M& ~6 N$ Z7 q
- #undef EDMA3_DEBUG
+ B* e/ A: p& @& h# O* {* d; a8 p - /*#define EDMA3_DEBUG*/
8 ]- B& V$ e9 K( N) Z6 a* E E
7 G$ C* P" k L" f0 k- G- #ifdef EDMA3_DEBUG
\9 t9 o# Q$ r1 S3 n5 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' i4 h- p9 {! H7 D- c' `5 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 |2 L* J2 M# L' T( z& d: z8 t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 R; b( ^& u9 b- i - #else
* J# G: A1 e3 `+ x G$ A( d - #define DMA_PRINTK( x... )0 W& w L" B; K2 W. V, O+ _5 j
- #define DMA_FN_IN3 ]. ^+ X" ^8 g% |" N
- #define DMA_FN_OUT
% t. V: q8 c! r2 `& f - #endif
4 d. ]8 V% Z3 |% H- x! e" p - 7 Z6 t; Z# V; @4 d1 o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& g3 _! S& h8 K2 d( b, h - #define STATIC_SHIFT 3
) @2 a/ [* c- z4 _2 V% O8 W - #define TCINTEN_SHIFT 201 C- N( L. b1 w+ x& h
- #define ITCINTEN_SHIFT 21) r4 P( K4 t/ _4 ~0 w
- #define TCCHEN_SHIFT 22
6 O0 Y: [" j7 A - #define ITCCHEN_SHIFT 232 b! Z" l K' g
& _" _, A. S$ n' G: n5 K- static volatile int irqraised1 = 0;
( ]- N% H4 H$ Y7 c) T - static volatile int irqraised2 = 0;
9 r% B$ Q7 X9 H6 G8 o! g |- r, F
/ l6 o% T* c; _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 P) J! g; T4 J' U1 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# x& K5 ^* ~; t y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ v. j5 }) F. N8 C3 P; M - 5 T% \1 C) ^! I5 \& V- M
- dma_addr_t dmaphyssrc1 = 0;
; `$ }+ {+ p K7 } - dma_addr_t dmaphyssrc2 = 0;
, R# G' c0 U" }7 i$ X8 v - dma_addr_t dmaphysdest1 = 0;; F+ X; p3 c+ |( u
- dma_addr_t dmaphysdest2 = 0;% o. C! I7 }# X3 `) y9 F
' F8 E. L! `6 J' W- char *dmabufsrc1 = NULL;
* s8 l( C6 c1 H0 w' z& g - char *dmabufsrc2 = NULL;" |/ L8 _, }; w" i; q2 }# q( W
- char *dmabufdest1 = NULL;6 a6 a/ R, U1 y0 z) k0 s2 B9 {7 N+ V
- char *dmabufdest2 = NULL;
0 u2 J; w, t0 w- p3 z - 7 U, m q1 I3 n8 \& D
- static int acnt = 512;9 Y# x7 ?+ L9 B7 k- X* L3 K9 {
- static int bcnt = 8;
' N5 C9 L5 U s" ~1 E g - static int ccnt = 8;
0 }7 p. x5 J! ^- B
( N L4 ~# W- Z! e4 p2 R1 Z- module_param(acnt, int, S_IRUGO);4 _9 o& R) Y5 ^2 v
- module_param(bcnt, int, S_IRUGO);6 N4 y2 i0 ` n9 X4 E
- module_param(ccnt, int, S_IRUGO);
复制代码 ( W" u; j- y& l- ?) \
. H/ \' |( V: e: t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" h5 g2 P# L$ r0 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& I# `$ E4 p3 s0 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 L$ p$ d: Z( A _$ k7 y
, `+ b% u( r4 C
) j! J2 T: S: y, r |
|