|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 \- e' k1 h" b. V* a/ ~- [code]EDMA sample test application
) X* ~% q+ ]8 y% ~1 W2 a) y' E Z - /*
7 J$ L& S$ G4 T& {9 E' o E. |- ~ - * edma_test.c
: ^. B7 t) M& v0 [6 J, }! k - *5 f* G" J8 V3 z
- * brief EDMA3 Test Application. ~6 ]( z* u5 q. ^
- *
3 n. e( ]' B4 S3 f - * This file contains EDMA3 Test code.4 M# Y' Q9 o1 J8 ?+ m& ]7 n
- *
3 [2 v$ {8 |5 _3 [7 k+ v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& j4 P4 ^; s. c7 n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 |- ]2 y( e( p0 W4 l7 t: a - * TO CHANGE.
9 p/ u! L$ E4 z6 Q% ?7 M - *
- X X; V6 u% `+ s" _/ u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ B9 E+ B0 R- { E
- *
4 |3 p/ U3 Z) f9 e) t0 R! Z2 j - * This program is free software; you can redistribute it and/or
& m9 [) Q- ]' |. s: c" I - * modify it under the terms of the GNU General Public License as6 {1 u# ?" m% T6 @% S, Y& {& F
- * published by the Free Software Foundation version 2.
$ \" T9 Q2 h- k7 T - *, g. X R! y0 e1 ~# Z) S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ h( v; l/ F2 Y1 c ?6 L - * kind, whether express or implied; without even the implied warranty. H3 } G* B C+ N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ J& }/ A I# H! W
- * GNU General Public License for more details./ e6 j+ E; A, F, \( j
- */' B$ |8 ?1 u" s( D: b( a
5 @- x' s& W8 q- #include <linux/module.h>* a |. r* z5 d* b" A2 o+ i3 A
- #include <linux/init.h>
0 A( B; P. L0 i3 e# Q( [7 i - #include <linux/errno.h>
. _; m. u# @& O! {' A, v - #include <linux/types.h>
+ v4 s) s5 F1 t6 f. v: K. h - #include <linux/interrupt.h>
9 ?' |1 O" v) w) p0 I - #include <asm/io.h>
( _+ ]- ^/ a3 V. y3 h - #include <linux/moduleparam.h>. N3 a# w( M( x: l4 I* g
- #include <linux/sysctl.h>
1 S5 @2 I) r) ~2 A5 J/ ~2 G - #include <linux/mm.h>
0 E' i5 `" \9 Z, a - #include <linux/dma-mapping.h>- g7 Q- @2 T: v
! a+ s5 V! q7 E7 M A% l' Q) `- #include <mach/memory.h>
( d& s% E2 T: t0 C8 C6 h _ - #include <mach/hardware.h>$ f/ }7 h7 t; i) c6 D
- #include <mach/irqs.h>( K; D7 R$ e! p% O5 l" \; {( u0 q
- #include <asm/hardware/edma.h>
/ R4 ^) i$ ~$ |3 j7 B Q: R - 7 `$ D0 j: _* k6 U0 `, S* `' U
- #undef EDMA3_DEBUG
- E5 g: x# n; _1 q - /*#define EDMA3_DEBUG*/
5 X/ z1 U# ~% e; s( _5 Y" p% [
1 H. x2 ^& y$ k; R: y1 E" |- #ifdef EDMA3_DEBUG6 J" E: `! l' ]. e! f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 K8 |/ v' [7 R, p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 i1 ], V9 H. A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# [0 k+ M/ E, M1 Z
- #else. I! H+ T {! b; B0 g' C0 i. u' ?
- #define DMA_PRINTK( x... )
0 U; I! e5 D1 f- t- N2 y - #define DMA_FN_IN
3 X* L* C3 h& L" c$ ` - #define DMA_FN_OUT! h; L; |& l2 x! K
- #endif' o0 X5 G" N F3 Y; M( W$ p( ]" K7 @
- 4 M0 m2 ?' j& g9 M" c/ O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& V9 i# e5 d3 l- y# M$ G, n - #define STATIC_SHIFT 3" b5 n# T+ V! P$ c
- #define TCINTEN_SHIFT 20
% Z$ [8 x3 A1 [% w& U! P1 t - #define ITCINTEN_SHIFT 21
( j4 K& m8 I) P - #define TCCHEN_SHIFT 22
+ G' G7 m# u$ p7 C! d7 i) Z - #define ITCCHEN_SHIFT 23
4 K$ g' r$ K2 a% }2 h - , g- X N4 j6 V3 |# e
- static volatile int irqraised1 = 0;. b. U) |3 y' p ~8 q9 k( \: Z7 x. @
- static volatile int irqraised2 = 0;
0 ^: [" D' ]9 t: Y1 C L- f
6 m# q9 Q) |& o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ W$ I7 e# k. P0 H, O9 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Q. _4 {7 X- Q% c% m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: f4 P% {" T+ ^2 p/ J I& G! Q0 b
8 o) A& l5 }: M1 t4 ]- dma_addr_t dmaphyssrc1 = 0;
6 l6 u* A3 P0 ^6 a; [* V1 q - dma_addr_t dmaphyssrc2 = 0;
- D0 F4 [ Z" }2 X2 e7 ` o5 c f - dma_addr_t dmaphysdest1 = 0;6 m, ~' Q Y/ k
- dma_addr_t dmaphysdest2 = 0;& x5 f' z7 W! P
+ A9 p* c! G! j- char *dmabufsrc1 = NULL;
6 y' D0 G$ d# T* R% H% ` - char *dmabufsrc2 = NULL;
* d7 ^) I4 j$ E3 I- o6 w - char *dmabufdest1 = NULL;6 m/ J% h5 G& J! q* `9 y5 ]' d" s4 A6 W
- char *dmabufdest2 = NULL;# l9 k0 B2 j+ v1 Y0 I, Y
, N c2 o& u! z5 B- ~' Y( d- static int acnt = 512;
/ Y4 P6 E- S, B' k6 X; m7 L0 j - static int bcnt = 8;
( P& z: m, V7 @" w8 K# J# ^, c - static int ccnt = 8;5 h$ d, P8 ~" B$ @5 f* [- M3 ]
- ) s3 z$ i r! c6 [. `) e T
- module_param(acnt, int, S_IRUGO);
1 f" b: a f. Q* q5 n& {9 A& m) Q - module_param(bcnt, int, S_IRUGO);, M6 p+ ^% y6 n5 Y5 B# T7 g
- module_param(ccnt, int, S_IRUGO);
复制代码 , F+ B- D$ G! [! G* Q
0 }: b9 s* L. U- C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ u2 X' f5 ]4 ~$ y p) g' Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; B- a, C$ }, y8 o" P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) m( S: A! m, K8 W n, ^3 n8 ^8 H- f8 N1 ?+ f
- Z; R# ]9 P& D% u$ v3 }
|
|