|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ P, T5 u- g8 p9 O) A: [5 D- [code]EDMA sample test application/ A; w( g0 p- _4 v
- /*6 o: {) l# M6 E& G R% y
- * edma_test.c" C/ h6 c: ~" ~6 d
- * W0 y! [* f# y: Z! v
- * brief EDMA3 Test Application3 O# i! Y$ J {2 U
- *
) P( j# ^" ?# |2 B - * This file contains EDMA3 Test code.
- T }% h, j+ E# H& E, S1 W5 P4 \ - *
! j9 F% G2 {7 d0 p. Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" `# H2 W. D" {. c6 Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( T) x" z" ?( ~6 S: h - * TO CHANGE.
2 E( @( h, o ] - *3 j' g. l2 T& c o$ m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* n/ M5 c9 h; w! m0 s3 b. i
- *' [& Q7 h6 Q& H$ q! H1 t, w
- * This program is free software; you can redistribute it and/or
2 `: w/ v0 E* H+ U - * modify it under the terms of the GNU General Public License as
1 p# J8 W2 j5 N+ o0 Z; v2 S. | - * published by the Free Software Foundation version 2.
; X: D7 M+ m9 h% Z* J: y. n - *
P5 ^$ H8 t$ P; a+ i4 E! p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 I: c" I, e! N! Y - * kind, whether express or implied; without even the implied warranty
" E/ ?4 A8 G/ u2 } N9 X# A0 o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ z* x$ M! ]( k7 ]7 y# K: u
- * GNU General Public License for more details.! d# {3 v& C7 o8 _0 y! W# N, A9 q
- */5 M: D. X: ]! z! F# t6 P
3 r1 O* f! B9 w# K- #include <linux/module.h>: a! Y* c2 C9 D- ]
- #include <linux/init.h>9 T4 W) f7 A2 M U
- #include <linux/errno.h>( T% [6 R$ i A! ~( B
- #include <linux/types.h>- t: i: U5 R* \- H3 P# r1 P2 m0 N: _
- #include <linux/interrupt.h>
2 j/ m6 [, A0 h, b' C - #include <asm/io.h>7 [8 K6 B( S/ y1 u3 I l
- #include <linux/moduleparam.h>
2 Y( r4 u, v% L6 b q- o - #include <linux/sysctl.h>1 w" i' @8 f" d" V% Q- Y
- #include <linux/mm.h>% P2 e$ F; u1 i; v; b
- #include <linux/dma-mapping.h>& D0 I( `* K) b6 ~' C
( L, O$ A$ p& d9 a- #include <mach/memory.h>: i# G+ ]2 x) M
- #include <mach/hardware.h>
" F, L% Z) c8 n6 C - #include <mach/irqs.h>
: T" S1 X. S4 y/ _ - #include <asm/hardware/edma.h>
. `& e; |* b5 v+ a1 F
) D; y% A3 [* x/ [- M' Q: ^1 c- #undef EDMA3_DEBUG6 {: a5 b9 Y X. l2 t+ W
- /*#define EDMA3_DEBUG*/& {* c2 F$ ~' P* ~
2 D4 T/ A& O5 }) k* t- #ifdef EDMA3_DEBUG' V5 i8 E% _ c$ A0 [- `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) v1 J+ q$ O4 ~) K, e; E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): A3 |+ y+ X4 K5 T. N) f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, O4 P$ @8 F3 _, \& v - #else
$ L# `: k% A6 x& d - #define DMA_PRINTK( x... ): L9 }+ R3 m5 Y: U) M' a4 X
- #define DMA_FN_IN
$ P# z2 y" y9 {1 K; v - #define DMA_FN_OUT
, o' \* F9 G6 {5 B0 x4 R* a2 z - #endif' y% ]- `9 q" }# g5 ~
% f& r9 H) M. A+ `( Y3 z `- R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. x; D0 n, Q3 o) n+ q0 S5 ^ - #define STATIC_SHIFT 39 b+ _" I5 g# R: z1 n! S
- #define TCINTEN_SHIFT 208 P ]" y9 M+ v$ {/ t! b! C4 z) [9 e
- #define ITCINTEN_SHIFT 21
4 P! Z0 o* a E3 M6 m" _ - #define TCCHEN_SHIFT 22
' M$ `" |* x5 S" @ I9 _, ] - #define ITCCHEN_SHIFT 23
7 W9 I# C$ M0 x4 }' t: w
. d) b* e |$ p' X. W& Z- r+ }- static volatile int irqraised1 = 0;
5 g( D' [8 C% Z: M - static volatile int irqraised2 = 0;
- b. Y9 x2 Q) Y8 c0 U
+ a S; L, _# y/ M4 ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 |+ I6 l' ~% X7 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 O3 G7 ?' K$ |3 P4 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h+ q `9 T; s* `% P9 d
- : Z" Z: b3 [9 C( y* Y; c
- dma_addr_t dmaphyssrc1 = 0;
% b: v8 ?' d0 c" O( f - dma_addr_t dmaphyssrc2 = 0;
7 O9 S7 Z3 K) g) _5 ~ - dma_addr_t dmaphysdest1 = 0;
+ ]8 ]4 O W6 p6 [& f8 b: o - dma_addr_t dmaphysdest2 = 0;# x, a1 K; [; _+ Q( j O1 w
" M/ i7 a7 U4 v4 w! w# b/ v6 V- char *dmabufsrc1 = NULL;
0 W* n$ f2 Q8 @3 @3 z/ W - char *dmabufsrc2 = NULL;9 D' b9 e+ k* a4 B4 a+ M
- char *dmabufdest1 = NULL;
l/ X% r* G6 n8 ?& z( P; p - char *dmabufdest2 = NULL;
: V- d; ]2 e2 _0 T! Z9 t. e; H8 ^
# C+ u6 g& ~6 W! \; h2 ?- static int acnt = 512;
- V* M1 H! G- X& l8 R: C - static int bcnt = 8;
/ L8 ?/ C! c0 K8 L3 n - static int ccnt = 8;7 v' T/ W5 ]8 p: |9 _, R' F) ?& h& D
- ) Z6 a' p4 ~' n9 B. I, F1 r
- module_param(acnt, int, S_IRUGO);* ~. i0 S! G$ E( ^+ K7 V
- module_param(bcnt, int, S_IRUGO);
0 m9 Q; z( v, p; ^( I - module_param(ccnt, int, S_IRUGO);
复制代码
+ |+ l) ^# }1 I. w+ m7 b- x
6 `: [3 \4 x2 ?! G1 ~! T/ D5 d& T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ s# t" G6 {, S% z4 D: r9 S
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 N( _' T/ B8 h/ S$ g4 l& _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 l$ X' V4 D; |/ Q
' `5 ^3 z" L+ {8 W4 ~1 ~; F% H8 |& x% R( M: k1 H
|
|