|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" n) F* L% G( w7 N3 T. ^5 w- [code]EDMA sample test application6 S4 W2 c) L, z( H* m% r# r
- /*
: Q" o Q* O8 d" R9 V& E5 f - * edma_test.c
$ B+ t" d w! i) z$ T; z - *
+ P" K/ b: x& v/ |; p - * brief EDMA3 Test Application
2 u. o. ?6 t5 n/ ~ - *
3 A5 ]5 w8 c3 p. O. d+ n( Y - * This file contains EDMA3 Test code.
- S! J3 u& X# M - *0 {- i4 p& b$ E4 r% Q: m5 C, j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 [* y l# K* |5 @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ?( H6 ^/ n& }5 f. i# B
- * TO CHANGE.. Q: l6 F3 A# Y1 P3 i& c
- *
! t) g+ k( Y9 @; F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ h0 s! Y& p: ]% b; ?
- *
) T& D5 K8 }. n {: k - * This program is free software; you can redistribute it and/or. J) d) ]: [" t- I; [
- * modify it under the terms of the GNU General Public License as
- N7 B3 J+ `4 z0 R9 f - * published by the Free Software Foundation version 2.
! I4 t5 ^- n+ v - *
! v4 u3 _! F* H; u! T3 f, x! G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 c9 u1 p, g5 `3 `! @$ a
- * kind, whether express or implied; without even the implied warranty
) }: ? F# K3 ^" i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ F% o1 \ I3 }0 v$ P" S2 q
- * GNU General Public License for more details.
3 h. [7 ~& k' j# S) \) r - */2 `+ M B; m) @- [
- 6 N2 ~( |; b) u4 R; M2 g
- #include <linux/module.h>
* [( \" b0 `" o- u - #include <linux/init.h>2 k4 d9 K* e) T9 Q& v [( l ]
- #include <linux/errno.h>
& {; L5 Q7 P/ l: Y1 ^ - #include <linux/types.h>
7 E/ r6 I0 l. _$ \' w6 L4 ?0 m2 ? - #include <linux/interrupt.h>
9 l2 Q& C( w0 |. x" |" D% N) n2 L8 K - #include <asm/io.h>8 r- `, V% g ~0 O* j0 S& R2 s
- #include <linux/moduleparam.h>
- I: T ~/ l$ u' @ - #include <linux/sysctl.h>$ _( h: h* V9 E4 H% _
- #include <linux/mm.h>: }& S* }% t4 d+ r1 O3 }% z0 X! j
- #include <linux/dma-mapping.h>& {. L8 _. v/ D2 r# D
- 6 @; S" f/ n* p& m0 P4 B5 K4 y
- #include <mach/memory.h>, k* F& Y2 J$ P0 H& c" ^
- #include <mach/hardware.h>6 z F7 T1 q1 H7 n9 k
- #include <mach/irqs.h>
O7 j7 h4 f, v- e) ]+ K" H7 g - #include <asm/hardware/edma.h>
6 ^: r; z! h2 Z0 C+ {3 Y4 P - * a* ~$ z& R5 @5 g* z
- #undef EDMA3_DEBUG
* J/ ]( O: O, {; f - /*#define EDMA3_DEBUG*/
9 |# B. j3 J R" U! b Y2 e+ f1 K
5 b8 l+ k. D, Y9 Y- {' P' o- #ifdef EDMA3_DEBUG9 P1 i Q+ I ^& E0 a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: A, w2 _) h% f3 Z% D9 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) m1 s& ~" t+ Y: S0 W8 u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 o3 Y) R7 A( h; ]! a" C" E Q8 h - #else
+ x8 ?) y: ~5 v8 R2 C - #define DMA_PRINTK( x... ): H' V6 ~: v' ?$ T" f2 v0 d0 ?, N
- #define DMA_FN_IN
+ @3 t- ^: }; d! b( h8 \ - #define DMA_FN_OUT
& Q: L. {! }) c* P m - #endif
% T. b3 G! Y1 r( C0 Y
6 S3 f2 J# q' o4 m# l$ ~; Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! s5 X0 Z8 C! a' I) [+ |4 F
- #define STATIC_SHIFT 32 e7 a3 K! Y1 \% m$ N6 H
- #define TCINTEN_SHIFT 20
* c/ l, n) k+ z8 ^4 U5 E - #define ITCINTEN_SHIFT 212 e+ _( c* k2 u+ z+ Y; t
- #define TCCHEN_SHIFT 22
0 ~. e+ H+ t" Q( O% m - #define ITCCHEN_SHIFT 23
X4 D5 h$ O4 Z' Q4 B - & t* R/ p" z& y: p! l5 E/ n$ p
- static volatile int irqraised1 = 0;
; d1 G/ I" M& \+ I5 H0 ]% m - static volatile int irqraised2 = 0;
' ~$ r9 R9 d0 Q4 {5 K
0 u- h" v K6 ?8 `) H, R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 {8 S6 _' T) e) x; ?& |% C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; Z: [0 d" S. X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% k) A$ f; s4 z% o) L8 I - # j* n L6 e' c: y5 [: z! S- ^4 z# j, t
- dma_addr_t dmaphyssrc1 = 0; K$ r& l0 N; T' R- w
- dma_addr_t dmaphyssrc2 = 0;9 W' K* I1 B' U, H; x% P: @
- dma_addr_t dmaphysdest1 = 0;
' W/ [! ]# z/ h+ d7 u! F9 M - dma_addr_t dmaphysdest2 = 0;3 J, c* y' [5 v7 W3 t: P
- 0 u" M, ?; O& M, _
- char *dmabufsrc1 = NULL;
) N. a1 ~' `! D) C - char *dmabufsrc2 = NULL;& c# A* I7 x% G2 ~* O8 u
- char *dmabufdest1 = NULL;
' v6 c+ l5 E/ b0 l0 J - char *dmabufdest2 = NULL;% d' Y1 j8 j/ o# F4 Z
- ) H0 w$ L1 y9 _3 `0 E* _
- static int acnt = 512;: o8 P2 ~! F1 @/ j
- static int bcnt = 8;
& \ c) u* |" s/ S" C2 A5 x - static int ccnt = 8;
/ H% `( X5 W% Z; A" v+ t3 U& R - . }5 X' a Q/ r
- module_param(acnt, int, S_IRUGO);
+ b9 o0 C( j" @- p' l - module_param(bcnt, int, S_IRUGO);% n8 ^5 v) ~# U. W* i
- module_param(ccnt, int, S_IRUGO);
复制代码
& y8 V4 G4 Z7 d$ e# b: C9 k
4 r, f, z, u4 \' P( { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; W- O* |/ J8 B7 ]' E( H" m2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. b; j7 }( G% P2 K3 w; R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 n K9 M$ Y; C- j$ l
; P+ l" A t4 b. o% e
1 Q- f9 h, L6 {# |+ _0 S# @ Q |
|