|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - {9 S* s( ?0 l3 R, b& B% q
- [code]EDMA sample test application# S4 f/ E0 n6 W8 ^
- /*( A6 I. F/ h1 j6 d
- * edma_test.c
8 ?, N# J3 c: f8 b- H1 P - */ [9 m) z! c& v
- * brief EDMA3 Test Application
5 R; t/ |% ~5 ]* N; T: k - *7 z6 d6 M! S2 `; q" Q7 \' o
- * This file contains EDMA3 Test code.
* W6 S" N' H1 w. D. M - *, d( u9 z, D6 s* }4 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 y, [ ^% G# S( {% m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& ^7 |: y& H3 _1 C' s }* q - * TO CHANGE.. `+ C. s0 s$ d, X. o M& A- c
- *: Q3 d6 m% b+ r1 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; y% U9 ]* ?2 G m7 O- G - *
0 c3 \6 K5 G+ N- P8 H3 q - * This program is free software; you can redistribute it and/or, `0 _( S& b# I: `' M; F W
- * modify it under the terms of the GNU General Public License as
/ C, K2 q }4 d2 i' O - * published by the Free Software Foundation version 2.2 J4 s% c+ b1 ]- D* ]' a
- *
6 {5 c$ q0 n8 e+ P _' ~+ d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 ?7 e B: R2 z' K
- * kind, whether express or implied; without even the implied warranty( c9 X( p0 O7 m% Q1 i, Q4 V5 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. l$ Y( y" h0 O; J8 E - * GNU General Public License for more details.5 [. P) f: V3 P7 i. F( O) K
- */; C4 Z/ t. H/ O; F5 U p/ x) A' t
- ! R$ v. ]" t7 [
- #include <linux/module.h>! J& p* A/ E" G* t, ]
- #include <linux/init.h>
5 s) C, }4 J$ B$ [9 _# D - #include <linux/errno.h>
8 {4 W) g9 q8 {' C# N1 d6 _7 q - #include <linux/types.h>
( E p& M C( R, P* ~4 e - #include <linux/interrupt.h>1 R. z( _" ?# Q1 U e% _. m
- #include <asm/io.h>& {6 C( [* F3 g8 D' n8 J
- #include <linux/moduleparam.h>5 k! t. y7 k& q( _
- #include <linux/sysctl.h>" ~! n! u5 J5 t4 u. k5 S
- #include <linux/mm.h> Y; M C; Z D4 ~9 m
- #include <linux/dma-mapping.h>5 k2 [' v3 _8 [3 e
- & y$ e& v* A+ x& }& D9 H w
- #include <mach/memory.h>! C B/ W7 f$ R" a
- #include <mach/hardware.h>
" A5 Q* z* G) D( t6 j+ ^ - #include <mach/irqs.h>
2 N/ e2 ^ G1 R - #include <asm/hardware/edma.h>
9 W V0 B k- l* v5 q4 i ?
" t+ o) {8 @; A- #undef EDMA3_DEBUG. K. r5 z: E3 b
- /*#define EDMA3_DEBUG*/' Z/ e; f: f: n, h
- # i' G' D$ o$ \1 T9 C8 B
- #ifdef EDMA3_DEBUG
4 F/ |0 N1 l" ~' L1 K+ o' _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# U" H$ n6 t' t, a( V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( `+ A% [+ {: j7 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% ?0 U: N7 j: n; R% b! a - #else# m5 L. ~$ k0 X/ M( t4 Y
- #define DMA_PRINTK( x... )# P r* x+ J! |5 c- o
- #define DMA_FN_IN
8 x/ E; v, D, r4 {3 o; E - #define DMA_FN_OUT
8 J) y2 _5 U1 S! U" ~# X' C2 Z - #endif
y* E& T, [1 b
& _. Z, X3 u! q+ p+ z/ A+ |# k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ u& z2 i8 K" E
- #define STATIC_SHIFT 3: e/ D% A8 J6 U" I7 q
- #define TCINTEN_SHIFT 20
/ v7 m( V9 O2 A/ z$ p - #define ITCINTEN_SHIFT 212 \: z9 ^1 Z( A- w; M
- #define TCCHEN_SHIFT 22, O/ E4 s3 _! Q/ u
- #define ITCCHEN_SHIFT 23& J- e. T; z0 D7 ~8 }3 V/ I
5 z+ {) J& O0 z1 }, ]- static volatile int irqraised1 = 0;( I. M. K* O) o6 Y1 J/ {3 ?! q: B
- static volatile int irqraised2 = 0;8 q2 d; W8 F9 U+ w& S$ l( s
$ [; c6 O7 l ]# X8 p8 s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 s: B+ J9 ^& L% T5 y; [' p( W6 m! N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) v! Z4 v4 I$ V6 i' I6 P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 I" V; J$ ~5 L# c$ b. O, d
$ U8 |9 G7 \% g% X. D7 h( k- dma_addr_t dmaphyssrc1 = 0;
T. r( F- G! q5 Z0 c& z/ c - dma_addr_t dmaphyssrc2 = 0;# t( J8 ?+ a, M* V; g
- dma_addr_t dmaphysdest1 = 0;$ ?$ M2 p d7 d/ U) u6 u
- dma_addr_t dmaphysdest2 = 0;" f0 F& G+ m; Z1 Y; t
- : _, O3 U( `" z% b% a5 B
- char *dmabufsrc1 = NULL;
@% a l) z6 f1 y - char *dmabufsrc2 = NULL;- A; @$ o) I% T2 D, E8 t( Q
- char *dmabufdest1 = NULL;2 i; P7 l% q; f0 O: ?& k
- char *dmabufdest2 = NULL; u0 ~* p8 V0 Y S! S
- # ]/ r" |, d' V7 ?# V6 U
- static int acnt = 512;
1 J( [! M1 |5 q5 j) \/ {" t: h - static int bcnt = 8;
4 ~; a0 x3 J* j( A. v# A - static int ccnt = 8;+ B, a) Z* l6 o0 ~
- - a5 G: T; u5 h1 T
- module_param(acnt, int, S_IRUGO);
6 n! |. z5 a3 T4 m) D - module_param(bcnt, int, S_IRUGO);* p, y1 q- ?' [! Q3 k) Q1 P
- module_param(ccnt, int, S_IRUGO);
复制代码 2 }) `8 h; |7 D: ]4 W% V9 g
: L3 @2 L/ n: n: Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! f/ a k5 v- G4 [2 n: l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! r f# s+ H: |! s' Z; x& a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* A" @' H5 O. n3 m+ c
5 ?$ I5 u' g; T3 Q. e4 A" z, ^$ k+ o, T: Z% h
|
|