|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 h; p' F% M9 V- @/ w- [code]EDMA sample test application/ ]/ E, C9 W Q0 v
- /*& o3 b- r" } K7 u" {' p
- * edma_test.c
) N8 J- Z# q9 H: m5 X% s - *
- G+ E" ]0 O; K1 S6 @) q - * brief EDMA3 Test Application
' n& |- R5 O, T/ h( C) R - *
; A! b4 s4 ~) T' O% ~. E3 f - * This file contains EDMA3 Test code.
+ }& U) d/ X- d& z$ P6 V! c/ U - *
* m+ F7 w' u# x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# G! n2 O' l0 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 v$ P. i/ H: U! ~0 R
- * TO CHANGE.4 K6 {% V, k( Y# e: \6 e6 @: e, f
- *& G; r+ Y1 O) @5 v8 p& v' c: `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! R& B8 `1 k6 z' R% v. c
- *$ Y2 ^, L( |* v
- * This program is free software; you can redistribute it and/or. y, ]9 S; X7 x% ?. D6 X
- * modify it under the terms of the GNU General Public License as+ s3 y- P2 d1 O2 L. k7 C
- * published by the Free Software Foundation version 2.: }* o+ h l1 z+ D1 o% ?9 S
- *
1 j% c# c$ s! H) J- A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 }; ]3 l K1 G u - * kind, whether express or implied; without even the implied warranty
. [1 n9 a6 E3 T, s( E/ f. s" `) I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' N8 W/ C% z0 s& g/ ]5 H' I$ J m' ] - * GNU General Public License for more details.
7 d- p, l; F4 B; Y6 g2 l - */8 H; X. x3 y) d& [; r8 ]" X
- ! \' D# D' P6 _ y( x
- #include <linux/module.h>
. C; X6 P2 x8 v3 Z& @ - #include <linux/init.h>
" ^+ W' o# y4 G& D! S' h: R, L - #include <linux/errno.h>% J( U5 l, Q7 \3 k. n. G) N
- #include <linux/types.h>9 x6 s6 J5 W( f7 a0 r. o& L' Y
- #include <linux/interrupt.h>5 ]9 J0 D: O$ P
- #include <asm/io.h>" B( O- Y8 j9 V( K7 y
- #include <linux/moduleparam.h>& n$ i3 v& p3 U" m
- #include <linux/sysctl.h>/ {1 J, P9 b1 y# r
- #include <linux/mm.h>
4 O% P9 L4 f5 O( `0 K. Y2 K3 \ - #include <linux/dma-mapping.h>
- n3 s- p9 {" {6 A1 m
8 o5 L% b7 q) c( x- #include <mach/memory.h>+ ]4 V& S9 s2 G" s5 E9 |3 Y# E
- #include <mach/hardware.h>
& H0 L) D6 Q0 \ - #include <mach/irqs.h>2 {, W: `6 m9 [6 h3 @
- #include <asm/hardware/edma.h>) Z. U& T, `, k; ^$ B) }1 q( c
- / y+ Z f& \, a# W
- #undef EDMA3_DEBUG
8 A0 }) n! m; j' k0 X - /*#define EDMA3_DEBUG*/! a6 y+ {) U' x6 k3 @; w& B9 a
- + Y, d% h; { i$ a# H0 C
- #ifdef EDMA3_DEBUG& Q% Z/ x/ @# B% T* F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 r. P1 d+ ~5 f( U4 K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 [1 S: P2 k% Y# A0 P/ V, L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), f) Q8 U$ b3 r$ B6 f6 W( N
- #else, B) `; c- h8 o: o8 h
- #define DMA_PRINTK( x... )
; J) T% L4 d7 t8 J - #define DMA_FN_IN
2 D- T6 _7 l* y( F - #define DMA_FN_OUT8 i0 A7 j7 U3 C. J
- #endif8 Z: M L' W' }2 }( i% c; ]; W( o3 _6 K
, e5 W8 N* V7 r) J% E4 S2 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# k# g& I6 c: Y' V9 t - #define STATIC_SHIFT 3
% H) A1 t+ a- A4 b3 x. k - #define TCINTEN_SHIFT 202 ^+ l( C; A6 j6 v
- #define ITCINTEN_SHIFT 21+ h% M2 V2 J' Z6 Q% c( N
- #define TCCHEN_SHIFT 22
4 @5 g, Z: }; F4 _6 u: o) K* C - #define ITCCHEN_SHIFT 232 L/ U2 o. ~' c d1 f2 }6 t4 s1 y
- 3 C1 |# L8 R d/ Y/ k' \
- static volatile int irqraised1 = 0;
5 X% u* `4 x, ^8 k/ z( W3 V - static volatile int irqraised2 = 0;
( u6 _! X' B1 e2 X2 Z' Y [
4 ?8 y6 H3 `* @* w+ g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( R5 K& T% a/ y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~; z _ u6 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ c9 B Y* ~/ P4 V
! f# w, E6 l' I3 O9 A- dma_addr_t dmaphyssrc1 = 0;" G3 c v( Y! D9 T2 G
- dma_addr_t dmaphyssrc2 = 0;& g& Q) f+ g$ i7 T0 g& o; \+ q) N
- dma_addr_t dmaphysdest1 = 0;, G' m+ c* b8 W3 B5 P% E# x
- dma_addr_t dmaphysdest2 = 0; J, K d( a1 q" h, G
- 5 A6 G7 l7 C) K4 ~$ u% c/ o7 n
- char *dmabufsrc1 = NULL;
/ o9 X; e! I c. c* P - char *dmabufsrc2 = NULL;
- y+ Q7 l0 S5 i0 ~4 x - char *dmabufdest1 = NULL;
2 M4 j4 e3 [& s' w. { - char *dmabufdest2 = NULL;/ H2 o6 ?" h' j
9 y3 R6 O& e% o' V- static int acnt = 512;
8 M: o ^6 @& O% d/ L - static int bcnt = 8;0 @9 k# v% |7 s. |! h3 U) u
- static int ccnt = 8;- s* U5 m- J* a p2 O
- ' Q8 P) X9 ~: `# P8 J
- module_param(acnt, int, S_IRUGO);. H$ I- k; c& x8 J8 o) K1 s4 G; E
- module_param(bcnt, int, S_IRUGO);
9 O# `' [6 F ]" w" Y - module_param(ccnt, int, S_IRUGO);
复制代码 2 T5 i; {6 |. f$ K& H
& F- I+ J" o' A" l I& J L3 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! @& O x" g1 F; h* c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: B3 ?+ Z7 i2 }. S& g& z, }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& M: D- M& U6 S; D/ w1 u' m
* s0 j: o& U2 U& H$ R" [
4 `4 ` R) s5 v, s, X9 z |
|