|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ X" V# G- o& | c' u. y- [code]EDMA sample test application
# a- b) T8 n; g5 ]4 F1 Q7 V - /*
. ~3 c0 Y& ]. r - * edma_test.c4 h% j) @1 v! C" B. \& Y. Y
- *
5 C' m9 M6 V, i, H - * brief EDMA3 Test Application
+ [7 T; N/ V% K& v3 O/ c% W& p - *
' O5 ^6 z* E& g5 ]1 s. c2 G - * This file contains EDMA3 Test code., p( P3 { N3 B# [8 I( w
- *0 {4 f; t b' @5 G8 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" E% ^/ u# B) X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! g1 |" o! C: [' M2 H
- * TO CHANGE.
+ T8 h0 u' I* V - *# g. E0 A# Y. u! a/ O3 H* ?# C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 _5 R+ N7 M8 M0 B/ {, {+ n+ A' |* ^
- *8 t. A; |6 ?9 c9 i2 _* k/ B8 o ]
- * This program is free software; you can redistribute it and/or: j- z, [5 `/ X$ \$ g
- * modify it under the terms of the GNU General Public License as& Y- R8 Z/ ~: t( a
- * published by the Free Software Foundation version 2.1 h! K' ?' J3 Z
- *9 ^! x# l0 ]: a! w3 P$ C# G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 I6 @5 q. |, d$ @ - * kind, whether express or implied; without even the implied warranty
- S, B: g4 o/ ^9 w6 t8 H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 e( U, K% `9 s; q( s& F - * GNU General Public License for more details.
% d8 p9 s' l/ ~8 e - */
4 f; ~, f( Y. t ] - 1 T0 m$ `- [$ y0 [
- #include <linux/module.h>
9 U4 u$ d1 h3 G- j. a% f - #include <linux/init.h>% B* m" k X+ M* @+ M3 G
- #include <linux/errno.h>% d, M2 V `' ~3 r2 G
- #include <linux/types.h>
, o; v- o6 G( ?; {, L - #include <linux/interrupt.h>
- ?1 I8 ?% R$ j3 ? - #include <asm/io.h>) P1 y8 j! n* i# o# z% \- B
- #include <linux/moduleparam.h>/ a7 b! n( u+ q* Q
- #include <linux/sysctl.h>
m0 v9 y( _1 O, T - #include <linux/mm.h>+ R+ F1 x: s2 z" n/ H7 ^' g9 B
- #include <linux/dma-mapping.h>
+ i: i9 g6 P9 g) y* c# F4 s1 a u5 M
' Y- ]# P! l0 a$ ~7 V7 N2 S- #include <mach/memory.h>
$ b$ g4 Q- e5 P, W7 q# s% c2 g - #include <mach/hardware.h>* W+ d4 j/ b) ~9 a4 ]+ S3 ?
- #include <mach/irqs.h>2 j" S. c# ]+ R9 Z0 G3 D/ f1 m+ G# L
- #include <asm/hardware/edma.h>. u% C; G5 e o% j, W; ?
& K! j7 x/ O/ Q5 ~, J- #undef EDMA3_DEBUG
& m4 I" c7 P4 E% O c+ ~ - /*#define EDMA3_DEBUG*/
+ Z- t+ u. o; q/ Q1 V
# B! t j/ `2 m5 `! v6 s- #ifdef EDMA3_DEBUG- K8 g( f& b3 d7 A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! e2 ?6 e$ d7 i' D J; g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 D4 R, T) R6 R a! M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 f% s' b- `8 f5 x2 _+ o8 v6 q - #else
$ c6 s" h# Q5 H- p8 g. Y( A4 e - #define DMA_PRINTK( x... )- c/ [" E/ h& h$ z1 e9 |( x5 B/ ~
- #define DMA_FN_IN% P4 d u2 q" [4 N5 W! V4 G8 [! n
- #define DMA_FN_OUT4 X% K' X# B) a C# h
- #endif( `# P* I" ]+ i" c4 J- C; v* s9 _
7 M7 Q& g( d+ [0 j, A/ [# I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 ^2 u+ E2 m; T; p! B% z - #define STATIC_SHIFT 3
7 K# {( W6 @! Z% A" J) \ - #define TCINTEN_SHIFT 20# O/ ]$ K C' z6 o
- #define ITCINTEN_SHIFT 21
+ _1 [# H/ ^6 N! { - #define TCCHEN_SHIFT 22
5 Y" a3 U* [/ B# ]/ k: ? - #define ITCCHEN_SHIFT 23
' [% W* M3 h0 P/ U1 u0 Q9 V2 J% m0 x - 9 V6 G- N8 r l0 o
- static volatile int irqraised1 = 0;& U1 q: W }6 s/ Q/ e; q8 |8 U- j' K
- static volatile int irqraised2 = 0;
6 v7 M. [# A+ `6 ?/ R- Y/ Y* H; R
- L) _' b w6 Z g j0 ]$ Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ [8 c j/ Z, A# {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, P: o, o+ @4 F* J% K! l4 x9 s1 V8 k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' y8 C. _; b3 k( O. j - " g' _5 v, W7 z' h+ S( ^% P( ~
- dma_addr_t dmaphyssrc1 = 0;: S, `; g m4 S8 ~+ M C
- dma_addr_t dmaphyssrc2 = 0;/ N$ x& W i) y& h
- dma_addr_t dmaphysdest1 = 0;4 b7 j7 L4 R- l. q$ M! F
- dma_addr_t dmaphysdest2 = 0;) _7 H8 W8 Z, S z: U! s8 r1 M
( J0 u1 s9 y1 q6 G4 O/ y- char *dmabufsrc1 = NULL;& L6 s. d8 W& b/ P6 ^: M
- char *dmabufsrc2 = NULL;
/ _3 ^3 \$ v& j' { d% k - char *dmabufdest1 = NULL;
% c9 @7 O. w: i- y1 g9 t& j - char *dmabufdest2 = NULL;
! B( g& Y7 E" p - 5 H; B! ~5 D9 s* K
- static int acnt = 512;5 g @6 \1 i% q
- static int bcnt = 8;
% z+ P9 E9 G: u0 e, @& @6 t - static int ccnt = 8;2 b! J7 Z9 u/ N. t
( p+ O) v$ U t0 P. s @" n' }1 I- module_param(acnt, int, S_IRUGO);1 v4 s; L" t% j7 e2 \
- module_param(bcnt, int, S_IRUGO);
" L. D- U; p2 E; q) M, P; ` - module_param(ccnt, int, S_IRUGO);
复制代码
Z2 A+ E" ^8 o" ^2 I: M }
) O* r5 H" `' b5 A! Q; q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ J, J; X6 t0 N" z) f3 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 z( o& N) I R# J- q; L5 {. m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% G8 m+ G3 C5 s1 v E3 e# |% C4 i! ^* A, n% a
, h: M6 Q4 M6 U3 Q1 Q
|
|