|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - a& g5 ]; X) l+ y6 V) v
- [code]EDMA sample test application
8 z% A( c+ \$ v - /*+ [0 g+ K+ |' ?/ I
- * edma_test.c) K. k I9 E7 p9 s3 e0 L7 a. b1 Q
- *( O/ R' w; |1 n& q% p L/ C
- * brief EDMA3 Test Application
3 t1 ? }5 O2 S0 y1 [. B - *
$ H3 X t: H2 ?& M% @/ A4 |% l - * This file contains EDMA3 Test code." F# j" R% d! j4 }
- *7 d/ q( d( s8 ]* C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: m z y& F4 t; m* O, Z) D$ ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT w# s$ Y L" r) t$ O2 u. V
- * TO CHANGE.' C0 J& _) e( Y2 M2 _6 i' r+ I" e. o
- *
; R8 T& m$ i0 J8 S% e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 o4 O" T, _ Y7 N. p- f - *0 Z, j: ^/ K) x2 i2 p9 i" F
- * This program is free software; you can redistribute it and/or
) n! l }5 ^: C: ]4 s9 M$ O - * modify it under the terms of the GNU General Public License as
. h# b1 {1 p) e4 J - * published by the Free Software Foundation version 2.
, _0 H- v! v* _0 u% s - *
1 `7 Z- q& o" }& H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* b2 h( b! E" [4 z% G$ G% l1 p - * kind, whether express or implied; without even the implied warranty9 j. A3 q7 g- ~7 S+ h9 f2 b" r, D! a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& Q/ M9 |& N! B0 }1 P' W - * GNU General Public License for more details.
% E7 W( V. U } - */
, M8 I* p0 c8 {0 x; H% |
3 P5 `3 d! Q- {- #include <linux/module.h>
0 T/ ]/ F) P5 Y4 K( W5 r - #include <linux/init.h>% w7 f( C' [7 i g. x6 y, D
- #include <linux/errno.h>
4 e* R2 Y, [6 x - #include <linux/types.h>3 q% c* h+ y3 _
- #include <linux/interrupt.h>+ l% `7 h3 W, [2 m1 W3 i
- #include <asm/io.h>
& u4 |8 m) b& T) N - #include <linux/moduleparam.h>% F' C, Z. k2 Y
- #include <linux/sysctl.h>: J" I3 u1 \' ^1 }+ a) D0 y
- #include <linux/mm.h>% y! o$ ]" V$ S q
- #include <linux/dma-mapping.h>
) ]* B9 D. o% Y+ v* o* v
& u/ ^9 {3 u. ?- #include <mach/memory.h>
) N9 o A) \% S% S# I - #include <mach/hardware.h>- l0 G- f# u7 `3 t0 w: u+ `
- #include <mach/irqs.h>
3 b9 f# W! ?4 o - #include <asm/hardware/edma.h>- L: K n9 O3 A' Z/ i* |/ Z$ Q
- 4 `1 H- _/ k( b
- #undef EDMA3_DEBUG# Z* N7 a F7 \, v/ g
- /*#define EDMA3_DEBUG*/
( R; r) Y# F) w+ X, y" t4 m/ _ - 4 B# }6 y6 n. `/ d4 A5 w
- #ifdef EDMA3_DEBUG
& k; n: a( w r2 J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% h4 G0 g [3 O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* G7 d, m! T" W# [! G {, w( o$ _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- U: G. p, d) T# t - #else# D$ T ^- v, |) g" E+ o1 n
- #define DMA_PRINTK( x... )7 W! _- |5 H& F
- #define DMA_FN_IN9 Z* }; P9 V, J6 p c6 [
- #define DMA_FN_OUT
" L% h6 `) a3 `5 ?2 J0 m0 f$ x0 s - #endif# [1 M3 w' A, q' T9 u% P
- 0 }- A/ V$ X9 Z. X- G: W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
Y- U" C; w3 Y& L% u- ` - #define STATIC_SHIFT 3, R% c5 w9 n& ?" F" E0 o3 x
- #define TCINTEN_SHIFT 200 d+ V0 Z( p/ | f, L7 B6 p' G
- #define ITCINTEN_SHIFT 21
& H7 y* l& [4 ?7 C: V: D% ]7 K+ q - #define TCCHEN_SHIFT 22
3 {* Y. |) `2 l# S9 ^ - #define ITCCHEN_SHIFT 23. g; { e2 _) X6 k6 ~) j j
- ' _' {& ~$ z) C( ~# K4 g
- static volatile int irqraised1 = 0;8 Q p0 N& I+ a5 e, V! v- U
- static volatile int irqraised2 = 0;
4 ^7 r3 [8 x; v$ H1 y - ; T3 }; l+ E+ q/ \! x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 m) c2 K- X! m, S9 d/ P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% D4 L$ ~7 h: d$ ~- G- z2 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 }+ I' U I, f6 p, [ `
' n4 V ?; Z- @8 K4 N- dma_addr_t dmaphyssrc1 = 0;. m/ }' ~) \* Q# c$ h( n
- dma_addr_t dmaphyssrc2 = 0;
+ m% o: u( K0 h* L' i- U - dma_addr_t dmaphysdest1 = 0;( s( {) z6 X( U. k+ X- w5 F" ~
- dma_addr_t dmaphysdest2 = 0;5 e, c9 { Z' z* u: j) d3 I4 C
' h; \" Z& f8 ]4 {, \& G' }- char *dmabufsrc1 = NULL;1 t; G" I" D5 {! O8 a" `
- char *dmabufsrc2 = NULL;! L/ F$ J, I4 q+ W; u" ^& y
- char *dmabufdest1 = NULL;
: ~& B! W |. m( z9 c0 q/ q - char *dmabufdest2 = NULL;
; L t1 h8 w# K) Y7 F: b
9 M8 I4 h% o" T! w9 p- static int acnt = 512;
& V. K2 F) N+ M3 e6 J - static int bcnt = 8;
0 j) D5 P3 x9 T" K - static int ccnt = 8;
% {. T& B* _7 ?7 s+ K6 {
f U1 M% B y' M8 a$ g- module_param(acnt, int, S_IRUGO);9 S7 T% x9 w6 @7 G& L
- module_param(bcnt, int, S_IRUGO);
/ W6 _' W- W5 x/ J/ T# I8 N6 c - module_param(ccnt, int, S_IRUGO);
复制代码
2 t: e$ n" L3 N2 q& b* X% E* x
, R# k( a0 K' O2 A2 ?4 W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 w( T% [8 Z+ @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 x- [( g; @6 f' ~- ^& \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 x5 D3 z* r3 j/ G( f
& F, o& {# [- T, P0 H ~2 Z0 \
# ^! o! l# R ]; G- j |
|