|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 ^ o" [# R" f/ b( S2 g
- [code]EDMA sample test application8 x8 T8 y- q7 j3 h$ m
- /*& K: x' i w- H: L' z7 G
- * edma_test.c9 H' v/ S/ r. `5 T5 j, c# f
- *+ W: B3 m6 F: v' s
- * brief EDMA3 Test Application6 T( L0 D T- g5 z
- *9 c" u% N, D/ O& [0 b/ `0 r7 m0 \5 ?: e
- * This file contains EDMA3 Test code.8 w! y5 k# h+ I5 l# P0 S0 ?
- *
% B& K0 u+ }" ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ e7 t8 Q5 I$ ]: }/ e, ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 u- H4 l# ^- z, p' `( Z - * TO CHANGE.8 p) W& m' s4 T3 R. u \" \
- *3 [+ Z6 P' |8 x7 A4 y% E% \' C" ~# u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- X% V+ ]! E: q( ?# C& f* x) M, c - *
. ?' n) n2 ` P: _( G$ Q - * This program is free software; you can redistribute it and/or
& ~# g: G5 u$ R$ n* q, p5 Z - * modify it under the terms of the GNU General Public License as
4 B- w4 C! A v3 z: [6 t* r - * published by the Free Software Foundation version 2.. w2 V# ]2 |8 y ]2 M# H' q' M
- *
5 H/ S( E) x E* G8 B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( b0 x1 p% h* l2 z+ d
- * kind, whether express or implied; without even the implied warranty/ P: i& Q6 K, x" n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; c" H9 G6 U, _& \ - * GNU General Public License for more details.7 l: L2 Y3 j! h/ j
- */7 x% d Y; j. \/ N2 [
6 J& m' i% m7 y0 W- #include <linux/module.h>' x# q9 H; c0 O3 ]: P2 c
- #include <linux/init.h>6 u( w# X1 W" s) B4 K ~
- #include <linux/errno.h>
5 G* g( `, f) z. k a - #include <linux/types.h>
4 t a4 J9 V, ^8 Z' o' ^ - #include <linux/interrupt.h>5 p) r; Q! ], G: p4 Y
- #include <asm/io.h>
/ l. w* L6 M0 N; d - #include <linux/moduleparam.h>
% F# P. S! X8 ^ o" r - #include <linux/sysctl.h>
0 p" R$ x1 y- k s- v - #include <linux/mm.h>- u2 T/ B# ]$ Z
- #include <linux/dma-mapping.h>
- ~' w+ l& B9 K
, M4 w& ~7 B+ }6 s- s' X- #include <mach/memory.h>
3 t. a* s2 v" ^- h: L; ~ - #include <mach/hardware.h>0 p$ ^+ b* O& Y( k
- #include <mach/irqs.h>
4 U& G! Y: r# U, N - #include <asm/hardware/edma.h>
% Z4 M' X; [. x) N& n8 ? - $ J. q) }, l9 }, z& C; n" H# a
- #undef EDMA3_DEBUG
$ z6 K% W: C9 m9 e - /*#define EDMA3_DEBUG*/
+ d& ?& p- Z5 S8 Z3 p - ( x% o3 q7 A e6 F
- #ifdef EDMA3_DEBUG
* P+ f1 E5 P' B5 ]0 ?7 U e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: R- Z$ N. q% b4 ]5 X( Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* [% @! j' e' r' k4 \7 Z5 G2 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) i- k# c1 M* N. e0 B - #else
) b# F& }( t# a( e$ M$ F. N" O - #define DMA_PRINTK( x... )
+ F+ g+ t; E) T3 f - #define DMA_FN_IN% u( e: e* g6 G; e7 |3 w; d- L
- #define DMA_FN_OUT
, J4 B1 f8 w) W/ f( m - #endif
, }" z- M. W" ~* E, [ - " H9 ~/ l# P; P6 j% z, k5 h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& O9 p4 I0 S! ~( Y8 ^ - #define STATIC_SHIFT 3
& Q. Z1 P7 I3 h; u! ? - #define TCINTEN_SHIFT 20
0 ]- b# _; h% j3 x - #define ITCINTEN_SHIFT 21/ k: o& }. T* l
- #define TCCHEN_SHIFT 22
# ^5 \- k8 a! G& s7 K - #define ITCCHEN_SHIFT 23
& i5 G" u3 f) A
/ O5 w0 R6 [+ t% V4 ~# l* Q5 K- static volatile int irqraised1 = 0;
D- U- c, j" ] E" [4 G* e - static volatile int irqraised2 = 0;
4 s5 a9 _7 d6 ~; x1 C7 k i
! r6 \9 z1 h) }6 `8 t1 }1 X# w9 R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: R1 ]1 x& _3 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 T+ b2 K+ Q: J: t1 ~; t9 P2 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 l z$ M- K' g, V6 K
5 c5 e% r. D+ R6 \, N; Y* c! p- dma_addr_t dmaphyssrc1 = 0;
2 \9 R. G) z% d! N2 K- }- H4 Q2 C - dma_addr_t dmaphyssrc2 = 0;
- W7 P7 C, ?- I- V. j - dma_addr_t dmaphysdest1 = 0;$ N. H9 n9 A. e0 I
- dma_addr_t dmaphysdest2 = 0;
5 { h& a+ L5 o- h/ i/ T - / P/ x9 K; ^% P- y0 J. v) t
- char *dmabufsrc1 = NULL;- T A' Q" T- Q2 d& m
- char *dmabufsrc2 = NULL;
3 l; S% s _* Q - char *dmabufdest1 = NULL;5 f/ E* O$ ~. }& B9 p* X s, |: Z
- char *dmabufdest2 = NULL;
1 O0 N! F. A& s+ U! g3 h8 `4 s
+ k8 H2 F1 Z/ }3 F% c! u- static int acnt = 512;9 F$ z# C+ e& [. u
- static int bcnt = 8;
6 E5 |3 o$ [# H% d/ z) W - static int ccnt = 8;
& h1 A: H! p9 r5 J1 O" z, \
' g; D, @# O) G) b/ ~- module_param(acnt, int, S_IRUGO);
( r* f8 U6 |5 R - module_param(bcnt, int, S_IRUGO);. C/ Z# a. i# u
- module_param(ccnt, int, S_IRUGO);
复制代码
4 U5 C5 x1 e5 Q5 J5 w* Q0 R9 Q& P6 r5 z Q a) A9 L& N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: r; M$ h: q$ s) \' q4 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 E/ V+ T& N+ h1 S% A7 Z- \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 N; e+ H; R p, m+ u3 c
2 r6 u- G$ d9 N; v! p' J; P
) b( L3 r2 l/ ~: Z5 p
|
|