|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 U$ ]7 k% t$ n. ?* y, t- [code]EDMA sample test application6 V: P/ k9 |+ }" G! \& Z7 r
- /*5 ?. x& X6 V6 J" ?7 _5 |) ?
- * edma_test.c
! F# G; Q# b2 D - *
" K. y* u, u: n& [4 I, ` - * brief EDMA3 Test Application
$ e" O f5 }; C V3 k3 h+ W - *
8 V( o4 s" @0 P, x7 t6 q2 g - * This file contains EDMA3 Test code.
: ?$ y" v( I5 U1 Z( E: E - *
m: {5 O* h8 Z& }/ B( S/ `& G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* _" e2 y& A; S+ V- o) A% O; X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 b% o, i4 Q ^9 r$ i& c
- * TO CHANGE.
3 V9 m' ]$ h3 k. v# U - ** G ~" ]: `! m% A* @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ S" I+ j% A+ J" {4 _
- *' v+ A0 j3 \4 x# j
- * This program is free software; you can redistribute it and/or% m1 h: e+ z+ o! L
- * modify it under the terms of the GNU General Public License as
4 J- a9 O% V K* q- h - * published by the Free Software Foundation version 2.
@5 v2 t; v2 P" I - *
m' F, S. ? Y: y# N' j' ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 \9 J4 x% {) N$ {
- * kind, whether express or implied; without even the implied warranty- h ?* Z3 C O# \# z7 S/ z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. L0 j; o; _1 H9 p
- * GNU General Public License for more details.
^1 \* `/ }0 M: I9 z0 o - */
5 I5 H; P; f4 k8 m6 `# f' b
# o z7 v1 b5 n `- #include <linux/module.h>, E! l% O+ V# h% c4 U
- #include <linux/init.h>
- l/ d6 P% Q" U" m - #include <linux/errno.h> ^! v3 X8 G2 x& n0 @. S) P {
- #include <linux/types.h># Q/ k. o7 U7 S; O! o
- #include <linux/interrupt.h>
+ z9 v* P# U4 H& L - #include <asm/io.h>! h4 P9 s+ X2 d: V# R4 c
- #include <linux/moduleparam.h>
) u/ A' \, K l - #include <linux/sysctl.h>
9 |, a$ n- o4 J8 i+ P0 e. a - #include <linux/mm.h> }3 s$ p& b4 t6 c
- #include <linux/dma-mapping.h>: w( }3 s* ?4 x
- 4 T+ D: o. g7 P( N- s) o
- #include <mach/memory.h>
, o2 b. M; p! i' V - #include <mach/hardware.h>6 U, l# W$ y3 {" v! K0 T3 O4 c
- #include <mach/irqs.h>
$ i5 r* l3 ^% \8 M1 d: m" | - #include <asm/hardware/edma.h>
3 e( H2 b3 p1 N! H* H0 F. J - 2 r0 D- U8 m' c5 `. n; z' V
- #undef EDMA3_DEBUG7 X9 T; K( h; }9 p2 U4 M
- /*#define EDMA3_DEBUG*/
) X. h, _- s9 `: C! L0 [ - 8 F! J9 Z$ `5 h, u* R3 Q
- #ifdef EDMA3_DEBUG4 A4 d0 v) z$ I8 e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 e) {) X" I: C7 W2 @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( O8 [5 M" ^5 w4 b% c- }% f: i- R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" O: A9 D/ X' F) r# t7 [) Q
- #else6 F' n; x; i2 Y& s! e: y. K
- #define DMA_PRINTK( x... )
9 X8 G& y1 X1 V - #define DMA_FN_IN
) @; }& D6 R# M3 B" f; V- p4 a5 Q - #define DMA_FN_OUT
w) h0 Z9 X2 ^! V+ ]9 [# { - #endif1 g9 i; D$ b H- L# E* `
& m: ^# C- ?( N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 a" D+ G# Y7 S
- #define STATIC_SHIFT 32 }7 Y/ v; c8 e) h! g2 z8 [1 [
- #define TCINTEN_SHIFT 20* K7 l+ _9 c/ y' T$ M! R' {5 s
- #define ITCINTEN_SHIFT 21
( s+ P$ v; r0 q/ G - #define TCCHEN_SHIFT 229 ?( k" N2 t4 E! m* T) R
- #define ITCCHEN_SHIFT 23! u$ y9 c% i4 C; B: |6 N9 G8 i
8 A' h! s: `4 f4 w9 ^0 _8 C- static volatile int irqraised1 = 0;
6 s, A! k! C! f6 S - static volatile int irqraised2 = 0;
. h, K* e( K d0 C J - : b+ \$ {$ R$ G! Q+ e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
z8 |& k1 ~- i8 c$ P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. g* j) N% S/ j$ i6 ~" a" ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; y6 Y! m: i$ B: W
, ^, t) ]; b7 k" u* R- i- dma_addr_t dmaphyssrc1 = 0;
; s' h# i) N/ y - dma_addr_t dmaphyssrc2 = 0;
4 F8 R+ m- o/ l) E0 A; @ \; ~ - dma_addr_t dmaphysdest1 = 0;
8 M/ t2 D! D8 p' T, u& B# L - dma_addr_t dmaphysdest2 = 0;
& m5 y3 |6 g" J* K2 z) d
" W4 S! Q4 H% _ D) w3 Z0 i- char *dmabufsrc1 = NULL;2 a8 C Y! y; ?8 v
- char *dmabufsrc2 = NULL;
4 f8 [4 L# w- n3 f; a# |9 v - char *dmabufdest1 = NULL;# @7 d& L. w& b9 k
- char *dmabufdest2 = NULL;7 |" S& Q7 |$ M& P5 @- M
! S2 ~' H2 D# }5 b% F' ^; ?4 S- static int acnt = 512;% _; G" }0 m' l: i: l
- static int bcnt = 8;" P5 H5 Q# a( |+ |5 H2 g( X
- static int ccnt = 8;
) ~# ^" S4 R9 G0 w& `
% ^8 I* f) M! y6 H# w% O' b1 X& @- module_param(acnt, int, S_IRUGO);
8 l& J3 B+ }3 d% K& Y0 ~ [" f - module_param(bcnt, int, S_IRUGO); s( v6 j" _9 }' ?
- module_param(ccnt, int, S_IRUGO);
复制代码
: ~7 M6 }9 ~8 Y- R% V& @1 ~3 ]- k; U, r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ {3 \2 U) Z4 X) z0 E, T: B# @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 H5 B; m4 ]! `! A3 n- L9 z- R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 i% z; C) d8 y9 t4 \4 e
" t: z1 e+ g$ `0 r
+ Z6 E* ^# Q" v. z+ _ |
|