|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & d9 y {8 g# ~/ f* p5 X% ~; y C
- [code]EDMA sample test application: J* Z5 `+ k& N# e1 |! W" v
- /*
9 {) `# P; R. K. b3 P - * edma_test.c
" C, G5 ?" {9 i' |! X* P. f - *
5 {8 Q& ~5 W$ p# D) p" T - * brief EDMA3 Test Application3 M" Z7 |* V& [& E( g
- *+ n6 }+ p3 B1 y2 M' \, P
- * This file contains EDMA3 Test code.) n- ?4 U0 F# W) h* R
- *
( o2 U* x" A7 C7 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& s6 T+ x# ?2 K: V& z8 [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 b. W1 Q9 s- Z, `3 V U( j - * TO CHANGE.
) ?5 g( F6 _7 V7 A) b( x - *
4 U9 K- E1 P1 ]' [4 ^9 a6 B5 Q% X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, H& M% Y' b/ H: K3 i* v0 B; T7 K! y
- *5 K' @9 o- t+ Y9 d- F
- * This program is free software; you can redistribute it and/or
0 l/ S1 e8 i# z - * modify it under the terms of the GNU General Public License as
+ P9 Z; _1 t& X( U0 i% ]9 I$ Z: W! s - * published by the Free Software Foundation version 2.; x* D& P8 f1 p
- *
. }% @& P4 W- T" U9 d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 [5 z. X; r' r- \' c; b" ^0 p - * kind, whether express or implied; without even the implied warranty
J, @$ U9 p) m' w, f, ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* M* w ]( O0 T0 [) X- I
- * GNU General Public License for more details.
* E7 c# r8 G. _* Y: W - */- V+ Q$ F" F9 y. [: J& R- i2 h
- * ]" S) x8 t9 k8 D8 F4 b/ B% @5 P4 C
- #include <linux/module.h>
4 h/ R0 [& ?5 Q! f" K9 f - #include <linux/init.h>
3 G2 x, K4 T! H8 P6 f, I - #include <linux/errno.h>
9 @' a5 d% J! Z - #include <linux/types.h>/ l" E. |+ U5 D) _
- #include <linux/interrupt.h>
0 ~" e& G. g- v7 ` - #include <asm/io.h>
+ j5 V; A# w) D8 [# i% \ - #include <linux/moduleparam.h>) m6 a! z$ E3 J2 E1 W
- #include <linux/sysctl.h>0 Y' s0 ]9 n1 b! |
- #include <linux/mm.h>
& q2 M1 C, u. w& m1 Q( r, l - #include <linux/dma-mapping.h>
, }8 d+ O4 T/ z" x* R; p; L5 o - % |' C8 X) h& L: L
- #include <mach/memory.h>, @" {: I: U. y# b3 ?7 H
- #include <mach/hardware.h>5 X/ s, z* H$ l3 Q T: k) ^
- #include <mach/irqs.h>% l# W. x7 p% i6 d
- #include <asm/hardware/edma.h>
2 ~# U5 f4 B5 u8 P K% D) Z
1 q* ?3 {/ y4 J- V' u* H, `- #undef EDMA3_DEBUG' H) M9 N! d8 y
- /*#define EDMA3_DEBUG*/& a. l, v+ ]1 E% W) t: P+ Y
- , K8 [. H7 v, m" i, U( v+ m
- #ifdef EDMA3_DEBUG
% s- j/ U% S% x/ R6 n. o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 O2 @( D; E) A* q3 n8 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( n9 v* v2 T& z0 k9 F- _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% l1 _; k/ G; ~' T7 u" L
- #else X/ p. e7 s t) H3 d* \& \
- #define DMA_PRINTK( x... )
# D0 a* _. b; `; B0 ~7 D# }# q: ` - #define DMA_FN_IN$ Y" U' i3 O5 c/ _% {, g1 e
- #define DMA_FN_OUT9 t$ J3 |/ s% E. w
- #endif
, l% O+ L- N* d+ M8 K8 a7 Z9 a' o- S
/ C( X+ Z. |9 ?% y6 ^. t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 T& v# b( @8 v4 V6 z
- #define STATIC_SHIFT 3 ]& Y' T8 m* B S
- #define TCINTEN_SHIFT 20' `$ Z- W9 M- ], Q2 u4 n# W
- #define ITCINTEN_SHIFT 21
* z7 w* l+ R. h0 w/ i( Z) q - #define TCCHEN_SHIFT 22. u9 N. i7 g* X& G5 |' y- I
- #define ITCCHEN_SHIFT 23
, P3 b h. q& j - : X0 I3 E5 v8 @$ w, t c* d
- static volatile int irqraised1 = 0; J, G2 n( f( o9 g$ @; m/ i
- static volatile int irqraised2 = 0; y% f/ z* C6 U- L* L& A$ I0 R, F
8 \1 }) u9 G; G* n* k! Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, s: h! S, E/ ^/ n2 B* b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 i+ V5 g: l( x: z) Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Z2 K9 t* _, S" w! `- m3 ]
- 1 S1 E! [2 _/ K1 ~" r
- dma_addr_t dmaphyssrc1 = 0;+ }% n) q. C- N1 g" Q
- dma_addr_t dmaphyssrc2 = 0;8 P" x5 E4 B. [" M' l, z. q1 `* ?& G* I
- dma_addr_t dmaphysdest1 = 0;
; @9 {0 h; i. V6 W5 N [) Q - dma_addr_t dmaphysdest2 = 0;
, M8 _+ d" f- l+ O% Q+ s - 7 m/ ^, z" E$ b% R( G, T+ c4 r
- char *dmabufsrc1 = NULL;1 k8 Q% n+ ?/ m- o
- char *dmabufsrc2 = NULL;' a* b3 l$ U$ o' r h
- char *dmabufdest1 = NULL;
8 \" i z8 V- w- s" K: z - char *dmabufdest2 = NULL;
* @) ]! K6 ?' s' m0 I
" a3 c \8 T: `- static int acnt = 512;0 Z8 F# Z( n/ H6 e" v* B
- static int bcnt = 8;
# k$ P0 J3 z: \ - static int ccnt = 8;$ |& j2 G# x- c: |/ |+ r6 r
- 3 m9 u* P: S! t) g" a6 i0 J
- module_param(acnt, int, S_IRUGO);8 b _3 c3 Y @9 t
- module_param(bcnt, int, S_IRUGO);
; S" v, _2 L, y, X: P! T - module_param(ccnt, int, S_IRUGO);
复制代码 3 C( F& e( L% F, o8 j) t( d
) _4 F( c9 u1 p, S) Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: x# }) X! f& c6 n% M9 H* Y1 a; D: K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) C* d! X% m1 ?" s9 ^# s) z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& W* w! a5 N% P& G$ r) b
; Q" m$ z. M% ]) ~
$ e* y; I& l6 @5 d9 n |
|