|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 U$ Q/ Q+ e7 }" A8 p6 c- [code]EDMA sample test application; t$ G6 e& Y% ?$ q
- /*6 r6 e: R! y& F5 q& r! c! |# L
- * edma_test.c2 i5 Q4 p& w: X9 X! T
- *
* R5 u" M2 I! g8 V' {, [$ n - * brief EDMA3 Test Application' o& L: o" o: _8 N
- *
! E4 b3 O: H# G; Q$ }1 K }7 R - * This file contains EDMA3 Test code.
; y7 c3 y, n+ d, M5 B9 s, J3 H - *
% e5 g* j, ]5 l) U' Z6 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! Z: y0 r$ z: q" q4 K! A5 @# M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% `) g+ m1 w% U7 s% M& P* f- b- V - * TO CHANGE.' d- F u' F; Y/ s6 |8 a4 k' A
- *
+ x3 W; B- f3 O( ~3 C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 K2 D- k* i9 U D( f - *
6 h1 D N% Y4 o7 f - * This program is free software; you can redistribute it and/or
* D' ^" i" U9 b9 K! `5 \) p - * modify it under the terms of the GNU General Public License as
+ S0 x! c$ V2 s* t1 M. E3 Q* F* ^) m - * published by the Free Software Foundation version 2." \' d; |5 Y! k1 D
- *- M) m! w/ S- }' G! L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 \9 R4 g9 f6 A. ~) W2 \) g
- * kind, whether express or implied; without even the implied warranty
0 q( L' @3 B. ~) B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 K X) z& V8 ?) g; n' e - * GNU General Public License for more details.4 G: e( V* x' f, e# r) n. n
- */4 m+ U% Z; ^7 k: B
- $ Q3 b) U `" f5 ^+ B
- #include <linux/module.h>5 T; S: Z0 [6 \, A% H
- #include <linux/init.h>
8 L8 \0 V1 R8 B* R - #include <linux/errno.h> n; A, O: l+ C6 @$ X% G
- #include <linux/types.h># ~# H1 Y$ z7 W/ N0 H% J
- #include <linux/interrupt.h>
( U2 h% u! @7 Y) Q! D7 D6 ` - #include <asm/io.h>
3 _3 g+ V6 j( G" | - #include <linux/moduleparam.h>
5 _; |1 g) _/ s: J/ W4 P2 R - #include <linux/sysctl.h>
4 P" S8 I- t1 u; n& J6 j5 M- d - #include <linux/mm.h>' B; ~0 Q* t* Y! {9 \- g
- #include <linux/dma-mapping.h>
0 x9 X; d5 c1 y4 h3 r% Y
0 i; o, u6 ]$ b- #include <mach/memory.h>2 ]0 u; Z( Z0 b
- #include <mach/hardware.h>
; _" G$ w8 g+ |0 o9 _ - #include <mach/irqs.h>
/ ]9 c z+ p* Y* g9 H. ?* K- Z- f - #include <asm/hardware/edma.h>+ R0 t$ m3 A4 q5 t, d
- + b4 {# u6 D, H/ F: E* f
- #undef EDMA3_DEBUG
2 D8 J( f: w! x - /*#define EDMA3_DEBUG*/
: S! O/ l+ ~ c& G
, X" M$ K: t _- #ifdef EDMA3_DEBUG
& a' j, W6 h# x/ w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 u* F) O& h/ k P* ~; x( E0 `1 P+ B1 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. y8 ]( n, e3 b5 _% M( v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 X! D6 L# y$ n w8 t- Z" ~' ?& h - #else) r, [2 L: A3 Q: b3 L
- #define DMA_PRINTK( x... ): B" q6 a; A5 x1 H4 I/ }. U2 l
- #define DMA_FN_IN: K# o+ u* ^0 z8 D9 i0 R- M
- #define DMA_FN_OUT+ m0 k( e4 W8 I& H) H+ L# b6 x
- #endif* o7 J/ R5 v7 c' |
0 O1 U! b/ e6 C: K8 t1 ~( N2 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768) s) @, Y2 q; e- k* `1 J% C$ o& b& w
- #define STATIC_SHIFT 36 \ @/ w+ y6 I3 M, c
- #define TCINTEN_SHIFT 20
4 c4 I9 e( p8 ~1 |% [ - #define ITCINTEN_SHIFT 215 c3 h# @" F" I) ^* X
- #define TCCHEN_SHIFT 22
" T4 k5 k6 ]$ E; [) D( w$ v - #define ITCCHEN_SHIFT 23; x& k& `; F" i
) V; b9 u2 [! l. h% X3 _- static volatile int irqraised1 = 0;
, _. }! Y: b5 L7 J& t - static volatile int irqraised2 = 0;
5 ~, r2 R, Z/ Z& v% R/ s1 h/ o
' C( h5 u* h# K( _- M2 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- M) G! D* R- a J7 X$ Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ X% {0 m9 Z' a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* v: m8 p' I- Z& f+ f% i& y - 9 f9 X) c3 T9 t% J7 ~! g! L( {2 D; O
- dma_addr_t dmaphyssrc1 = 0;
z: v0 |' F7 z% [* `5 ?2 j0 H: _+ g9 U - dma_addr_t dmaphyssrc2 = 0;
+ { G# F) S. p+ Q6 W0 q) h& Y - dma_addr_t dmaphysdest1 = 0;- N& c/ M: w4 W' c
- dma_addr_t dmaphysdest2 = 0;
5 Q2 A; ^5 i3 h0 z4 v2 x
" Y' l0 D3 [* h" G4 F- char *dmabufsrc1 = NULL;% Z- F3 j5 }8 \7 ?$ k% Z
- char *dmabufsrc2 = NULL;
8 v+ K9 h) Z- [% r+ q - char *dmabufdest1 = NULL;; a7 m0 S. U; h3 C$ y; ?
- char *dmabufdest2 = NULL;
& F: Z, Y# t% N, M; y7 @ - 4 y5 ^# S' f# T1 [, F
- static int acnt = 512;
5 P& ~* U) U+ T. J" H - static int bcnt = 8;
* p% b+ m0 ]- K; n+ H/ a6 ^( h7 Q) @ - static int ccnt = 8;
2 B1 V& T' t0 H1 ~1 s3 k - 0 {$ O* Z8 w/ _( {/ W2 \
- module_param(acnt, int, S_IRUGO);3 s% j) j3 C' z6 W |0 z5 M
- module_param(bcnt, int, S_IRUGO);
: R4 B l& R# e; ~. X. } - module_param(ccnt, int, S_IRUGO);
复制代码 8 A. w! { S e O$ N6 \! J8 h% r
2 j4 t! J5 u2 A) ]7 w! Q2 G+ N+ [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! N7 Q% T7 o/ Y0 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Y$ e1 A5 h3 q/ x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& s0 F! U5 ~9 B: L$ e5 x
7 N; G. [! \7 E1 \$ a) a
6 n4 d) i G+ D9 l8 R: Z4 ~, n |
|