|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 v9 j; i) C( W* v
- [code]EDMA sample test application$ J, _% k& _" f. F
- /*
$ l' `. X! W. @+ F4 `3 N - * edma_test.c. z) O$ E W$ q' T# } E W Q
- *+ _. \0 R% _8 }# D; l) o8 o
- * brief EDMA3 Test Application5 Z: i3 a2 q( t( z7 e+ R6 R- _( ]
- *- a( [" a7 h; o1 O1 }3 n
- * This file contains EDMA3 Test code.$ K" T$ U( m+ y Q
- ** h& e3 A9 U5 T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 |: p7 u! _1 w: n# |' |3 Q+ u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ E) c) \1 o, E0 y' r - * TO CHANGE.6 L, J }$ b1 \- ^, d
- *
2 d: Q' V) F2 F w5 M( x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; k: Z( C' u# r: \/ u% Y% X, y5 Z" C
- *' J3 h K; Y( N& C8 X, c" c
- * This program is free software; you can redistribute it and/or5 W L3 U; x, U
- * modify it under the terms of the GNU General Public License as
4 d! J. e; _5 U0 x+ g/ l1 m$ }$ z8 I - * published by the Free Software Foundation version 2.7 l6 F7 B( K( Z% [* h8 Y1 Q
- * e- e7 l6 X/ F' |$ v0 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% G& {7 O# w9 Z# x
- * kind, whether express or implied; without even the implied warranty
* R2 p# |' ^8 X! Y. ~$ m* ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ u; ?0 q4 F: U. u6 H
- * GNU General Public License for more details.8 p1 J ~! D, Y9 r% v$ A
- */: ?$ ]3 f6 d" I, s2 ~
- 2 v+ F X* ~ S; J$ X
- #include <linux/module.h>4 r v% P! o0 ?) f: U4 u
- #include <linux/init.h>
& }/ q# h n# i0 q" ]" E - #include <linux/errno.h>
3 @; J$ ?2 Z+ j% D) Z% Y W/ x - #include <linux/types.h>" z+ Q. \% q: ` `- k: ^+ L
- #include <linux/interrupt.h>
& L. o& U4 d9 T' S; K! ` - #include <asm/io.h>0 t6 ]( O- L' Q/ n+ g8 x: e
- #include <linux/moduleparam.h>
! N0 m% c6 W9 a, P! |" H - #include <linux/sysctl.h>- I! U( n+ d9 B
- #include <linux/mm.h>
& W, K2 }. \( t& {* _' o - #include <linux/dma-mapping.h>4 D+ T5 a( M: K
" E+ |! p0 E1 ^( Y! W$ r* h- #include <mach/memory.h>- K% F3 j, i8 P/ o, O7 V! P) a" g
- #include <mach/hardware.h>3 S g8 l+ o( E9 q0 |- P
- #include <mach/irqs.h>
% v9 O6 G& W0 D9 Z ^" A+ s - #include <asm/hardware/edma.h>4 G- j4 i1 p* ?9 c# p* K
9 I+ B. E* P2 N! M! q* |- #undef EDMA3_DEBUG
) Y+ E8 ?8 m5 `6 M# k - /*#define EDMA3_DEBUG*/. [6 ^' a! v x
4 \0 ]9 N: `, D# L9 e- #ifdef EDMA3_DEBUG
& _' D4 @; a5 Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' \, Q1 i! S: W$ H/ A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 G) j8 x% S& c" U9 M, D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); n' @" t) `; A# Q: ]! k
- #else
3 ^3 V& l# Q, ~+ b; S# Q. ^( A9 K% r - #define DMA_PRINTK( x... ) t6 }# B* D5 O, n$ q4 U
- #define DMA_FN_IN
: {8 s0 e" i$ y5 a8 A# K - #define DMA_FN_OUT) I2 a. s" D1 s$ m: W9 }1 V
- #endif
7 z: D4 u$ _. y
3 [, e& k5 |: o7 ^/ Q3 d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 g5 }: t& x+ J
- #define STATIC_SHIFT 3
$ \% [; E: B; _! F8 ` - #define TCINTEN_SHIFT 20
! S; m; p% J8 s* p - #define ITCINTEN_SHIFT 21
7 F8 D$ x1 C* p/ K+ O - #define TCCHEN_SHIFT 22
7 {) o8 J( J+ H2 P7 \/ T* c3 ?+ |& o - #define ITCCHEN_SHIFT 23
8 t* ^) K2 |1 y6 i1 R8 \$ N5 |5 e - . Q( _2 Y# l8 p! A) G! d5 Q, N0 m
- static volatile int irqraised1 = 0;
4 R a6 G* a: O& Y9 _ - static volatile int irqraised2 = 0;% G2 v# u- B) A0 u
# A7 D6 V2 X& D/ y; a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! E* u* W; K* ?- J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 \! N8 L8 o9 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 {! D3 G6 T! p
0 C# C3 x: L( I% w+ Q8 R- dma_addr_t dmaphyssrc1 = 0;
& y% E) S4 \ d$ C - dma_addr_t dmaphyssrc2 = 0;
- J7 H8 @6 T$ R& X - dma_addr_t dmaphysdest1 = 0;0 r7 z; K; P2 y- @3 `
- dma_addr_t dmaphysdest2 = 0;% L- w+ W. f5 |: N/ G* h; q
- ! E2 ]/ z9 A7 E( x+ N' P
- char *dmabufsrc1 = NULL;3 s# a# `; Q7 S: Z; k4 {
- char *dmabufsrc2 = NULL;
1 E# Q/ M0 K0 ?1 D0 g. Z/ @& i - char *dmabufdest1 = NULL;$ D& }5 R$ q, O) t
- char *dmabufdest2 = NULL;# I6 x% M2 U% V8 ]
- ( a% P n# @6 L7 a4 H
- static int acnt = 512;8 A4 X8 V2 ?1 s3 [5 Q
- static int bcnt = 8;5 D( |4 o# E e0 u; w/ b% d) F' g
- static int ccnt = 8;! F0 X+ ~8 j" W! J' P
& K4 o" C) Q) W" S3 j- L! E- module_param(acnt, int, S_IRUGO);7 l# ^* v! R1 f( V$ Y# K
- module_param(bcnt, int, S_IRUGO);3 ~/ t! @% B9 N) b: W
- module_param(ccnt, int, S_IRUGO);
复制代码 . j% D0 O) z; [! @4 a& \
. }" Z3 {& M7 [$ }1 h) J/ } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: j1 F" M: F# n; G8 G/ F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 D; A% B" J/ L2 N7 X/ b) p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% c6 Z* P% F) N) l; G4 o: G! s ^# v. s- c" p
! Z0 [' L; W1 ^* n9 J4 J
|
|