|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " D9 T9 u6 K+ h1 U7 ~ S* }
- [code]EDMA sample test application
! M7 \$ k3 K0 y( l: v0 p8 n$ B5 q3 i/ C - /*
$ L s. _3 u/ B' K, C - * edma_test.c
% v+ p% V6 n: `' R# U1 A! ^ - *
V! C0 U2 r7 [! h% H& V - * brief EDMA3 Test Application
& O6 W. O; J+ R/ B - *
) g& N0 h1 m/ K. S8 S - * This file contains EDMA3 Test code.
, a) n+ o$ ^& M: j/ Z4 i - *
( q+ s2 ~6 g' a A# }$ e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 P3 U# |5 `' I2 C! U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ r% t9 q# w) h- n
- * TO CHANGE.8 O: a7 B* m5 N8 T
- *8 ~7 {; j; N' P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- ~3 d' B# d/ @, v - *# O9 U) ~+ H+ w! S- j
- * This program is free software; you can redistribute it and/or
, [+ r& V2 a. k - * modify it under the terms of the GNU General Public License as8 n$ N- V, y, y
- * published by the Free Software Foundation version 2.; t# ]& _$ [6 k! X$ z
- *
3 E) r+ E( u# t7 u2 \) w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% ?# n2 T. K0 p0 p2 ~
- * kind, whether express or implied; without even the implied warranty- R+ Y/ v2 b8 z1 f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 R0 a- h: N; T - * GNU General Public License for more details.8 R6 w" ~& R) b) x3 O
- */: C! M8 w4 s+ C$ [; f: Y. k5 _ b, Y
0 S" _& j: S' Q9 v- #include <linux/module.h>9 N, g, B' Y' {8 c2 v$ b) i8 W7 X
- #include <linux/init.h>
8 b% w# \1 | }- S1 }& [0 r - #include <linux/errno.h>) E5 R+ }, O0 @
- #include <linux/types.h>- j7 O" R$ ]: o1 k* A
- #include <linux/interrupt.h>
& C! Z5 c' x& N8 s6 J) K - #include <asm/io.h>
4 Q$ I5 p. N4 ]" s: i4 K - #include <linux/moduleparam.h>
0 c d% Y/ z: p: z/ r# L7 V - #include <linux/sysctl.h>
9 G B% Z/ ]# K - #include <linux/mm.h>
6 S' ^& [) n$ O& ?5 R- s - #include <linux/dma-mapping.h>
% `, V7 m8 b) m - / |9 _1 g6 q0 f8 y6 g- y7 b
- #include <mach/memory.h>4 P) R0 J9 |% D, V7 I
- #include <mach/hardware.h>
$ g% B. }1 z W" C+ P6 Q, P - #include <mach/irqs.h>
6 T! }- l) R% D2 U9 [ - #include <asm/hardware/edma.h>8 P% f& G) i8 |6 r
- 5 S% s/ x. v% `4 l
- #undef EDMA3_DEBUG
& @5 G4 ^" m5 M6 X0 N - /*#define EDMA3_DEBUG*/- U- M8 v q2 d* E
+ W3 ?9 G( u8 f% T' s- #ifdef EDMA3_DEBUG" T! C7 t! _( j' x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 n! C# V( C5 r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* v% U6 s: p& t/ q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), |& ]/ B. y2 ?( a2 q9 o J
- #else
- b! G; k& }0 K1 A. e/ v7 l - #define DMA_PRINTK( x... )
2 L* G6 H: `) B - #define DMA_FN_IN
/ m7 ^0 c6 V3 j9 s& b - #define DMA_FN_OUT2 e0 g1 U1 H( z. m( M7 a
- #endif
, { B& ?( L2 b9 h - 9 e/ } F6 K5 Z n3 W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 d6 S3 t5 u5 W6 S. O+ }; k
- #define STATIC_SHIFT 33 w% a5 l5 ] P& m. y5 l1 i
- #define TCINTEN_SHIFT 20
( S/ f5 w- o) y( _% ^' g s - #define ITCINTEN_SHIFT 21
2 T( d# ^# n( E; J4 M; r @ - #define TCCHEN_SHIFT 22: ~, t% o% b5 `& \5 X2 x ^
- #define ITCCHEN_SHIFT 23
9 L" S1 I: u$ S% e- F9 I0 t7 h
& n5 Y' y: g2 T1 h* k( V- x7 _- static volatile int irqraised1 = 0;
5 @2 S" D a( |1 ~8 U8 I) e8 m - static volatile int irqraised2 = 0;3 P9 g" l" I( s# E1 c/ G* u
" H% f# S* o- o% M+ B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Y" N" s! t/ v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- I o4 D& P$ t( A1 ? @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ S* ~0 [% T' g$ j1 r: O' Z8 X! w - 7 \9 i& W S8 R) K, X3 F0 B
- dma_addr_t dmaphyssrc1 = 0;
! \- _$ V0 w0 | - dma_addr_t dmaphyssrc2 = 0;
" }+ c3 d! w3 b% v3 B - dma_addr_t dmaphysdest1 = 0;8 c) w0 a- |0 p5 N
- dma_addr_t dmaphysdest2 = 0;
% C- o7 c' M2 u5 J( Z6 W. J- d% P
+ w4 M2 d. u9 _2 @- char *dmabufsrc1 = NULL;7 y% \+ p* D& _7 J9 P
- char *dmabufsrc2 = NULL;
, }& W4 R9 ?% q3 M/ d2 o/ L - char *dmabufdest1 = NULL;8 K' w Y# M5 ^7 }; C
- char *dmabufdest2 = NULL;
" t% }2 j2 G' `( p
# m8 z! D2 w2 G1 b( F- static int acnt = 512;
$ \/ F5 l, v( k9 `; q, [5 h+ p$ c - static int bcnt = 8;/ T" W1 b+ {; c+ h/ c
- static int ccnt = 8;
4 d2 z! l% x+ u, h0 Q& c' V' d - ! \, c0 E" `$ P1 h6 u
- module_param(acnt, int, S_IRUGO);* ]+ w% Y& S, M( Z: s, O( u% o& D
- module_param(bcnt, int, S_IRUGO);9 Y1 j4 F: @# j5 O) z
- module_param(ccnt, int, S_IRUGO);
复制代码 0 Y7 |5 k w7 F6 m" }% y
4 t* \& B% D6 n3 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) v a' \, B s4 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 C9 x7 E, H x# |" s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; r7 U, @& x1 [9 i
- U m9 z8 ~9 ]5 J9 E4 i% T/ x
4 ?1 ~3 \, T' O* @2 a* B/ p |
|