|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / F- U1 D* {1 F
- [code]EDMA sample test application3 Q0 e2 r9 O ]2 I1 w1 r& J
- /*
9 m, ?; o" R* K1 {) M# D - * edma_test.c! D4 o) r6 j* e! X
- *: ]- K1 i0 i4 A' K2 `! j# O
- * brief EDMA3 Test Application! K. L. F& @( ?4 R* M% S# X# X* A
- *! c4 D' N+ `$ _6 y+ E1 ~
- * This file contains EDMA3 Test code.
P/ @1 V" H O. z; v - *& F. F4 H$ C( E5 o G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# }8 `$ h* h, h, `! `" R7 m# L) h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- U. x' K& o3 y* R) I - * TO CHANGE.( a+ A' m! t1 I5 b* Q
- *
$ F8 ~. a9 \ E) Z% v( V( m" h! W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% p% f3 e0 U& Q* R$ S
- *
; O" C J$ e3 U7 e. K - * This program is free software; you can redistribute it and/or
" E" b8 h3 ^8 L6 Q2 x0 T4 A& b1 g# S5 o - * modify it under the terms of the GNU General Public License as
8 B- l; d7 K: U1 f, r- U1 _) q2 [* i/ Y - * published by the Free Software Foundation version 2.+ o- G; |; y' U. t# I; [
- *& j0 |" R6 i2 M5 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 w% p% U1 n$ g7 E1 E+ ] @% ~$ H
- * kind, whether express or implied; without even the implied warranty
5 d' K% @* F( ~8 H1 w. Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. [( {5 G' t2 R7 j - * GNU General Public License for more details.) R& N! g" W) J! B3 Z
- */
# q m8 c$ m0 j7 F
* e8 C4 G( f( E5 k9 X7 d h- #include <linux/module.h>$ c1 R- h+ j, @% L# Q4 \8 x
- #include <linux/init.h>
4 M5 Z3 u3 \5 y0 Y8 ^$ _& n - #include <linux/errno.h>
# N% I7 \0 h% a, l( X - #include <linux/types.h>
/ b% d, _3 E$ ^ - #include <linux/interrupt.h>
7 a/ s3 ], \# n* f( ~5 q - #include <asm/io.h>
7 ]# ~: C3 j1 ^, ]& ~ - #include <linux/moduleparam.h>
& c7 b6 M: ?2 v - #include <linux/sysctl.h>- R% W" |# [8 M3 K, G
- #include <linux/mm.h>% L- H- _ M7 D7 G
- #include <linux/dma-mapping.h> B8 z6 M& |3 f
- 0 [+ c2 k! w) H. u' z/ o$ z1 K+ H7 j
- #include <mach/memory.h>
- A7 @3 b' k4 P( _5 Z( [ - #include <mach/hardware.h>* l* i& T2 _2 z* P- q
- #include <mach/irqs.h># S& `- @8 D) n$ g% f
- #include <asm/hardware/edma.h>
" O9 y k5 [. w; ?- A9 k
& T; R6 Y' A; L- i/ |- #undef EDMA3_DEBUG# h* S! E1 |; y5 G5 [6 j
- /*#define EDMA3_DEBUG*/" f4 B# \3 i' W! n
- ' o; u. I2 c H# a5 ]$ M( C1 X
- #ifdef EDMA3_DEBUG
# b* B. d/ {. z4 m- H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- [% L/ \% O8 R/ {, z+ s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 L3 K1 Z4 v4 X7 b& t% S3 O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 H3 v- w7 x! s2 g& }
- #else
T7 p9 l' M; _9 S i' _6 \, r - #define DMA_PRINTK( x... ): O/ e" W( B7 \
- #define DMA_FN_IN
1 B1 J5 |. t& y& V8 T - #define DMA_FN_OUT7 c" e9 F" L0 n/ v; ]# z
- #endif7 n ]1 G6 N- [1 L$ `# ^# t
2 c! q- `6 D$ M, U1 d! y7 R& y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) Y, S+ n" k1 i - #define STATIC_SHIFT 32 S9 C! s! j5 W6 S
- #define TCINTEN_SHIFT 20; ]7 t3 a t$ D; p5 c$ E
- #define ITCINTEN_SHIFT 21, S* T3 T) H: b5 m
- #define TCCHEN_SHIFT 22( K( l5 V( S, H2 w! f9 Z( @0 c j
- #define ITCCHEN_SHIFT 23
, ~7 m3 W6 u/ L% x# B; X - - ?3 l9 O; R" y0 X; L3 g9 l
- static volatile int irqraised1 = 0;
; Q; ^* V1 t e. ^ - static volatile int irqraised2 = 0;* c5 _$ m$ I# T+ b) t" P1 K
& Z4 R, z- b' c* J2 _2 E5 m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% B. A; D( [# f& B1 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 n u6 Z2 X3 F- `& }4 N4 V0 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. J0 g, O T( F( z' _, g - : n; D, Q+ o& m. c) K* a
- dma_addr_t dmaphyssrc1 = 0;
. ]) f9 O5 N/ V* y6 L - dma_addr_t dmaphyssrc2 = 0;
! E, F/ T1 m: _( h t+ j - dma_addr_t dmaphysdest1 = 0;
?" z3 X3 {8 \ o/ } - dma_addr_t dmaphysdest2 = 0;
2 W! Y1 s. q6 M/ L4 y9 F
8 O) C6 i+ y5 G) [& e$ I- char *dmabufsrc1 = NULL;! ?1 m) {8 H, S- u4 v) A
- char *dmabufsrc2 = NULL;2 }* \9 d& a7 l) F% I. }, w% x
- char *dmabufdest1 = NULL;) p( C/ E8 I, X+ F' X+ x+ H, a
- char *dmabufdest2 = NULL;
( I- O2 D5 w: S - / L- {2 p4 ` L- z
- static int acnt = 512;2 M5 J% H) D) h9 Y% m3 K# O# e% O
- static int bcnt = 8;
6 B1 w; K+ g1 Y( N$ J - static int ccnt = 8;7 Y2 Q) a. J* H
- % r: Y4 h( ~$ w9 Q( R
- module_param(acnt, int, S_IRUGO);
. _2 F9 T, {& ?8 Q' \ - module_param(bcnt, int, S_IRUGO);6 d( Y! d, ~; l; O9 K* m1 }
- module_param(ccnt, int, S_IRUGO);
复制代码
; }- w: B6 k9 b, k- J
5 I8 e: r* }% P; H% I" s5 Y) R/ } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- `: ^8 {3 H; p5 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ C3 G( }/ o1 `- T, a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. C, q d$ n5 F$ W, t' b1 Z* }7 w2 h
4 z8 l. @2 {$ k
|
|