|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " m8 H: }; ?; l0 A# B. P
- [code]EDMA sample test application0 W, Z" {/ b- c3 D
- /*
& ~- U# P" v( _0 {& y# [ - * edma_test.c2 X+ k1 e' A% S
- *
5 b" K# z4 @; v - * brief EDMA3 Test Application4 q7 m# P" g1 Q. ^7 y5 h
- *
, ] z. C* _8 W1 U+ c& d! F; I8 B - * This file contains EDMA3 Test code.0 |8 Z: o, A1 v
- *
1 I. @. d( s$ \% w5 ?+ g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 z% d( |$ Z& p5 a/ n1 e& w) c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( d& ?) C1 y& j" p$ _6 `1 J& z! j - * TO CHANGE. }. k9 v7 a. Z5 X, J4 n
- *
0 v, m7 S; C7 ~! ?+ g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 S2 f9 y) s3 A6 @( G# I. K - *& y- ]3 i/ u/ m. Z3 ]4 h r6 W9 A
- * This program is free software; you can redistribute it and/or
% Q% u2 [- k" N& | p9 ~ - * modify it under the terms of the GNU General Public License as
% B0 g0 l- l, q8 Z - * published by the Free Software Foundation version 2.
1 `5 w) ^+ k( i# t - ** g; k5 V9 f u! g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 t8 t$ A3 b8 j1 v6 s, H, [
- * kind, whether express or implied; without even the implied warranty
. ?' t# H; i$ N& [+ H: S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* l; s; `; d. A# o# {
- * GNU General Public License for more details., i8 \+ q2 f% H; w- y( q& w
- */
6 u; B& i6 u/ R5 f& z; ^+ t2 J
: p6 m# w. v9 J; p# f& p4 E- #include <linux/module.h>
. j6 |5 q) J! I9 Q1 x9 j - #include <linux/init.h>
$ X2 k5 G: M% O% ] - #include <linux/errno.h> v; j. l) q+ @$ e% K
- #include <linux/types.h>
I9 b5 o4 G. L, i+ T1 D7 v m, [ - #include <linux/interrupt.h>
& o: A ~* v& F* M6 v% t - #include <asm/io.h>5 M4 ^: T+ K' w1 O
- #include <linux/moduleparam.h># H# l$ A+ N$ t$ o* M+ b
- #include <linux/sysctl.h>0 F, ^( t! P! D, k
- #include <linux/mm.h>
+ m6 q1 U* w7 o1 b" `, t - #include <linux/dma-mapping.h>
3 C# I* @- g% _/ v3 U% ] - ; G4 u2 T- f7 M4 M7 e' K
- #include <mach/memory.h>
, Y. h. d4 d& Y: Z - #include <mach/hardware.h>
E, J5 X; p; Y" k& D - #include <mach/irqs.h>
7 _0 I2 V# o% N2 o* u - #include <asm/hardware/edma.h>/ D5 e: o$ D/ _' Y2 i! L t
( j( F1 r: `9 l) I- #undef EDMA3_DEBUG& }$ h6 q, G. I: ^+ t
- /*#define EDMA3_DEBUG*/
+ N2 C7 \( e; N8 a2 h0 w5 } - 1 r/ h- \) I6 m- D; {
- #ifdef EDMA3_DEBUG
9 u' T1 A+ K0 I0 A( H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ q* C) X3 T; e; w4 i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# `( J' Y& h0 \2 X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 M; B2 Y0 g2 h% j
- #else0 S6 \' E9 m. v# Q1 M7 J4 B/ D7 t
- #define DMA_PRINTK( x... )9 c+ ~( I& ?5 c6 n
- #define DMA_FN_IN* D9 ]+ F6 }, O8 l
- #define DMA_FN_OUT) N7 b y$ C! \ j1 \$ p7 r
- #endif
. y' z0 t# G; r4 | V; ~" n - $ X0 d/ F4 q. Y) a* H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); c8 S1 ]4 T1 l$ _3 A. d
- #define STATIC_SHIFT 3
! g: \8 l! h5 f* N3 h - #define TCINTEN_SHIFT 208 H) K% v" I# y
- #define ITCINTEN_SHIFT 212 a; R2 ~+ H+ X3 o( [6 o
- #define TCCHEN_SHIFT 22
6 X* A* Y7 n1 R/ b! p' Y y - #define ITCCHEN_SHIFT 23- h9 d* S" {" K6 e/ ^
) A* l9 t. b3 @3 k. p3 ?. r3 Z- static volatile int irqraised1 = 0;& M7 V( @6 \3 t9 C
- static volatile int irqraised2 = 0;! t- O6 N( c4 z. r
6 Q# d% P. r$ T$ n+ h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. }+ V: S' R& L3 v# |( b, b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 r h2 v; z" i4 V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# l& e v B# T3 C
- 8 X* a& M) J4 C5 G2 N
- dma_addr_t dmaphyssrc1 = 0;
3 ]& p8 x/ F8 S" y - dma_addr_t dmaphyssrc2 = 0;
5 D2 q+ y6 Y5 K - dma_addr_t dmaphysdest1 = 0;
" f$ d o' r. o4 u - dma_addr_t dmaphysdest2 = 0;, I& F) p+ u1 J* m" Z" {
- 2 ^3 l" A/ U6 R2 Z& W) r
- char *dmabufsrc1 = NULL;
# y4 P8 H, x7 c# O: l; F, y3 K - char *dmabufsrc2 = NULL;
5 w: g* ?( _0 J- K# `. N' u5 i# \ f - char *dmabufdest1 = NULL;' g/ A. k+ k, A( i7 T T3 q, n+ _
- char *dmabufdest2 = NULL;
2 x! B5 V) N1 ~" L6 M* K+ ?$ E+ V) n
' r( `. e% a$ r- static int acnt = 512;
, C% F+ z- N) I" Y) {: I3 Q2 [ - static int bcnt = 8;
, E9 [ b1 u% d% v& ~ - static int ccnt = 8;0 d9 W \6 |' D2 R4 w+ D: @
- 3 R j0 O/ o2 {. t
- module_param(acnt, int, S_IRUGO);
, G# S/ Z- Q& m T+ L - module_param(bcnt, int, S_IRUGO);
+ K% B9 l. O1 U) s) M - module_param(ccnt, int, S_IRUGO);
复制代码 + B% D+ S2 q6 A: {
4 q/ Q$ O' O. j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ^ u: ?+ i+ v" S+ Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' J! U% b1 ^: q' u2 l4 T% B" D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. p/ e* B R7 N/ h6 l3 Q
0 Y0 F1 Q, p. o: t3 v& v3 G5 {5 r# {# _( W
|
|