|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% S7 y3 b+ U. C H! `- [code]EDMA sample test application. P7 ?4 N1 `/ k
- /*" L7 r" {$ {9 r
- * edma_test.c; P0 y3 `, q6 U9 C; T, t
- *
: Y) E% ]& n% S# [ - * brief EDMA3 Test Application9 j; f# f5 {! v2 z
- *" u" i4 V6 u) L9 K
- * This file contains EDMA3 Test code.
% R+ R- X. L! @4 t5 g5 z. F+ o9 q - *
( ^8 M: H* ~- z# U/ F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. g$ o7 `5 Q/ r- W! ~0 q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# p8 z" l; x' k8 U# [' J
- * TO CHANGE.! }! @; {& h6 q% [, a
- *0 e* |1 `: w# a' B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// M7 T. a4 H' K
- *
! b6 n) R$ u) ^3 [/ R1 R- Q# m - * This program is free software; you can redistribute it and/or
5 i$ l8 H+ z7 @' V3 H' |$ D& K - * modify it under the terms of the GNU General Public License as/ O& H5 Z; {; G9 z, w- u; Z+ U
- * published by the Free Software Foundation version 2.8 w# s. b1 b! B/ k
- *
/ Q( S. C% h" U) H' s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 S8 o6 r4 b; V# s4 h# U# ]
- * kind, whether express or implied; without even the implied warranty1 Q. Z& B, g5 G3 L' i( p& k7 U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- q2 L6 M& ^5 N' u" o) C) a - * GNU General Public License for more details.
8 |' m/ v5 r" ]* c' X5 D' [7 s - */
4 Q1 q8 [/ o/ j6 t x7 x3 J( E
+ {& k1 ~1 X8 t2 T7 g) M5 O- #include <linux/module.h>) r N5 D! a4 ~) X! R3 d
- #include <linux/init.h>% z0 f7 V; K4 z5 {) i! t$ E
- #include <linux/errno.h>
! j6 C/ ^( ~! v' @6 K - #include <linux/types.h>0 M' T3 X: H% p% a
- #include <linux/interrupt.h>
' o- ^6 G' B, m: R4 G - #include <asm/io.h>
' C) q G, `" \ - #include <linux/moduleparam.h>
! E! d5 }3 u A% R" j3 h0 ` - #include <linux/sysctl.h>
# u: e2 O1 L9 t+ R8 f: s - #include <linux/mm.h>. g) O9 _! f6 S) E
- #include <linux/dma-mapping.h>
4 P) J/ v9 S7 b6 [3 d - , Y3 @; _' t5 G! B! C
- #include <mach/memory.h>
. M/ b; _3 F5 ]6 p6 Q - #include <mach/hardware.h>
4 P- Y& @# \& N6 ? - #include <mach/irqs.h>* ]7 D* I3 X8 g" ~0 u0 F, h
- #include <asm/hardware/edma.h>" {) K6 `: }; R1 ?! J. R
; ?4 R0 p% \9 c2 M- #undef EDMA3_DEBUG
) V; q% X3 }4 ]" m% A" V& t - /*#define EDMA3_DEBUG*/! L7 ?6 c0 w& P
+ p A! R- E- q+ b- r- #ifdef EDMA3_DEBUG
# b0 \2 F9 W0 v1 i0 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); I( B% t3 |0 X$ n" r& X4 V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: |. s/ w6 x2 k% t/ i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# }; i; D0 b3 T+ W, Y4 ] - #else6 D* J. X1 r, V6 @# G
- #define DMA_PRINTK( x... )
1 x- ]& X) J+ u& v9 _9 u - #define DMA_FN_IN6 E4 q' U" x4 l5 r
- #define DMA_FN_OUT
6 o/ ^! x! U* c' { - #endif* f1 ]- U4 d& D( b
% D7 e' R1 b: T- T: X7 d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 j0 L% n9 H* ~- w
- #define STATIC_SHIFT 3$ g% b2 U4 P3 c2 c7 S0 ?9 _% O" h
- #define TCINTEN_SHIFT 20
: h' b" d) B2 U4 ]/ `1 k4 H - #define ITCINTEN_SHIFT 21
0 O) j7 \- R. w A - #define TCCHEN_SHIFT 22
# N8 U1 U4 u) K/ `+ z - #define ITCCHEN_SHIFT 23
9 \* ? x" n' e! b) Y
6 L2 Z) \- J. ~; Y$ h- static volatile int irqraised1 = 0;3 X& N" m. L& I
- static volatile int irqraised2 = 0;
/ |& h1 F3 ^* h2 a5 M. s2 q - " h& Y% A6 U1 j0 h* ]! V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* v- Y. V$ B' R/ @) y7 @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- \/ {6 ` r. r& @, r% g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ t1 }) X! _, i
% w, [/ O( o& l- dma_addr_t dmaphyssrc1 = 0;
( w5 g5 ^3 z* A' d, @# j' W, M y - dma_addr_t dmaphyssrc2 = 0;1 i& z4 l. J$ t! ~
- dma_addr_t dmaphysdest1 = 0;/ Y' s2 S4 v7 w+ F- e$ ^% j: o
- dma_addr_t dmaphysdest2 = 0;
/ J2 J, m' W" P% s: d: j - 5 s# C6 o& j' r1 s
- char *dmabufsrc1 = NULL;5 t: Y4 R5 l. k) L8 d: G$ ~, H& Q
- char *dmabufsrc2 = NULL;
$ ~7 p S3 e9 @- ]6 G' f - char *dmabufdest1 = NULL;
( k9 f. w- T4 I6 v - char *dmabufdest2 = NULL;
0 a: ~$ }1 U/ Z: T" K' X
, m% b( r* d7 R: {- static int acnt = 512;' f9 r. q0 M2 P3 g
- static int bcnt = 8;
/ U3 X( [6 F& F) k - static int ccnt = 8;
- M! p6 j- J" j+ n& u - * ]' W; S2 l0 z+ Z
- module_param(acnt, int, S_IRUGO);7 R# s. Y! M6 y1 v8 d1 Y
- module_param(bcnt, int, S_IRUGO);
4 w: C0 A* W6 H$ E5 ^: ]! W - module_param(ccnt, int, S_IRUGO);
复制代码 ! m8 V( {6 O. ^) h: [/ o
: N e1 @. K' P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, B5 J9 R$ o' }$ Y5 E8 W2 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ U- h: |: Q6 Y7 X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 h$ l: N: d; h# Z- T
. ?$ R* D& q" o2 ^- R# g" ~4 v! }/ J6 @
|
|