|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- {' d) E7 ]: M8 O8 j- [code]EDMA sample test application
U( v+ T1 ^4 K( W# c - /*4 l& p8 p' O2 a: Q! K; G5 b
- * edma_test.c
( w2 V2 q1 s# \* s" e9 R' U - *
~/ ~6 O F% D! J1 t6 J - * brief EDMA3 Test Application
& N5 _9 d& U( I- ^ - *
+ I) Z, v! W% {5 x - * This file contains EDMA3 Test code.1 }) c4 r3 f0 F$ Q
- *
' T. ~* P) H9 W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 D! p& h# K/ F% ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 P9 T2 ]4 S& Y1 t - * TO CHANGE.1 p ?8 ]2 R- v6 ~6 K- F
- *
5 S, F8 q R8 X$ ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! l+ b9 h; f" x: M- _4 d - *
0 \- S& Y1 P# d - * This program is free software; you can redistribute it and/or4 ~( q& N- B$ N2 w) t' z5 ^: ]
- * modify it under the terms of the GNU General Public License as
. C' m6 [0 B' U d R - * published by the Free Software Foundation version 2.
1 b2 ? V" l) g: U0 A - *
( \* z& L+ @2 a4 ~. O1 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( N$ E) f$ I6 O+ L. J: m - * kind, whether express or implied; without even the implied warranty
$ ^* }" c# N( `3 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, _9 u" m, ^' m - * GNU General Public License for more details.
# e4 _! g, m& c2 J0 A - */
6 C5 Y# b/ Z+ V u4 z3 ?! W/ ]
, w% }( h" M2 N: R- #include <linux/module.h>
8 C" H6 G8 ~" M# J; \ - #include <linux/init.h> X, j7 W' v {4 G9 n+ U- v, M
- #include <linux/errno.h>
- B8 L' X8 s; u( P+ o8 g4 @ - #include <linux/types.h>! B0 _" D8 ]9 T; f0 p3 e7 L
- #include <linux/interrupt.h>
- t; Y5 ]0 n5 }' X) A* B7 K - #include <asm/io.h>
* h5 r% P) K( n1 O4 M! u - #include <linux/moduleparam.h>
- R6 S" l$ v$ ?& T6 `& W - #include <linux/sysctl.h>/ m8 ^+ K! M* _" U% ]5 D; ^
- #include <linux/mm.h>
9 D+ n7 ^% k8 H5 u) R) } _ - #include <linux/dma-mapping.h>, I3 A4 Z* E* z1 _0 A
- ' d- m8 |! |7 i* K6 c* B
- #include <mach/memory.h>
, G+ V. P+ U" o" Q& v - #include <mach/hardware.h>7 Q( w) u$ G7 W- J' J
- #include <mach/irqs.h>
) z( v) q0 a6 i. h" q - #include <asm/hardware/edma.h>0 O; u [1 r2 {" H6 T( V% S
- ) A# X* J3 O" I6 \) h Z3 T6 R' y: e
- #undef EDMA3_DEBUG
3 j" e" q2 x* p$ p - /*#define EDMA3_DEBUG*/8 ~0 f/ B0 L. u0 M
9 S4 @$ N* K( w. t* [( f6 X7 }( }- #ifdef EDMA3_DEBUG; n" f: P: N% Y L5 D3 \/ G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ]8 o3 M* q1 `& y7 Q& i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 a# L u+ i* \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 K4 P( I9 ^5 ]( U" Z
- #else
9 T6 g& r6 D; `; n0 A& d* v- a - #define DMA_PRINTK( x... )
3 B0 j8 t, p# ?" \, m% b - #define DMA_FN_IN
9 J% B! f$ Y0 F& d) p( W3 ^6 Q - #define DMA_FN_OUT
, S! m E6 ^+ j+ M+ Q \4 H - #endif0 e; }1 Y& K# q" O- @
0 j: r2 a) Q: _, [. l- R& U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; Q6 X5 N* X" l2 R9 N" u - #define STATIC_SHIFT 3
$ I" ]) Y1 k# Q" X4 }) o - #define TCINTEN_SHIFT 20$ r. y: H% o f% V, ]
- #define ITCINTEN_SHIFT 21
7 v3 h: w( V0 O7 T1 { - #define TCCHEN_SHIFT 22
& Q3 O2 w( P- \: C - #define ITCCHEN_SHIFT 238 e! P% y. z( r$ C
- , i# e- \2 I& F: S Y* q# z
- static volatile int irqraised1 = 0;
6 w& Z+ @1 E' [9 y3 e, z: p* _ - static volatile int irqraised2 = 0;' v. ]: @1 \& T9 x+ p
- $ j/ w' o7 u3 p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 @' ]+ d: s% O% c! d' {0 O& v8 f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, H; P$ c5 }7 z3 `$ T( T) d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& h3 e/ [7 [$ V
+ ^$ k; M* e& f. H6 O- dma_addr_t dmaphyssrc1 = 0;
. @- C; N' h5 ]1 ? - dma_addr_t dmaphyssrc2 = 0;
5 D. X! ]+ e; x7 @( L8 W/ l( K - dma_addr_t dmaphysdest1 = 0;0 [/ W1 d: A9 k4 y
- dma_addr_t dmaphysdest2 = 0;! h! F* ?; K4 q; E8 G# F) o1 X
* K" {! \/ z4 W; m" i& @- char *dmabufsrc1 = NULL; C2 L+ z) I. W2 v0 H1 b$ J, u
- char *dmabufsrc2 = NULL;
6 O/ h# U) C. R - char *dmabufdest1 = NULL;7 S$ y' q# N* c, `3 z' V
- char *dmabufdest2 = NULL;
, _5 K+ W4 _3 h0 Q+ R+ Q( q - - G8 \2 a3 M( J) U' b3 c: @! i: D
- static int acnt = 512;
5 y& H7 R$ e* {! b; e/ Y4 w, x - static int bcnt = 8;+ f. t2 [' p5 U4 Q- O. ]
- static int ccnt = 8;. e% O; r% p3 X/ i: L
, D8 \/ {. ?' }5 c$ O# C( ^3 ~; s- module_param(acnt, int, S_IRUGO);
0 b" ?2 s1 G3 C3 n: | - module_param(bcnt, int, S_IRUGO);; Z- D" u$ b4 B
- module_param(ccnt, int, S_IRUGO);
复制代码 & L, o* P' H3 M# O
% E6 {# H e% `0 J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 f* `2 m+ \0 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# K/ J$ @4 D* i0 A, W) G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ c) ?$ I \. ^. x7 ?! G' }3 V8 m# b' s- h+ b+ d" @ p' C
' }9 l9 _7 h: G. a. y
|
|