|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% x7 A' p1 }6 ~/ F I- [code]EDMA sample test application
& f+ n2 e& M7 g [; S - /*0 n( n& D) q* O5 o6 C
- * edma_test.c1 b6 b( S8 y3 k
- *
+ a9 e* X+ z) i. K - * brief EDMA3 Test Application
# @4 l$ D, P5 _) ~6 B - *
$ q" e4 n; F: z4 x, p0 i1 X4 U - * This file contains EDMA3 Test code.
( z# }$ \: v5 Z6 [ - *2 t2 h9 l9 ]4 g) X3 [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# k6 f( {: T2 g& ^- i4 z; p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% x) Z! n9 }7 P1 h6 g+ V8 ` Y
- * TO CHANGE.
4 R7 a4 f1 w# i) Q# T - *: y7 Y0 N @( U9 f- J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 G/ M) h7 h$ P, Y. e. H - *
" A- I) K9 F# `- M5 o - * This program is free software; you can redistribute it and/or+ s; W3 Z4 G, ?" |
- * modify it under the terms of the GNU General Public License as/ h& _) T4 A$ k% N( I
- * published by the Free Software Foundation version 2.
7 H) a9 \& S; V/ C - *+ r( a6 \8 g% a$ y9 e1 N( a9 x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 U4 d7 ^+ A4 T A
- * kind, whether express or implied; without even the implied warranty
( \0 R0 @& q C1 l& w* z- m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 m- j7 T2 G! Z9 D5 F' W: t8 C* E' i - * GNU General Public License for more details.
& X; s3 ]- [3 j& o1 d6 p - */
0 r* @/ |- ]1 m! n" b6 p - 5 o; U" N- k6 s3 {: T' c' s
- #include <linux/module.h>
/ U% J4 B% H" { - #include <linux/init.h>
; {3 E3 k5 m# z( B! L1 J - #include <linux/errno.h>- R7 j L1 j. h5 B
- #include <linux/types.h>
- t& v. M( p& a, b) t - #include <linux/interrupt.h>
! k6 E5 z& }7 a' b* p - #include <asm/io.h>( f' e1 j6 q5 _; Q% d& W. k
- #include <linux/moduleparam.h>
: j, B; w; S ]! K - #include <linux/sysctl.h>
+ b( o1 N) D$ |0 Y5 r$ L u% s5 G; y# Y - #include <linux/mm.h>; B9 h% G, p2 ?7 M1 e
- #include <linux/dma-mapping.h>
0 [+ X/ G( ^% x A - 6 ~9 h n5 {% F
- #include <mach/memory.h>
. b; Y# F2 |6 Z& c/ y - #include <mach/hardware.h> [1 X- V! \0 Z4 K
- #include <mach/irqs.h>' C- _5 [/ _- F# x
- #include <asm/hardware/edma.h># {- s E) v/ r6 q L
- * @) K0 ]" V( N' j
- #undef EDMA3_DEBUG
+ Q5 Q P, T) X( C# O& C5 C9 z. v - /*#define EDMA3_DEBUG*/, u8 j/ H( g& k$ b O
' _6 H) }$ n( e P- #ifdef EDMA3_DEBUG" Z, L: ]7 C/ u# |8 D# C% E2 @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ y9 f/ L/ M- ~# R9 a w0 [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% j$ ]. u- q, b2 H; V% \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" W# W' F, m+ E5 y# h - #else
! D0 K6 F. {. ^0 |# l% F2 p' E - #define DMA_PRINTK( x... )/ w. C7 R+ D3 V p, d d3 s
- #define DMA_FN_IN
& W- Q1 T9 u* b0 q2 @ - #define DMA_FN_OUT1 f/ }0 l( D6 ]; K$ B |
- #endif# F" t. N9 U+ e& M
4 e! J( w/ x$ n# j! C' J+ G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# D' j# J. W) {* F! ?2 t - #define STATIC_SHIFT 3
* o/ R4 _' x- e3 e - #define TCINTEN_SHIFT 20
" g: a, ^, o9 y% x, V$ j1 e - #define ITCINTEN_SHIFT 210 x* j% j4 V0 K
- #define TCCHEN_SHIFT 22
4 t* M" H/ J/ j" }3 c - #define ITCCHEN_SHIFT 23
5 p4 j$ ^7 X( x' Q( i8 F% F n2 S/ [+ w
+ s" h) ] u. m$ i9 }+ E) \$ ~- static volatile int irqraised1 = 0;& o/ j" D# @1 i
- static volatile int irqraised2 = 0;
4 |/ Y% g5 \9 c) s7 s9 C - " q! ^8 V3 B0 r1 F" I* k" l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ A7 P8 N8 @ ]0 t/ e7 M: F( Q7 G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- a1 O/ \7 _2 L* O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! m- n: y; S2 P
o5 ~" g+ _- e3 h" a+ i- dma_addr_t dmaphyssrc1 = 0;
: r, E% n/ g S; @ - dma_addr_t dmaphyssrc2 = 0;. r- a. z. _- Q# i: [' j- u. U
- dma_addr_t dmaphysdest1 = 0; b5 M$ T& S4 w4 c! ~
- dma_addr_t dmaphysdest2 = 0;3 |5 V& p- d. m+ L9 O" E/ l
- & g; z6 E/ k* A" ^
- char *dmabufsrc1 = NULL;: j% n2 H& z* R. l: r0 V
- char *dmabufsrc2 = NULL;
' D! G2 W; v* z5 }5 q - char *dmabufdest1 = NULL;
. Q# g5 U$ M& I: ~% ~5 a' k, X) p - char *dmabufdest2 = NULL;
( h- f% C: W- g; {* ^$ w6 q - - W# F/ z0 I+ C
- static int acnt = 512;
$ H3 j% K' i2 [5 W( h. I - static int bcnt = 8;
3 H/ ~- }( E. y1 c6 f' { - static int ccnt = 8;. @# d6 }. k* @2 h1 M c1 I
- 1 d) I J+ v2 t' ]' V; P
- module_param(acnt, int, S_IRUGO);+ D# W# g; ]: c# p# D( t
- module_param(bcnt, int, S_IRUGO);/ e7 u6 ~# d4 b. K* l
- module_param(ccnt, int, S_IRUGO);
复制代码
* e& H1 N, C" t# V" D3 a: Z8 \. h9 ]. m2 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 T) r$ U6 p& R& l7 M/ ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# b- x8 g. o+ ?9 V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* m' [" u2 K b3 I# i6 X; l: Z- {* E- b! c5 o5 U* C
' {2 w- k. R8 T/ [) s
|
|