|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 j' L& a7 {% a, @) l& X6 r- [code]EDMA sample test application
+ _% x7 z+ V: T8 f - /*2 N' F% p( e7 I/ k% e* A
- * edma_test.c' m: E4 b+ m$ I& H' t& y+ ]: H
- *
% J, n7 [* d0 u" I- s' E - * brief EDMA3 Test Application/ f" T0 x' Z; q! I+ q- j1 R
- *+ Q A/ b# {* _" b( h
- * This file contains EDMA3 Test code.5 t S! q, z6 }( n
- *
4 G8 R5 K: ?5 w" d$ Z8 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: ~# E$ L/ R0 W2 v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: [- W, N+ q* M0 ^- b7 B' }, j - * TO CHANGE.
* L" Z& q0 u/ H5 B2 ? - *
8 j3 |8 N! R& K1 f" p8 e' Y& u3 y" x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) S" j" e. q& G, F5 j - *8 `6 o! i) z5 I" a
- * This program is free software; you can redistribute it and/or
2 j# ?$ P2 ^4 K# m- f/ ^2 P - * modify it under the terms of the GNU General Public License as: l' E& U$ K1 c, O' |$ F
- * published by the Free Software Foundation version 2.
# k; o6 |: ^( B7 e0 C/ D - *% G$ c" P; E8 L& Q/ J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# y0 Q K# k0 T2 ]+ V s/ I - * kind, whether express or implied; without even the implied warranty# s* ^; S4 w3 U9 t D5 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; \8 x( _8 m$ m! P# y& U) ~. r
- * GNU General Public License for more details.1 `) o! d4 y) e5 W2 w8 |* F: c4 h5 _
- */+ e0 c5 o1 L* F0 a4 O
) Q2 e; y, [% l4 Y% v- #include <linux/module.h>' Z) a. C3 Q) Q( M5 B' p% l
- #include <linux/init.h>
0 i8 @2 S5 i$ E0 n9 q0 I, H& f - #include <linux/errno.h>
7 Y6 X, `' J2 N7 C2 U9 A6 R - #include <linux/types.h>! _$ w) s/ k3 _/ h* g7 M# m
- #include <linux/interrupt.h>) k1 t' j- Y3 J: y
- #include <asm/io.h>
1 L7 t# ]. Z$ g - #include <linux/moduleparam.h>
8 l/ ~3 x+ E S" ]; \ - #include <linux/sysctl.h>
' P1 F& l7 M4 {# D+ Y; V, e5 I - #include <linux/mm.h>
3 C' Z, e" E: C. z - #include <linux/dma-mapping.h>
) Z" A7 X+ _5 [2 b" {8 i! M% T" J# \ - % L$ F) v7 W5 w6 l* p; c
- #include <mach/memory.h>. @: w5 Y1 [( g2 }& }
- #include <mach/hardware.h>$ l5 `0 h; c6 P, }$ R
- #include <mach/irqs.h>
7 F! d$ w3 Z2 }# b - #include <asm/hardware/edma.h>) P" s" D: w% V
- ! p1 {- j4 s* C
- #undef EDMA3_DEBUG
7 G# S- G1 P7 Y0 _ - /*#define EDMA3_DEBUG*/7 m; Q+ ~$ w$ E) }9 H" a6 V
- {, W6 W8 ^% w
- #ifdef EDMA3_DEBUG9 J) z, f @; ^9 H6 s! Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 L. x W: I2 X. s# l+ d( @5 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 \! `7 ]0 h" A" R; J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! C- R% U9 B' z* U; V1 s+ U - #else
3 e$ a( @- e# ~* h% C% g/ _ - #define DMA_PRINTK( x... )
" p8 t( }# q9 k' ] - #define DMA_FN_IN
% Q( e2 a+ g- c: \; d1 i - #define DMA_FN_OUT- t( v- k4 }0 C5 E9 n
- #endif7 o }0 ?$ _! `( j N# x
- + }7 k# C" F8 |9 d5 K* V! F( y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). F9 V- |6 r! n% [2 y& b- M
- #define STATIC_SHIFT 3
$ f7 j3 x7 j+ ?+ g* t - #define TCINTEN_SHIFT 20
. y g' r) e3 X- s. N0 X - #define ITCINTEN_SHIFT 21
. D* Z8 F; @) L7 `0 }- j" h, Y' y - #define TCCHEN_SHIFT 22
5 W$ a: g5 M( C0 k) W - #define ITCCHEN_SHIFT 23
\( O; K) C9 B8 d
+ \% [* U8 g+ W- static volatile int irqraised1 = 0;% e: u2 t e: s. g- Y; c
- static volatile int irqraised2 = 0;
3 U1 F& F$ x# t* }
. I# E! T9 h4 t. i# A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ S a. b8 X3 }+ C6 q/ @ |5 F& t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Z4 T7 [8 i+ O% A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 t) D& P8 C" R1 d
7 I5 a8 v$ B7 E. P3 C* w- dma_addr_t dmaphyssrc1 = 0;
( T7 `0 r4 {/ u& ~ - dma_addr_t dmaphyssrc2 = 0;
) `7 y8 \, X, m - dma_addr_t dmaphysdest1 = 0;# e4 O! G& H, C. k! q R
- dma_addr_t dmaphysdest2 = 0;4 p1 @1 {7 f+ i
- + T4 y/ |9 O& z- N y
- char *dmabufsrc1 = NULL;
7 T/ { Z; W3 ^. U - char *dmabufsrc2 = NULL;% z& y3 E) \/ J0 M0 S0 S Z
- char *dmabufdest1 = NULL;: }$ A5 Q. N w- j0 N/ _
- char *dmabufdest2 = NULL;: O5 E9 j* A3 ^7 p
- 2 A5 w8 k, }" [- K
- static int acnt = 512;* x) I: o' a, i0 K( ^' t
- static int bcnt = 8;
& P: R6 m' h" } - static int ccnt = 8;
" X, @& ^4 P- [' H - : d, \( \+ n% g/ v8 ^" m5 |
- module_param(acnt, int, S_IRUGO);( y& ? \+ M6 I
- module_param(bcnt, int, S_IRUGO); @8 U: H% I2 U3 u
- module_param(ccnt, int, S_IRUGO);
复制代码
f* D. q7 C$ {+ l) p* Z0 c
; ^$ b& D5 q$ F) Q W6 Z& T# } t4 ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- S, T! p3 b" _5 b3 `, U+ ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N. n0 ~/ N- Y. R& G. j( e& O: K) j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: U) F7 Z3 X! e8 Z$ q3 s7 O$ y9 q0 h7 k7 q* t
" H% r+ L3 o' @7 t& Y% u. T9 m, M2 n2 E
|
|