|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 b. ]: V% k( p' C- [code]EDMA sample test application* v8 q" o( t7 N/ t' H& I# h
- /*" L& P- W( s4 G% [1 J. i
- * edma_test.c7 S d& V8 l; J0 [7 B; c
- *6 I" o0 T: F: [/ F* ~
- * brief EDMA3 Test Application& m! j' x e- ]
- *" m }' Y/ Y2 x- Z
- * This file contains EDMA3 Test code.0 K3 X& j% l6 t0 {2 A
- *
6 u- G f7 p3 c7 M. {) F P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% o. |/ l5 u6 X1 `# x$ \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! \$ ^ H# @& H) O3 ?7 M
- * TO CHANGE.0 z! B9 W$ D5 i' w
- *; m" U+ Y1 |* _% k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! G5 Y& u) I3 P* [, T! v
- *9 l) y! @; B" h/ |- W
- * This program is free software; you can redistribute it and/or' j( O9 _% n" r) V
- * modify it under the terms of the GNU General Public License as
5 _! F8 u7 Y# E - * published by the Free Software Foundation version 2.
8 g K8 J% D! e/ l9 }7 t - *
1 I' P$ |' a# m# y3 I' H7 ?1 ?1 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# [1 s( g1 p# ~3 b4 D4 Y& W
- * kind, whether express or implied; without even the implied warranty& g! U1 T! h0 N- S/ J3 y* T2 w5 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( h& | F: {7 R% G7 w: F0 \: ?
- * GNU General Public License for more details.
4 B# ^0 Q$ `5 W9 ?6 a& u! Q - */
0 C. Y9 _2 P4 J7 e/ P+ n0 F* [ b - , _# ?. ^6 h# O4 i
- #include <linux/module.h>
# H- B2 D/ ` g) } - #include <linux/init.h>
# r0 U( p# G* }" J - #include <linux/errno.h>9 j' c0 W- [. Z( Y
- #include <linux/types.h>0 ~5 `& U( g% h! c( }: L& z
- #include <linux/interrupt.h>
- M: e& t! u" A. z# y, \& L N - #include <asm/io.h>
% P0 P5 o7 Z2 `" l, d* G4 e - #include <linux/moduleparam.h>$ |. b2 y8 a/ L9 V0 l- g
- #include <linux/sysctl.h>
0 }. Q$ N: N; s# b7 c; C- \# X - #include <linux/mm.h>
$ H& M A# U* H& v - #include <linux/dma-mapping.h>
8 `1 u+ i8 }6 ~% b6 N# Y - 6 C& C# N# g: A" Q3 ^) f1 X' G
- #include <mach/memory.h>
- ^9 |& J( H N+ X& \ - #include <mach/hardware.h>
1 _7 t" {9 b% ^% O" i' r2 ?7 q - #include <mach/irqs.h>; x% Y0 j9 D2 O1 k; k( p4 m+ g! j2 o
- #include <asm/hardware/edma.h>1 W2 t+ F$ v3 L( x
- / Y3 P" J3 O0 D/ l. S* o
- #undef EDMA3_DEBUG
% K% E# }0 b5 V: i8 G; v2 E4 f - /*#define EDMA3_DEBUG*/- T3 y, B. u) C. Z- d
- : V5 ?9 q# A, W: h
- #ifdef EDMA3_DEBUG' s: O/ |, I& H4 s) E" M8 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 Z- u$ K2 k* c9 q( m$ o2 Q6 Y! f/ j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* w1 [; y* Q6 J6 v! t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" ?4 N+ z( `9 \) q, I# n - #else5 k( V4 P5 x8 b$ w
- #define DMA_PRINTK( x... )3 @5 |$ {" O6 a# }3 Z3 }4 T
- #define DMA_FN_IN
' G7 M" g! L7 a0 S, G2 ]9 S - #define DMA_FN_OUT' y g) b% i# E1 B
- #endif0 k! L. ]6 ?, K3 Z1 ]
# L0 w/ N+ w" v) Z' g% ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% I" }0 }0 f- A; ~& F3 e - #define STATIC_SHIFT 3- f9 d: E5 T6 @% R2 a# q4 a+ _
- #define TCINTEN_SHIFT 201 b8 F( b1 X1 q' x" B0 T
- #define ITCINTEN_SHIFT 21
( B) c; ^! n# B& F4 T - #define TCCHEN_SHIFT 22
! H0 T7 Y+ W! o' d - #define ITCCHEN_SHIFT 23
F6 E8 E5 H0 [; f. J - & { Q! T! X i6 W7 R1 u
- static volatile int irqraised1 = 0;: N2 J5 d- K* a( k. {
- static volatile int irqraised2 = 0;
' _# S1 A( v" |: @' i% p9 ?
1 D# w' ]2 ?3 Z7 f% I. |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( r, g3 L- Y4 d0 n- i+ b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q3 [; ^' J2 D- m1 \) t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); R9 ~0 K" x' [$ K' U' k
: d$ B; ^7 r* `8 p7 n4 s* ]7 ~- dma_addr_t dmaphyssrc1 = 0;
7 F. ~* G6 W9 k* w3 ~, B - dma_addr_t dmaphyssrc2 = 0;
) P* u% l6 p1 I, [$ h' E- P - dma_addr_t dmaphysdest1 = 0;& U+ B7 U3 z% z) ^
- dma_addr_t dmaphysdest2 = 0;2 g& _5 c L8 K+ f# X4 y
9 K+ h. l; V: n1 L0 t% q- char *dmabufsrc1 = NULL; h2 k3 g) K% b4 ?8 }8 g: w
- char *dmabufsrc2 = NULL;
/ W7 K9 h, h+ |# \ - char *dmabufdest1 = NULL;
: O. J1 H5 J( ?* ] - char *dmabufdest2 = NULL;6 f- S5 a2 q8 R- b6 v+ D* ~: B
- 5 f7 m; u: ^1 {: D% Q; K- O
- static int acnt = 512;
4 {4 o, y# g. _ ? - static int bcnt = 8;
/ t# S# q* S- s5 e O - static int ccnt = 8;
3 q2 V% h* e+ {1 A" r% K# N- d
5 d, A6 A7 e3 y+ s8 l# N4 b- module_param(acnt, int, S_IRUGO);4 P5 E) M5 J+ b$ c$ \- I
- module_param(bcnt, int, S_IRUGO);& r7 k% a7 y& M$ n* ~2 o( w9 p
- module_param(ccnt, int, S_IRUGO);
复制代码
3 R. T: V* s4 G; Q- f" d6 t7 G1 W& T7 P5 G$ Q, C# G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* Z4 h- ` K& F! X% d" y( larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 B, n- V& U' l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 L, D6 m- k+ q' q: E m4 s2 i
6 v! ]' O6 ~" B! K B. W' z3 N I0 J4 P
|
|