|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 v$ b0 G7 j( N
- [code]EDMA sample test application) I' Z( D" l/ D) J. w7 R! } f# D
- /*
. T* O" A g( h# u e- W - * edma_test.c1 g9 M4 ~( n* d) K
- *6 B; O8 W- i) C W4 u: N
- * brief EDMA3 Test Application
- j- ` R+ k* f( M- H - *
. n" X$ R4 G0 ~: {" A$ f - * This file contains EDMA3 Test code.
) [4 M9 W3 U7 Q - *2 j1 [) j% q! ?8 W9 p0 U, Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 I+ D$ V( e! X1 A( _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: ^# H$ w: }6 c - * TO CHANGE.7 X, ~: @- d( x- l- r9 r- i. V* _
- *; G) v4 d/ y: |& }+ T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! V! |1 L% ?- Z7 @/ [5 x/ w& u - *1 ?5 z/ R- m0 E% V& F& I
- * This program is free software; you can redistribute it and/or* H' q1 y. m3 t8 l2 B
- * modify it under the terms of the GNU General Public License as
1 o2 O9 I" @6 W6 } - * published by the Free Software Foundation version 2.
! \8 Y. T. V/ K4 V+ k - *1 c y: a4 G) o4 B" _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- j% O* @; d0 T* {5 x+ ?2 I4 L
- * kind, whether express or implied; without even the implied warranty' a3 `; B" g2 s& \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 z8 Q& C3 ^3 A6 ^( U - * GNU General Public License for more details. C5 g8 M3 P' y' Y
- */! M6 L8 @. f( W/ o+ B
; h0 B& v. V1 Q. b' m$ h# X. s- #include <linux/module.h>( Y$ p( o4 p( ~
- #include <linux/init.h>! W. `; ]1 Q: h% {- \
- #include <linux/errno.h>, O6 Q, f$ V5 R7 R# Z" q" d# N
- #include <linux/types.h>% [/ v1 { @. A, J" H# J; E% u+ p
- #include <linux/interrupt.h>
" d+ f$ d; u2 A ` - #include <asm/io.h>) \9 k7 _. o/ `8 l# S
- #include <linux/moduleparam.h>
9 j2 r0 e* r. o, J/ @; W - #include <linux/sysctl.h># f. y2 [9 c6 d3 h m! {: M4 I
- #include <linux/mm.h>' a4 ?6 k: n/ Z; G* s" T$ o
- #include <linux/dma-mapping.h>
" F" i9 s+ V; n. r6 s7 G
1 O& t! H# }, K# k- #include <mach/memory.h>" Y; b% c$ G2 A7 Y5 {& N
- #include <mach/hardware.h>
8 [* v* _5 F- R4 g' C - #include <mach/irqs.h>
, x+ M t7 r: c# P; e7 ] - #include <asm/hardware/edma.h>0 w; f; Y# X$ S
7 j/ ]$ ]# `7 A) K2 _- #undef EDMA3_DEBUG
! c- c9 D% ~! ]* q; l' v0 C - /*#define EDMA3_DEBUG*/
) W. W( ]3 n; t3 K0 @, H2 r - 0 p/ B% d/ S& j/ o
- #ifdef EDMA3_DEBUG
# ]) z7 ]: v6 e5 _2 N% j+ j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" `2 ?+ g; j" |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- p3 E- Z/ ^, Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% K z" k0 f9 m( {) I" _4 T8 l - #else. S/ A' s. Z3 `# V/ J
- #define DMA_PRINTK( x... )
* w1 x) L; L9 a/ u7 g9 { - #define DMA_FN_IN& D" d& p5 w" m9 Q" @" O& i
- #define DMA_FN_OUT7 |0 ] p6 q. ]8 m4 u0 X( z
- #endif
8 e- n8 `$ ?4 j. f4 C
' |/ J: i0 ?+ i' D* D) d }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& r9 q$ M6 x% q$ W
- #define STATIC_SHIFT 3
+ t4 i( v7 p% K! H# v - #define TCINTEN_SHIFT 20
$ n& i( v# g) X$ { - #define ITCINTEN_SHIFT 21
8 V p. Q; B2 v, P) ~; ^5 V4 r' f0 j6 F - #define TCCHEN_SHIFT 22
" u! A& t' o/ D( U! C; I0 Q - #define ITCCHEN_SHIFT 23
7 f3 @& O( g$ H2 `* |
, k3 ^) f: c; a/ W) x/ ~% i- static volatile int irqraised1 = 0;
2 h' N: R7 y6 J4 u* C; h4 S. \ - static volatile int irqraised2 = 0; ` t4 v4 \" `# v3 c! L' {
- . L6 o9 Y4 ]+ V6 l. _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# w2 |" @( z6 {+ D# u: E7 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* o9 x9 `' [$ O5 W5 L" r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); F1 y5 c5 v; A6 A( P# B& Z8 m
# O5 \ Z( ?- t- dma_addr_t dmaphyssrc1 = 0;
" f. r& ]& @; M$ g& Y4 U - dma_addr_t dmaphyssrc2 = 0;* j6 _2 b) j: S
- dma_addr_t dmaphysdest1 = 0;
1 ~6 E/ m+ K5 ^, K; B2 n! ~ - dma_addr_t dmaphysdest2 = 0;
$ O; P: p$ P& S, A4 d
$ s% }6 P8 X1 d% M- [9 E# N- char *dmabufsrc1 = NULL;: g2 n0 L! F* h6 U( P9 B; M
- char *dmabufsrc2 = NULL;
7 @& L/ i0 ]- k' I( ? - char *dmabufdest1 = NULL;' ~# L1 n- M7 }* q8 @/ h
- char *dmabufdest2 = NULL;+ G7 u: L4 E5 z/ y0 s9 o
: B7 G! \0 X( }% }3 {$ ^- static int acnt = 512;
0 \" _- z+ z' \3 Y - static int bcnt = 8;
% ^) C. h$ D* x; t3 G [: J0 _6 z - static int ccnt = 8;/ v$ N3 y% N4 O/ c. l
' D/ G' l$ F. u1 M1 i, J7 Z/ ?- module_param(acnt, int, S_IRUGO);, g' T( x9 C& L
- module_param(bcnt, int, S_IRUGO);9 T' L4 ?) }/ E) n. {0 Y
- module_param(ccnt, int, S_IRUGO);
复制代码 V: ]2 k/ \5 U
; r0 W Y! _3 q6 W- p% D6 d2 `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 `1 J% d$ I5 U1 T) f) o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 I, ^. Q, M% _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% }" Y$ b" e" a( @% H9 i) {
% z0 w1 D/ H v# O1 `. S3 u( r( `5 R6 [6 m
|
|