|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : b. K& Y: q8 A% O* m
- [code]EDMA sample test application2 R7 c4 c. m8 }& Z8 r* T& p1 E, F; q
- /*
7 ]" X, |7 E# _. } - * edma_test.c- y; x8 e+ V) D, H: C
- *5 @8 F& b7 W& w/ `# Q" D
- * brief EDMA3 Test Application, c% ?0 h2 {* M% P" U
- *, F! Y2 v h- }
- * This file contains EDMA3 Test code.9 a2 o. M! E. D# C Z5 x& m
- *
" a0 B$ A" Z0 i) G. `0 @( t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 y/ X0 x9 B, e: a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( f: Y# ^! t/ m: n0 }. A
- * TO CHANGE.
* p, @4 a! c5 O D - *1 ]5 F( i% R3 L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; F' z P7 r7 c/ V. `
- *
- l" j& K+ T* R5 V/ V6 X2 N - * This program is free software; you can redistribute it and/or9 G% L; ~$ x+ K' l; r; O- A% B
- * modify it under the terms of the GNU General Public License as. y- r% I' Q. d6 P g- W" ~0 g
- * published by the Free Software Foundation version 2.
( T* g9 n* {* ` _/ N9 h; I4 x - *5 e8 P$ v5 z k7 `/ D8 k. e R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 a: \; i J" _$ V9 o6 u. k - * kind, whether express or implied; without even the implied warranty
I* N4 K$ l3 F8 D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# F2 U1 k+ ~- x - * GNU General Public License for more details.' |, }! D& g8 o$ k2 {
- */9 A' i" R2 `+ E4 d. M$ U
- ! t3 A S* x" M; u
- #include <linux/module.h>
9 N0 E/ Q- S4 d6 k8 S8 X4 U; c, i% U - #include <linux/init.h>6 E2 X+ \5 Y Q# j
- #include <linux/errno.h>
2 H8 l- h: D: ^2 G3 v% ?; N - #include <linux/types.h>
+ l, v# L" L- o! u4 j - #include <linux/interrupt.h>, _7 f: d$ w$ E8 u" |+ q1 c- S) ?: A* C
- #include <asm/io.h>. B @; P4 H2 W7 U
- #include <linux/moduleparam.h>
v1 |4 x* Q8 F5 Q7 Q - #include <linux/sysctl.h>0 z$ ?# [: U: u; f: H# c
- #include <linux/mm.h>
. s! f% b9 _ j! Y$ ^+ a+ W - #include <linux/dma-mapping.h>
v8 h$ K) K+ ?2 K) c H6 t
2 K% y$ r! f7 y& ], V! F2 f& G7 o* B- #include <mach/memory.h>) @: Z, H, j( j K/ G2 `
- #include <mach/hardware.h>
5 ?' \. u1 N1 k - #include <mach/irqs.h>
$ t5 S; L) x/ M* G G. T - #include <asm/hardware/edma.h>
o, g2 k% O6 D3 X N- K. a
! V0 _3 I2 y) n; ~8 R6 ~0 v- #undef EDMA3_DEBUG
7 K1 J N5 Z' B; ^6 D/ X4 F# u - /*#define EDMA3_DEBUG*/1 Q3 u( E9 E0 s6 S
: S% B7 P2 A+ v5 L) [ {- #ifdef EDMA3_DEBUG
9 g$ |& W1 S B( h# ?( e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. T& V+ s0 g' q) D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). E) t2 {8 e* J* O0 _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 x3 L. s: V0 R/ ~ - #else3 a" M. A. R+ o6 D4 f! [
- #define DMA_PRINTK( x... )" ~ m- q7 M+ t x+ x
- #define DMA_FN_IN
2 P8 o3 a: b# e - #define DMA_FN_OUT
- ]7 {; \$ w! J% h9 x - #endif
/ I4 p" K! T* e, x( e$ N5 v5 r - ! O- P9 E0 ]8 ~( u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& `. m1 _9 ]! ]3 v1 O% e+ E5 O; V - #define STATIC_SHIFT 3
1 f5 H0 O$ D( p0 T. E" L - #define TCINTEN_SHIFT 209 ~" ^8 Z0 C4 a- s- f9 a- e4 @% o
- #define ITCINTEN_SHIFT 21' c5 F! _# X# b+ R
- #define TCCHEN_SHIFT 22
; q. `4 L% h) B' \% |. M3 P - #define ITCCHEN_SHIFT 23" A: j. @1 {$ ]: b5 ^! Q; F7 C
5 ]8 x' ?7 N/ ]9 ?1 ?8 q- static volatile int irqraised1 = 0;7 L0 w9 O* v- w' L7 g
- static volatile int irqraised2 = 0;3 v$ k' c8 T' @: L7 A
2 j* F( P! z! X- I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N/ t0 S( h0 K3 X' ^- {; }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q4 W7 M; a% W/ ?0 D- ^) ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 i. A2 e: C; G9 K, B% Q - ) H( n. A1 k% e8 j* ]5 J
- dma_addr_t dmaphyssrc1 = 0;0 e# Y- o# s. a% }
- dma_addr_t dmaphyssrc2 = 0;& d; ?' i W' _
- dma_addr_t dmaphysdest1 = 0;
, s B+ i, b; g7 t - dma_addr_t dmaphysdest2 = 0;; |+ X0 v. k1 e$ f4 r
& \( g6 ~3 t# Z- char *dmabufsrc1 = NULL;
5 R i4 [, A& z( ~ - char *dmabufsrc2 = NULL;1 s/ y; K7 ?+ v5 ~* z
- char *dmabufdest1 = NULL;
j, e( f$ z+ J) t8 i - char *dmabufdest2 = NULL;
3 |. \# m) w6 E9 C q - ( ?" |3 K! A0 d7 w0 u
- static int acnt = 512;
, U* g& v- }: M5 b - static int bcnt = 8;
0 r" E! `/ d% D6 ?% H - static int ccnt = 8;: |( E4 X- Z( v8 g/ U
- # |* g* i2 B8 H4 }2 q% ]9 I6 [% f
- module_param(acnt, int, S_IRUGO); T) z' R- c! l- T) |
- module_param(bcnt, int, S_IRUGO);
4 G* A$ W4 G" a( a2 M' W/ D6 L - module_param(ccnt, int, S_IRUGO);
复制代码
5 F1 ~7 B& b& x- ` ?4 y9 M& ~- [4 H8 R& f) K7 w4 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' B6 |5 y% [* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* z, Z# r4 B0 n8 s0 J& `3 j3 A8 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# A, C" r ?9 Q+ H2 ^! b# ? D- G
, s8 V! u" j* ~0 j- p% T' h6 L7 G* C0 R! q; `& j; O) l
|
|