|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. d4 k, l6 [( d- [code]EDMA sample test application k, q5 u# e, c0 Q
- /*1 v+ u. z3 H# |4 { ?0 ]
- * edma_test.c1 Q/ W7 w5 N$ `/ S( Y7 H1 d
- *
) [: c! ~3 K5 p0 d" T1 g6 m, { - * brief EDMA3 Test Application
" t% R: t ?2 m - *
9 ?% ~7 m5 ?# d+ S6 c- C - * This file contains EDMA3 Test code.
$ X6 ]6 d* d, Z7 y# d+ @ - *5 b! _% }) k6 J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: p$ c3 b F' A) \& [7 ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 O1 ?/ G6 W9 I; b0 q+ h
- * TO CHANGE.
@: P8 J9 h, n - *
: w& F- _4 t" ], R2 `3 ]* B6 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 S- y }4 N+ B" f! D+ M: r* Q - ** {& w( b( ~. s: ~ f
- * This program is free software; you can redistribute it and/or3 u/ b) C- a+ Z% O
- * modify it under the terms of the GNU General Public License as
( J( o' M$ ?8 r' o1 r. L5 ` - * published by the Free Software Foundation version 2.2 ?. s, K( q5 T5 U$ j
- *5 _( Z R2 D. e' v0 v( Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* G |! n8 Y5 [
- * kind, whether express or implied; without even the implied warranty
7 N4 y7 H3 q& v/ n2 n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ _# I3 y; c9 c4 p
- * GNU General Public License for more details.- V, e& n5 r! t* i( y$ k
- */
/ B" Q- }# s" L - 5 t5 _) j0 O6 Y. q: {1 a
- #include <linux/module.h>- \8 k4 K" i: N; s8 i, V$ a
- #include <linux/init.h>4 y; ~7 C' X( U: i8 H8 `: A
- #include <linux/errno.h>
4 }9 P* v( k- `) f5 H3 @, I, A - #include <linux/types.h>6 y- _2 t2 j' u* g& I
- #include <linux/interrupt.h>
* f9 v* ~" C: O# ?& f- u& B' L2 G - #include <asm/io.h>$ o7 Z, ?) H& N1 {% `! g6 V# Q+ [
- #include <linux/moduleparam.h>
- g: W% ` J# { f( X0 S4 K - #include <linux/sysctl.h>( x1 z; c- D" i1 M% k8 [4 o( C
- #include <linux/mm.h>8 r8 ~. H# w, k8 q
- #include <linux/dma-mapping.h>
" {: q: t( D. a5 q7 \* K& C
4 K# Q. b' U l2 l- #include <mach/memory.h>2 O) A8 V3 {: a4 e( y5 @5 N
- #include <mach/hardware.h>
( z# w$ G5 S% L% d - #include <mach/irqs.h>' Q: W2 r2 r" K# \% b8 _; Y0 O
- #include <asm/hardware/edma.h>
$ |- ?6 `+ A9 u
6 C9 q' d: Q9 q8 Y- #undef EDMA3_DEBUG
: [, ^/ P6 O: n% I7 o - /*#define EDMA3_DEBUG*/3 y9 w1 d2 w; f" B9 l
, X. w! D' N+ X) x& y3 j) A- #ifdef EDMA3_DEBUG( y. e* [5 _- K) N6 l! M: ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 J; D9 P8 D4 _6 w a, E2 I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: Q- \6 J. o# J, p0 J0 z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* O' d( B' o; d* `9 G; n' a7 J9 x
- #else
2 A: @+ \/ @2 u" K - #define DMA_PRINTK( x... )
; l* Q: {% f0 _6 c3 \ - #define DMA_FN_IN
6 s2 P- a8 B r' h) |$ n - #define DMA_FN_OUT3 V1 x |7 G( c9 }, S( a! n
- #endif
) \- }* w7 D; J& b' h8 z+ C
, T; H9 S. K* j: A1 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) E5 ` g2 k# Y& n! P+ y - #define STATIC_SHIFT 3; y9 X" [8 l& x2 h5 L- ~/ J- o( w
- #define TCINTEN_SHIFT 209 `& M& Y9 G( N- c$ P. y. J# Y6 i" R
- #define ITCINTEN_SHIFT 21
# t! b5 h+ f: D, C - #define TCCHEN_SHIFT 22
1 B' B6 x" T6 [ _& f5 W - #define ITCCHEN_SHIFT 235 K; X6 {0 y- b" |& o7 a. ]
- ) G" J- [! n4 j A# z b! z! Q
- static volatile int irqraised1 = 0;$ v' e$ p& \+ B+ L' z) \
- static volatile int irqraised2 = 0;( l) r0 S& n" }2 A- }
- }0 {* A0 }) J; }/ [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 b1 g) U) g* w# u+ y( a5 t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 [2 N+ v8 `, H8 A" A$ w* ^; Y8 D/ Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 h- t/ o% X! r: B* B( k - ' h- X' T& j5 |: o
- dma_addr_t dmaphyssrc1 = 0;: [* t# r1 B6 H. T/ m5 L3 ~
- dma_addr_t dmaphyssrc2 = 0;
u1 ^' s. w0 ? - dma_addr_t dmaphysdest1 = 0;
* H; d, [6 Q% L/ S - dma_addr_t dmaphysdest2 = 0;
& `7 ~6 R6 ]; L( X) O2 A - # h, @* T0 `6 r
- char *dmabufsrc1 = NULL;
* v% U) I h$ g8 i9 V1 X/ p - char *dmabufsrc2 = NULL;. |% a. I) D, U' F
- char *dmabufdest1 = NULL;
6 V! s" W0 r% |% _ - char *dmabufdest2 = NULL;
* ~6 v8 c* c, P k4 ?7 A D+ e" d9 i
6 J' D1 f" Q8 G9 Z" ?# ~- static int acnt = 512;
& C, `; O6 W1 `. b - static int bcnt = 8;* t0 B% \ R1 u9 s" k( U
- static int ccnt = 8;. W: a2 K+ [4 W" _+ I$ B; g$ E: F0 O
* q$ l( I# U4 X8 O1 f, ?5 K- module_param(acnt, int, S_IRUGO);; T6 z* }' m( w2 s
- module_param(bcnt, int, S_IRUGO);) {5 [8 s# _3 }) Y: L4 M
- module_param(ccnt, int, S_IRUGO);
复制代码
( V8 c" a" W% L. t( r
% y, @4 K' q; e3 X7 F2 j4 ?: [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& Y# x, c! \, n: larm-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( a" R; J' @4 v* G' g0 y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( \( B% @( ]+ t* \" N" z) u8 {: f9 ^4 s9 \: R; n
! Q4 m8 _+ Q. Q7 q$ X |
|