|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" _7 ?. Z9 ~9 b8 l0 z! x9 S- [code]EDMA sample test application' X" |; I0 _. |& |# R1 x# M6 y
- /*
+ u0 s/ h% B% b - * edma_test.c
6 U. N. o" m# p6 ]2 b - *- U# L1 h5 ^( \
- * brief EDMA3 Test Application+ h7 [7 V7 G8 @9 P6 o' D4 p. _: t
- *8 e$ ~. ~% ^$ c; `
- * This file contains EDMA3 Test code./ r4 Z9 z3 J+ F/ E5 L9 N( Q$ j
- *
7 m/ |) J2 \' ^& B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 s5 r0 u6 v% J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 W) s' ]7 J1 b- T$ ^$ H
- * TO CHANGE.6 O# V5 Z" S. h* n
- *
w# p) q( }. L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% p+ P, z& `9 J! \4 h$ @
- *+ u" Y9 B+ c7 @& y7 E
- * This program is free software; you can redistribute it and/or4 d$ p; A8 s7 C6 c: j
- * modify it under the terms of the GNU General Public License as
( q/ P- p0 V4 ^ y5 x( Y" F - * published by the Free Software Foundation version 2.2 p6 k. J& {, A4 [$ F% [" v% x
- *0 k/ v' Y. u/ y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# i! a# }/ _1 D P e' Q' y
- * kind, whether express or implied; without even the implied warranty
0 G7 p; E4 {; l6 V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 t( J) }3 ^7 z) P7 O
- * GNU General Public License for more details.
7 d8 M, \* y! v9 h6 w - */
, C t: w6 {" U- N' P
3 v! F% B, C0 L5 g- #include <linux/module.h>
' i# @- e x: M8 ~ - #include <linux/init.h>
9 a9 T+ P' L* M) y - #include <linux/errno.h>
" P+ n! {6 {6 n - #include <linux/types.h>0 Y( |0 B3 U% c. ]: ]
- #include <linux/interrupt.h>
1 A4 b4 L# Z$ s! l - #include <asm/io.h>
4 z Z; S% H$ G0 m - #include <linux/moduleparam.h>1 N5 G7 }6 N- \5 j6 O# b1 T
- #include <linux/sysctl.h>' E A3 R* i! q p0 j
- #include <linux/mm.h>
4 }( l8 `- U* R. s! ` - #include <linux/dma-mapping.h>
1 e2 ` ~! V$ m$ S! B. I. s3 M
1 j* L, O, j0 h6 K- #include <mach/memory.h>0 @& B3 c3 L4 M5 K
- #include <mach/hardware.h>2 ]8 z2 @" M; ]* ^. c+ |
- #include <mach/irqs.h>
; {; f- j2 |! A8 z+ l - #include <asm/hardware/edma.h>
' ]+ b* y# y7 ]- p, ]( j - 5 F* c9 u! O0 X2 u! M: D2 ~
- #undef EDMA3_DEBUG
" v9 H/ }2 ~) {8 s - /*#define EDMA3_DEBUG*/2 G$ x; t( Y1 k; L
@" G8 Q: r, P5 ?- #ifdef EDMA3_DEBUG7 o, O3 G! R8 V; L$ t p9 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 E9 X' X; B4 P* v; j" {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( @0 H' v1 d; r' W! H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 \% A7 Y( _' u' J* | s! ^ - #else( y) X( i6 u( F- |. \
- #define DMA_PRINTK( x... )
0 l# [3 k1 c/ G9 g8 n( W! b - #define DMA_FN_IN& t( D- J u( P
- #define DMA_FN_OUT& U3 W1 t$ d G# |2 m# U9 g6 S/ V
- #endif
N2 i0 W j/ L5 _0 h, ~$ e o& S - ' C* f' B* ~5 A D, _9 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 s0 L0 y' j" }$ k2 O - #define STATIC_SHIFT 3
/ g x% Q7 n% P" B - #define TCINTEN_SHIFT 20
2 M9 Q7 N0 @4 l - #define ITCINTEN_SHIFT 21) K# X5 B4 ^: |/ f
- #define TCCHEN_SHIFT 22% e5 V, W, y f0 h. u
- #define ITCCHEN_SHIFT 23# a4 v/ K2 u9 e+ L3 a) x
- - P. H0 z6 ?& s# b# _
- static volatile int irqraised1 = 0;
, s" @; Q6 F/ z - static volatile int irqraised2 = 0;* _7 |. v7 e6 X) a0 [) Q
- 0 R# m( Q# n( r1 x$ A o _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Y$ i8 \' d% \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 U% a0 l. D) h% J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* C! n' R5 K# R' V$ Z, ~: b
- " h: e. d2 {* l0 E5 I9 f/ O
- dma_addr_t dmaphyssrc1 = 0;
2 S& x, q6 C! a8 z# _. Q, v& _ - dma_addr_t dmaphyssrc2 = 0;2 h) u, e( r9 Z2 F7 P
- dma_addr_t dmaphysdest1 = 0;) ?4 l: E0 E7 m( C2 v2 K
- dma_addr_t dmaphysdest2 = 0;& B& Y) X0 F1 W' k0 _
- " H& _# f7 R( x2 G Z6 v
- char *dmabufsrc1 = NULL;
7 W. k' H1 x! ~5 ]( G - char *dmabufsrc2 = NULL;. i+ l, ^- a: p! B$ n
- char *dmabufdest1 = NULL;: Q4 T$ \ R+ L
- char *dmabufdest2 = NULL;
4 |* o$ O0 @0 K
/ ?- G- R, ^+ C ]3 h/ U- static int acnt = 512;/ s9 [! C5 o0 _. d7 z, ~
- static int bcnt = 8;+ {7 Z' e8 A% g- m: c
- static int ccnt = 8;
, d' s6 A( _$ A
2 z: ?* \2 `/ C- module_param(acnt, int, S_IRUGO); Y$ A2 a- _! h) c/ Y+ x
- module_param(bcnt, int, S_IRUGO);. @7 } z/ d6 {
- module_param(ccnt, int, S_IRUGO);
复制代码 $ y$ O) s; q E1 D% a2 `
" [2 H1 e! {- ^5 F, q0 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 H+ z/ Z. f$ M* M+ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 x/ b+ z5 A8 V h2 Z: u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 q$ {1 V: k3 A
2 w1 P7 v2 D% d g& j1 u/ U; @5 D5 k6 C$ H$ c8 y
|
|