|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , e. ~" p i t' ~
- [code]EDMA sample test application9 o' e# |- L/ q
- /*) m5 ~- \; A, f4 Z$ t& x. l
- * edma_test.c
7 l/ Q. p1 G0 E/ E) i# ? - *
/ x' J: d d, I# h - * brief EDMA3 Test Application7 B4 w* L0 A& g8 E6 C9 c# Q
- *
. T, n. p, P) h( P - * This file contains EDMA3 Test code.& g6 l' H' t( Y0 \; J
- *
* l$ [( P/ V! w7 E5 J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' u0 V6 P0 d4 ^1 @3 r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 e9 k4 O @$ f9 A2 F# H - * TO CHANGE.+ ~& X3 a& @* D ~% U
- *
" |% C( ~4 B. {9 f. z" P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 R$ K) R% ?* d# k* s - *: x; g U- l4 V) P! {
- * This program is free software; you can redistribute it and/or$ U: `) t7 ^) @! m& E) X1 Y
- * modify it under the terms of the GNU General Public License as
% N! }- P- j# ~* } - * published by the Free Software Foundation version 2.. p6 ?3 [9 Y: h# @% F
- *4 x7 j$ l$ C4 x% w' m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 Q% M. {" S# `3 K- Y# j* F5 y
- * kind, whether express or implied; without even the implied warranty
3 X6 [# z* A5 ~) }8 z- { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: R3 F1 |! Y* O
- * GNU General Public License for more details.% o3 ]8 d5 ?6 s+ u+ x
- */
8 B' N" a( f k5 }9 J n
5 l: n3 d. y: E; p t0 [2 e& s0 k- #include <linux/module.h>, Z( ]7 v0 D2 W/ f" p- w7 S1 c
- #include <linux/init.h>
) o9 G5 G$ Y8 ?3 D* N - #include <linux/errno.h>; K/ ]/ ^/ w7 b' Z
- #include <linux/types.h>
: ^2 {$ l' m" p% E) m- p - #include <linux/interrupt.h>
/ h% r t* A7 u - #include <asm/io.h>
: x, u! c1 P8 @ - #include <linux/moduleparam.h>. q4 W1 w; M* i% A4 a& @3 ^' e
- #include <linux/sysctl.h>
5 G( J5 x5 I. U$ `$ _ - #include <linux/mm.h>" o9 N4 `. A5 `0 O9 K' Y
- #include <linux/dma-mapping.h>) k1 f* U" j O+ ^% V) v9 t! y
h9 S" [, A+ Z3 ^# {# [4 ]: P- S- #include <mach/memory.h>8 y0 |) X) t2 C [2 X0 Y" e
- #include <mach/hardware.h>, u& e/ l1 Z. G; r- v o- s
- #include <mach/irqs.h>; K) @0 [1 j% } n( e; u0 z
- #include <asm/hardware/edma.h>
( Y1 n2 [7 ^ ^9 c/ U& {" T3 W - # E' s. U' B1 [$ Y8 p
- #undef EDMA3_DEBUG) t( Y# S8 H6 V |
- /*#define EDMA3_DEBUG*/# [- e; }! s& Z+ i
- * n0 I: p* i/ q( k& [# q* {" j
- #ifdef EDMA3_DEBUG& h" I' d9 Z3 f# Q7 b7 t7 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 a) [8 ]1 M6 p. L$ O A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ D- g3 j6 `9 [) v/ V# y* m$ ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; e" C7 n5 d( k0 a x - #else0 r; W8 l0 Z# [& F# f; D$ y; U
- #define DMA_PRINTK( x... )
0 }& k6 g; h; L2 v& }; B - #define DMA_FN_IN
) c7 x4 Y% e: g; w8 E( J - #define DMA_FN_OUT0 x$ [) i# F! y
- #endif6 F% c0 @: R Q
- , M( n6 i" C* E- G8 u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 a. h, }- S( Q% S - #define STATIC_SHIFT 3
9 _# x @. l7 d9 {' n - #define TCINTEN_SHIFT 20
) Q$ |% Q$ R, {8 E6 D, D - #define ITCINTEN_SHIFT 21+ _; [9 t) `# B6 E0 n+ N
- #define TCCHEN_SHIFT 22; T. l9 K' `" Y
- #define ITCCHEN_SHIFT 23
! O# w P' {3 m! Q - ) C! D2 c4 D( Z( r" Z' z
- static volatile int irqraised1 = 0;! E: a+ @! i- G/ p( E) x2 G' Q
- static volatile int irqraised2 = 0;5 i& f4 W. y b9 {
; [- v! }& o, ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: L. g* p5 }: L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% w1 x4 {4 B0 d G3 a" m# V L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P: x. h4 L# [# }6 B8 V
- 2 G5 j& R" y% u1 C! h5 [
- dma_addr_t dmaphyssrc1 = 0;
# g" d- S( }3 ?, q# D - dma_addr_t dmaphyssrc2 = 0;
/ }5 r6 o* I/ k; }4 w, n$ Z - dma_addr_t dmaphysdest1 = 0;8 I( U6 J0 s/ y( } n
- dma_addr_t dmaphysdest2 = 0;
4 Q5 c" _7 T! q
/ j( \! m% w$ I2 H7 m. W Z7 [* A- char *dmabufsrc1 = NULL;
& V2 {# b$ L1 S3 f* u i, p - char *dmabufsrc2 = NULL;" ^1 u4 V- N: S; [, @' \6 S
- char *dmabufdest1 = NULL;4 d2 {+ s, b8 }, D) \# G" s# V
- char *dmabufdest2 = NULL;
9 {/ f; Y, l; L# S+ F - . x, |2 Z# m% g, U- Y
- static int acnt = 512;
$ w3 ]9 _& [# _' ~# V( N: Q - static int bcnt = 8;+ I& z; Y& O3 V. z0 D
- static int ccnt = 8;
9 |* v' {$ Q e) w) F) K% m6 V
5 `9 r+ K% p! @! B- module_param(acnt, int, S_IRUGO);: U0 P- _( \1 J2 Q
- module_param(bcnt, int, S_IRUGO);
7 s" y3 |( ^4 S! l( c7 j6 x0 V- | - module_param(ccnt, int, S_IRUGO);
复制代码 4 G& `, M9 T. A
0 V% ?" O9 _ L( \* u6 L- x( q( S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% Q4 L) d% m! j* f! `% n! o5 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ K$ W2 m% \# _. q! f. | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 I9 W4 W- y- M
8 L6 n$ g4 m! @9 z9 e0 G5 P
( l0 W8 _4 |& J3 J/ p6 F8 D' ] |
|