|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 z$ e3 }, [7 G6 d3 _0 R; f7 ?
- [code]EDMA sample test application8 _' K9 i* u3 d0 V2 B+ M
- /*/ B7 t5 Z F) T/ ~( s4 k
- * edma_test.c
3 q0 E& J, ?+ r - *
% d: Z9 h$ O$ _! ]4 O% p - * brief EDMA3 Test Application( q. `; ?, e# c; K3 K/ r. Z$ X
- *
. B- C& [1 u2 R5 d) j, w - * This file contains EDMA3 Test code.
) H0 x Z) k3 C5 C( J. b - *
) y% ~1 `2 B7 h6 p7 W, c3 O2 v7 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. Z) S' T! J% [( O5 s- ~1 L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 d* j2 T4 X) `+ p( l% ~
- * TO CHANGE.
" d" ^# p9 G$ y" w5 u - *
5 m/ s, R" m6 N& I% K- z3 I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' \+ K, _" A3 @0 v- e8 z y/ x
- *1 ?6 p: I) H0 c7 W0 P7 x# l+ R
- * This program is free software; you can redistribute it and/or
" g( G3 B# h8 t3 P7 \ - * modify it under the terms of the GNU General Public License as3 r; e' f; [, e) o+ K
- * published by the Free Software Foundation version 2.
+ `7 J" \6 B- S - *
' X# o0 w! `* M1 b7 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: m3 @6 A+ G; C! r+ A" e4 u) P: o% | - * kind, whether express or implied; without even the implied warranty9 d; J' C( k0 n3 s2 w; x$ }; }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 V9 m' Y: ?! [, G% j! G - * GNU General Public License for more details.
; l) K3 |+ f$ W! s6 K1 g3 J( Z! q - */8 l' `2 M% G# U
! S% W' q' }3 W; B! v ?& ]2 a" |- #include <linux/module.h>8 b9 x4 W4 A# v2 J- O0 I3 t* l
- #include <linux/init.h>
1 u: u6 G) x* \) X, q. S - #include <linux/errno.h>, M5 Z/ ~: L( {" _
- #include <linux/types.h># O+ I- c- {! e
- #include <linux/interrupt.h>
+ A% J0 O5 @5 k M+ B7 {% h - #include <asm/io.h>% j7 P6 h" b# f: Y: b1 B6 I
- #include <linux/moduleparam.h>$ [7 V+ w$ U' }) `6 M
- #include <linux/sysctl.h>& F$ o- h9 L6 ?
- #include <linux/mm.h>+ @; @1 Z [9 {# V9 w
- #include <linux/dma-mapping.h>% B% U w- ]; e7 B1 l
) {8 \% ~) B/ a T) }- #include <mach/memory.h>
) I6 h& f. d9 u, P7 D/ o - #include <mach/hardware.h>
0 [& E5 N3 B) y' M - #include <mach/irqs.h>9 ~4 e6 k0 Y+ \* _
- #include <asm/hardware/edma.h>$ e# p7 W4 P h E
/ w. }% ~ D. i& h4 N: l- #undef EDMA3_DEBUG# h, c0 d7 O8 E6 Z
- /*#define EDMA3_DEBUG*/
. p t5 G, z L) |% J/ G
) W. @6 Z* r; L1 E1 n. O- #ifdef EDMA3_DEBUG
! k; Q. R$ x) \' v U6 Z% b" S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( e0 {8 S$ d3 Z8 K3 t- R4 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ l- U% F7 s0 T% j7 n9 `% `3 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. y, q2 J1 D7 v3 I! L# Q9 {6 J - #else
1 b. c# p* {& [ - #define DMA_PRINTK( x... )& L7 g" [7 `- c" S
- #define DMA_FN_IN
* |3 I X. \; ~* t - #define DMA_FN_OUT2 |4 f% o& l0 q
- #endif
& o3 s2 C6 _% O* W9 T* V* U9 G& c; _ - w* V9 c; U2 @0 a# V' n+ Y6 {" F- A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- h; i2 z- ^& ^6 c; I* [' d/ l! A - #define STATIC_SHIFT 3
1 j# V$ G8 C$ Q( p4 b - #define TCINTEN_SHIFT 20
- E0 n; A R7 w7 o6 y - #define ITCINTEN_SHIFT 21
# R, l0 K. f1 B6 z1 Y - #define TCCHEN_SHIFT 227 C+ k) C2 m; N! D
- #define ITCCHEN_SHIFT 23
9 h, j9 [3 E, i% {. I% x( l
; r: X7 m+ T; y- static volatile int irqraised1 = 0;8 [3 E! R3 [! ]+ Z5 o
- static volatile int irqraised2 = 0;
. S1 i0 I5 F; _) h) W+ D - * T; m# w' V" w% g4 Z; N: v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 S0 l. \6 ^8 j$ A! ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* x9 w" C1 f$ [- q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 _7 m t8 a" G [/ C, g6 l
& _, [: W& O4 T B7 u' l" E0 o. l; C- dma_addr_t dmaphyssrc1 = 0;' R% i/ n0 E; O, g( w1 e
- dma_addr_t dmaphyssrc2 = 0;
% J/ v, m( r8 j$ A y* b - dma_addr_t dmaphysdest1 = 0;
6 B* g7 f7 \4 k' g. T - dma_addr_t dmaphysdest2 = 0;
" } q% K9 v3 W9 y$ T. G - 2 X8 K, O- g& n* n5 Q% V% ^: ~
- char *dmabufsrc1 = NULL;
( n2 e, H) M; i6 d7 v% b( W - char *dmabufsrc2 = NULL;% _9 [; \8 ?4 O4 ?* j" [
- char *dmabufdest1 = NULL;
# Q# a" I5 \" e8 S - char *dmabufdest2 = NULL; I) n2 T3 X3 n, Z ^1 e" b
- 7 k9 I7 J) u" @6 g, } `2 `3 ~1 S
- static int acnt = 512;0 M! m( c& L+ v# |" x7 u
- static int bcnt = 8;
+ y+ X* K$ v! @ - static int ccnt = 8;
7 Y5 H) B. |2 n' D - ( L/ k( w% u6 d; L7 ?
- module_param(acnt, int, S_IRUGO);2 [: X; X7 C( S, x: @% ?2 `
- module_param(bcnt, int, S_IRUGO);( D% |2 ^+ D5 h+ ~2 _8 p9 S
- module_param(ccnt, int, S_IRUGO);
复制代码
; E& V" T; f9 L1 q" ~2 P
* k% k* P {# I" S: P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* J. i9 M( T( }+ x( g/ a, f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% a, y$ y v% f6 W2 r" V1 g. P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 t2 _* l1 o1 ?/ H
9 I# ~5 u7 U' g% m/ H+ x V! G1 P1 H8 |" z) L, L! `
|
|