|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! B9 ]1 `' v2 d
- [code]EDMA sample test application3 g5 _: ^% v2 L3 |# ~( S& e
- /*5 u" O% [$ B6 g- i
- * edma_test.c' t& @+ S3 W1 N, n" O. v
- *" n4 D: ?) i$ l8 z, X! B
- * brief EDMA3 Test Application' O3 j* N# b3 p8 R$ n
- *" X2 h1 ]+ ]# _, a" W5 M* F
- * This file contains EDMA3 Test code.
" F' ^8 J6 l( b9 h. _7 Z" j' X - *
7 s4 ?/ P/ I3 }3 m$ Y5 g3 E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' `3 c u% k, w, c$ L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. p* O2 u3 o' R7 e: B5 N5 e$ |
- * TO CHANGE.
! D! b1 V- d, p$ L+ K0 P0 e% ` - *
% X0 ^! Z8 c( z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: F4 U+ y$ |. x* V" E - *: S3 W+ q4 o* W0 [% c
- * This program is free software; you can redistribute it and/or
8 y8 P0 k% e5 ~2 Z - * modify it under the terms of the GNU General Public License as
8 ?. R5 d0 J( z+ y - * published by the Free Software Foundation version 2., @1 n0 _7 m I' C, h2 v9 u- _: [
- *
8 s0 t: @: x4 {0 g% {( _ } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ z9 k' }) I1 D" u- R
- * kind, whether express or implied; without even the implied warranty
+ _9 w3 ^' o7 p0 } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 P% U$ u+ ^8 ]4 }
- * GNU General Public License for more details.
* z+ q6 k+ f7 e( j# U0 M - */- A3 P7 Q6 ^6 l' |* A) v& b8 ]& _
' L* H% p+ o' E& O* i+ ~- #include <linux/module.h>
1 y9 j' V' ^# |- l: a4 D - #include <linux/init.h>
1 A0 `9 ?- H7 |0 ]( e6 O - #include <linux/errno.h>$ i9 y) {- U. Z; H! U
- #include <linux/types.h>
: E D# J; R4 P& W - #include <linux/interrupt.h>* y$ R1 L0 U' M& y
- #include <asm/io.h>
$ y7 S1 r. x- v7 k. Z2 Z - #include <linux/moduleparam.h>) q- Q" J8 |& {
- #include <linux/sysctl.h>( c( ^9 C; I3 q ]% f5 u' b
- #include <linux/mm.h>
2 X& y9 V2 }; n - #include <linux/dma-mapping.h>
% s D b/ e# A
* C' S' p$ |/ Y5 Y- #include <mach/memory.h>
9 @& j; v- J& V( ` - #include <mach/hardware.h>
' z4 j$ Z: t" j" s - #include <mach/irqs.h>
, R Q% K) f: O' Y- _ - #include <asm/hardware/edma.h>
; o/ U. }, y; h! f5 G0 K - 4 q v# ]5 R |4 y# r0 F
- #undef EDMA3_DEBUG! p2 Q" P$ Q# v/ b# d0 e
- /*#define EDMA3_DEBUG*/
: G; p5 h$ V0 i( {" T# P! Y, l - 4 E7 M4 m# U/ i0 \& ]+ e
- #ifdef EDMA3_DEBUG; x+ O# U8 N. S e# m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 t, I9 W: c1 d' f# ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): Y" r# [6 H5 B' @9 o, S8 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 X: N8 W0 B C! g' S( x
- #else& r$ ?& y1 X' j5 @
- #define DMA_PRINTK( x... )+ A, a8 ?7 t/ ~+ r7 y6 R; p! F' C3 n
- #define DMA_FN_IN
8 t6 F/ S4 @4 K0 B - #define DMA_FN_OUT
/ U% b/ j5 C2 c - #endif
( E% r8 d% Q6 y# L
: {4 i# i7 q# c' G. ]7 }% t2 o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 p6 |: H4 F6 H0 g w0 C9 @
- #define STATIC_SHIFT 3
: a; E2 y# [( b# F$ f% S - #define TCINTEN_SHIFT 20# f% c5 d/ }" E1 s3 Q
- #define ITCINTEN_SHIFT 215 N) [, b5 `/ K+ O
- #define TCCHEN_SHIFT 22
! \8 n( T9 d+ M* R - #define ITCCHEN_SHIFT 231 S. ]) h; {- [9 f8 @ N3 L
! A) `1 b8 |: H0 s. z- static volatile int irqraised1 = 0;- j' j! |6 h4 H/ [* o7 p0 P! O
- static volatile int irqraised2 = 0;
7 K: M2 j! m+ ~0 r
4 I' n: [& r- M! X' b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% K9 y, Y% \( P7 Q; D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. Y/ c8 G8 D- U. a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
Y( p) H: I) c2 r. _3 L+ O; d
z' q) U/ m! ^" e) t @- dma_addr_t dmaphyssrc1 = 0;
! p0 ]7 S& P9 Y& ~/ M8 I. ` - dma_addr_t dmaphyssrc2 = 0;; F5 P5 _# l, }. h+ v9 d
- dma_addr_t dmaphysdest1 = 0;" m% j" v0 Y( ^4 k+ E( D R# g3 I: I
- dma_addr_t dmaphysdest2 = 0;$ r+ c" p: l6 m# u8 O. i
" ^- L2 m. W- k; I' p5 X/ c' j- char *dmabufsrc1 = NULL;
0 X2 m/ P W0 V$ h* j5 S; W+ B - char *dmabufsrc2 = NULL;, E5 C# r* e D8 M0 j
- char *dmabufdest1 = NULL;8 |5 k' i+ \6 T+ B- B8 L2 a2 w
- char *dmabufdest2 = NULL;. |8 Q( a1 \; a" i& `
% f+ x3 }! ?; l* Q( l- static int acnt = 512;
N3 e9 j6 e$ A$ q0 E - static int bcnt = 8;
3 z, Q& |: R) N, w& E - static int ccnt = 8;
0 R! d% J+ c- P; ?; S1 t4 }& ~
( x' w4 m8 U2 ?) E3 S1 @, O- T- module_param(acnt, int, S_IRUGO);
% W$ J6 q2 h+ z: M3 o( ? - module_param(bcnt, int, S_IRUGO);
+ u0 x8 F/ W3 e3 s; J" | - module_param(ccnt, int, S_IRUGO);
复制代码 ( x' H) Q; L* m6 C6 o
( F) L+ W) j) c6 c/ G4 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 }: L$ k8 m* u5 l9 H: l: parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) k$ o; @$ M% k7 ?; J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 U# L$ ^+ q3 M7 u) I6 T
0 p7 G2 d( z& i4 ]4 i0 |- _' ]: i+ x& P' j
|
|