|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& Z2 u+ v5 s% ?$ [; _( E/ @& V- [code]EDMA sample test application* H6 ~0 _* Z2 b2 z1 g, q4 n N
- /*
0 j* r2 G2 @4 [$ z3 j - * edma_test.c
$ T& [6 ~5 e. h9 T3 Y, V - *0 K: n5 y/ F% r6 y1 H5 l& k
- * brief EDMA3 Test Application
% x r$ p2 a6 D. l- y# Z5 z - *
, ~3 u1 Z" h; U5 K1 T& ~ - * This file contains EDMA3 Test code.' t# \0 i6 I J m# a+ a" f
- *
7 m( C5 g2 B) r9 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# Z% M% @; H' E5 e5 ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# P" O9 g0 j$ \* b1 Z2 q2 Q1 {& m - * TO CHANGE.7 I2 Y( B0 G& t" Z7 I
- *! B, x4 J% @& Q2 f& D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
V" t8 l) Y3 E7 P- k. c - *
, |. r+ f2 [( x6 T f J$ ? - * This program is free software; you can redistribute it and/or& `6 W8 C% Q+ J
- * modify it under the terms of the GNU General Public License as+ f7 x" O3 E+ [! X. W0 J; z
- * published by the Free Software Foundation version 2.
# l! u! p3 Q; n2 [ k2 C - *
( `' r/ B1 e1 p4 v. _& [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! w8 Q: J1 x0 ^8 a4 C
- * kind, whether express or implied; without even the implied warranty
5 H# m' @; r' l/ @' } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* h- L1 S' `. E; i. M: V
- * GNU General Public License for more details.9 F$ O6 g, w' X( H8 c c& O
- */6 {; S1 t g4 @4 J
- " s" Y& C- b+ N
- #include <linux/module.h>7 J+ z$ O9 T1 _8 |
- #include <linux/init.h>1 O9 v3 f! A# \2 z' g# N
- #include <linux/errno.h>! \9 H8 g3 @: S* M: m
- #include <linux/types.h>
1 [9 [% T$ Z6 n) b - #include <linux/interrupt.h>. x' C5 l- m1 _. g: H' n
- #include <asm/io.h>
+ t+ l4 ^( l. U9 P" D G- E' k - #include <linux/moduleparam.h>7 {) k: l( C* T4 n) t0 n
- #include <linux/sysctl.h>' o/ |% W3 H7 B4 y7 h
- #include <linux/mm.h>' b8 b) \2 w9 A. R
- #include <linux/dma-mapping.h>
+ N$ f5 F8 |# E
5 `, Y% V% f" c( h- #include <mach/memory.h>5 o8 m. M4 B' v& _- u3 |6 ^
- #include <mach/hardware.h>, n' M* p, a7 k+ H
- #include <mach/irqs.h>
: a2 b6 c! s4 Z - #include <asm/hardware/edma.h>2 R. i# _: K5 Y% p( n
- ; Z$ ]" I7 Z; Q2 j/ h- [
- #undef EDMA3_DEBUG" w3 X. p) d4 Z6 Q A3 b$ I/ D
- /*#define EDMA3_DEBUG*/
& ~0 r: ]$ j, _+ |4 L+ E% ]
C) I9 n' c. Y4 J$ H- #ifdef EDMA3_DEBUG
9 w$ O0 r( K3 l* l/ {% v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ p) X8 T6 W' ~$ v5 C6 K) G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 h/ `7 P: o: ]2 `3 u& a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# e; T3 U# `8 z! ]; l - #else3 I0 _ B ?5 P1 S0 R
- #define DMA_PRINTK( x... )
" I/ D" p$ L1 x - #define DMA_FN_IN7 ]" O) V8 j! l0 I' t9 _
- #define DMA_FN_OUT8 ~& H5 c! o3 e: b8 c% M6 I
- #endif
# V* I8 V/ L/ I1 p! {' P. k$ @
" Y8 K* x% y9 I( O6 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 V" g4 H. u9 b8 ^; P - #define STATIC_SHIFT 3
' b K2 t7 C$ b' p - #define TCINTEN_SHIFT 20. ?* A1 o* P/ ~- f$ X: d8 b4 h( E$ x
- #define ITCINTEN_SHIFT 211 k: I) c# [* @) J0 C
- #define TCCHEN_SHIFT 224 a {( E o6 ^7 e7 g
- #define ITCCHEN_SHIFT 23
: ?; i& _8 W$ G. c# _
# b% S6 w; W: J- static volatile int irqraised1 = 0;
8 W5 k' T% Q1 X- H- ]0 e - static volatile int irqraised2 = 0;7 H5 [' \# g) [& e/ @# y
, `! Z; g/ ?* b5 H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- S4 W7 h& d) {" {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( T% z5 Z0 i. m' U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; C3 i) q+ {3 q# V8 w6 c
C0 A3 A# \, A' I& o* a+ B% K- dma_addr_t dmaphyssrc1 = 0;! Z* L- g% J% B" [) R9 I) F; ]% Z
- dma_addr_t dmaphyssrc2 = 0;
$ ~+ k# E* k0 t. b2 d - dma_addr_t dmaphysdest1 = 0;
]' e8 ]5 l, i- R3 f - dma_addr_t dmaphysdest2 = 0;
8 A" M0 n) ~7 L% k" I2 E* o' D
8 h+ a* M. ~7 ^0 ?- char *dmabufsrc1 = NULL;
. f4 ~2 y) ?: L - char *dmabufsrc2 = NULL;0 t% h$ m" C. `9 y4 U; d( E0 e
- char *dmabufdest1 = NULL;
" _9 D& B1 N; B0 v5 X+ m - char *dmabufdest2 = NULL;
- R$ S) ~# s4 F7 G - , S$ c: T4 q' \4 M, L# R
- static int acnt = 512;
) Z$ F6 j- @) \5 A$ d; R5 j; i - static int bcnt = 8;
+ s( B4 `; E' {( y) f+ f& j - static int ccnt = 8;/ ~5 e) s: X$ m7 u$ f# |
% x X( q# s" b! F+ x. j2 d( J- module_param(acnt, int, S_IRUGO);7 a! c9 s% O" L8 F
- module_param(bcnt, int, S_IRUGO);
0 F+ D! y* S/ B+ H - module_param(ccnt, int, S_IRUGO);
复制代码 # G1 b: j$ m" Z- ~1 l
4 q$ B9 s* n: {' l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( u5 o2 s/ {5 t9 b: _6 ^: n# R" ^0 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" t+ Q: y+ q9 F* L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: W: z* l6 I' \) J0 q: c
- N* k# x! O) @% R
9 b. g. g# y0 Y6 o+ i
|
|