|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! z" M$ z0 h$ q, y; D0 @
- [code]EDMA sample test application
% H% Z" X- e7 \) |1 L - /*7 l, E' T) V* \2 w/ [) Q1 n: v
- * edma_test.c( I4 ~7 M6 C1 \' N3 q9 y$ W
- *
T9 _6 p$ H! R& \/ v - * brief EDMA3 Test Application
2 D1 F& z+ l& Y' a* \0 P9 H - *% J- V* I; x2 i
- * This file contains EDMA3 Test code.
7 Q1 w; U- f# z8 O+ f. m - *
" Y7 {0 J* t/ d. w0 N: i- x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Y2 U; B/ e5 j, x6 B; x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& g+ s$ O- b3 n - * TO CHANGE./ y# d+ V) ?! ~+ H. Y8 \0 j$ C- C
- *6 E) w9 T5 H2 M( G& A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# U, D6 ]9 C3 i/ f) i0 d5 e( p
- *# z4 r4 P' a( u8 ?, v
- * This program is free software; you can redistribute it and/or. z& r- z) d" E4 @2 U
- * modify it under the terms of the GNU General Public License as
" t! }; x, x, o8 l3 L - * published by the Free Software Foundation version 2.
; B5 r4 E. P% ^! U1 ]& Q U$ [% G+ v5 b - *
; d+ Y6 ^. H! w8 c5 U5 k* [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) l2 _1 F" l9 Y( L
- * kind, whether express or implied; without even the implied warranty
% J/ E9 W3 u" w8 R% ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, q! F, k$ J: @- I) ]
- * GNU General Public License for more details.
! V! z' E/ x7 ^ - */
1 v3 }- P; k9 o4 a+ ]$ K - N$ B6 B/ _/ @6 l& e K, B
- #include <linux/module.h>' e ` ?" d. |
- #include <linux/init.h>
4 o% E8 A3 J7 X3 S - #include <linux/errno.h>
2 C, t j. j5 q7 T( W - #include <linux/types.h>0 ?5 o& A# o' o- c# L2 y& }$ \
- #include <linux/interrupt.h>
; z4 K6 j- W2 L& d - #include <asm/io.h>
3 Z% I+ x" Z8 M; w1 D9 H - #include <linux/moduleparam.h>
& O- p; X6 j# n: f. @# I - #include <linux/sysctl.h>, J F& ?$ I# g: j
- #include <linux/mm.h>
+ q1 y/ _/ ~2 A2 Q( D g* z, V - #include <linux/dma-mapping.h>) ~$ l h n2 `
2 B5 O' E% Y: b* S% b; I- #include <mach/memory.h>
' P( ?4 r: J- k2 ]/ {& ?( X - #include <mach/hardware.h>( U9 G7 ^2 h, Z! q ^. f
- #include <mach/irqs.h>+ [1 B2 F$ `" _1 v1 z% k- n& [
- #include <asm/hardware/edma.h>
6 f9 g2 j0 }- W- H, m6 L9 U! y - . z$ H6 O6 T- g2 y
- #undef EDMA3_DEBUG
/ j& E2 c4 Q- C$ ?0 Z" ?0 e - /*#define EDMA3_DEBUG*/
6 T$ f4 p9 h% ], D! A& O$ n' P - ) V5 M& d |2 Y
- #ifdef EDMA3_DEBUG
! a0 O( U0 i5 k/ h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& W% }3 K* Q% W7 Q& |( T! L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 a: V9 f7 V, m0 v. s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 T. a( b$ ~# q5 c - #else# h! r; w/ \& H5 U* x( L2 d; T& i6 m
- #define DMA_PRINTK( x... )
8 M' N+ r7 K# L- h- }& c - #define DMA_FN_IN
* L0 T" K, v& Z3 p, G! x- r7 i - #define DMA_FN_OUT1 l# D5 _) e1 P) Z) k
- #endif6 q" b! I! ^1 h. ~
( K) _8 i) m/ I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 d$ V4 |9 m& U& H3 z - #define STATIC_SHIFT 3- N6 G- `2 T. D$ ~) e) W
- #define TCINTEN_SHIFT 20, F: d# }, U) a5 w
- #define ITCINTEN_SHIFT 21
6 D& h5 J( J0 i! R, Q; N! d - #define TCCHEN_SHIFT 220 C' l5 C- N2 Q- M8 [+ d
- #define ITCCHEN_SHIFT 232 [7 |4 z8 _ `3 C' s& v4 M% S
- U9 u4 D" @) J! J4 e$ W- static volatile int irqraised1 = 0;
. |9 N. l- f- I - static volatile int irqraised2 = 0;0 U) @' D! y# a4 w/ d9 [
- ( B2 P% i( { `% A. k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H. w7 [: _4 ]' g: V* @5 f9 V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 z# Z! N' A; W1 i& F2 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 F [0 N }0 X9 f - 8 d1 D1 v6 ]9 O5 B4 D2 O
- dma_addr_t dmaphyssrc1 = 0;
+ w- E; \- C" X - dma_addr_t dmaphyssrc2 = 0;
7 M }$ o% f) U- w6 v. c: M* n( Y - dma_addr_t dmaphysdest1 = 0;
& C: r5 H7 r6 @8 N - dma_addr_t dmaphysdest2 = 0;
/ O) X) b6 S8 O& n
: ], u* c" b) P8 t6 m" ]3 z/ [7 F- char *dmabufsrc1 = NULL;' l5 [2 X2 i1 e5 g8 K- {. g
- char *dmabufsrc2 = NULL;
' s- x8 ]( Y# r: c - char *dmabufdest1 = NULL;3 k S2 L: ~- ]9 [+ @
- char *dmabufdest2 = NULL;
( K7 ~8 T4 |$ u6 a+ B/ v - 2 |0 A" \+ F4 O' w# }& p
- static int acnt = 512;# g: F8 _8 m6 F/ @. g* g
- static int bcnt = 8;
- ]( O+ k$ v. ~, e - static int ccnt = 8;- K/ R5 H- A2 ]0 T! D
- 9 ?* _" B2 }0 m
- module_param(acnt, int, S_IRUGO);. P" g- ^' u) A' |$ v2 p. ? l% T5 F& H
- module_param(bcnt, int, S_IRUGO);! U/ _, b; J" A: D1 L
- module_param(ccnt, int, S_IRUGO);
复制代码
0 x" C: I1 e. C: _9 y6 Z; N% Y6 r# B* a) y; |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 \: e" F& b# [% `0 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ {4 S( s( W' R' D q+ x1 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 M. U' O$ y6 X# k; C& P9 ]6 @
% ?, m4 W5 y. [" p# J' ?4 a9 ?. |, k
I/ \8 ^8 g! X4 N |
|