|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 b. r9 s& ~8 y% j/ p
- [code]EDMA sample test application7 H8 F# ?8 P3 r; l! J" ]2 m+ ^
- /*! \$ Z& s& z$ `! C# B
- * edma_test.c8 l. N* Y) e3 ]: ~- E+ e2 H; E% [; q$ M
- *4 j9 x; i4 n" I p
- * brief EDMA3 Test Application0 x, e: b1 ` v. i/ m/ h
- *! J$ U4 h% b, c
- * This file contains EDMA3 Test code.
% h f- e# m. o2 R - * d: J5 ?# C: n8 l! G+ q F0 m# d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ \; i! t' u/ |. Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ G0 d6 |# o4 m6 B. `$ b- g4 m
- * TO CHANGE.
! L! W q7 m( ]) e6 C - *! c6 H. B% \: v- p9 G* H/ Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) U: @0 K+ E+ D/ _- C4 z0 ~+ t
- *
# I. ]- \/ |. \' n: w - * This program is free software; you can redistribute it and/or+ O, x3 q H6 X. N
- * modify it under the terms of the GNU General Public License as
& C" S6 ^" {5 y" C# X& V; s) U. Z/ F - * published by the Free Software Foundation version 2.
3 @* T3 E' C* g& N/ U( h& j6 C - *
8 ^; Y7 ~% r. B3 t! w! U, F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# C- R0 Q5 d. \: U( V$ _$ C' b
- * kind, whether express or implied; without even the implied warranty' |. w+ J+ S, ]; c6 C' ?! [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ P h6 u6 i0 y8 `& O - * GNU General Public License for more details.
/ L1 O: a9 ^6 q3 m - */
: b& I& {) z' s2 e+ @
& e! U) k% X0 h; B9 A Z+ ~/ e- #include <linux/module.h>2 H; l3 A: X! ?# [( E
- #include <linux/init.h>
. M d% H$ w% v: s - #include <linux/errno.h>" U$ Y1 M. @/ {. g8 v7 O
- #include <linux/types.h>
8 D) m X; O8 m4 Y) g. {6 D) D7 p - #include <linux/interrupt.h>
9 d1 b* x2 ]! p/ M* ]4 {. [4 H - #include <asm/io.h>) @0 G9 E1 y0 `$ C9 L
- #include <linux/moduleparam.h>+ R1 v# ^& n1 ~4 R
- #include <linux/sysctl.h>; O' c& w' g: J3 w, G; w# W `( V3 ~) C
- #include <linux/mm.h>, L! G ?9 B! F: W t: B# O0 q9 w
- #include <linux/dma-mapping.h>
# A, L1 B: R- O
, T( P+ W/ A; ?9 ?* P0 ^- #include <mach/memory.h>/ G0 T7 G/ R2 G! b3 l
- #include <mach/hardware.h>/ F0 ?( [* t: F; W k
- #include <mach/irqs.h>7 J F! T1 [6 i: h; b
- #include <asm/hardware/edma.h>7 W. }8 H T R v, A
- 3 v" R% ?1 y% }% h0 _
- #undef EDMA3_DEBUG
5 C8 I7 C1 s" o6 A1 G/ ] - /*#define EDMA3_DEBUG*/
9 l9 B B8 _+ y8 q- _- Y9 e4 V - & u# F* Q3 y( R' K, X$ }% p
- #ifdef EDMA3_DEBUG$ Q: ]; M: n0 F7 O5 b2 E( @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) c' _2 ?+ ]# @ T( m% M0 @ r0 [3 i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: T( F& G" x: H) [' m: x I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 x* C; Z6 j Y. W. d - #else
! I! m8 a! C0 L, w6 h: r" E - #define DMA_PRINTK( x... )
* [$ O: M0 w+ N' V ]) z - #define DMA_FN_IN, L3 h+ Q& b% C/ z
- #define DMA_FN_OUT- Z: l* j& ^3 z1 ~. R
- #endif5 ?1 J! s* x3 a3 J+ @5 x
( U0 l$ t5 U; T- y9 W5 D- #define MAX_DMA_TRANSFER_IN_BYTES (32768). ?+ ]5 K: | x9 u4 Z. ^
- #define STATIC_SHIFT 3
/ L* c: h) f7 J0 X# h - #define TCINTEN_SHIFT 20
D% d: W7 ~: e/ z - #define ITCINTEN_SHIFT 218 r' \6 ~: _: B8 V
- #define TCCHEN_SHIFT 22 |4 p& x R. j$ z2 o1 q
- #define ITCCHEN_SHIFT 237 Z- |6 w3 M* @/ m( B% {, z
- 9 M+ J& P7 ?& n# Q
- static volatile int irqraised1 = 0;, z' k& ?1 W* e K: S
- static volatile int irqraised2 = 0;
+ ~6 N* B5 c3 i0 U
! Q' j: J5 s, r5 }6 F' m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 \6 _% g% Y$ j* F* i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, M/ y) t/ A& ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: x3 W4 n0 ?. \ }6 O. p/ X
( h! G! f4 A7 k: ]$ B* ?' j) W! k1 u- dma_addr_t dmaphyssrc1 = 0;
2 U& V9 w% ~- m. b1 @4 i1 J1 u/ S: N - dma_addr_t dmaphyssrc2 = 0;0 v# q) e6 p( p( M
- dma_addr_t dmaphysdest1 = 0;' m- b+ T, ~8 B* |3 G# `
- dma_addr_t dmaphysdest2 = 0;
, X2 D, T# g* s6 T - % n" h5 Y% L7 C) ~
- char *dmabufsrc1 = NULL;5 i& |7 W( ^0 b2 s; _/ M
- char *dmabufsrc2 = NULL;6 }5 i+ O' m. c$ m" o
- char *dmabufdest1 = NULL;3 J! P% s) Y* h9 B0 @
- char *dmabufdest2 = NULL;
9 ^. E0 \- F, `' g& n$ i" Q% }
, |. m: k+ M8 {2 q- }# s- static int acnt = 512;
* w( y3 C% Q8 K - static int bcnt = 8;+ h% m, d( ?9 }% |! i5 k
- static int ccnt = 8;0 q! ?$ I, g, X8 s& O
- 1 m2 J0 P& i% x' h
- module_param(acnt, int, S_IRUGO);
" U$ e$ B, z8 o - module_param(bcnt, int, S_IRUGO);' H: f: t+ S: V" j
- module_param(ccnt, int, S_IRUGO);
复制代码 % W/ D. F" L5 z: P$ p
2 w/ {/ \; M& G$ {- Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 }7 j! ~. C. E$ Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( g) U- @: j- _" g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# m2 g. R7 I& |6 C& R
/ j0 K0 C, ^/ t/ h& g3 A
; [2 h& Z6 o9 H# Y1 v |
|