|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " H' P7 W. T" D# b5 h
- [code]EDMA sample test application
1 b: F, l' C6 l2 Z2 Q: j2 F7 V - /*
% y% @) u$ ?* d: q( ?0 N1 z - * edma_test.c
" u3 t3 T* N' [ - *8 T4 E( P; E0 P8 F4 N
- * brief EDMA3 Test Application
" Y! v# x0 R- f2 H* Q - *9 S1 @. j3 M3 q5 h: D) ]
- * This file contains EDMA3 Test code.
( W) R* [) C7 ?" N% b. z# i - *8 A+ ~; I* n' k3 C1 T, |4 B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ a, w( T" g' i' Z% u' C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 q$ f: b! H( d - * TO CHANGE./ m& z1 `" E. z1 P( @
- *
& w! u# Z/ h# j: r4 Y2 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 C' j3 c# }% H- `. J
- *
+ r; P9 M; w( }8 ~$ J/ A' ~* b - * This program is free software; you can redistribute it and/or# Q/ s6 p& B3 X L; B, @7 Z, F1 _& x
- * modify it under the terms of the GNU General Public License as
3 q+ i [, [- k. O/ p - * published by the Free Software Foundation version 2.
6 {' c7 P3 Q/ p( \& T) F2 ?9 D - *
5 j/ ^$ ]8 Y' u- H R. s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* g/ Q+ _( F3 c7 ? - * kind, whether express or implied; without even the implied warranty1 d# B9 `" Y0 b1 t. D; u7 m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- k& f+ i) L5 h9 s q
- * GNU General Public License for more details.6 ]" z" ?5 x3 T# K$ Y
- */
& l3 ]1 H7 [. @, v# [( h8 T
. j+ D x4 m o- #include <linux/module.h>
4 s- B! }. _7 a. N - #include <linux/init.h>
9 ]( P& I. ?+ B$ l - #include <linux/errno.h>, k7 D. P' S! @
- #include <linux/types.h>$ o7 a/ F; N( j ]' i
- #include <linux/interrupt.h>
) l6 u3 A$ c4 |6 h% ]) B: L' j - #include <asm/io.h>/ G9 r# u$ y# E7 r ~0 h
- #include <linux/moduleparam.h>* l' M Z0 u5 D
- #include <linux/sysctl.h>5 {" B- o( X4 E9 H2 K+ a- U
- #include <linux/mm.h>
+ m; U% \6 X9 M8 r% Q+ a2 ` - #include <linux/dma-mapping.h>7 ~8 o0 i7 {8 ]& A+ m% ~
- ; |6 q8 c# S+ k2 m
- #include <mach/memory.h>: n4 e! I: r" o! o/ q2 w" d( I
- #include <mach/hardware.h>. n! c/ a l. K6 t' {- T: l7 x% h3 T
- #include <mach/irqs.h>
/ Q6 S8 `% B( m8 Z* _- T/ V - #include <asm/hardware/edma.h>
5 x1 p/ }/ X, m& l
0 H" r+ u* K) H- #undef EDMA3_DEBUG5 O1 s3 J2 `# d0 x, J [
- /*#define EDMA3_DEBUG*/" `5 d3 ^2 c2 \7 w' [
' [+ C, ?2 J4 ` d$ O; m. e* l0 ]- #ifdef EDMA3_DEBUG! I) z8 J" z! \' T }, ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), @, A& a; g5 E, b- ~' _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# o1 x" Y: o7 l% }6 H5 b( B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; O$ c8 b$ I+ B; t U; b - #else) w( R4 ~0 Y* E- t
- #define DMA_PRINTK( x... )
3 \3 d# P4 N/ U - #define DMA_FN_IN
( E; \3 `" ]6 p6 x - #define DMA_FN_OUT
2 y/ R& e2 R6 g a* `" L - #endif) i! R" i" J7 A1 K
% p r& V- ^* p6 e: }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& u6 A+ O& x% e- q x/ d5 w' N+ o
- #define STATIC_SHIFT 3
2 p# _% J. a% m; N9 P - #define TCINTEN_SHIFT 201 o( s) f$ n* b
- #define ITCINTEN_SHIFT 211 R* w0 s5 z. A+ d3 V
- #define TCCHEN_SHIFT 22
* }* O* f. ^8 {0 r - #define ITCCHEN_SHIFT 23" E) d# W3 q2 u; S& a3 S
- . q) J. P/ P" U) ~4 |) a" ?: C- k
- static volatile int irqraised1 = 0;5 B) T2 Y' |/ a$ [
- static volatile int irqraised2 = 0;% y" j4 q3 K1 ]# q
3 D9 M1 g( _( n7 N: S5 g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( i7 o/ H6 S6 U3 O! V! Y' _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# b8 \2 o7 P: N* Z3 l3 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 r6 I( A" ]: M+ `4 z* Y - + G! I l5 x' l, ~& m8 f/ X p7 W
- dma_addr_t dmaphyssrc1 = 0;4 f+ K: e- ^: c& E! B
- dma_addr_t dmaphyssrc2 = 0;1 l2 A# q, Z$ x- t1 P( e
- dma_addr_t dmaphysdest1 = 0;
; B; B+ B1 E' a- z& V - dma_addr_t dmaphysdest2 = 0;
) k- X6 E- M: S1 D4 M% | - $ m, u) U& w T. W, w6 G+ b
- char *dmabufsrc1 = NULL;
2 f, U" V6 U( m - char *dmabufsrc2 = NULL;
3 W4 d" g' `, s* R' q - char *dmabufdest1 = NULL;9 K( Q3 o' g4 h% C- v1 e3 M( x m
- char *dmabufdest2 = NULL;
2 r8 B% f8 b) g! D4 u
3 D5 U7 B+ X$ o2 \! K- static int acnt = 512;' }5 m* z* w! T; c/ q: N
- static int bcnt = 8;
# A* O) W9 i! E) c* @7 ? - static int ccnt = 8;' D# Q+ h4 R/ m: G6 i7 P. o
- 5 _- ^% n7 ?2 w) b5 T4 N! Z8 U" Y
- module_param(acnt, int, S_IRUGO);
4 y+ g1 z7 B: a2 x" P3 y3 d - module_param(bcnt, int, S_IRUGO);, `/ P) G h& J* I
- module_param(ccnt, int, S_IRUGO);
复制代码
* \1 _$ V$ l; g# N) G
) |& q' h1 r: I5 c' ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' t+ {: h3 f3 \! d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 H. E+ e% ^* K" R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 n: j& g. L' q2 g0 z
9 C' Z8 g! r D( b- E8 {8 L3 h" n' G
( v& H$ ~; x$ Q |
|