|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 v. A$ Y# p; t- [code]EDMA sample test application7 @# C* M3 |8 ~% H$ b/ D- O
- /*9 D' G: d1 Z: h# E( S: o: ]& j/ P
- * edma_test.c
' U3 c( E5 D5 e* ~ - *7 ^9 D2 x! N5 j4 i4 _+ p
- * brief EDMA3 Test Application5 b- o+ ^: w2 j# M& f. h
- *
: z% R' X s& T/ o6 C - * This file contains EDMA3 Test code.
: @9 z6 W0 S8 N. t2 n - */ B% e8 s3 e! _8 i' S& E, m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ r. n( l* V; [: M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 y: O3 w+ y0 H% H - * TO CHANGE.
8 N# v' Q) x3 J" j; A" U - *
6 U8 y( r1 e) q( k2 J/ X5 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. {1 @; w" |7 q9 {7 G2 b
- *" _* o8 J$ B% U# _
- * This program is free software; you can redistribute it and/or
% c4 M* b! J3 Z& R; w' m- Y% ~" U% g: V/ T - * modify it under the terms of the GNU General Public License as' E" |! Q0 n; y" c
- * published by the Free Software Foundation version 2.7 n6 h0 V3 }( k
- *9 e0 Q* F7 w) H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 J3 X" F; U- Q* M3 c5 h: m9 P$ U
- * kind, whether express or implied; without even the implied warranty
* D' g! Q) H9 j9 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& I! u- A9 ^) H1 l% ]0 C. H4 Q) r
- * GNU General Public License for more details.% f6 \3 B9 g' w
- */
4 h& Z! ^$ b2 N3 Q7 r/ b6 l) k7 D - & |' W: M8 K3 a7 j7 ]3 j5 I5 Q
- #include <linux/module.h>0 p% u' _' y1 r" c& [7 r
- #include <linux/init.h>
3 C# k: R) \# G( T - #include <linux/errno.h>
9 K& i, M7 b9 c( U8 R3 K {% X - #include <linux/types.h>
' t7 y+ d2 I* l1 C- A7 o - #include <linux/interrupt.h>
% B6 }" |8 d+ E. `+ A1 n( s# Z5 ] - #include <asm/io.h>
5 Y4 r5 m8 V- x - #include <linux/moduleparam.h>6 W2 Y Q: V+ z# k
- #include <linux/sysctl.h>+ @& X3 Q) h6 ^4 }) l
- #include <linux/mm.h>
: ]1 e! l# c& y1 c! B3 Q! z - #include <linux/dma-mapping.h>
) N6 ]. P5 r8 h% H9 R7 o - ( T9 c3 [- l6 W% z! F
- #include <mach/memory.h>
7 s5 ]6 p( t5 ~% r2 ] - #include <mach/hardware.h>
" z) P j' \$ `+ M" ]4 a V - #include <mach/irqs.h>
6 `' M9 I& k% {$ ` - #include <asm/hardware/edma.h>: S$ F7 `" y% F
$ O& Z; o# |% R2 s- #undef EDMA3_DEBUG5 i. f' h/ z3 M2 H4 s6 d
- /*#define EDMA3_DEBUG*/, Z4 l5 Q' S- x# u
; n3 Z" N9 i0 j4 E, ?; k- #ifdef EDMA3_DEBUG
- ^* ^6 ^* Q0 n, J. W& F' X9 x6 \1 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 B. k4 u3 |! }- k$ [0 ~" {+ d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 f# J6 o8 |4 j; ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ z8 y! ], W) w6 t - #else$ H _% i9 ~: j b9 ~7 p; ^
- #define DMA_PRINTK( x... )
, @8 A6 L2 F& t- Y1 |% q. s8 }1 [- w- G - #define DMA_FN_IN
5 }+ S2 p$ L* j# V4 b, p - #define DMA_FN_OUT8 |' X. f' {. O- E
- #endif
+ c# L3 \* |, e! u9 f - 3 l5 N, V& A: D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 K% j4 q% _3 ]. |7 e' V
- #define STATIC_SHIFT 38 g& M2 F! I0 ]* |7 p+ e, k7 C
- #define TCINTEN_SHIFT 20
$ L4 d: j0 u9 X - #define ITCINTEN_SHIFT 216 ?2 i8 ?! `+ V# V
- #define TCCHEN_SHIFT 229 J) S! }# \$ [& d4 `, x
- #define ITCCHEN_SHIFT 23
1 J/ _' W T& V6 Q* H3 S/ ~ - ; d* U$ D9 d+ b4 V( ~1 S
- static volatile int irqraised1 = 0;1 F6 w; c" R. {; k
- static volatile int irqraised2 = 0;
4 C8 F& s. y2 q
6 A! t6 b1 V6 y& R, r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Z8 W$ @5 H( i6 A6 C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 A3 N9 s$ R! l/ S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 H8 b1 `7 D/ w/ x- ]2 { w% ~
- : j( w) T& H. O4 _
- dma_addr_t dmaphyssrc1 = 0;
9 ?8 n% G; ^1 T2 u - dma_addr_t dmaphyssrc2 = 0;
- c: V7 G! I' D2 ^ K9 @ - dma_addr_t dmaphysdest1 = 0;
7 o5 \! U, u4 X! `( T - dma_addr_t dmaphysdest2 = 0;
. L: {1 g( Y+ }+ G r' ~0 ~% R7 s - 5 @1 Y# s; v! t. d9 @* n
- char *dmabufsrc1 = NULL;1 ~; u; R. p( {& ? U0 x
- char *dmabufsrc2 = NULL;% K. i) u! ~$ R9 ]' a( }$ _
- char *dmabufdest1 = NULL;: A. h6 j+ J: ^4 e5 v
- char *dmabufdest2 = NULL;+ V1 ^/ l3 ]" ~ p; V: A( x; W
* y0 ?4 d m2 W+ O+ p- static int acnt = 512;
* k$ D) \4 ^0 o) k4 n- C+ n& j - static int bcnt = 8;! X+ Q( ^- ~% j; i* _: l" x
- static int ccnt = 8;
4 ~3 y* s8 m' V - . H0 r2 Q( {" L! _0 H3 ~
- module_param(acnt, int, S_IRUGO);
) L& i J: {3 b3 a - module_param(bcnt, int, S_IRUGO);: Z3 g2 q! q& s9 |+ |2 f
- module_param(ccnt, int, S_IRUGO);
复制代码
/ x8 J8 \* P% M3 P
6 X. T! A! W h( S9 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ]) U0 k* L, ?; r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
B# N! Y+ N0 d& t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% {/ t# b: `( j7 y
; u7 q, k4 i6 o o; \
6 Q, v. M& K8 ^% }4 H7 g |
|