|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 @! J8 ?6 z! Y( `+ ?
- [code]EDMA sample test application: f0 g1 V/ Y; w9 l p) k
- /*
6 l7 }' ]! y) G' u5 V; e3 |( B - * edma_test.c
5 h% y. K+ a6 E) y. q- [ - *
% ?; e( K3 k" H2 ?# [) q9 m+ s - * brief EDMA3 Test Application
, \; S2 P9 _# ~- V+ P# v% p - *
( i0 A3 X5 J! s0 ]2 p; Q5 J% ] - * This file contains EDMA3 Test code.
1 n8 \, H) f1 ?4 j3 |6 H) R - *
[/ I: N. E# q% x6 Y3 c5 Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" W. |) G' I2 l! h3 \$ k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! h. a. v3 L( \! C; Q; `1 R4 M - * TO CHANGE.
! W! w( R) E+ `4 J7 m) J Q% |! s - *5 E8 Q) H( R* O. p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! h' l; q. h" ?. q; J
- *
" @" _( A6 f5 d9 T& z2 w, d4 J - * This program is free software; you can redistribute it and/or6 }, _1 w1 i# f& ~& [% @; d
- * modify it under the terms of the GNU General Public License as" m- N# e$ s9 H
- * published by the Free Software Foundation version 2.3 t A+ z$ v; j5 H- N
- *9 V [6 a4 a8 j" j4 P' R, M! @2 H# E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: }+ e3 t" T9 d; K; | - * kind, whether express or implied; without even the implied warranty
* H+ W5 e5 O! \, _" M5 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, w1 O4 p* K4 m
- * GNU General Public License for more details.! q$ s0 K# p1 x0 h
- */
3 L0 K; n- X: l0 [8 E
1 k$ a7 ~; @/ x- #include <linux/module.h>
2 k0 N% }1 G8 g* m - #include <linux/init.h>! }8 y0 U) j1 j
- #include <linux/errno.h>6 G0 Q7 J% l: P% I1 Q
- #include <linux/types.h>
' D0 e3 R( L: m/ I - #include <linux/interrupt.h>; ~: \. @( V M5 l' D$ d
- #include <asm/io.h>4 L% b2 @5 }$ a- E* U$ i
- #include <linux/moduleparam.h>& l2 z2 [! x+ L& \
- #include <linux/sysctl.h># ^$ e* V& W. S! N5 o$ F% }% n
- #include <linux/mm.h>9 X) y4 P+ ^9 e# o9 u7 Y' d2 W
- #include <linux/dma-mapping.h>
' O) ^9 w3 c+ r - . ^6 |6 c* S0 i6 U2 S6 W
- #include <mach/memory.h>
@9 h0 {, y5 f$ Q4 n6 `; y, s - #include <mach/hardware.h>% `; [1 V% J* z8 E* k/ a P2 [
- #include <mach/irqs.h>. N" F" g- k! Y
- #include <asm/hardware/edma.h>
) O$ d$ ^7 o" B/ `1 a - : N3 T# y6 [ h$ m U+ P# N9 r
- #undef EDMA3_DEBUG6 L" @8 J5 }) B& O
- /*#define EDMA3_DEBUG*/
) f7 B* j/ l' m4 D, ^) U
& J* \6 b7 V, u. k% x+ X" h- #ifdef EDMA3_DEBUG* {% f s4 L7 N1 a6 j0 ]* M) C) p0 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 z/ b9 |! h0 i4 m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% G- g4 o2 u: ~6 [. F, m, O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 [7 N# A' v- p0 U5 m0 w, D3 H! N - #else
/ U. I, t$ V$ c7 r+ y) X% V - #define DMA_PRINTK( x... )3 K; D* T2 v& N5 B: X
- #define DMA_FN_IN
1 C$ n6 q9 j: S& D# q0 o - #define DMA_FN_OUT
) l+ Z# |4 v7 D/ L f - #endif1 E0 V! ^' K+ n7 S- q ~
- : r$ ?9 W1 L) i) Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 A1 Z6 A% V# S8 w - #define STATIC_SHIFT 37 {5 w( {: e; o
- #define TCINTEN_SHIFT 20' v" B3 P# w2 z3 {( ^% X5 a4 O
- #define ITCINTEN_SHIFT 21
& a8 \/ P7 z' C1 I- }& l - #define TCCHEN_SHIFT 22
! [. D9 @+ }9 Z* i - #define ITCCHEN_SHIFT 23
- U0 f( k6 Q9 P
5 L- J; T! V0 o T" [- Y- static volatile int irqraised1 = 0;
7 Z5 x+ P7 ?; F- P - static volatile int irqraised2 = 0;
* I" G) @) G) |- @! Y1 z6 ~
0 {4 [& u% V6 ^9 }1 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( C$ s. x& _3 `3 s6 J% S, L/ I( t! J4 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ J1 u/ z1 x: a- V* \( T/ v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. n" S" H0 |3 D9 G8 s5 Q
0 P2 |4 F9 U6 Z3 _5 ^- dma_addr_t dmaphyssrc1 = 0;
; j, ?7 `8 I$ ? - dma_addr_t dmaphyssrc2 = 0;
( ], p/ r1 i/ d7 s- f8 K* x1 l - dma_addr_t dmaphysdest1 = 0;# |5 e5 p: X; a: a% x
- dma_addr_t dmaphysdest2 = 0;4 n3 O! J0 U9 S- g6 e+ T( [1 o
- # { O# i8 N* j( b9 Z& |
- char *dmabufsrc1 = NULL;
% q/ |' Q5 N1 d3 Q# e$ S - char *dmabufsrc2 = NULL;9 v1 u% n6 U1 [
- char *dmabufdest1 = NULL;& T1 m8 ^! ~# t2 A
- char *dmabufdest2 = NULL;
! Y- s3 a& X" u
- K" v+ S! p* m0 j! T- static int acnt = 512;
- j. K! C( U5 ^2 q7 A - static int bcnt = 8;
" q& _! W# d# e - static int ccnt = 8;! @; i; E: Z1 @: O& f
- % N) y1 e. l# \4 b% B
- module_param(acnt, int, S_IRUGO);! ]6 N5 T0 v& `! A9 b( b
- module_param(bcnt, int, S_IRUGO);3 V3 Y% t7 U8 W) g
- module_param(ccnt, int, S_IRUGO);
复制代码 % Y/ }! _: K; Q% ^; X
/ t9 E$ k/ X) X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 x5 U1 ?1 V, e5 X, ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! v& E6 A+ v: M) x- W8 y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 A ?( G5 C/ e# Z9 V, h# p' d9 N
! R; z! A2 _5 y, z4 h( O1 ?$ ^# s9 d. M1 L$ ~8 f$ ^2 Y, ]( T" P$ `
|
|