|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 U( I6 B4 ^$ _* W- O' s5 v0 n7 t- [code]EDMA sample test application
4 L8 c1 l0 J0 m; D) [9 Z - /*
5 a5 j! F: B v" x6 V3 T0 P - * edma_test.c5 _; v! e! N, x% K" P
- *
. O( {" v+ p, ~ - * brief EDMA3 Test Application* b3 V) u' Z7 [( `! Y9 y
- *
& ?* W, j+ P( ^$ M% g - * This file contains EDMA3 Test code.
% D; H# j+ I4 n( D x6 q% n - *" ]0 j$ S1 h5 E& O( z) H3 P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 r. C; t' @$ Z6 \$ R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 U4 ~( B9 G/ O: h p* h# g/ P/ B" C
- * TO CHANGE.) S3 Z! c8 D( Y) w/ _) h5 C
- *: U& Y, t' v& T+ i8 l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: I1 q1 P; X7 F7 A0 J - *5 I3 \ Q5 r+ C
- * This program is free software; you can redistribute it and/or3 V# j3 {% h) g/ X0 z
- * modify it under the terms of the GNU General Public License as7 ]0 H$ I" M2 v; o4 g1 q+ X( S
- * published by the Free Software Foundation version 2.
6 I) l; T- c A: ?0 c: r - *4 T! h9 C/ A* \1 M* g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* e0 C* @5 n' {/ ]3 B, d - * kind, whether express or implied; without even the implied warranty
' W! U7 s2 B5 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 m% K! |7 C/ {9 J - * GNU General Public License for more details.
* @1 k% B) W' ?8 Q2 \$ p - */
) } x2 S$ ^8 \ m2 N$ @& ^" n
) y- L: J. `! x% U+ v. T- #include <linux/module.h>
6 d. y+ R7 r& }% _3 q6 d - #include <linux/init.h>* l( b9 G3 n6 A$ B0 e. B& V9 V* c) P
- #include <linux/errno.h># k1 J% |6 g/ m* `1 [6 Y9 c9 W
- #include <linux/types.h>
# |% ~/ f5 |' w' D* C. o* f - #include <linux/interrupt.h>! m% i& r# M& s4 y
- #include <asm/io.h>0 M4 u1 A8 V* |! [) n
- #include <linux/moduleparam.h>& h: Y4 U( d! R1 c
- #include <linux/sysctl.h>' R, s& P% {) C1 x! F
- #include <linux/mm.h>/ t h6 M S3 u2 z6 ]) M
- #include <linux/dma-mapping.h>- x3 x& r% Y3 H% o
- $ ?; W( c2 G0 O: E6 v
- #include <mach/memory.h># `9 G0 R8 `$ |9 q$ N
- #include <mach/hardware.h>
H) B( u' f1 x) l2 U& L6 h( S - #include <mach/irqs.h>1 ]& e7 Q |. b9 R
- #include <asm/hardware/edma.h>
# W9 c% L" i* O" `' `) u
% m6 ]' A- ^' `- #undef EDMA3_DEBUG
$ U/ N$ Z @ s" N, c. D8 D - /*#define EDMA3_DEBUG*/, l5 i! a" X: ]% C2 u
- . z& v7 I/ ^2 |3 x3 U
- #ifdef EDMA3_DEBUG
: f \! ]# Y3 S% z6 ]4 l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! m& {6 g) j: C5 V5 ]8 k q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 a' o/ w- `/ P, y9 h+ Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), `8 n/ f- U; s, h
- #else
% y9 z1 B- ^. o- K1 F$ w - #define DMA_PRINTK( x... )
" W4 q- u3 ^# V$ } - #define DMA_FN_IN4 U1 D2 l6 b) a- J+ |4 H& f
- #define DMA_FN_OUT
1 k# I B8 _+ V& h9 d" @ - #endif8 P/ X6 H4 L( ^$ s
* N# ^6 v) F5 Q% J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 |1 `4 p: s/ o. y# ], _7 L - #define STATIC_SHIFT 3
# D+ T. t; a/ F) t9 a4 | - #define TCINTEN_SHIFT 20
0 I- b1 @2 U1 j - #define ITCINTEN_SHIFT 21
3 x- r# s+ @; ^/ |- h T4 \ - #define TCCHEN_SHIFT 22, r0 l3 a# Z" R7 j9 U4 o9 E" v5 k
- #define ITCCHEN_SHIFT 23
2 F/ v' Y8 g& ~ - ! h; J' m" o: t$ |
- static volatile int irqraised1 = 0;
2 K* M+ n# U ]: K) `& J% \ - static volatile int irqraised2 = 0;: H% H+ }9 I) M( L. [
0 E0 u3 Y: T- d M7 B- M3 g( D8 k/ s* b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 b( R% I) d- m' B# [0 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ h: |0 z5 @) s1 \# S P- ?7 m% p5 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# V+ z- s1 i: t- p# h$ `2 u
1 H$ A) q5 l; F* Q- dma_addr_t dmaphyssrc1 = 0;8 l) ?7 ~: ~0 K1 ?
- dma_addr_t dmaphyssrc2 = 0;% _6 a+ b& @' n! q6 ?- W$ q
- dma_addr_t dmaphysdest1 = 0;
8 B9 s, K7 d6 i4 Z& t( m; M8 ? - dma_addr_t dmaphysdest2 = 0;
! ~/ D, v! e( a) @4 u; X( p - - M5 s. L" M3 }: a
- char *dmabufsrc1 = NULL;
' g8 f2 ^: K+ { - char *dmabufsrc2 = NULL;; T' p4 [8 x8 M! ?* M. V; X
- char *dmabufdest1 = NULL;
; b) Q% A5 G; [5 Z2 a. f2 _ - char *dmabufdest2 = NULL;
$ {9 v! `5 X# T7 C/ r2 z
' l* y s+ a9 q2 T( e6 L0 C6 z2 B- static int acnt = 512;& v; t- S2 |1 U6 E! i, R
- static int bcnt = 8;3 s) T8 }! P" Z8 O! G& V K. j& H
- static int ccnt = 8;0 j% h! `- e9 |6 p& G) D
- 1 V3 W# @' X7 q; S4 ^
- module_param(acnt, int, S_IRUGO); ?" ?9 a4 c% C; P3 w# c3 p, |2 x
- module_param(bcnt, int, S_IRUGO);. x* K3 z* F( V9 V. }1 c
- module_param(ccnt, int, S_IRUGO);
复制代码 * K% R1 s( x9 p( ^! K
$ u/ g9 x; _8 W7 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, P) N. j$ L$ g! q: x% I9 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 C1 c/ Y2 @) g7 G( |, I: d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 T3 Y( r( z+ ~" \
# U* v2 n8 F" p
: Y0 t6 P1 A7 L8 s$ p3 u |
|