|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; m' `4 R! e$ K9 \. @0 d) p' f2 k6 J- [code]EDMA sample test application
/ t+ M" y8 T* D: y7 A0 b5 Q+ r6 r4 r - /*) Z( y, Y; A3 _5 p1 B
- * edma_test.c3 A! V b# Q( ~! `7 P0 u
- *
9 G3 E6 u5 P0 [# S5 Q+ l/ I9 n - * brief EDMA3 Test Application- m# S( N, k' H% ~2 K8 }
- ** t- `# n G& G; @, c1 d
- * This file contains EDMA3 Test code.) u' |- f }) F" F/ |0 \. y# E
- *% M( ?% F: z3 c, \( w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
j( D; y9 g, S$ f9 a6 v I6 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 M4 r2 ~ Q+ O* Z - * TO CHANGE.
; ^# J" i3 h( g8 c% d1 w, t5 F - *% `; e! L" L; h( k3 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 S* `. C" Y- x1 E# f& Z - *
, |5 m5 x9 V- k0 K3 G' G3 W6 N5 o - * This program is free software; you can redistribute it and/or& l m5 v- z% F5 L0 D
- * modify it under the terms of the GNU General Public License as1 Z' X' A! e# P8 Z8 r
- * published by the Free Software Foundation version 2.
8 T% h6 ^2 p- j6 n1 d6 A$ z; b w - *& |- s$ R' q8 S0 l4 D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: n% h/ W- R& ~ - * kind, whether express or implied; without even the implied warranty7 ^* J" Y) `1 h7 s6 q. _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 _) Z/ `, l& L - * GNU General Public License for more details.# o& U- q# Z% o* W" `0 g6 n
- */
8 N+ f9 }0 j2 C; E4 p2 @
, U! C8 w" n9 j4 p- #include <linux/module.h>
- M1 _/ a( b" O3 F; w" K, D1 r - #include <linux/init.h>" i$ M) i& F5 T, t8 G
- #include <linux/errno.h>
. u' o5 Z, y& D! R" `2 {( o - #include <linux/types.h>
9 _5 @$ S f9 X' Y - #include <linux/interrupt.h>
9 C* j" o A- A: h - #include <asm/io.h>
! E- m+ |" i6 I2 w. ` - #include <linux/moduleparam.h>6 O% g2 K! n& ]5 _. O; H
- #include <linux/sysctl.h>% t8 O3 `" J. C: M8 x0 R
- #include <linux/mm.h>
3 x# j* w4 Q: Y; ` u3 U8 F: ~ - #include <linux/dma-mapping.h>
! q4 E, e+ j+ f0 ^) ]" `# W9 ]7 H - 6 n8 M1 p0 z& N! ~2 `
- #include <mach/memory.h>( ^4 o( r) F: X& a! K( T
- #include <mach/hardware.h>
; a# T1 g, ^( B# ] R6 M5 l - #include <mach/irqs.h>
# Y. r" i K2 C$ w. `# M - #include <asm/hardware/edma.h>
" k [* t$ \) x; v& O0 Z
) Z) y [" v6 X$ i$ D2 v c- #undef EDMA3_DEBUG
1 |. X' m }- g& ~ - /*#define EDMA3_DEBUG*/
( ?& ^3 b6 ~7 y9 N' ~0 i
6 h. P7 D' F \- #ifdef EDMA3_DEBUG
. U! z. a7 a. r& m" I0 l) q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! j K7 O. q: @ l; o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# }# P- \# Q) {2 A6 M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 C$ Y4 g( g$ V2 z6 \- b0 V
- #else& ~4 L, m U# \: j" k4 _8 l
- #define DMA_PRINTK( x... )* v0 M$ ~0 n: m8 G# U5 F4 U7 ?+ X
- #define DMA_FN_IN+ d, ^# g# O' b" L; N2 {' A* n
- #define DMA_FN_OUT6 Z( s& w+ a& L% o" R5 I+ q
- #endif1 I+ n. N4 `. B/ p- Y2 D
- 7 ^5 \, c# f+ F8 ]2 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ F* L2 ], ~3 u6 g e9 I# e% y
- #define STATIC_SHIFT 3. Q' B. v3 j/ t h' {9 Z
- #define TCINTEN_SHIFT 20
" U; X/ m b H+ o/ T% w, M - #define ITCINTEN_SHIFT 21# \, C1 t- {. ]: L4 I/ B
- #define TCCHEN_SHIFT 22
. {3 d& p6 b) g5 m7 b - #define ITCCHEN_SHIFT 23- }7 m$ ]7 R# y: l7 I5 f
1 u8 |& c. z/ J" z! ?4 c. u6 u- static volatile int irqraised1 = 0; x+ e! z/ _1 K! ] I
- static volatile int irqraised2 = 0;) w7 z4 a% Q- G8 H5 T
- Z) K+ ~" O5 }6 t8 r% H/ y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
y: m% i' y, @' ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 E2 ~1 ^+ X/ w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 \5 _4 y1 A _0 i
, W2 z$ l: p3 j; w: B6 N+ k3 T' h- dma_addr_t dmaphyssrc1 = 0;+ B0 h7 k. s- M! ^8 {8 n9 Q! R9 d
- dma_addr_t dmaphyssrc2 = 0;
3 V+ M0 ?5 O5 H* d - dma_addr_t dmaphysdest1 = 0;% ^: f( |# _; ^ P: N; \
- dma_addr_t dmaphysdest2 = 0;! l$ N. A8 }& l: d6 s
- . G* ]9 r( H# J2 U
- char *dmabufsrc1 = NULL;
5 t! Y2 k# R! z) E - char *dmabufsrc2 = NULL;, v( v" B( E( S0 m
- char *dmabufdest1 = NULL;
, V8 ^. E) B, x: | - char *dmabufdest2 = NULL;
% P6 I- ^* ?8 \3 Z - 2 T/ O" x: V( s
- static int acnt = 512;9 U/ j0 H) ~* W U3 r
- static int bcnt = 8;
' M' ?* G: ^2 d9 K - static int ccnt = 8;# o& {) m1 t. Z8 h3 w
+ q2 J2 j3 C0 o2 O- module_param(acnt, int, S_IRUGO);% n0 x7 E- @8 \1 I) M5 Z4 H
- module_param(bcnt, int, S_IRUGO);
6 r6 V! z1 g: e, r - module_param(ccnt, int, S_IRUGO);
复制代码
0 |' @3 n/ }( \$ R6 `+ \4 E6 f8 l
) @, ?* I1 p5 j* D2 `2 R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ L2 r0 c0 `) V" V0 B q8 N. aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 L. q- u3 X: Z/ X' O! U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 u3 x! m* Q- U ?6 q1 R2 b. b. |4 S |$ [
# z% A7 ?) p# G' k% w# Z" w4 _ |
|