|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 Z3 S. y9 J; [8 W$ H
- [code]EDMA sample test application+ J% J& X9 z2 a- N, P, f* ?
- /*+ I7 x+ K, s( t# L& o/ w6 m
- * edma_test.c
" ~0 i$ @/ f$ h8 r/ k. \; g0 ^ - *" y, {! ~, I* [! [
- * brief EDMA3 Test Application
# \4 u8 r, V _) x5 g - *
3 ?( ~5 s" w7 \ - * This file contains EDMA3 Test code.
0 ]$ o, R' Y1 v2 ]# n x$ r" G - *
. M5 \/ k: Q5 n( r. l/ K# X2 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 a; Z) B: q, z) a; e! m1 S8 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. X8 j5 {( X. H$ N3 j# a& W
- * TO CHANGE.
2 ~1 c. g _/ Y' d( k4 H! h# Y - * b: y" p+ u- N b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# Z, R" ?. m: f# Y4 }9 W) q - *
6 p' H2 j; R ?8 e L# h - * This program is free software; you can redistribute it and/or7 ~9 t0 t6 q$ H/ h
- * modify it under the terms of the GNU General Public License as% l2 n5 d/ i: o: `( ]
- * published by the Free Software Foundation version 2.
/ T4 M- v$ U/ Z( I1 z - *
, r; `: h# l" i W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 A3 m6 u2 H" X0 {( N - * kind, whether express or implied; without even the implied warranty
* l. X1 C5 a; C5 x1 D" l* n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 _: Q: n2 w, d6 M8 q5 {2 d/ p
- * GNU General Public License for more details.
) j+ c( |1 q' u" W$ n9 H% W4 z - */
4 b2 D- K4 W+ g5 |8 Y6 X, O: p - # A. E$ g2 ~+ V
- #include <linux/module.h>( ?0 y# m8 W5 ?: h1 P
- #include <linux/init.h>
3 J% B% F4 j+ U( P% N0 x* v - #include <linux/errno.h>
! R; {4 b/ O! \5 K* q - #include <linux/types.h>
! y' S8 N6 g* Y" |/ a6 O5 g. V - #include <linux/interrupt.h>- h- n8 w. ~0 y1 e4 c+ g I
- #include <asm/io.h>
J( _3 O) z0 W: j7 b - #include <linux/moduleparam.h>/ R& D( [& Y! U. k
- #include <linux/sysctl.h>1 F; G6 @" _1 t* g9 U
- #include <linux/mm.h>
3 s- j. E, x7 {7 M" |; V; R - #include <linux/dma-mapping.h>
# I* z6 d. f& w6 P4 _& S, R- r9 Y - # C+ L0 u; b8 i2 T
- #include <mach/memory.h>
) s: I% i/ O6 X* J4 F$ [ - #include <mach/hardware.h>5 u7 y; k; u( t- I
- #include <mach/irqs.h>
' S) j1 Z0 x$ U) I9 u4 @ - #include <asm/hardware/edma.h>! h- A* k! q6 v3 V8 \
- # y6 Z! p' p- O) {
- #undef EDMA3_DEBUG+ [3 H1 l$ b3 F* @
- /*#define EDMA3_DEBUG*/
, J. J/ y! L# x* u$ ~0 y - 5 {5 T( {5 |( r; e+ T% E
- #ifdef EDMA3_DEBUG
3 o- e* R- R, |: \ t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 G; I: _; T* A+ |/ v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* f2 N h1 e* g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
~& o; c v) M! @7 L2 f - #else
; O1 q/ I+ ?- a' L - #define DMA_PRINTK( x... )
9 R4 C1 Z) E8 c - #define DMA_FN_IN
^% N+ c4 B: z7 Z& O5 P3 u2 B& u+ g - #define DMA_FN_OUT3 |2 @5 I! s. J, ]; g) M
- #endif( r3 y) f' U, b4 G
! S0 O4 X$ O. ]1 X7 k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ @4 {, k+ E- i) c6 r! x: J
- #define STATIC_SHIFT 3
3 j3 e& y# ^3 ^5 f: P& p - #define TCINTEN_SHIFT 200 S, G8 ?& O/ L7 J! E7 w$ v+ o* d
- #define ITCINTEN_SHIFT 21
! C: r6 e- }- W$ R. ? - #define TCCHEN_SHIFT 225 E4 b7 t/ I# z9 R
- #define ITCCHEN_SHIFT 23# T4 W& M& I) V
) W7 _4 s& f5 B- static volatile int irqraised1 = 0;
- n3 y/ z# H2 ]- _# s5 R - static volatile int irqraised2 = 0;8 C# [0 y {$ O# x8 o: Q' _
8 F- \5 s, ~& J( H: F: V7 e% y1 O6 k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 T7 F! \) i4 A9 x2 O8 ~/ f1 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 _, \/ `+ L# K) W, o, ~" g) v# p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 P2 V2 i: p4 A( y) O2 l
0 z& c0 b% }2 F; a- dma_addr_t dmaphyssrc1 = 0;. ^! h6 K# d; F9 n
- dma_addr_t dmaphyssrc2 = 0;" @4 T" H; p( H8 M
- dma_addr_t dmaphysdest1 = 0;% a% F0 n0 g4 O9 @
- dma_addr_t dmaphysdest2 = 0;- K8 ^ m( }, i, x
% i$ n/ \$ S& A/ L- char *dmabufsrc1 = NULL;
4 O! G( W2 D1 K, Z2 J# D9 r: t- ^- Y - char *dmabufsrc2 = NULL;3 i" J3 x9 A# I [, ^6 s
- char *dmabufdest1 = NULL;
: N" H) y. i0 q- P% W - char *dmabufdest2 = NULL;. v7 C# |6 y; l% m M: E3 T0 r+ X* b
- + k8 W7 n5 j. E9 I' T) U- t6 h/ N
- static int acnt = 512;
$ x8 ]3 \0 A! U - static int bcnt = 8;! ] d! a( l, q( n Z
- static int ccnt = 8;
3 i1 {! c: I* M% `6 J
, ]7 a) |1 y4 P, l9 m+ L" E) l- module_param(acnt, int, S_IRUGO);1 Y" k, U6 w: f3 K5 X
- module_param(bcnt, int, S_IRUGO);
* ~2 Q& J( R& u" S - module_param(ccnt, int, S_IRUGO);
复制代码
) H* r3 G7 ^1 g7 c+ O9 B1 \: Q6 I; e8 m5 Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 [" [9 f% o" |7 g, _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* s7 n* F. o' Z) ]! @6 U, p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. X! u" G1 [1 C7 V& H
( N6 M. @3 J8 ?4 }: d/ e. l7 m+ U5 S& W% Z2 X
|
|