|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & F7 x, s' v8 y) S3 F* c* I
- [code]EDMA sample test application+ R7 Z) _( q9 X. X3 S
- /*
4 o9 l: p8 ?: k& V* d# S/ U - * edma_test.c
8 O* h* q4 e7 D; [2 ]0 E - *
7 I: X" Z6 V! h, C" R4 E) R! ? - * brief EDMA3 Test Application7 j' G7 h0 d4 [# J! v( K
- *5 E, G, }% D" C" W
- * This file contains EDMA3 Test code.. E8 R# @. M. Q8 q$ c2 y0 }0 Y
- *. ?9 q. I. {- m7 p+ k9 z+ V. M* {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- q, s( S4 F7 T4 C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! @! B/ G {( ^/ e4 w5 f8 { - * TO CHANGE., A4 k+ ]3 j; e$ A9 P- r! K
- *( {: n0 o. B) S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 ` y- f3 s' Q5 b! r& M* ?
- *2 o) {0 u! U2 n8 Z8 v5 {! }) a
- * This program is free software; you can redistribute it and/or' H) k$ R1 ?4 O6 y
- * modify it under the terms of the GNU General Public License as
; e: U. w J# ^" v8 i0 _6 L1 l& f/ R - * published by the Free Software Foundation version 2.
, P+ i4 @+ M& }, E: Q/ ~ - *
* D7 N* l4 E) [& W0 j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: ^" Z% U' G9 S) F9 [$ ?4 L - * kind, whether express or implied; without even the implied warranty( J) O3 }5 r) _- t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 n9 j v' d& N! z3 P/ i- F - * GNU General Public License for more details." ^) l% i& x& l" h! B4 ^
- */
& S! n7 n2 r" R - 8 j/ x4 m( w% v& d+ c
- #include <linux/module.h>
) [4 o+ ~( b4 x( { - #include <linux/init.h>5 `0 G5 o" n9 H9 B, M# b( V; c
- #include <linux/errno.h>; q% f8 ^( F" s4 L8 d
- #include <linux/types.h>
: h6 b% Z, ~: `; k9 e1 p - #include <linux/interrupt.h>; [' i' m7 U0 E* w0 i
- #include <asm/io.h>
" D5 N, f1 ~* L* j; { - #include <linux/moduleparam.h>3 b4 r+ |( J/ N- R. @
- #include <linux/sysctl.h>3 Z+ K9 e1 d/ D
- #include <linux/mm.h>
) j8 v0 {' Y. N/ D- r* Y# O - #include <linux/dma-mapping.h>8 c0 h9 ^% N G4 N& _
% o- ?! l4 m* i) x- #include <mach/memory.h>" r3 C) y" t$ X u" K1 F
- #include <mach/hardware.h>
0 U+ D' C# O6 m8 _4 r' g' Y+ z% E - #include <mach/irqs.h>" V& v% ^2 O0 p
- #include <asm/hardware/edma.h>
5 k8 N. C0 ^% ~( F6 k - 4 n8 U" \- S! v% w& u
- #undef EDMA3_DEBUG' ?7 J& f8 Q" g( f) [* C% K/ c
- /*#define EDMA3_DEBUG*/7 w; X+ Q) ^& ]6 G9 q8 A" J* g
# e% @, t2 I" C- #ifdef EDMA3_DEBUG# C3 e7 [1 t# I# {+ T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
H8 P! F. Q# e/ F, t: d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! B$ P& W% s$ d( Y9 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 }3 d8 d# Q! Z; v% Z6 {( p1 @# [
- #else
1 _( w; S& i$ D - #define DMA_PRINTK( x... )* |' ?7 B" y9 i; Y
- #define DMA_FN_IN
. M+ A. f. W6 E" u, U# Q - #define DMA_FN_OUT
! L4 s; d. H* z/ l - #endif/ k O. z4 V: h
) g. q# a Q. ^' I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- s! ^1 v+ m& \7 e; O, Z - #define STATIC_SHIFT 3
6 o7 i, J* p# i/ m% A; P - #define TCINTEN_SHIFT 20
+ K! j6 j X/ z5 a" s - #define ITCINTEN_SHIFT 21
0 V( W8 a9 B( A: S! S - #define TCCHEN_SHIFT 22- H" o; p! z6 z5 @' i5 d
- #define ITCCHEN_SHIFT 23
h2 x3 `; `0 ?1 R8 B! E
1 O2 X- H) B' Q3 j2 B0 X2 ]0 i- static volatile int irqraised1 = 0;
. U( A* ]6 }; s$ X - static volatile int irqraised2 = 0;( H2 z7 w$ q( u% z! H
: p8 a! T# l1 E8 c6 x% J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% [/ d2 n* L. q6 t, _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) V. n) M1 L& A6 V; r; j* q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 g+ b* y; w# G3 }
- , t1 O, X d+ b, \4 c
- dma_addr_t dmaphyssrc1 = 0;
1 z$ I* T# E7 G0 Y: w: M - dma_addr_t dmaphyssrc2 = 0;
! Z+ [8 K. |1 |/ @; s i1 Y6 T. v# L8 b - dma_addr_t dmaphysdest1 = 0;: ^8 \1 L' H: q3 t/ P7 \) ?
- dma_addr_t dmaphysdest2 = 0;
H0 _, @% z7 G& t1 J - , I) M1 m3 r* j' I. v+ ^7 t
- char *dmabufsrc1 = NULL;
3 ?7 D$ _4 ^" p& y - char *dmabufsrc2 = NULL;
: g \8 K; v: r9 v7 U) k5 f, l - char *dmabufdest1 = NULL;7 f4 A6 M& H- K. f, B
- char *dmabufdest2 = NULL;
. q4 B ^2 {1 H: u% H ~
* n: B" S- _- v6 v7 O4 D! C4 q/ u- static int acnt = 512;
; |- B" ~5 O! m3 m# v1 s! g( g - static int bcnt = 8;9 @ ]! N2 d; V2 v- y
- static int ccnt = 8;
% a- k% p, O5 ^7 H Z - ( a6 U; _, W2 ~0 u* V( ]+ Q7 b
- module_param(acnt, int, S_IRUGO);
* `4 X* |& e8 U: [9 E& x - module_param(bcnt, int, S_IRUGO);
/ n1 {5 O" i6 W3 R$ d: m1 g8 E - module_param(ccnt, int, S_IRUGO);
复制代码 ( X& C2 H( J$ s$ d, U: L9 _4 m/ d
& U1 e; O* S8 s9 ~8 j& ^: Y; }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ @! S6 ~& v3 |0 s% T) H' e% B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 U7 i! S* B+ V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
e1 z0 U+ e @- U9 i
^0 z, S& n! b3 X6 F! ]. F0 C* B( y$ \4 `3 _ i' h$ b7 x. x
|
|