|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : a1 ?3 a% y. b- ^8 o
- [code]EDMA sample test application; |: s* k+ t) _+ c- `1 r, s& g, i
- /*
- o& E, k. c1 Z) h - * edma_test.c. o* n5 r) v; r( ^4 C
- *' g$ R1 G+ F g
- * brief EDMA3 Test Application1 k+ O. m; X2 A8 K& [' T1 Y
- *
3 o& [) x! q! @$ o2 [ - * This file contains EDMA3 Test code.
1 J' J0 G2 _1 T& L/ p - *
! G. P/ j/ u) l5 O% y0 T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 u$ n0 o% }& T- ]* v& @6 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* O" i/ Y$ t6 H. G, k
- * TO CHANGE.. O, o1 P& b( \& L0 S8 E
- *( S2 l: Z) `7 y; y, g) c7 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. R5 g# A, _6 X! K - *' L2 l9 t7 j5 g9 B% W1 a2 O) J
- * This program is free software; you can redistribute it and/or
* s1 N$ J8 J: g9 ?' C - * modify it under the terms of the GNU General Public License as
6 m! p% \1 w8 z2 V; f* z" ?8 c - * published by the Free Software Foundation version 2.
& b( H1 H/ _# I: | - *$ H5 V$ Z) Y3 `: K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 [, r% i' F2 u5 \" |) O - * kind, whether express or implied; without even the implied warranty8 p3 }, @9 R- h4 B7 H9 f$ Q6 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 ^" V3 y. b5 [2 I; T) s
- * GNU General Public License for more details.: a% Y- ~6 c' ~
- */5 l1 [7 q2 a8 L. t7 ~% l3 s
- 6 Y: f3 Z% n* u1 b( x3 J
- #include <linux/module.h>
& S! R8 ?( L" Z. X/ ~! l! a - #include <linux/init.h>
, n3 K! L1 i& U! B9 }" P - #include <linux/errno.h>$ k) ~- I/ n" w' N
- #include <linux/types.h>
: N7 ?0 n4 P! i1 G0 R - #include <linux/interrupt.h>
) B9 P* W, [- L- Y' y - #include <asm/io.h>
' ]$ ?2 ^5 k& p! s3 G - #include <linux/moduleparam.h>
: _1 |7 Z T) f6 x! F - #include <linux/sysctl.h>$ @5 }( N- g# y/ |, G
- #include <linux/mm.h>- k4 y2 \- k0 |2 D4 U u# i+ o. L
- #include <linux/dma-mapping.h>
. H( t7 K3 [/ I- h' [, H6 C
' J7 E( [! J& u5 \* P* d; _- #include <mach/memory.h>1 r b2 |. b4 J1 V% y
- #include <mach/hardware.h>/ {3 S, m; v* L! f; l: `
- #include <mach/irqs.h> f; r+ G, V1 w; }0 w
- #include <asm/hardware/edma.h>
H. N6 m& R0 r/ P! p& i
" j3 \& }1 y6 K2 ]: t# C" v- #undef EDMA3_DEBUG
5 j8 e% S" v: @3 ^, f - /*#define EDMA3_DEBUG*/
% ~* `6 F) s C d- W - 2 U8 Y* I% q( A9 n Z& _
- #ifdef EDMA3_DEBUG) A; u x& k% D- A" i( C5 [# F1 f. o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ s! M5 H5 b4 h% q7 e- d" Z$ ?, u# D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& v3 t/ Q. k( |9 `- ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 X D% P. L- ]5 j+ Z0 A
- #else* Z* `! m7 q2 u7 K( H& B
- #define DMA_PRINTK( x... )! C6 H+ S7 ~ h
- #define DMA_FN_IN
2 t9 c- G' K) G. c# Y+ r) N - #define DMA_FN_OUT3 u8 b! }% O! k2 @
- #endif
% j5 K/ v* H% c8 |, S9 d% b* Q
' k/ |; P/ J4 @! v! D* G8 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% g# X2 E; B" k
- #define STATIC_SHIFT 3
! C) [/ U, r8 i# l. B2 } B4 p - #define TCINTEN_SHIFT 20: k8 O3 m* s2 t( n
- #define ITCINTEN_SHIFT 21
% `! d2 y$ i* c; L) E- O) [ - #define TCCHEN_SHIFT 22
/ a/ f0 ]; c$ a: u# c - #define ITCCHEN_SHIFT 237 Z# q7 e {! P- U9 s! I/ M
- 1 G6 x4 R1 u# a7 Q) ^ P8 V( Y
- static volatile int irqraised1 = 0;
. k$ E2 M, ^, R - static volatile int irqraised2 = 0;
7 p$ T4 z0 \8 s5 i/ [
; w+ o. @# M9 L# l# t& L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ v2 a$ q U4 H/ ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. O4 b- ~3 E" c" J! g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ T4 U3 J0 ~1 V/ O/ a5 T
7 v3 Q6 ]# v% _9 |4 E- dma_addr_t dmaphyssrc1 = 0;
: B) K! U' O& `! h - dma_addr_t dmaphyssrc2 = 0;
- S# a+ J: A. M* Y5 r3 a - dma_addr_t dmaphysdest1 = 0;
N; ?. C( c) P Q0 e8 e3 j - dma_addr_t dmaphysdest2 = 0;
) t1 g+ e( E: m. [8 Y6 U1 j
4 O) C7 {& G# ]- char *dmabufsrc1 = NULL;3 F& b( A- e- u/ l' l% _0 z
- char *dmabufsrc2 = NULL;
" K& O+ ]7 @& Y! P2 N - char *dmabufdest1 = NULL;2 @8 U/ Q! p- S. v
- char *dmabufdest2 = NULL;4 s; Q/ \# E5 i
- * i# @1 {3 z8 J
- static int acnt = 512;
% g7 U0 H$ K* M/ v+ w& E - static int bcnt = 8;# `( s( ` ~! ~& y
- static int ccnt = 8;
/ b2 q0 f' D2 b9 b5 a( H+ b
- N) [/ D% q( x- module_param(acnt, int, S_IRUGO);& h3 m Y0 e4 i7 ^ t' _8 S' G; g4 Y8 X
- module_param(bcnt, int, S_IRUGO);
+ v& T. O1 G% o+ ?" `3 h% v8 W$ ? r - module_param(ccnt, int, S_IRUGO);
复制代码 ( L) r0 N3 f, s! n ^) x
8 y# n0 ~1 s3 N" ?$ E8 D, a0 L) R; v _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. _8 S1 @+ Q1 P' {! ?4 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: ~5 ] K$ p, y, n; Q$ v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 a6 G# b7 `# }6 q8 P4 z' O
l, B. ]4 _& |/ c1 E3 R5 I0 P8 k
5 v: \" F& E& I$ j* V v
|
|