|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / _ z+ m4 B1 U
- [code]EDMA sample test application
! j a& F# x4 ? - /*
. Q* j/ v$ C2 ]- X1 r! U: r$ L9 F' v - * edma_test.c
) l% n' E4 O* G - *
; c! o9 U% o4 z$ i& V* }* e1 d4 K$ U( f - * brief EDMA3 Test Application
4 `5 `9 n2 C1 ~4 n, W - *: z: Q, v# n9 ~! b* a
- * This file contains EDMA3 Test code.' n9 b# Z1 v7 p) k
- *
0 a! b- q! M7 C3 T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# q( D& |0 D, a5 }+ ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 g i1 i1 Z# T; U* R, _! g
- * TO CHANGE." E1 S( u" P7 N/ C/ G7 W* y
- *, }5 a; J" t) M4 u2 Z0 T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: J5 k8 y ~) L! j
- *8 S- A6 o( K( M8 c
- * This program is free software; you can redistribute it and/or
2 q" \0 Q& H# o. M; q N9 d - * modify it under the terms of the GNU General Public License as
! ]# |9 L' M$ U# _, J9 q7 [" u - * published by the Free Software Foundation version 2.
7 D R& f8 b% ~- J" B - *
, D. P" \! C9 r6 J& T' ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 j- N+ L+ l2 i% I' j9 d2 R
- * kind, whether express or implied; without even the implied warranty( B( e6 @0 D, m) M: ^! J- L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 i0 }9 \0 l( z4 W. a; k
- * GNU General Public License for more details.
# i! h5 g, J y v, M - */
+ M% }: w9 g: W7 z/ [5 m3 c
1 _9 A& v3 r2 X8 G9 ]+ Y W7 _- #include <linux/module.h>: |- H+ q% V( @7 K) v6 t9 n+ V
- #include <linux/init.h>8 d+ K, w% d+ h* I
- #include <linux/errno.h>
9 _ ?! f" e1 E) c, z - #include <linux/types.h>
6 ], d) U @+ m - #include <linux/interrupt.h>2 e6 z$ P4 D0 Y) k1 S
- #include <asm/io.h>
# f" T( S6 n7 ] - #include <linux/moduleparam.h>
+ h; {/ z+ s" U" r) N+ V! T* K' d - #include <linux/sysctl.h>. D3 Y) _/ g ?$ G- {
- #include <linux/mm.h>
: ?0 s2 k2 V) |1 Q% X1 N- Q& l( T - #include <linux/dma-mapping.h>+ f. y: k- s0 R. Z
7 I4 }" K _5 M5 n1 l# |- #include <mach/memory.h>
/ e" P( F r# }8 E! A - #include <mach/hardware.h>! D2 d z$ j% T! K8 K* q
- #include <mach/irqs.h>) f$ ]: I) u. U" M$ a
- #include <asm/hardware/edma.h>
8 r. i$ y# I5 G0 Y$ ]" b
7 Y( {+ [; U& u: i1 ^) |& `- #undef EDMA3_DEBUG
' {- m0 P( D0 O - /*#define EDMA3_DEBUG*/, F! X f0 n8 ?3 O8 e
- ! y: L- K2 \7 W* F
- #ifdef EDMA3_DEBUG
1 t O$ S) b! z$ x. ]7 i: \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 g# a' ]6 ~1 I1 _- j: ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' k# t. ]" K1 `- J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 ]; p" ?* V* J* A. t" A4 P
- #else
7 P# d7 }* {0 ~$ Y$ Z - #define DMA_PRINTK( x... )' E6 C5 T, _& a" }
- #define DMA_FN_IN6 p7 Z n! o6 [1 q2 v
- #define DMA_FN_OUT; r! m) y& w* P8 y+ z1 T/ |
- #endif! u* D9 Z( K) R
% w" w) M- U$ A9 E( q- #define MAX_DMA_TRANSFER_IN_BYTES (32768), j! n7 D! d% t/ T* l
- #define STATIC_SHIFT 3( L( z% e: C+ u2 n/ s' f3 N
- #define TCINTEN_SHIFT 20* g( _$ j5 w' C( k$ U
- #define ITCINTEN_SHIFT 216 G! R/ b( P. K* ?7 U X! r
- #define TCCHEN_SHIFT 22 a9 a( s" V: h
- #define ITCCHEN_SHIFT 23: I( z7 `/ c* l" s2 m
2 X8 r% a9 C9 x- static volatile int irqraised1 = 0;
; ]+ f; d( }5 a B - static volatile int irqraised2 = 0;
9 l- H5 s u9 t: d3 {3 [$ [ - ' `4 h W, W8 q( o* X/ D# D% T# W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# J$ [1 F; J! I- Q A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 {2 u+ f5 _+ }4 \* ]: k+ z% O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ?7 _- J# R1 U5 C; D' [ - ! v- A0 E8 X) _! g+ \) z* D
- dma_addr_t dmaphyssrc1 = 0;
4 [' U( t- F5 D8 c; Z( j W - dma_addr_t dmaphyssrc2 = 0;
0 e+ w( I' r7 }& M* k - dma_addr_t dmaphysdest1 = 0;
9 ^6 _' k9 W4 I3 k9 w4 Q8 D - dma_addr_t dmaphysdest2 = 0;
) O9 E% Q5 i+ y9 F3 y - ; G9 z' ^. c$ M. l2 t
- char *dmabufsrc1 = NULL;( t& G7 E0 F7 W: F3 z* m& B; [
- char *dmabufsrc2 = NULL;
# l l2 a% B5 c3 V2 Y3 P" [. u - char *dmabufdest1 = NULL;
3 f3 v1 ? i1 Y" Y' v: z - char *dmabufdest2 = NULL;( }8 v. [/ d1 s4 K
- : M4 a/ H# `* a# M! c' X" V0 @
- static int acnt = 512;
p' r$ S) v" d3 c! M F% P - static int bcnt = 8;
0 t/ u' s& t( ^1 V& `3 l - static int ccnt = 8;, J6 ?# `# `1 I" s
- 2 w7 l @! W! @6 J. _! Q, ]
- module_param(acnt, int, S_IRUGO);1 A* D1 h( D/ n& \
- module_param(bcnt, int, S_IRUGO);
+ \: s1 z$ r9 h3 J" e" Y9 v9 Y - module_param(ccnt, int, S_IRUGO);
复制代码 ' f* t4 p: D. U h9 s% t
+ v: z8 p/ k) g. p" @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 y* n0 A% L2 t1 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& G8 H/ ~5 [6 [4 [- P$ n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 t4 z1 Y/ v& h/ A* U
! S) i: |7 T, Y4 ~ j9 J9 s4 X# l" }7 w
|
|