|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
W2 {& N/ z# B- [code]EDMA sample test application- s; ]; I" G, Z$ _
- /*, k8 |, b7 {# G# k1 N+ ~* T
- * edma_test.c
! S- t; \! m/ y/ u4 A; P - *2 o9 S |+ ]& K6 \. @6 E6 y; x# u
- * brief EDMA3 Test Application
7 A9 J/ c; D0 F' o1 c - *
0 Y/ n3 M7 ^% W4 i* T4 L+ x( C! y% c - * This file contains EDMA3 Test code.
# r; T& U9 n* n$ f" w6 F3 T3 r - */ d+ W& G6 M8 N( Y3 {! j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: q8 a. H% e( x# b; y5 a; _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: s$ q; R2 B" b) d, | - * TO CHANGE.
( u/ b6 k* @# N2 b - *+ N- n$ Q" z' [: M9 G; ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# d5 O: Q6 u1 x, v
- *
6 E# w& k. I# G - * This program is free software; you can redistribute it and/or
8 a; F" C- B: P, V+ f5 D - * modify it under the terms of the GNU General Public License as
# o) h9 M3 T& ]: ^7 T8 j - * published by the Free Software Foundation version 2.$ G0 ]5 G4 D% L$ P' ~
- *& A1 I* c( {" V5 R; Z5 R' I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- B" X2 P, V0 g7 W6 |4 V- r - * kind, whether express or implied; without even the implied warranty; x; x+ r8 O: [) i* {6 x$ v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% @& m6 w) ?1 e& c" _0 s - * GNU General Public License for more details.
3 R* o b3 @) t) T' d+ N- H2 _! g - */- W2 b8 X* [$ P9 e* M
- + t; _* [- e8 W; x
- #include <linux/module.h>
' D' d' j6 F" p6 d - #include <linux/init.h>, v6 {8 q( c1 r5 z# o
- #include <linux/errno.h>7 z6 W5 }3 L0 Q
- #include <linux/types.h>" w2 V+ F( p# z2 P
- #include <linux/interrupt.h>
1 e7 E4 a _: m6 b, g - #include <asm/io.h>
5 J. N% d( j" N8 L. o" S% M - #include <linux/moduleparam.h>
$ i0 @2 ~1 h* A8 p - #include <linux/sysctl.h>3 @4 t0 _( X3 K; \2 N
- #include <linux/mm.h>" g2 R5 h7 `' L, \9 O: M8 }
- #include <linux/dma-mapping.h>! U8 e* p9 k5 y& {4 p* |% m
: i; `+ K: ^8 a# u/ y9 V- #include <mach/memory.h>+ a4 t( J# k) g6 S9 L8 V
- #include <mach/hardware.h>
* e! |1 t& r W/ N8 g - #include <mach/irqs.h>
4 ~$ ~# e C7 Q* {+ q; c: f0 X - #include <asm/hardware/edma.h>
6 v% ^1 ^! K8 s% b/ ~8 R3 R: F% }
L: o! k. m% g$ e/ U- #undef EDMA3_DEBUG* a6 m6 W! p* N+ X
- /*#define EDMA3_DEBUG*/
. i# C% R6 ?( q" C6 E - + i0 D0 K, w7 Y& C
- #ifdef EDMA3_DEBUG
4 A5 ]; N" b! O% V! o/ S% G5 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% N9 T5 n, o# G) L# a3 k( Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& i9 N4 t9 F6 ^1 y( X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) U, w$ f5 L( W% o2 A
- #else
% L: F5 T. I B7 z) v - #define DMA_PRINTK( x... )0 Y) y1 V& d6 d/ ?' R
- #define DMA_FN_IN
! I8 Y4 k) O$ R* @ - #define DMA_FN_OUT' i+ r. H: y- l0 j6 d" O
- #endif4 X- _7 s) ]+ `% b S; v7 W9 R
3 [$ a8 o' `3 S! a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. ]# l/ n2 }3 D$ Z, S - #define STATIC_SHIFT 3" R7 c% X/ y! b; [- R
- #define TCINTEN_SHIFT 20
5 \- }2 Y1 }" F8 k# r - #define ITCINTEN_SHIFT 21
4 ~4 M5 x; b7 g; X- V1 g& a - #define TCCHEN_SHIFT 220 H7 [: e) I+ u/ V& X3 m
- #define ITCCHEN_SHIFT 238 d9 A2 j3 h/ _
9 X3 @4 j/ W: i: o5 X1 l- static volatile int irqraised1 = 0;1 m; l0 k6 W9 d2 J# L7 B1 t
- static volatile int irqraised2 = 0;
" \6 P' K+ K: v% J+ n/ |. Z
9 W9 Z" f3 y+ b/ c R" z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 _ ]* c+ x% S, w% K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% {8 \3 d* a7 u0 V, t" O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 k' N. D& f3 N% D5 M - # _1 T; x- t' X0 a9 z
- dma_addr_t dmaphyssrc1 = 0;- w( E8 i0 E% t% F% K7 G: T A
- dma_addr_t dmaphyssrc2 = 0;- g+ I( M& G' k- Y" y; T8 y. b
- dma_addr_t dmaphysdest1 = 0;- ]1 j8 J7 G( o+ Z a
- dma_addr_t dmaphysdest2 = 0;7 W3 k: b1 s* j% ~' W8 R
- , W7 z( {" ^1 k n$ r
- char *dmabufsrc1 = NULL;
9 k2 j" s2 e. q- ?$ j6 r2 ? - char *dmabufsrc2 = NULL;
. U& v" c' l, ?2 R* c+ j( s* C - char *dmabufdest1 = NULL;
0 V7 b1 h) N1 C - char *dmabufdest2 = NULL;$ O0 H/ E+ S0 F# X
- ' D& A% x h. T$ A( l( u% D
- static int acnt = 512;
' S t% }; r' `& y! G - static int bcnt = 8;# G' o5 d! {; X9 Q) D
- static int ccnt = 8;7 I2 q7 G1 Y1 Y
- $ [# D3 s4 \: H1 d4 i
- module_param(acnt, int, S_IRUGO);
: @* t ]1 u5 N( V - module_param(bcnt, int, S_IRUGO);
: q7 b& a3 H4 N; r* R! T - module_param(ccnt, int, S_IRUGO);
复制代码
3 Y- Z j1 m# V o4 W" G1 R% ?& y; G! C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 Y: t" X R3 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 `4 i8 K1 v* Z! w" Z% t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) y* w7 a& c6 x1 L3 ?' _% }6 g; g
. }! e6 T# O5 N) `# V+ |
6 z3 Z7 G' D7 U2 X ~# n. h |
|