|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 C, f5 g( n; c$ C! G
- [code]EDMA sample test application2 b- @3 e$ ?( [
- /*
! A, E" F5 n0 r/ @ - * edma_test.c" n: B) c0 ]+ c2 ~9 z% N: ~
- *! ]1 Q) S0 x- _; \0 f, e! ?- X& o) I
- * brief EDMA3 Test Application7 Z8 |4 d0 {) i9 W j7 }
- *( o& c8 R3 \; n: j
- * This file contains EDMA3 Test code.$ s3 u t: y8 @4 l1 A7 f" b- W
- *
5 Y0 L3 ?% e# I5 c/ @, | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- k# g& s) p2 Y2 f i' i; |0 x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) I0 A6 Q* c, d+ }( P5 q. g
- * TO CHANGE. ]2 n$ m# ~) {, N+ @
- *
9 p, E& w g& T8 P& L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 ^9 g7 \8 M! y( z: ?
- *# b( g! I5 }5 ~- N2 n! R$ H
- * This program is free software; you can redistribute it and/or
. j; Z2 q1 g: ^) z( B3 L/ b6 A( m5 K - * modify it under the terms of the GNU General Public License as
% N; V: Y, v( m) t8 @: Z' T6 ] - * published by the Free Software Foundation version 2.
: Q/ m" ^2 U1 l* I - *
a7 ]: A3 d4 Q7 {) V3 D% Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 D* I' ?0 p: x4 y+ I. Q9 K - * kind, whether express or implied; without even the implied warranty: k# {( f6 x5 O* x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( p# z+ [. l. t, r% C2 o; ~ - * GNU General Public License for more details.
! _2 ~% }4 H& Q, y) R - */
8 {" }% O: x! N - , D4 J8 Q/ [0 Z; o% W6 ^8 @
- #include <linux/module.h>
: O% I- ?4 v+ ] - #include <linux/init.h># Q N0 S0 Y4 k
- #include <linux/errno.h>
# f, ~" T9 C8 o/ B7 [, a+ N - #include <linux/types.h>
! H; U% n# z# W% e! b - #include <linux/interrupt.h>) s- o( A7 {' r) R% m7 s& c) Z
- #include <asm/io.h>
& P- U& H$ H" [0 d8 N" P4 _ - #include <linux/moduleparam.h>
) k( ^3 h. {1 [9 p$ o - #include <linux/sysctl.h>
: [5 b- A' W0 E6 E- Z; X, V! D - #include <linux/mm.h>; H+ i6 g/ f& w
- #include <linux/dma-mapping.h>7 L& l: X) K8 J0 s
- $ T0 D" j; h( F; N. `- n3 |
- #include <mach/memory.h>/ i' L% }8 S' ]4 T4 b6 J
- #include <mach/hardware.h>* Y7 Q. n6 G d$ L5 n( I
- #include <mach/irqs.h>
" X+ _/ Z# Q8 q6 J1 d - #include <asm/hardware/edma.h>
$ k9 A* M* g# y, j/ I - 2 G' d2 K S; |# a0 W6 M# o/ f9 x$ E; |6 O
- #undef EDMA3_DEBUG
, E1 l: E' O6 B+ H6 f - /*#define EDMA3_DEBUG*/. o/ t* @) p3 \% K7 U' t+ ~) H
) l3 g8 E+ T+ J# t( C5 [! a- #ifdef EDMA3_DEBUG
# T$ U. y7 l3 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( ^7 u" W. n' \) g# O, I0 r8 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- E" t1 @- \& l" U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 o7 L* K4 T% w( m - #else; ]9 g y* k0 i7 Y
- #define DMA_PRINTK( x... )/ C4 Y$ g; f6 I6 @
- #define DMA_FN_IN: e% U+ y. z* }9 ^+ B. P
- #define DMA_FN_OUT+ y6 o. ^) Q5 d/ ^; a) `
- #endif
6 X/ v1 U1 `- z S. b- j5 @ - ' U; o& W0 B* U1 t% x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# j7 H$ D A; X3 k. X - #define STATIC_SHIFT 3! h2 Q9 V2 @% s. v0 S
- #define TCINTEN_SHIFT 20
$ |* l3 r7 _7 ]: l# L - #define ITCINTEN_SHIFT 21
: z4 Z! J& B* n& M, g - #define TCCHEN_SHIFT 22: s% m7 W% f7 g f I! r3 l
- #define ITCCHEN_SHIFT 23
5 c) W1 s. ^- B: N! P - + ]; ?; \! D+ ^* n b( D
- static volatile int irqraised1 = 0;3 K' u. P) i* J& H) }; D
- static volatile int irqraised2 = 0;4 s* \& A8 u3 d: c0 y
8 h* _0 ]4 N4 ]9 i+ V# S/ F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 }6 v4 [( e1 i b, Z: l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Q, j9 \' Z% P1 b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& r! g# Y' s. w% K8 v% S
- , |% `4 r' ?% p2 q
- dma_addr_t dmaphyssrc1 = 0;
) e" l; H+ |1 v- D* k6 T2 r - dma_addr_t dmaphyssrc2 = 0;+ @" P& H4 F0 Q" t/ t P
- dma_addr_t dmaphysdest1 = 0;
3 F+ m4 E& r/ J% g# w - dma_addr_t dmaphysdest2 = 0;; W- Q5 y5 c7 ^) v0 d; ]
- & t4 M7 O7 P' {! a
- char *dmabufsrc1 = NULL;: N |% j3 A: w2 H) _4 u, k5 B$ R: R
- char *dmabufsrc2 = NULL;
( x5 m, K0 ~& {. G - char *dmabufdest1 = NULL;
8 M" z9 F( }4 }& }4 F3 r - char *dmabufdest2 = NULL;/ g2 A! e& a/ M6 U
- ) [1 r3 `. _6 ]% [4 K3 C8 F
- static int acnt = 512;& Q9 W3 Q9 n( t* j
- static int bcnt = 8;8 F: }5 ?; E8 L0 e' v$ @
- static int ccnt = 8;
) Y6 i, x2 U; F; W$ P. h. c8 d - ; q' B$ y% a2 q' V$ g: l" r
- module_param(acnt, int, S_IRUGO);! [6 {( S3 {! `
- module_param(bcnt, int, S_IRUGO);" A2 o2 U0 X$ q \
- module_param(ccnt, int, S_IRUGO);
复制代码
$ w( W6 ?9 H- |1 s
2 d( E5 B9 m$ N: D0 O) E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. ]+ Z4 J6 I2 `' Z9 H9 q9 |( `2 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ Q+ X" Z: k! j% S1 O7 j7 L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 J: w) s- P. [- C; f# d! [
+ P8 k4 G+ h! j; d: C2 e" |& }6 A O, i2 n" Q+ l) t
|
|