|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) t1 {3 g( ~6 N5 O% g, \& R i6 m, Y
- [code]EDMA sample test application6 v8 i e" q! R$ ?: k7 H6 r4 {
- /*, a5 ?. z# k9 G, n; U. k& y/ B# d
- * edma_test.c! Q- D# C3 P; m, e' t3 f' K
- *
- f2 ]5 `) C7 ^5 T' g - * brief EDMA3 Test Application- t. i1 F9 u& P/ Q9 E5 i
- *9 R1 h" O! Y9 G6 z
- * This file contains EDMA3 Test code.) j! b' ?. ~4 Z8 l! l
- *
8 _8 t# p' W& o+ x) Y2 ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: y2 z$ u4 d" ^& O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# X+ U$ U* @0 ?7 \ u
- * TO CHANGE.
5 @0 D% c% L7 J5 {4 i - *$ `3 ~0 ?3 A0 U; ]3 S0 x) }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 H/ Y+ x; D$ d( c# M7 d% Y* ~
- *& G& u, k4 O! A( F4 X5 V
- * This program is free software; you can redistribute it and/or
% O) Z: e4 @ w( C$ q - * modify it under the terms of the GNU General Public License as2 x- l0 R0 N7 r1 l( Q+ T- j
- * published by the Free Software Foundation version 2. J$ c" o2 r0 V( b5 u# J4 {
- *' k6 g7 V7 _8 [1 q+ {6 A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 A+ K- U0 B6 W( N; f2 E
- * kind, whether express or implied; without even the implied warranty
: v& @% u0 [+ R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( e! {' N# H) p7 q8 f - * GNU General Public License for more details.$ r* p) o! ~. r% @) j
- */% _4 |3 k- `3 r
8 A* Q4 O: W" J' |$ P; c7 ^- m- #include <linux/module.h>; D7 L2 ?8 c5 a5 @7 C
- #include <linux/init.h>
5 @7 j) S% _* H) q' \$ D - #include <linux/errno.h>1 K& ^) ~& P# C
- #include <linux/types.h>$ h4 r$ a: C5 P6 K% a: `
- #include <linux/interrupt.h>' ?4 i: B1 T; A9 ^
- #include <asm/io.h>! H3 v- S/ E# g; F) x" T
- #include <linux/moduleparam.h>; m! D, A- t1 l+ N2 j
- #include <linux/sysctl.h>
( o' s2 a! w& r) F- G - #include <linux/mm.h>
; o4 v. r* U8 F - #include <linux/dma-mapping.h>
0 w# s6 t, J0 G/ s+ {- z4 H' g& [
! q |8 b) M z% o- #include <mach/memory.h>- W& L# R Q) Z: e. m* {# S
- #include <mach/hardware.h>) ]2 N7 f* M1 ?5 k
- #include <mach/irqs.h>
# K. h6 E( Q7 m; G - #include <asm/hardware/edma.h>+ T" N7 V5 T# p
- 4 z+ M" @- O5 J
- #undef EDMA3_DEBUG
6 e8 m9 {6 C& T! Y8 l - /*#define EDMA3_DEBUG*/+ b: v5 @3 R t! ~. b$ Q0 m
- k% S5 ~6 X: U& h0 U- #ifdef EDMA3_DEBUG
* X, H7 C) B4 R5 J) B, V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): D; |0 Y6 ^, U! |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* `. Q$ `! ^ V& C* f7 k1 K. W' v1 R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): c. f2 @/ e4 p
- #else
& B2 @2 n8 m0 s* O7 { - #define DMA_PRINTK( x... )
7 r- d& S5 [8 Y - #define DMA_FN_IN
J4 E7 b4 v, I9 ^; L8 ?$ }) r - #define DMA_FN_OUT
% {8 K( f2 _" c7 n% S, Q5 R - #endif
0 Y; O/ \$ o' R% ^0 f) Y K - - _9 m( {& t W+ X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 Z: \' \0 z0 w( L
- #define STATIC_SHIFT 3! K! z+ W5 o, \1 R5 g1 ~
- #define TCINTEN_SHIFT 20! g: ~) V" U( ~" M5 d: e. P
- #define ITCINTEN_SHIFT 21+ N2 C5 V( Y! h
- #define TCCHEN_SHIFT 22
1 Y( A. I6 o6 e% p$ ] - #define ITCCHEN_SHIFT 23# p$ v- t e% o# I
9 \+ Y: t$ W; i8 P0 b- static volatile int irqraised1 = 0;
$ G2 Q( y8 z# N - static volatile int irqraised2 = 0;
- D* H9 y& ?2 Z
/ V- O$ K+ @4 Z0 Y0 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! l2 r. ~" c9 l* S3 V' E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' @" n) O3 u; Y3 l6 V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 J0 [- S1 s Z# o H - " ]7 ~ D3 e( E$ k& G
- dma_addr_t dmaphyssrc1 = 0;$ F) ]; v3 ]( [- p7 H% ]' @
- dma_addr_t dmaphyssrc2 = 0;2 @) t6 G, o% H8 f B% x( B
- dma_addr_t dmaphysdest1 = 0;
- z* {. r# s- c9 K - dma_addr_t dmaphysdest2 = 0;1 [6 w% U$ [- m# \
1 ~1 {4 b- M+ g9 F- char *dmabufsrc1 = NULL;
! a$ ~& P0 ~1 L5 Z - char *dmabufsrc2 = NULL;
) l- Q7 h f. ?5 k - char *dmabufdest1 = NULL;
/ L7 {& V! r$ W& a5 W - char *dmabufdest2 = NULL;8 A# g7 K9 M5 J n
) ]" H3 R$ W0 R6 m; d: l- static int acnt = 512;4 P9 i X6 G! n+ w3 R
- static int bcnt = 8;
+ P L9 Z. A1 N& v: l) N6 h: x* C - static int ccnt = 8;
- h( }* V+ i% r8 \8 {% B" f
+ b6 c O' J- Q/ E! C- module_param(acnt, int, S_IRUGO);
6 S$ u# x; ?1 g - module_param(bcnt, int, S_IRUGO);
$ d9 v; H4 U Z - module_param(ccnt, int, S_IRUGO);
复制代码
) K7 H# l8 J3 L- z7 T* i! j5 g3 J: c w( C, G$ K( [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 A1 x9 T, h) l7 k8 I& J: `1 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* E& G/ T/ j6 l4 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ O& o% S& i# C! X" f1 l* R! [* W& H U4 ]& Z2 p
4 j- e$ }4 `& G4 m; ^; b7 s
|
|