|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - R* y" M, t- }
- [code]EDMA sample test application; G" r" h' J% O
- /*
, e+ C j0 i8 c/ k& ~: s U - * edma_test.c2 b: D" M* O) [5 m6 \
- *
3 u+ }+ `) d7 i; _; p) K+ T5 h - * brief EDMA3 Test Application" X7 i! |" Q/ @+ Q/ g& D
- *
# T0 }$ o0 P1 K - * This file contains EDMA3 Test code.
+ r' _* W6 u( I+ W: a - *
$ d4 R* e7 V4 N1 ?2 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 E, Z0 b- ~. l4 K/ m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( l$ k5 A+ k& D+ U- H
- * TO CHANGE./ G+ D$ }) e3 g( F
- *
) [. v* d, ^. b# d4 i! @- c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- {% r9 Z5 A' s9 b, e! `& B7 p
- */ |0 J' L7 O2 \0 |
- * This program is free software; you can redistribute it and/or
' Z; x0 Y, W% m( j! E' ?( ^- g - * modify it under the terms of the GNU General Public License as' B1 N& k+ r1 q, o8 ^
- * published by the Free Software Foundation version 2.
5 ]+ C+ d* v2 ^ - * s/ N, S' @! _* C$ @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! d" D: ~5 q0 \" t4 C. E" @
- * kind, whether express or implied; without even the implied warranty
! I: a8 L) o+ b, J' _( C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! @$ K8 v. q1 _
- * GNU General Public License for more details.; r- P( k* J5 a$ G% K- \; o- h& N
- */
' X: n+ I% T. e2 _ - 4 Y6 U" Z, f( [6 R* F$ ~) n
- #include <linux/module.h>' G6 q% j2 u3 h6 h
- #include <linux/init.h>1 W' D( t* D! L
- #include <linux/errno.h>, k; e/ R, F2 ?. c7 A8 r, D
- #include <linux/types.h>9 ?: j6 f8 a- g
- #include <linux/interrupt.h>5 P2 ?# a: [4 ?* W% v: `0 y
- #include <asm/io.h>
& i3 o% t# s5 c& {9 q, T0 J - #include <linux/moduleparam.h>$ D* J. r: r9 D, L8 l
- #include <linux/sysctl.h> j. T* Q1 f H* d( }4 \2 c0 _! ~0 n
- #include <linux/mm.h>2 h. l. J; K8 @. v. ]0 K" N7 ]
- #include <linux/dma-mapping.h>
_8 d9 A0 [" ?/ c) [ - - }5 S2 z% l9 v$ Y% g" y/ X
- #include <mach/memory.h>
: q |1 S. m. ~! w - #include <mach/hardware.h>
/ @: m* F* o) C2 p. Q( H, [ - #include <mach/irqs.h>: {( g; T9 Z, z# G
- #include <asm/hardware/edma.h>4 F/ y0 {; ^$ M
6 P+ u6 o. { \- #undef EDMA3_DEBUG
2 S$ j1 t1 g* _$ ?- ?8 x _ - /*#define EDMA3_DEBUG*/2 ?# [; F+ g6 T K" u
, u- q- l4 P; y$ r- #ifdef EDMA3_DEBUG
! j$ C- P4 K# i& |* G1 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! p! a) E* {) g3 f3 v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 {: f3 c' h- h3 B! `4 X |) K+ a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: j, A9 H! h% |$ J6 L. P, w - #else
- Z) L# ~, t2 m: Y! q3 |, G - #define DMA_PRINTK( x... )* V6 ~# }. ` k9 R. ~" [# b
- #define DMA_FN_IN- ]5 l0 v2 H' c5 c( S$ D$ y
- #define DMA_FN_OUT
2 x$ J$ @$ K# Y9 D. @, r - #endif
( i& f! ~5 D! G" P
" X, q1 o% d: R S$ p5 z3 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ |. X$ R4 G5 u/ j8 S2 ^ - #define STATIC_SHIFT 30 W8 |9 I; C5 K6 t% o
- #define TCINTEN_SHIFT 20
1 k4 v7 H0 ~% E3 R5 y - #define ITCINTEN_SHIFT 21; D" ~3 @" }+ j8 T- c- J9 C: l
- #define TCCHEN_SHIFT 22$ B8 }' s1 z1 n r
- #define ITCCHEN_SHIFT 23$ n+ G! n7 ], k* D* f' i
- 5 U' I8 \; F- |
- static volatile int irqraised1 = 0;# W0 W6 S- \. L" Q% u
- static volatile int irqraised2 = 0;, D( q5 Q- ^1 J0 \
- 3 c* o3 M% V* P, R# E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! A; [, X$ `' N( V- e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
_ L' f7 ?# I: } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 x Y& `9 k4 u8 T8 h6 [- q
- ' _ n7 G$ d$ l6 [
- dma_addr_t dmaphyssrc1 = 0;( Q {) _6 G1 p1 _' u/ d8 G
- dma_addr_t dmaphyssrc2 = 0;
2 b7 u- j. P; G% v& F& ?3 f2 K& ~ - dma_addr_t dmaphysdest1 = 0;
, T, \! d2 e+ H3 q3 y$ _ - dma_addr_t dmaphysdest2 = 0;
- @( z9 q# E6 s+ f% u. M
( \0 n: U: T, M3 o6 G- [. A- char *dmabufsrc1 = NULL;& @' A2 h4 F" R8 a$ M: L! [
- char *dmabufsrc2 = NULL;
6 i" H2 ~+ ~4 G: q5 Q, T+ { - char *dmabufdest1 = NULL;7 _& h9 q2 u2 h: |3 z5 d, @8 r- `
- char *dmabufdest2 = NULL;
( Q8 c+ F+ b7 ?0 B' Z0 i, C
9 F( B1 L- g7 n- static int acnt = 512;4 M3 Y5 P8 L* {, \2 r
- static int bcnt = 8;6 ?1 f* V0 n) k, Z f6 Z: ~
- static int ccnt = 8;
8 ?! d ]. ]! B [1 A - b0 c# } l& P$ e% [ M2 `
- module_param(acnt, int, S_IRUGO);
# \# k0 v4 k2 H# n" v+ c - module_param(bcnt, int, S_IRUGO);. {8 P- G3 `4 A; s, @
- module_param(ccnt, int, S_IRUGO);
复制代码
! \# Z; T& w& ?5 i9 Q, k$ V1 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: K. z3 ~: x" p; Y8 }7 Zarm-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 y8 i( S1 n1 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& M+ ~/ }9 w$ i0 O
1 }! M) g+ K- X( j( y+ |! d4 W/ ^6 R% S. b3 l: o& S
|
|