|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ w/ Z7 I2 S. J, f
- [code]EDMA sample test application1 ^% u5 u' u2 m1 t
- /*
: l/ a, d( V/ R2 T% A2 i( z( t - * edma_test.c7 r# U! S# |. o# q5 W- W! ~ J
- *
) m/ l( v o: J, { - * brief EDMA3 Test Application W* r. |7 ~3 D. e) N
- *; V! ^9 A4 _0 x1 z7 k" l9 p7 P- u# S
- * This file contains EDMA3 Test code.
: g; T' u6 s1 `& f - *4 x" E, ^& X2 t' o! {" l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE d9 L( i, Q* g* q* n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" _# r; r- U. r - * TO CHANGE.
/ P8 u' n* D2 S' w3 \8 E - *
+ n$ K7 S P5 Q" f& J& ~* l7 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: A- j3 N! o' i5 O - *
6 l6 M: U- _& _# t* {# Q# V - * This program is free software; you can redistribute it and/or2 K3 p, \6 W$ G! f
- * modify it under the terms of the GNU General Public License as q/ B" u5 o d
- * published by the Free Software Foundation version 2.
8 R- D7 I4 q$ z2 j8 f. W - *
4 Z3 k; j4 W# R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 q& w. M$ e; E9 Y' ~" Z1 t5 i5 B - * kind, whether express or implied; without even the implied warranty' J6 B' _9 n8 P" t4 `& Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* }+ W) m$ L/ U( Y8 ?1 W
- * GNU General Public License for more details.1 J! e* w' y% Y e4 y) {( `+ ]
- */
% ^8 y! v* U& V! v. p - " \9 c5 p0 n7 X) s' h, s( M0 g) L0 a
- #include <linux/module.h>
" }6 D; F9 A% `6 k! S2 J - #include <linux/init.h>
' d4 R# T9 X3 e. V/ |4 N. ? - #include <linux/errno.h>
% L, B E% w+ b$ t, V1 t- z6 H2 i - #include <linux/types.h>
% l1 D- U) U \ m) g3 s8 P1 o. T+ O9 } - #include <linux/interrupt.h>
+ x+ x3 K2 C# u) b- K - #include <asm/io.h>
' y9 `6 S$ h1 H1 _ - #include <linux/moduleparam.h>
9 |4 k+ S' K% Y" q/ F - #include <linux/sysctl.h>
4 Y" ?4 S+ A4 R6 Q2 C9 s1 ?% M: B - #include <linux/mm.h>
$ ^/ t& I5 s+ g b - #include <linux/dma-mapping.h>
$ L( N* p- q" J9 j/ o5 p
! p( C+ c$ e7 A8 y; R; n# F- #include <mach/memory.h>
4 ?/ a6 O$ Q& {& A1 p - #include <mach/hardware.h>
0 W2 V5 p' p8 S+ b6 k: I, { - #include <mach/irqs.h>
$ C0 ^) O0 ~& s* e3 b - #include <asm/hardware/edma.h> B% {' K: w, C
- % l% O3 N' E; |6 Z; s
- #undef EDMA3_DEBUG
! P) G9 X0 K5 `( S0 X9 { - /*#define EDMA3_DEBUG*/. j( |1 d, U% N: Y
- % {: |' V0 i' u4 f3 I0 ~5 @
- #ifdef EDMA3_DEBUG
9 x3 e, h+ Q3 j+ p% E& n; o0 m* l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 F Z) }6 }: l# v! U& q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" F! \8 F; ]/ Q) C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# B9 A5 W' m) H' Z t9 ?7 D1 H" b - #else* ?6 u" d! N3 K1 f
- #define DMA_PRINTK( x... )6 k/ _1 n. K' K$ K/ }
- #define DMA_FN_IN$ {! K" E+ F1 I! X
- #define DMA_FN_OUT
5 p# I) ]8 e4 D5 K# X - #endif
) i& M# E5 h w
; V; v* Z2 _; Z+ Z8 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 E& k$ ?8 A2 x* y% R% i
- #define STATIC_SHIFT 3* A/ P4 l7 @, h \+ J# S; C
- #define TCINTEN_SHIFT 205 C# w& p( s) o- C* l2 W$ M9 {3 E7 X. O% w
- #define ITCINTEN_SHIFT 21" a" C. c3 b. ]
- #define TCCHEN_SHIFT 22
0 H7 ~' ~2 A" E4 R - #define ITCCHEN_SHIFT 23
: m5 h- |% U! A9 s1 c - ) [; H3 ~* q% z" X9 [5 {0 C6 T+ M1 y0 H
- static volatile int irqraised1 = 0;8 G, E) B- _! B& z3 g6 b C- [
- static volatile int irqraised2 = 0;) ~3 j7 F2 G# Y* q7 r; L
$ ]8 P" F/ l- Y A- H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. o* z6 x9 }2 I8 H. P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( C9 V6 U4 z; ?4 k' M. i# w, C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ~! g3 l1 _% j% O! \6 d& x& U" E9 z
- 2 Y/ O- O }. z+ m0 {* W
- dma_addr_t dmaphyssrc1 = 0;$ o/ d4 S- L/ i2 @/ e+ ~
- dma_addr_t dmaphyssrc2 = 0;
$ B* x1 B' Y2 X4 a/ p+ b - dma_addr_t dmaphysdest1 = 0;( T4 Y" G* ?& `' S
- dma_addr_t dmaphysdest2 = 0;
# e( b$ c9 V$ m& V7 _
7 b8 W# m! Q) o8 ~+ }( `- char *dmabufsrc1 = NULL;! R# d1 e- E* _" K! O
- char *dmabufsrc2 = NULL;
$ X+ H0 L1 F- ^6 y& L: { - char *dmabufdest1 = NULL;2 P* X! m" A, ^+ v2 |) P
- char *dmabufdest2 = NULL;
7 s$ u: E0 Z* P+ G1 C - 1 k! e0 D. }5 y7 j2 b) Z
- static int acnt = 512;
4 I! I' G0 ~2 v( X - static int bcnt = 8;" S/ i- ]2 b: {2 D; }# p
- static int ccnt = 8;
4 o: Y8 H3 h6 g2 k i% O/ k* l
& `0 d/ V7 v8 v- module_param(acnt, int, S_IRUGO);
" M r- `1 g9 `" { - module_param(bcnt, int, S_IRUGO);
" y4 ?: p- P# [+ N/ @% p3 b! D - module_param(ccnt, int, S_IRUGO);
复制代码 ) ?5 v' G! v; t( c2 s- _2 K- @
& O3 `+ w- u$ j: o- R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 a5 ?" ]+ h0 `& x4 i1 V2 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ G, ^ X: r: [5 S: n$ C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Z3 ]6 ?( E4 L& s$ q" d
. c* m" |1 {; z* V9 u& R r( [ _
1 g# v5 A W7 \; g# \7 `( o1 G$ h
|
|