|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 o2 z: l" h( t: z/ O! N- [code]EDMA sample test application9 `3 k' R( @. H0 [$ E
- /*
$ k2 `$ d& w H( ]0 J - * edma_test.c6 S" M B+ H% d V& e
- *, A0 h9 ~; G4 y: `6 }7 K+ V/ N
- * brief EDMA3 Test Application
$ s4 l% J) `- ] | - *
0 ~ E J% y3 f0 h - * This file contains EDMA3 Test code.
0 S! @! c$ q5 M1 E/ \% ~9 _1 N - *) Q* ~+ T/ u# O4 \( Z+ b( F4 E2 b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ z+ G# t5 ]/ W5 Z0 a) g0 Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 K3 ]# u! l' F! |8 E
- * TO CHANGE.
$ j( r: a" a4 Q - *3 E+ P% e3 a* i& y( R: ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ?; ^/ ^# L- N3 i
- *& j4 G% w, Q$ M d8 }$ U- L
- * This program is free software; you can redistribute it and/or0 U+ M6 x- z4 u
- * modify it under the terms of the GNU General Public License as
& i- W1 b6 L, X2 { - * published by the Free Software Foundation version 2.8 @, }5 {5 e( d* m- o, ^
- *
7 b; R. x% d9 F3 h& e( V- F d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 c* }" F! g$ g* V6 D. U3 R( c
- * kind, whether express or implied; without even the implied warranty% m. h, W& n1 A( a) _! D% Q4 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 e v. v# n4 f. S8 Z
- * GNU General Public License for more details.- @, o+ u* V' w, c! G T. ?
- */, H6 g, T9 [0 |) e# V
- . A6 B5 c" r* B0 N
- #include <linux/module.h>
. T9 L- c, k. G w - #include <linux/init.h>
% `0 z( S/ @# i( f - #include <linux/errno.h>
# ?& T. F8 Z2 ^ - #include <linux/types.h> c# V! J& Z) z. r4 U/ k3 l z1 R
- #include <linux/interrupt.h> E2 n! l9 K7 g8 W8 H1 ]
- #include <asm/io.h>
+ c; Q3 q. e# B3 X - #include <linux/moduleparam.h>4 C9 [' [. a8 M; r+ C1 M. S5 d
- #include <linux/sysctl.h>! S$ | ^* w/ }; T2 o
- #include <linux/mm.h>8 Z; g' l% u1 h
- #include <linux/dma-mapping.h>' c& |7 m+ a/ e [) d+ [: R1 w+ N
- 9 a, x' k0 p# h0 R, h
- #include <mach/memory.h>4 g! ]) o) }! g, p# d6 V
- #include <mach/hardware.h>+ c! p7 ~( m+ S: K. v/ Q$ T9 l
- #include <mach/irqs.h>
7 O9 X) J% p$ E" T - #include <asm/hardware/edma.h>
3 a' D2 g1 e! R - : p- I k W% c% k$ i
- #undef EDMA3_DEBUG
7 P+ p T- |! j - /*#define EDMA3_DEBUG*/
: Z1 M# ]& c* ^7 p8 N
, `" `) p6 a7 f) x* m4 k- #ifdef EDMA3_DEBUG% @& C- \* q# s( t' ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 E9 t) A; K% [2 H0 p6 `- K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 ~: z& r, C" y# p- d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) P( c: i0 u. o/ ~ - #else9 K: _" d+ k$ w! L9 ~7 E
- #define DMA_PRINTK( x... ), V& ]& A' X3 p; P0 F. h: Q- f" r
- #define DMA_FN_IN
# B# I4 O4 e% ?) H - #define DMA_FN_OUT" I, S; s( G9 u
- #endif2 }0 M+ ?$ A: u( A7 z& F
% U( _0 u; [6 k/ j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" t1 v p+ k9 A5 R9 U# t5 \
- #define STATIC_SHIFT 3
" F- i4 P& K( ?, V$ W9 l# `/ U - #define TCINTEN_SHIFT 201 [6 t+ d: i% I' e& _6 C
- #define ITCINTEN_SHIFT 214 S% i3 V b+ R$ f, W& ]# k* P
- #define TCCHEN_SHIFT 22$ F- X& c/ G+ I6 a. b8 Z
- #define ITCCHEN_SHIFT 23" t) K: g6 r: h3 W& \3 I; f
- 8 g) u6 g0 s O9 j. y. J' `! d
- static volatile int irqraised1 = 0;
9 s' J+ _- P' i" z3 ~ - static volatile int irqraised2 = 0;
/ r \0 d' M z3 \9 H$ E
+ m6 i; k2 ?5 i6 F9 j7 u3 @6 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 i' E% V% M( c+ ]3 Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( C9 b) R0 e1 a6 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 J8 E5 R8 U1 Q$ ^. p% }5 ^/ [/ m
+ @$ F. z: s/ r" ^& N1 }! P- dma_addr_t dmaphyssrc1 = 0;
% H" r, f) F' i$ d( D9 V" ? - dma_addr_t dmaphyssrc2 = 0;
( A. w/ i& t/ f - dma_addr_t dmaphysdest1 = 0;
& w% k5 f0 c( S, o - dma_addr_t dmaphysdest2 = 0;1 y$ L7 T8 a8 ?) l0 n6 q
) F+ h/ e9 t6 u* O7 j- char *dmabufsrc1 = NULL;
+ a$ u n# t* P s. z2 q/ W- J! i - char *dmabufsrc2 = NULL;
- b1 a0 Z5 m: a, ~ N - char *dmabufdest1 = NULL;
4 H! N( b' ~- g: {0 w0 J - char *dmabufdest2 = NULL;( K9 x: S1 p# c1 v$ c
, a9 I" d7 v+ A* ~3 J) |' P- static int acnt = 512;
7 O: p- @0 J' H: V3 M( ^, O- Z - static int bcnt = 8;0 @7 O, I; Y5 L
- static int ccnt = 8;
3 I' N% y! @" \) }$ \3 \# C6 ~ - + p( J. [" b! V3 O- S" B
- module_param(acnt, int, S_IRUGO);( V7 ~1 x; W- {% V1 c$ e
- module_param(bcnt, int, S_IRUGO);& {* C( h8 G8 O) Q% g: x
- module_param(ccnt, int, S_IRUGO);
复制代码 : H! x: }. s, \; G' H- ]2 H4 A+ [
2 Z+ ~4 \' p! e0 X, l! W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 }, j, z" K" p: e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ A/ ~; i/ U4 U* J5 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 q+ r. D( [( a5 E' ?9 n
0 u1 e$ s4 u& f9 `" a1 k
5 P. T& Q4 p9 U/ K |
|