|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 k. j' X0 S7 u* q3 n7 g% m- [code]EDMA sample test application/ G3 o! k' Z# D3 {, N) X9 W: f
- /*
+ D5 z# z0 n# w - * edma_test.c& a) j! C4 A- j3 I2 A2 q2 t" t- T4 @
- *3 ^9 A% h e& u
- * brief EDMA3 Test Application9 k* p" D! Y! H( I1 G4 R( W2 B( ]
- *
$ B# r& K' ~( E5 g* D7 Q - * This file contains EDMA3 Test code.! {$ O$ ~; K) U1 T9 K+ X- z( ?( V
- *& M! R- l* V z8 ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; p- t" W' q: Y( G. m0 G1 V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 ]$ O$ Q# P2 }3 N. G - * TO CHANGE.$ P8 L% ?4 V% V h6 W& c. I+ g
- *
w4 b( p! a! B6 w4 w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 h5 x$ C9 W- w
- *) O+ Q- {0 H" x5 F+ |6 m
- * This program is free software; you can redistribute it and/or
/ }# \4 U, Q# P( y+ F - * modify it under the terms of the GNU General Public License as
- B/ R/ p! }/ O" N - * published by the Free Software Foundation version 2.. f& Z" h$ g; b) _
- *# Z8 W1 i, D; }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 a% \8 {6 J' R5 w9 y
- * kind, whether express or implied; without even the implied warranty n8 ?& w. ^* N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, }7 a N9 O- F& @5 i
- * GNU General Public License for more details.0 M) T+ E' C+ C0 B- h
- */
5 Y& H" q6 H2 J. a6 |2 _
+ v5 E% C4 w, q' T5 A9 w* o6 J- #include <linux/module.h>6 J4 u# m9 ~$ X! r1 H: H. ?
- #include <linux/init.h>2 [) Y2 w: H6 o
- #include <linux/errno.h>+ j5 G2 d0 x; F3 L: T! k& `
- #include <linux/types.h>& `' Z h; p8 ~# P5 A% g
- #include <linux/interrupt.h>
* h6 q3 D3 [) s - #include <asm/io.h>) Y4 D9 j, X; t0 t
- #include <linux/moduleparam.h>$ t- d( B; z8 J8 F7 o% y
- #include <linux/sysctl.h>" g$ }5 K, ]( R) O# X M8 i
- #include <linux/mm.h>+ [* x7 d3 q/ V |
- #include <linux/dma-mapping.h>& d# ^/ ]5 P( E" R7 E
- / T) M1 N* p' G& u4 H# f9 U
- #include <mach/memory.h>
) v: y* ?* Y' A - #include <mach/hardware.h>% B4 l n9 y* D: F+ D4 S+ O- j
- #include <mach/irqs.h>
+ L6 `3 J0 _! h - #include <asm/hardware/edma.h>
, {. U1 \% y4 \ f- p
, G4 D- L& w u7 p- #undef EDMA3_DEBUG
. Y* `3 L# x7 P0 S* t4 C - /*#define EDMA3_DEBUG*/
' A$ \0 j1 u4 ~& ~2 @6 G
3 J* c$ w! `& {3 t- #ifdef EDMA3_DEBUG
: \8 l: `3 O' c/ K% x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. q- S+ l( c" r. ]2 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 f- \) M1 i0 d) W& `. P# r* u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% q. t/ D" _6 W) M: P - #else& y: }, e0 B7 S
- #define DMA_PRINTK( x... )
3 F3 G, w2 |% z; a - #define DMA_FN_IN) T3 J+ L# n" s; |3 J
- #define DMA_FN_OUT7 H* _9 N0 o' O2 }3 H
- #endif
6 j4 A( @9 C/ ?. Y - o8 T. I( {$ Q/ w9 D6 p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 g8 Q+ b; W; Q/ N. t# `6 R
- #define STATIC_SHIFT 37 L& V- x, m3 p0 m' ]' G% K% M, D6 E
- #define TCINTEN_SHIFT 201 M/ T6 z {2 @ m8 ?$ J
- #define ITCINTEN_SHIFT 21
; U. D2 W: w: w0 v9 D7 v% _$ ] - #define TCCHEN_SHIFT 22
G. o, A+ q& L. W6 n: l. p - #define ITCCHEN_SHIFT 236 z) U5 `+ S4 l- r$ G" K( K, z
/ _% u8 d0 p) O6 B2 o- static volatile int irqraised1 = 0;
8 m5 t$ h- o, ~+ Z& H2 @ - static volatile int irqraised2 = 0;
: o5 u+ D) [; N/ J- y; O0 U& Z6 [% Z8 ]
! ?4 @# p* w8 ^- y( M# z8 W; O" l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: R% l% v) }9 Z/ f/ ~9 ?% h9 P" { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( l1 v6 ?. S) i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% p7 Z" a: u9 y2 E: b
/ q1 H% {9 r" N* d& a: a- dma_addr_t dmaphyssrc1 = 0;
6 J) p' ^0 D* m8 j$ r - dma_addr_t dmaphyssrc2 = 0;
7 q+ ]; O: _7 P4 W - dma_addr_t dmaphysdest1 = 0;
4 j: U9 t4 D0 w+ Q( L& T - dma_addr_t dmaphysdest2 = 0;
5 K0 V) r: m3 J - 6 M- X o6 v h- ]: B8 L7 J- H U/ r
- char *dmabufsrc1 = NULL;7 R5 N6 I1 d* ]$ H/ n
- char *dmabufsrc2 = NULL;
/ Q! T/ g1 m0 p9 ~ { - char *dmabufdest1 = NULL;
" W; i1 t, h x! s$ H- e2 f - char *dmabufdest2 = NULL;
$ H- w0 T9 Z/ N* X - + J7 f/ a8 H" t: Y+ ?9 \$ [
- static int acnt = 512;+ p' g: {4 X* i/ c, w
- static int bcnt = 8;! d: W- [ t% v Z4 q" h! L
- static int ccnt = 8;
/ d$ @1 s7 e) X$ m
! h$ P/ Y9 y6 f) V b+ A! F0 _- module_param(acnt, int, S_IRUGO);( H, Y7 C8 j; _7 [/ e2 H# D5 Z+ {$ v
- module_param(bcnt, int, S_IRUGO);
; p3 u4 f$ G2 V8 [% A - module_param(ccnt, int, S_IRUGO);
复制代码
0 F4 O r; P' N" E6 n
$ Y) t; y. c1 ^- |0 c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* h3 V/ Q( n1 |0 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' v! v* E- `. ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 k3 M6 G" @1 f% c0 l. ^+ m6 ]2 ]1 N# Y
4 e% R4 E+ ^3 G9 f) p6 ~( j3 L" S
|
|