|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 M: Z. e# r9 Y- [code]EDMA sample test application
+ N1 R* r- W- V0 Z4 j7 Z - /*) s% d0 b. T2 a o! E6 R
- * edma_test.c( n8 J) Q5 H% M7 t: ~4 \6 V
- *- G- R; ?+ f2 N9 G) }$ r2 P
- * brief EDMA3 Test Application4 B! C2 E3 }: y G! R- m- I* l- Q
- *
; a- N1 w% e. V4 J, J( F - * This file contains EDMA3 Test code.' D9 K4 P/ S- W; D) I/ b* X% A0 p! u( r
- *
5 [4 ^7 ^/ i* I+ ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 M1 }& s: ?/ c2 |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 k& L v) n0 T9 I
- * TO CHANGE.% M6 D3 I# j( C0 W1 S1 k% s
- *
- ~9 S- s: k; j* b/ \) s4 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& U& n6 ?7 |- G& g - *
& A9 r9 o- z8 I. W% \ - * This program is free software; you can redistribute it and/or" H7 P- J5 [( @, e8 [% q# c
- * modify it under the terms of the GNU General Public License as
, b% _$ n9 v# v& e4 S7 F S - * published by the Free Software Foundation version 2.! V: V& N! o) j6 Z) q) a
- *% p3 i4 ?% n. I1 _8 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" b0 ^$ }( S3 g4 Z- }# f
- * kind, whether express or implied; without even the implied warranty" o/ ]+ d7 Y( `) q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% h' t+ }: _% K& W6 f# \
- * GNU General Public License for more details.% ~7 k% J5 t3 W% C: I0 j
- */
- X K( ~& O) k - 9 j, W' D' C# Q7 u7 h. E
- #include <linux/module.h>2 W. g4 \! t* N; Y
- #include <linux/init.h>
$ b, w( H) l) ^/ Q - #include <linux/errno.h>
( y8 f5 A A0 X0 _4 M& O# W - #include <linux/types.h>
& u! m! x. C! N8 o0 j - #include <linux/interrupt.h>
- P- S; c7 Y, _3 w - #include <asm/io.h># j; u: V2 P4 z, |" Z' ~$ |
- #include <linux/moduleparam.h>
- C! L# l2 D. z7 N1 w - #include <linux/sysctl.h>+ O# y. o y6 i! k* T$ B8 `
- #include <linux/mm.h># t3 Z* u3 r! f) h @
- #include <linux/dma-mapping.h>
/ ` Y7 k1 ?" `% l7 ?" {' X
. R( g! r% o5 L, V: s) J* Z- #include <mach/memory.h>' ^7 ]+ B" Z* J4 ~4 W( ~
- #include <mach/hardware.h>9 |8 y+ q; M2 Y8 Q
- #include <mach/irqs.h>
B4 r9 F" Z3 b$ i$ [% C& W - #include <asm/hardware/edma.h>
- J' W1 n( `- i# o% j( j4 L2 r - 5 S3 p3 V5 c9 M/ M" H
- #undef EDMA3_DEBUG
3 _. z* S! [& c0 e1 h f - /*#define EDMA3_DEBUG*/7 z8 L4 s3 A& X/ E3 o
8 l+ C- y7 d" M/ A; ]- #ifdef EDMA3_DEBUG
- @3 f" }, j( l9 H% ]2 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* b) p. L ^; L/ v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 v; t1 H" t/ n+ u1 J9 x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) h+ m! {/ L4 @1 a3 `
- #else
) D' k% k( P ]' H6 Z0 j- d - #define DMA_PRINTK( x... )
7 G+ l/ a- e; t- ^; d3 g - #define DMA_FN_IN
+ \- D" ?: N* d. M - #define DMA_FN_OUT# f/ M. g9 ?6 N* w8 e
- #endif
" u0 }8 k* u6 k% P7 X5 D
5 V- g; F* ` M4 {3 c# u& N: ]8 v2 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768); p4 g, X+ x8 Y" W% _9 Y
- #define STATIC_SHIFT 3
! y& Y$ d" W. K+ u; m - #define TCINTEN_SHIFT 20
% `% d3 Q$ I" j M+ x# | - #define ITCINTEN_SHIFT 21" f: b' I$ v o
- #define TCCHEN_SHIFT 22: \) t9 Q. Y. g4 D5 q( @
- #define ITCCHEN_SHIFT 23
! X) `' V2 O, I. s
8 p& K! z# B, P$ \4 d- static volatile int irqraised1 = 0;8 W' R1 t( K0 p
- static volatile int irqraised2 = 0;7 D5 J" D# `* K" z/ L7 ~) J+ h
" n! j1 S6 s( p( O. W1 {% l( s$ {" C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 X' k* s. r4 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ H8 O8 B" V6 X+ H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 R% l. x: Z* J# T5 C
% |7 B9 f2 d" Y. k( N- dma_addr_t dmaphyssrc1 = 0;% I6 i% x, R6 a+ A
- dma_addr_t dmaphyssrc2 = 0;
1 _/ D0 t0 H) V - dma_addr_t dmaphysdest1 = 0;
/ Z* \. n0 ~2 j% a$ V - dma_addr_t dmaphysdest2 = 0;9 d- M* Z3 H4 G
- v E1 u0 h! F2 g4 Y& x* v2 \
- char *dmabufsrc1 = NULL;8 T1 ~6 U( o5 w' T( o3 [2 E
- char *dmabufsrc2 = NULL;
( `* X. b* m' \. r+ ~6 n1 v' y8 S - char *dmabufdest1 = NULL;9 K/ l# M% y% k7 e C
- char *dmabufdest2 = NULL;8 y3 n, v0 t; S6 J% t
- ) ~3 z, b1 Q; F( N8 w" r" W
- static int acnt = 512;. m$ _6 V: ^$ s+ ?3 v
- static int bcnt = 8;
) b: W5 v; R# d1 ?1 D+ y - static int ccnt = 8;
0 [. s% d' t$ k! }. ?9 k$ p2 D - ) Z, T0 c( h4 J+ z+ q; B4 M
- module_param(acnt, int, S_IRUGO);7 H9 ], Q$ f- v
- module_param(bcnt, int, S_IRUGO);$ e% B3 q! v# i, \/ ~' P3 u! u
- module_param(ccnt, int, S_IRUGO);
复制代码
5 E, d) I0 A! V) C8 u, T4 V3 G! L5 Y6 i# f K. N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, B* ~# I0 a) y- h7 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* h& @& ~. R2 W A4 r* } c5 G2 F3 o, Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% w2 @ i0 F, V4 |$ M) V
; d6 y& |8 W! e5 o# l5 n: R
" V+ |! h6 n: G6 n0 c4 a! }- N, ?# V |
|