|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 \4 C/ r$ ?) M$ P4 e8 Q" H5 F; i
- [code]EDMA sample test application
2 V; p- U; A y - /*& r' Q3 D+ j) k* k K
- * edma_test.c
9 P1 S$ c) a+ d7 T# a4 ]) q, [ - *2 E8 P1 h3 p6 u: Z0 K% t/ x
- * brief EDMA3 Test Application9 W2 p1 ?1 |$ {( O; n" f6 T R& S% U
- *
* O- a. u3 ]1 d, O0 l- R - * This file contains EDMA3 Test code.5 w4 d4 [5 d3 V) z. M0 p' k g
- *
* b4 J) T: O4 X7 r" q( ?6 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. z0 U" Q/ }% b. a; P+ p) @2 {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 s8 K1 ~1 O+ J2 O0 W! q
- * TO CHANGE.
$ j. f$ G0 c3 E7 K# @% T& M - *1 l; l2 V& P7 W/ N2 @% O1 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: F: J; x' `, O
- *
! i7 p- M" y5 \! L' U - * This program is free software; you can redistribute it and/or& l0 {+ T! H$ u
- * modify it under the terms of the GNU General Public License as4 K5 Q0 k* g) q6 w# N
- * published by the Free Software Foundation version 2.
# K0 ]& P7 l- } - *! J- D9 j' R# z! |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- }, o: e* z. \4 q7 k& \4 k
- * kind, whether express or implied; without even the implied warranty
, s) w q/ Q. {. G7 }* ]# T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 Y3 p) Y5 r; R# x - * GNU General Public License for more details.- Q0 j0 ~' X8 }$ p6 C) G+ ]8 ~
- */: x* k V: }9 m- A( p
- . b1 M# B- N7 S5 W- g, |
- #include <linux/module.h>
. m" C k% ~2 K L" I7 ]3 ]1 r - #include <linux/init.h>
1 |8 }% J0 K4 ~$ z" L - #include <linux/errno.h>4 a7 t8 M# l0 k+ X( L
- #include <linux/types.h>0 a/ _8 Q" H9 S( _$ S
- #include <linux/interrupt.h>, n7 C( t9 B o& C) W/ Z9 Q
- #include <asm/io.h>
& a1 j) W, E) _" O+ W9 u) Q - #include <linux/moduleparam.h>+ V- g! R( [, ]. j& q
- #include <linux/sysctl.h>
& l! a- X/ \* K, G! w - #include <linux/mm.h>
5 y/ f' c) c; b; U* O- t6 K( C - #include <linux/dma-mapping.h>1 s3 U2 I# e( R0 Y. v
- 3 [& O, ?$ g o
- #include <mach/memory.h>0 l' n& t2 c+ U7 f# p" L
- #include <mach/hardware.h>
, V$ \+ t$ I7 u1 V6 V - #include <mach/irqs.h>
6 I: s1 P- N8 U( v9 S! G - #include <asm/hardware/edma.h>% i) H* L" x6 U0 X' h
1 W% i1 g" i. s; v- #undef EDMA3_DEBUG) Q8 `; ]& `! X7 l) t2 [ ?
- /*#define EDMA3_DEBUG*/
9 _2 B, N: y/ Q( B0 b
; M, x) p8 h, M4 [0 g: Y4 K- #ifdef EDMA3_DEBUG9 h) G8 F1 N8 F7 J) [2 x+ P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 k8 G! R/ U, y8 R( X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: B: z' c4 r- L: E2 p$ B$ h& T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 v6 n( M6 a; S
- #else
$ |1 X* p. a" H9 k; l, L c - #define DMA_PRINTK( x... )
& }# {, t0 F' |% F# J - #define DMA_FN_IN5 r+ m# j, V5 }* N7 G+ ]
- #define DMA_FN_OUT: K3 p& y) S& p& I
- #endif& z: O: M1 f7 O: }2 Z
, J) y5 b& X' h5 D/ m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: j6 t: r8 J, y% H2 c6 ~ - #define STATIC_SHIFT 3
# `( R9 C+ [7 Q# J" b- K/ v$ Y - #define TCINTEN_SHIFT 20
9 j" j% {1 y5 p& q - #define ITCINTEN_SHIFT 21
9 x( V7 H. N" C! L0 d! A6 i - #define TCCHEN_SHIFT 220 @' F) F* F7 N- X
- #define ITCCHEN_SHIFT 23
# q* U9 F7 F. K+ x8 F2 v' M - 1 h) W" t+ k- Z& J) p7 e/ y; s/ r' p% v
- static volatile int irqraised1 = 0;
' i! g5 m# B4 B' a; ? - static volatile int irqraised2 = 0;* h6 w7 r) L: z+ g
- 6 I4 Y8 M4 ?7 ]+ T+ r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) A7 w; P/ V. S2 k1 b5 ]7 T9 s7 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ^2 J7 d$ I* \3 [. q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! y1 d: t) t, M9 t5 D$ ^ - : Y1 p6 N. j7 F3 G# z( B
- dma_addr_t dmaphyssrc1 = 0;+ x; a6 Q% I P1 S: q2 X3 J! L7 a
- dma_addr_t dmaphyssrc2 = 0;
; L$ f6 i' M3 i& {6 O0 I) k* J* m - dma_addr_t dmaphysdest1 = 0;
5 h6 T8 e5 |" M0 ] - dma_addr_t dmaphysdest2 = 0;* w: M1 a; v& f G' L
+ A( T" n# V8 k0 [. m$ `% x* }- char *dmabufsrc1 = NULL;) s! G8 D# B% c. w9 U4 o, V |
- char *dmabufsrc2 = NULL;3 g0 `4 l- R/ P$ j
- char *dmabufdest1 = NULL;9 W/ Z9 u9 r% H ~: p: g ]
- char *dmabufdest2 = NULL;
! W$ v% a+ I! a1 y3 J/ M9 h1 A
2 D7 n1 n% e2 V1 K {- static int acnt = 512;
% B# s; @! E: f5 @1 c" r - static int bcnt = 8;, ^/ x8 }4 q( \" O7 y8 V
- static int ccnt = 8;
( U. r, g: W8 v2 P& m! J" Z* e l - . s" m" r+ _/ C/ s/ }+ F8 n0 e
- module_param(acnt, int, S_IRUGO);5 o2 e) x3 a7 q' P$ K
- module_param(bcnt, int, S_IRUGO);( J) s4 b8 u2 Y1 ]* \( C: {2 ]
- module_param(ccnt, int, S_IRUGO);
复制代码 8 ?0 [: h. i* C+ x
) o9 `) g3 O3 Z6 w$ p" X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 O+ x5 h/ P/ l! S' w* @5 n; s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 N! ?$ c# q7 m' J" F ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 y/ P3 V" f; X* O' X; Z! w7 Z5 v1 g* s
$ H" @ y7 H, Y1 _
|
|