|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 n. `% w! ?% ]" s
- [code]EDMA sample test application1 u" I% _3 C5 w! X- f& u8 \
- /*
$ G1 ^ t1 \5 ?1 E1 j. l; a - * edma_test.c' S& ^1 T% E+ G- r" Z
- *
% K- x& G. E9 u2 | - * brief EDMA3 Test Application
+ g& r; O& W) |5 v6 y/ A - *
. d* a4 I- |3 [: a, X - * This file contains EDMA3 Test code.) o' c3 w7 E1 j" z, d! V8 J% K
- *( x4 A v& s# }" X$ h4 V Q7 l% e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, l7 L3 F# O( b1 t/ S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 o7 I2 U2 q4 [
- * TO CHANGE.. B+ i6 u+ z1 X. l, R3 j1 B
- *
" J- o# ]3 u; B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, m6 M7 D. Q' A4 V) Y1 u1 s
- */ y; ]6 ?* p( L7 Z
- * This program is free software; you can redistribute it and/or
. ^4 @0 ?3 Y+ N7 x6 o - * modify it under the terms of the GNU General Public License as9 T1 c! m! c' D% b1 R# `+ x: T$ W
- * published by the Free Software Foundation version 2.
4 N* j) J" V( p& j/ k4 V: A" a - *" w v) A Z" B, d: |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; O* N& q( @7 I9 F/ j \
- * kind, whether express or implied; without even the implied warranty
- T& j) \6 l* |' w2 H& Y1 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ N6 F) Q# k' w6 p - * GNU General Public License for more details.! e% M. z. m1 p+ c3 D! |" B
- */6 e: o3 L8 |7 Q* F1 v$ z
! [; l( j7 }: ?% D# O& V- #include <linux/module.h>
7 B7 k3 w( l+ U5 }, ~ - #include <linux/init.h>
. H7 X2 I; E- D9 I9 Y- t - #include <linux/errno.h>
( e2 i9 W: l/ \# ?2 q# H - #include <linux/types.h>
# R: D0 J8 c/ T$ E* t/ K/ L - #include <linux/interrupt.h>+ ]' R, `4 l, v. f* J& \6 @
- #include <asm/io.h> r" M% X& d* S, ^! ~( Q
- #include <linux/moduleparam.h>
' ]4 c; B, C4 L8 c - #include <linux/sysctl.h>8 A$ K& } B7 S0 h. U
- #include <linux/mm.h>
( K, E. A l& y" a* P8 C - #include <linux/dma-mapping.h>
. w3 S4 t5 H7 H* L) Q: \
/ W- V- Z8 J& g" z- #include <mach/memory.h>
4 R; r+ s# C" b - #include <mach/hardware.h>
. Y3 X, l R9 \: J; B - #include <mach/irqs.h>
3 w' @5 Z3 P) L1 N& E1 R( p - #include <asm/hardware/edma.h>9 J. s- B3 _7 T. B
- $ v# ^4 N! v) ^" N, z
- #undef EDMA3_DEBUG& t0 } v6 x/ M
- /*#define EDMA3_DEBUG*/; n2 B# d. Z' Z* p* b: L
- ( V, M7 f# H5 t" F: h
- #ifdef EDMA3_DEBUG
4 h3 E. W$ V* Q& S7 a8 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 K7 h3 c k3 n: [3 G+ a6 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 T: r! ?. u& q( x$ j R: e# v4 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 |& `6 @, C1 A/ e! |
- #else
) `) E5 }# O) O9 B - #define DMA_PRINTK( x... )( F2 W# Y$ A7 f- _6 B' r- U5 N7 N Y
- #define DMA_FN_IN
' e+ v5 W+ A2 a* [ - #define DMA_FN_OUT" e' f" Q5 u& p, M
- #endif
' [+ Y! p$ H5 u& T y G7 E - 2 i; n& B* I* P6 n- w/ {* u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ I; n1 Q Y$ K4 |2 f0 C
- #define STATIC_SHIFT 33 n T) _% H' {$ Q1 r
- #define TCINTEN_SHIFT 20, b2 \$ M# a6 o8 s& o
- #define ITCINTEN_SHIFT 21* A* S$ P s& Z* {9 O8 X2 |
- #define TCCHEN_SHIFT 224 r& P: N0 f7 Y8 c! O3 M
- #define ITCCHEN_SHIFT 233 v4 J, n7 K5 M: ?& r3 D
6 t' t; S, l/ B- static volatile int irqraised1 = 0;5 _3 O+ w s8 U! }3 L
- static volatile int irqraised2 = 0;2 A! ^' a' f& T/ K6 W3 N8 [
9 V+ p* T' k+ l. r" F4 B+ K( d- F, k3 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# @6 a/ a* r9 M! R7 [) w% Q' d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 m0 W( T( h1 b9 E2 @" R% L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, j5 l# E- w* S6 d) f
* n; x+ j1 t S* R! K- dma_addr_t dmaphyssrc1 = 0;; T( z. k. L2 O2 l0 O
- dma_addr_t dmaphyssrc2 = 0;' D6 K& b' Z6 t+ Z+ w
- dma_addr_t dmaphysdest1 = 0;3 u# h5 V* A6 J- m$ c3 u
- dma_addr_t dmaphysdest2 = 0;) D# E0 u, x) l$ }. q+ C7 k
- $ r" Q3 i8 e* t) q+ }$ q% D
- char *dmabufsrc1 = NULL;6 ^( y g8 z1 `: j1 M
- char *dmabufsrc2 = NULL;
: ~$ O: p+ a# _ - char *dmabufdest1 = NULL;" X" E( {+ e6 v) P, Z: L
- char *dmabufdest2 = NULL;* E) n `/ v& ~! `) A8 a& C
- 7 U, O& c0 z! S
- static int acnt = 512;- [/ h% `" e6 x. O T
- static int bcnt = 8;
+ D( s8 E4 x6 b/ J8 A% {% } - static int ccnt = 8;9 c9 j. {1 {/ M9 I) @: g% W" W
- ! R2 C7 b0 X7 _: d. A: q
- module_param(acnt, int, S_IRUGO);
* |5 x3 Z3 C& V, h4 f$ O; v+ O - module_param(bcnt, int, S_IRUGO);
' Y ?& T5 w2 j1 n; ^/ ~ - module_param(ccnt, int, S_IRUGO);
复制代码
/ `9 k* E3 |" R2 ^9 _3 y
& ^/ P8 Y& I# _+ b. N& P$ T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( E$ ] R2 p$ s' F8 T8 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 K% E; Z J6 D# o: k1 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 L- }8 B* |* ~1 J
1 n' p, e8 S2 O" r- B: \9 E8 E) ?9 j! j4 J3 ^& q U/ \
|
|