|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) K0 d9 m' p1 G' B
- [code]EDMA sample test application! D, \" A7 C4 I/ F; ^
- /*
" |0 W" K+ h0 l, S% y3 f5 w - * edma_test.c9 C. f& x6 h& D+ `5 w( B$ j
- *2 f% p; p& w/ A5 X# O4 I4 f
- * brief EDMA3 Test Application1 t$ S# R! u8 r* @; \
- *4 t/ z" a2 `/ Y; o; z4 F
- * This file contains EDMA3 Test code.
+ B5 B9 F# c8 ?4 }/ J1 g4 r - *3 q& t i* N2 Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 ?* T- m/ v- g j4 X0 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& W( n( l: A6 S# P0 u6 j - * TO CHANGE.+ b3 q: V. r0 f+ x+ U$ U
- ** g* t# B9 y' H7 w4 I' h0 u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" L, a7 H5 `, k7 u
- ** z5 n* i5 H7 y& I9 A
- * This program is free software; you can redistribute it and/or" Y7 m7 u8 j% ~' M3 l. F
- * modify it under the terms of the GNU General Public License as
4 D9 x/ J/ q- ?1 N& t% j2 j7 G0 X - * published by the Free Software Foundation version 2. N; O+ b. ?( k4 p5 w
- *
: V4 w7 m# ]$ ~6 i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- y l, t. v7 h# T6 [3 B o) Z
- * kind, whether express or implied; without even the implied warranty b' x% I6 V2 H- C% S3 @2 {. F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% J1 @. v1 _! n4 ~% \ - * GNU General Public License for more details.
3 b1 N* G- a3 n) y& n$ U7 K. R - */
/ e1 N9 N/ y. m/ M0 n4 w1 x - & H5 j$ k( W3 n) a) p
- #include <linux/module.h>- G% e' X1 t& \0 s9 W
- #include <linux/init.h>
! X9 i1 V J8 A$ |% z! o - #include <linux/errno.h>" j# }$ a. L; G3 j% E) s' A
- #include <linux/types.h>5 U& k _, }, J- q8 `, ~2 ~
- #include <linux/interrupt.h>6 T- M* R3 h8 ]- Q: p" s
- #include <asm/io.h>
6 u8 ]% ~4 b/ D! Q - #include <linux/moduleparam.h>; T' t' P: ~. r) S3 m$ H
- #include <linux/sysctl.h>0 _% K$ p9 N1 z8 A3 z# h) X
- #include <linux/mm.h>
7 U* w [: m$ }) L - #include <linux/dma-mapping.h>; }9 B9 y( P- r1 ?
- + |6 `7 L Y# \6 X9 s/ K, R% b* F
- #include <mach/memory.h>; B7 b! Q I" B5 q$ Q. M% X
- #include <mach/hardware.h>! k3 P9 r/ W4 ]/ R
- #include <mach/irqs.h>. q2 G- f' `0 ]8 {
- #include <asm/hardware/edma.h>
2 E5 N) c9 [! v) a6 J& v( F. Q) E - + ^! k8 _8 }1 C) O5 Y; b
- #undef EDMA3_DEBUG
* r' [+ K+ A! H8 c9 M - /*#define EDMA3_DEBUG*/. m2 Q: G& V s- L
8 j7 v, ] _$ r6 z3 ?# ~8 x0 H& i M- #ifdef EDMA3_DEBUG
5 _; A7 |; B! o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( U9 }, @9 L9 f# Z0 W- }* N7 }9 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& t. X! d0 C# |; F) b& j: ?8 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 ]5 R) m: c9 b$ M* i - #else0 e4 M" Y) W! z! b& L. x
- #define DMA_PRINTK( x... )0 S# Q g% |3 a
- #define DMA_FN_IN0 u% H3 f; Y+ Q. Q; H; l
- #define DMA_FN_OUT
8 y* H1 `; o/ e, Y5 n$ Y: n; h - #endif
& |' v! G/ p2 B' G- j - + t1 [6 K* m) _( G( w0 W! c* s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 _6 t4 \1 T1 w7 Q9 g9 y - #define STATIC_SHIFT 3
# E9 `0 V' t+ R2 |4 Z6 y' ^+ w - #define TCINTEN_SHIFT 20) ~$ M9 r" C7 P
- #define ITCINTEN_SHIFT 21! e+ D' O6 d! c
- #define TCCHEN_SHIFT 22
/ o$ A! O2 Q+ l1 { - #define ITCCHEN_SHIFT 23* c$ \" L4 [, z. {# x2 _
2 \, L( m* V" o# [1 h- static volatile int irqraised1 = 0;
' B& r5 D( V7 s3 s4 ~" p - static volatile int irqraised2 = 0;/ G# G- u0 D0 J. p2 L
% d6 H" D8 P2 _$ e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: [* X) ^4 ~/ |, n, G* `- B6 }: e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# j& Y7 y/ a' T6 w$ V9 R. A6 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ W6 s# q: [( x: z
+ T( M% D: l, d4 a, K4 W- dma_addr_t dmaphyssrc1 = 0;8 v/ _0 m g3 J% {6 O
- dma_addr_t dmaphyssrc2 = 0;
1 R( P: ~' T8 @! b, K V - dma_addr_t dmaphysdest1 = 0;
8 i: O0 p+ ?, R [* O6 ^8 t) M5 U3 I; t - dma_addr_t dmaphysdest2 = 0;
- L5 \; M5 T( C
% R/ n/ l1 V# G- char *dmabufsrc1 = NULL;8 s( V9 w( X0 z6 P' F
- char *dmabufsrc2 = NULL;
+ d( R/ D! Y3 H# g! |4 T: ~9 ? - char *dmabufdest1 = NULL;4 e$ G8 K+ \8 @& P
- char *dmabufdest2 = NULL;
- X+ O+ z2 a3 Q: X* @8 A% A
& c* K2 q4 K8 k) g! v5 C- static int acnt = 512; J/ {4 t5 q! J4 y0 B- B6 Q+ l
- static int bcnt = 8;
; w( [3 P8 K8 H - static int ccnt = 8;3 d$ d6 I- j8 S5 R: _+ r
- * @7 P$ G& j% Y
- module_param(acnt, int, S_IRUGO);
2 h0 K# V' c. l - module_param(bcnt, int, S_IRUGO);4 N) }* m: B+ c$ [
- module_param(ccnt, int, S_IRUGO);
复制代码 ~' I: K6 R2 `" X) ]- z
* w8 b! _8 k- s+ T$ }. Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 R- H; ~0 c2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( l$ g9 _) e- n8 V5 f& D: j# L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& z1 h* ?/ m7 e% m7 B
1 t: q& B2 o; \0 j& q, g) I+ ?' a
|
|