|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " m8 A$ P4 i7 X3 {1 q ^' M
- [code]EDMA sample test application/ a0 V" ^8 H4 A) T
- /*
C* Y" l& k z; Y: n! u9 s - * edma_test.c# W' k5 h9 Z; z; X
- *' m6 M. Z1 n& e
- * brief EDMA3 Test Application
" B! A; u, D) [3 u: |: [ - *
" P; P$ J5 |/ l9 ~5 v* K4 Q. e% [ - * This file contains EDMA3 Test code.
: {4 g! C1 X0 \* o. |7 V - *
: D: G8 }& i, A- y: n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 |) h5 ~0 ~9 a( n: l) P3 n$ ]: W" r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, D4 ?6 x+ y$ e7 N0 ]5 v - * TO CHANGE.
2 L9 Z. |: r: p& O8 M2 s9 t# o- h9 [ - *
7 _) n0 S% @' j! _ X: X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 ]% Y% m9 T" K- |% j; ]. l6 V - *
# ~# [- R H- x* L" L, F - * This program is free software; you can redistribute it and/or
/ [: [" Z. o" k, N o5 |+ r - * modify it under the terms of the GNU General Public License as
) K$ O4 f/ w! f3 K) c% g" t - * published by the Free Software Foundation version 2.
9 \5 j" h7 S p+ S4 S3 U7 @$ ` - *
. g, L* u; Q: i9 X: Y1 Q" X3 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 @; O& w, ^; N3 T
- * kind, whether express or implied; without even the implied warranty
; u, o6 m1 q% T& v: G. Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ G& p$ n ?' _' Q; O8 x' D
- * GNU General Public License for more details.
- C. M6 t! v) [8 r0 [) f - *// A/ ? c8 b& s! T5 q
$ W* o' [. R# t% z$ `- #include <linux/module.h>
o+ T4 \' ]9 ~( b - #include <linux/init.h>
! J. u0 Y9 O/ h" {8 k7 D8 o+ J7 l - #include <linux/errno.h>$ A( M P0 u. J; q
- #include <linux/types.h>
) q; p3 h) {. `$ Y) k - #include <linux/interrupt.h>
! S6 t- k" h5 m1 q- x8 `- f - #include <asm/io.h>
q' d* z/ q8 X" U$ l1 q# K) b - #include <linux/moduleparam.h>0 }& v& h: o6 X& W3 k
- #include <linux/sysctl.h>
" b5 w9 C4 I: Y, A8 s9 u' v - #include <linux/mm.h>
% ?) _* d4 R6 W t+ l - #include <linux/dma-mapping.h>
+ W+ Y8 T7 V: d4 L) t e* X# G
5 o/ i: r# X) I) j6 J( [0 }- #include <mach/memory.h>* r. p5 g1 C; x7 z* _; {9 M3 i
- #include <mach/hardware.h>
( f4 B# \. M3 Y5 Z5 p) K - #include <mach/irqs.h>7 ]4 p4 I' b) b# @1 N' a
- #include <asm/hardware/edma.h>
7 w G+ ]2 F( N5 z* Y7 M - 1 `8 D: z/ ~* x8 E: F& Q( T
- #undef EDMA3_DEBUG
7 b ^- f; j( p - /*#define EDMA3_DEBUG*// [; M7 Z ~# C [( p- R4 {7 y: h
* h- Q& _0 h) y* W- #ifdef EDMA3_DEBUG* c% Y( d. e5 F' C+ C. S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), H, C2 Y" e# J$ V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( T5 G. c* ~' P& d) q- N* T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 E' a! I6 w( N* ? D6 W4 x
- #else
$ e+ x$ b% D1 P" p, t8 F) r - #define DMA_PRINTK( x... )
+ U& F( S; l( r: v' `4 I - #define DMA_FN_IN* ^! W8 k( y" F; h
- #define DMA_FN_OUT
. ?% R5 x3 s/ i0 B Y8 V6 w9 z% x - #endif9 g: N: S! N) t
- P [! z- s, }6 ~2 H' S4 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): [& j# q* Y; n5 V' b
- #define STATIC_SHIFT 3
. o7 L2 D5 R S6 |: f( J+ C( e - #define TCINTEN_SHIFT 20
" J! F( s+ s b - #define ITCINTEN_SHIFT 219 K! q1 j: U( h# ]
- #define TCCHEN_SHIFT 22) I. I: b9 z* s1 L4 F
- #define ITCCHEN_SHIFT 23
0 y9 S. u$ B1 m# f1 s
1 m& `, _' `* q+ T4 w1 A- static volatile int irqraised1 = 0;
2 A" X4 t! X% y. g" H - static volatile int irqraised2 = 0; F S; U$ C3 H* ~% a
# |% T, i% f/ ]/ \" e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 m! p5 }* R! \0 I, V, `6 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 y6 u7 p" C8 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' U. b* a9 P" g) h. ~+ |5 S
) H8 _1 z; Q; k4 o; W3 L- dma_addr_t dmaphyssrc1 = 0;' K: |, s( P7 ]3 o% M
- dma_addr_t dmaphyssrc2 = 0;
9 E, b( p2 d" j* H - dma_addr_t dmaphysdest1 = 0;( t3 M' i. M0 W$ S; A8 \9 T8 X
- dma_addr_t dmaphysdest2 = 0;
9 K/ Z2 Q" U7 N# [/ A
K% |3 c- X/ }) @9 c3 ~8 F$ ~- char *dmabufsrc1 = NULL;! K; F/ T* d& z& L3 G0 Z
- char *dmabufsrc2 = NULL;) j' y' M4 W, y- i8 m/ R- ^! n* r* \
- char *dmabufdest1 = NULL; B! Q: a( u, I& s4 o" c' i! {
- char *dmabufdest2 = NULL;2 h& u$ \+ N+ c9 U7 K$ F$ i
- - {- a+ a. _6 Q; E9 V# ~2 w
- static int acnt = 512;
* I2 M; q7 ]" k - static int bcnt = 8;
4 ^2 g" a( |% _) q - static int ccnt = 8;6 s3 B y% ?; ^) K
$ K' k. Q! u8 B$ E4 z- module_param(acnt, int, S_IRUGO);
H4 U8 ~$ h" h( T- w - module_param(bcnt, int, S_IRUGO);9 ]6 U) V! p& e9 D6 T0 Q
- module_param(ccnt, int, S_IRUGO);
复制代码 9 ^3 X1 C4 s& ?* j' }- |
1 M U' @( _2 y9 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 y7 d4 @' }+ u9 E' \4 G6 [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
~$ d9 W0 b4 F; ~5 V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 V* N- `6 y0 Z9 S
8 {% H b! s4 e7 g
) U8 Y- e" N4 p K: O+ h- h, U. F |
|