|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 g. Z2 D. X/ U0 c/ ?% P
- [code]EDMA sample test application
& U. q% ?( C- F* G6 k5 e7 J - /*) ^+ q8 g9 O/ f& `: ?: F" w3 f4 r
- * edma_test.c6 P; O# a x$ e" A2 ^ i& q' c
- *
) l$ N4 n4 B& d* i( K - * brief EDMA3 Test Application* Q. Z# e. N. Z+ R9 p' i, N
- *! W+ {( X2 |$ I3 k4 s/ C
- * This file contains EDMA3 Test code.
# g) }- i! p. e3 o$ Z - *
* D3 V, c$ R" X' `" o7 f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- h" W$ f# |0 q! k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& B H5 J0 M% v& b8 a3 c! G9 ~ - * TO CHANGE.' C- k3 i# Y, G y L [9 T
- *# h' ?. G4 |% Q6 y2 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: K" e" r1 _3 O( B5 t - *
& G$ r& S. _4 b3 M$ u - * This program is free software; you can redistribute it and/or
9 Z( y8 n; y+ b1 G - * modify it under the terms of the GNU General Public License as
; C0 a$ \+ O- Q8 L! O3 m - * published by the Free Software Foundation version 2.
" g. f T& T) j/ e: w# z, b - *+ @/ {- b- L# X& [0 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( [+ F; C M( L8 b- o
- * kind, whether express or implied; without even the implied warranty
. {- b) M P6 P$ b* S0 y0 c9 r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 P [ R% `3 L2 l4 ? - * GNU General Public License for more details., T& i: x$ @' B2 f* Z2 ^
- */
/ n. i7 s0 o: n- o8 @2 `9 O - % V- O# a6 M" n& n* Q4 r
- #include <linux/module.h>
4 ^- d1 B+ _* {( u - #include <linux/init.h>
3 v( Q3 k% [# O# N& ~ - #include <linux/errno.h>
' h& r! z2 O- r) G' g# V- [5 m* S - #include <linux/types.h>. T5 n( H/ s4 J D. j
- #include <linux/interrupt.h>9 D' o0 r* B; g+ Y
- #include <asm/io.h>
% U. A: l3 c0 P - #include <linux/moduleparam.h>& g6 \/ D5 L7 Q: d) N4 \( y
- #include <linux/sysctl.h>+ X5 q3 b2 Z' a, [1 z
- #include <linux/mm.h>2 q, _0 u# X' N# E5 m
- #include <linux/dma-mapping.h>
* t; m" a9 @$ N k1 C - 2 @0 ?! j' g$ j! p
- #include <mach/memory.h>
0 L9 l! B" {: @% @: M: I* A# G3 F - #include <mach/hardware.h>
# r h6 Z5 v! H - #include <mach/irqs.h>. Y8 G! F4 N: t/ L) e: J! |
- #include <asm/hardware/edma.h>
3 n- }; c4 H' j - 6 ]$ T( N9 z$ `7 C) F6 N. V
- #undef EDMA3_DEBUG
7 F, i) t, o* l R, p( G1 Y7 y' | - /*#define EDMA3_DEBUG*/
; H3 k2 y6 d+ k' C$ H1 V
) ` q1 U4 Q" N$ @$ ~1 s, i- #ifdef EDMA3_DEBUG- i, m7 E2 I0 \+ e* \1 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 [; U; t. _+ |2 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 X6 x/ q/ b6 |: h4 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' @4 c1 Y+ \8 a5 e8 k - #else
* [5 Z4 X0 y/ e1 W% Y/ ~) g0 n - #define DMA_PRINTK( x... )
; p8 d/ E: A3 ?$ T9 h - #define DMA_FN_IN" L2 _; u' F( J" y' F
- #define DMA_FN_OUT
2 X; f# l& A# X4 H0 b8 v - #endif5 ]9 u0 g: Z P+ T9 S
- $ h2 e0 O) j- S- B5 ?0 I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 V! B! n7 q5 H E* ~3 ?5 { - #define STATIC_SHIFT 3
8 k+ m5 J6 v" i) L7 g* F, ]; s. W - #define TCINTEN_SHIFT 20
+ Z4 W- H4 n8 t5 z - #define ITCINTEN_SHIFT 21' X4 Q2 B E; ]- Q! g
- #define TCCHEN_SHIFT 22
- i) }) S+ e/ y' M8 ` - #define ITCCHEN_SHIFT 23# ^" y. c6 ]$ D" r" t, ^
0 A! @$ Y1 T2 S- static volatile int irqraised1 = 0;, R$ f$ z5 L2 ~/ C8 T
- static volatile int irqraised2 = 0;
+ P5 [" \( C; X0 [2 b& j - , i" V# X: L, `3 p# q" ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ v) I; U. w/ l' z g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 @! k: N. z. V' X2 E. h* { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); W6 w0 Q* K/ E/ [% q
- * m9 q- D" Z6 ~
- dma_addr_t dmaphyssrc1 = 0;
1 o( M* ?: d1 ~- t) m - dma_addr_t dmaphyssrc2 = 0;5 {( X! ?2 v" h$ `. h
- dma_addr_t dmaphysdest1 = 0;8 @7 b6 i+ r# _/ b; e: Q8 r$ t+ ^
- dma_addr_t dmaphysdest2 = 0;& P) f a9 q+ P2 X& g$ H
- D; C) C! a# i3 _ X- char *dmabufsrc1 = NULL;
& T$ I' D M! C7 S3 [ - char *dmabufsrc2 = NULL;- A0 A d$ Y1 w. K1 j
- char *dmabufdest1 = NULL;
: G* N8 r% [/ A. P, [$ ?4 c6 I - char *dmabufdest2 = NULL;
8 j0 ]$ i% f# q% r' t( h
' J9 D( r6 o3 E& V, |( |- static int acnt = 512;
G* D# z/ H! T - static int bcnt = 8;
2 X8 j' Z. z: p# A5 ^$ M* o$ K. Z - static int ccnt = 8;, y/ i: J. t# l4 Y
- " ~% c8 V4 U1 S2 Y- E( @
- module_param(acnt, int, S_IRUGO);
8 \/ B! y1 N+ z2 z y; H - module_param(bcnt, int, S_IRUGO);5 e4 m6 ?( f: h3 H8 h- ^
- module_param(ccnt, int, S_IRUGO);
复制代码 7 v1 @0 s0 f+ z; c
- E, p4 U- x+ N1 i2 a5 s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 W# L6 y6 E3 s% x, }9 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 w- | d' Z) k; A1 i! l. s( d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 w+ f: t7 \$ r0 G
6 T, ?. q( i6 U5 |. f7 g
% p; H/ ?9 _. a) v( p- h |
|