|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& T* P$ U7 l4 t0 G; L A) V9 r8 a7 C- [code]EDMA sample test application* D& e* a; n \% K) I. i+ N1 _/ x( I
- /*; C, @! d( K4 L; S: }+ J9 o, q
- * edma_test.c
# q/ A8 `2 e N4 d - *
/ F0 F& j. \# T6 s& g( g/ P5 K- b - * brief EDMA3 Test Application8 x- Q7 ^8 _2 Z5 y- h
- *3 @4 P0 s/ }$ p- z R
- * This file contains EDMA3 Test code.0 n; z) X- R5 \8 ~, E' b9 Y2 d/ }' U
- *
8 z' i$ ~4 Q- e/ l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. G' T3 b6 w: X @* p$ J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" Y. q+ Z+ x) f' V" ?3 u# P
- * TO CHANGE.; L( l* C2 U) q: V! H) J' c% v
- *3 V/ |4 w" x( X$ n) C' l3 B2 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; F- f4 Y& O C. C' q: ^/ n7 c - *
" v) S: J. o" f. ], n - * This program is free software; you can redistribute it and/or
8 e6 j& z4 V" e2 o* R - * modify it under the terms of the GNU General Public License as2 o/ M; N$ q! d0 q" a5 R
- * published by the Free Software Foundation version 2.
/ m1 D/ E# Q+ N. r0 z& z: A - *
- `, c! O9 c4 j) i* w5 q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 c" J% [7 U- `+ W
- * kind, whether express or implied; without even the implied warranty
; N! c: a, H" P" z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; P$ u; p; L- V# q3 k/ N - * GNU General Public License for more details.
4 X8 O3 L, I" ^4 ^, c4 i: T( |" u - */
5 ^6 O+ G3 q1 }" V1 G3 y0 M2 o
. B1 o; r$ a" K6 p- #include <linux/module.h>- L4 [9 R, ]/ ?7 e
- #include <linux/init.h>
* ^) @1 y3 N- n7 U8 N, U - #include <linux/errno.h>) e8 e% d7 _1 L. T! K0 h
- #include <linux/types.h>
# S/ N: P$ H+ o7 J# s - #include <linux/interrupt.h>5 s' J3 W. p L
- #include <asm/io.h>
9 A7 B+ \3 C* L5 `( }3 x' F2 o8 a - #include <linux/moduleparam.h>
# g) j, e7 S/ y8 n - #include <linux/sysctl.h>, x5 B! w* M& }/ t
- #include <linux/mm.h>
1 t( ~! s& H9 P" O5 L2 I - #include <linux/dma-mapping.h>& s3 S1 w; ~ c; ~- f, r
4 e6 ^4 s, d+ y k- S+ U6 b" I- #include <mach/memory.h>) g( Y3 i8 Y7 u2 l' {1 g
- #include <mach/hardware.h>
@0 w- \; h( {) }6 U - #include <mach/irqs.h>" \ ?. ~" S- T% Z
- #include <asm/hardware/edma.h>* C% K% }6 x& ~: _ F" W* _
- 1 ~, ~0 t& k) F1 R! F/ {
- #undef EDMA3_DEBUG
# C& L; d& r' d8 `4 ]4 k2 M - /*#define EDMA3_DEBUG*/' i- k u$ P& H6 d; @
- W. T7 { @- d4 M% J, y; M
- #ifdef EDMA3_DEBUG
4 G& `7 w1 z, C) L) M& E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- T5 q" W1 Z5 _8 z0 c; y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
R- p/ \3 Y; J7 I1 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" S' `2 ?' u1 p5 a, ]+ n$ Q
- #else
* I, Z: q% z5 d3 L: s - #define DMA_PRINTK( x... )+ v7 X; j' {7 G6 A: n
- #define DMA_FN_IN
4 {6 {/ t/ Y' U' I( X( P/ Y - #define DMA_FN_OUT
F6 p1 e( n3 }. k/ m% X - #endif2 L# z5 x. U0 x* a5 s' }+ ]+ e
* O* V, a( J, u$ m# F: k( Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 x" U/ ?) x, ?7 d7 }4 v. ~
- #define STATIC_SHIFT 3) `1 ] U1 |( K5 x
- #define TCINTEN_SHIFT 20; c" R& A) |* @( P5 t5 v
- #define ITCINTEN_SHIFT 21
1 j7 u) U. z8 l0 [0 ~- S6 U' Q% ^% k6 M - #define TCCHEN_SHIFT 225 j+ g' |9 F, I. @/ x% j0 a
- #define ITCCHEN_SHIFT 237 B4 K* j2 w) |2 g7 P
- / r5 d7 {1 E8 N. l" W
- static volatile int irqraised1 = 0;7 I! @" C; j9 Z/ A' {* M
- static volatile int irqraised2 = 0;) r) @7 h* `2 _/ M
- 3 _" o4 r& H( N! u2 X; n% |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 I2 |3 x2 ^1 D- P. p% H" M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& N* h& t$ d+ Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 J1 }8 J! s8 D0 r& L
S8 |! ~7 t: i0 t1 G( V' o- dma_addr_t dmaphyssrc1 = 0;
) ]+ F" a) h5 p5 [; S! M - dma_addr_t dmaphyssrc2 = 0;# k/ ]- H' s( u
- dma_addr_t dmaphysdest1 = 0;( L& K5 \, a' q2 x; y
- dma_addr_t dmaphysdest2 = 0;
$ T3 B1 B. E4 g4 [, t3 D% I - 3 m j1 X3 y' r
- char *dmabufsrc1 = NULL;
2 G' m# J% T" C# z" [* \# e - char *dmabufsrc2 = NULL;4 Z9 ^( m9 F- m
- char *dmabufdest1 = NULL;
. [; w5 G4 [- R( g - char *dmabufdest2 = NULL;
4 X2 ^5 O" L2 `0 t* e2 q
, {7 {0 g4 l0 U3 T% ?- static int acnt = 512;0 I4 v" E* s, V q: }
- static int bcnt = 8;4 L( r. y( X$ F6 h
- static int ccnt = 8;
, F9 ?- Z' L% P4 u# h% [$ X - # t* \% m" ^2 C- g3 {" Y
- module_param(acnt, int, S_IRUGO);! r$ s# G: z7 Q! {
- module_param(bcnt, int, S_IRUGO);, L5 h1 W6 c/ t4 G5 B1 _& ^- J
- module_param(ccnt, int, S_IRUGO);
复制代码
7 d/ q6 H1 k: I! `& M, t! W! ~& w- z0 y# M/ X! c& H, ^4 \# }" P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) p, q3 v( m' Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 |% r" _# o3 V3 P6 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: C( ?; ~. m0 ?3 z( E7 U
% C, W- ^( h4 n x3 k( p" A9 Y' ]) g, C
|
|