|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; j4 M5 z- L$ g# n0 V" J
- [code]EDMA sample test application3 Z4 Q% X- h4 N6 F2 z7 E
- /*# l0 q3 ^1 v' B, b
- * edma_test.c/ M' j$ D# N1 ^: v1 b
- *
- ~/ N3 D$ p( ^! n1 k, H& @ - * brief EDMA3 Test Application/ j& Y- }8 f `- a6 E/ _9 n$ A
- *3 \( M* o6 R4 `
- * This file contains EDMA3 Test code.9 P3 i* f& A1 h, D
- *
* `9 m' v5 ]5 D) u, l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 k+ A$ H+ N+ N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; P. V% e6 y+ p3 ^" U - * TO CHANGE.3 K r* U. v$ W5 I4 M; d
- *
1 X a# u7 I) b+ x9 g5 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! I+ d8 k: P% |% p
- *
6 C$ D2 C4 I, D4 G+ z - * This program is free software; you can redistribute it and/or
- I& z/ i+ f% U3 V& d; g, e& O4 d - * modify it under the terms of the GNU General Public License as
; b, _: v6 N! c1 H - * published by the Free Software Foundation version 2.
" T e! H- H0 q6 t4 y! ]) ` - *
, M: u0 W `3 v6 p. C- h* B% d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 }% t# d$ w7 c* ~& \ - * kind, whether express or implied; without even the implied warranty
+ o; O! ?6 L U8 b* n' [* l" ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; ~" a2 V4 ~2 f6 \# N" i3 B
- * GNU General Public License for more details.
: R0 Y4 D$ w% J7 I - */
- g0 L F* l& H5 ^" ]7 A# I
) I- l, {% [. P# b5 u- #include <linux/module.h>
" l( y6 p& H" L2 q) k j U - #include <linux/init.h>
/ d0 e" D- ]( ?9 w) z. k - #include <linux/errno.h>, { H4 j, u; o( D, ?% V
- #include <linux/types.h>
( h2 r- ~+ |( z5 j$ T - #include <linux/interrupt.h>
$ H5 A2 a1 G7 G4 z7 m - #include <asm/io.h>
, {. W1 l( X, p, I7 C/ v - #include <linux/moduleparam.h> {- Q$ Q4 L7 }" o' `0 `
- #include <linux/sysctl.h>
6 {3 k% c) X$ Y" L2 j - #include <linux/mm.h>
! _* Q6 K- P! H' c! T( J, V8 d - #include <linux/dma-mapping.h>
" F3 R3 j( R9 O& O$ ?" l
2 [1 g p: x, o, c! ~. w- #include <mach/memory.h>+ L' f7 w) Z8 D& J' ~
- #include <mach/hardware.h>$ s* P) g- f8 q# X8 T. [
- #include <mach/irqs.h>
& w4 t! b0 b' ~4 [3 \0 x1 \4 @ - #include <asm/hardware/edma.h>
+ f7 c" v- |7 I" |3 I
0 c2 y4 m( y* _1 f0 g* y' v, g- #undef EDMA3_DEBUG5 v2 H4 l! v9 f1 m2 e
- /*#define EDMA3_DEBUG*/8 ~. n( b6 ~% G. A. x+ n# R
- 8 g* B) F; |7 j9 W
- #ifdef EDMA3_DEBUG
7 Q- Q, D, Z( z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 Z6 _# b2 v+ I# r$ F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' ]: }/ x: C z$ O0 E- \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ j! ]- b6 R s' F/ `) @
- #else/ H$ f) Q" F1 e! N( C/ ~0 l: S' b
- #define DMA_PRINTK( x... )
, ]3 b' ]7 C: r. g; C - #define DMA_FN_IN
* O* t# h- f( u* m& x - #define DMA_FN_OUT8 d( M I6 f6 C7 ?" \" Y
- #endif
+ z0 z; J! f6 R4 K3 n - / ~. V) p: g5 b1 |5 H, g+ q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 T- t& Q! F L3 M - #define STATIC_SHIFT 3
5 r/ e) U u# `# E3 N2 _+ k$ v. H - #define TCINTEN_SHIFT 20
' p/ x, ]3 V* S, e4 _# ~( t7 G - #define ITCINTEN_SHIFT 21
) W( a0 p& |! R( F) H, o - #define TCCHEN_SHIFT 22
[) |) ]' W0 y4 l5 k4 j5 B - #define ITCCHEN_SHIFT 23
* ]8 O: A3 X) v - " i+ o& R, A! S; C- {6 e: a
- static volatile int irqraised1 = 0;9 \( J- e4 k1 ]- C. _, H. T8 s
- static volatile int irqraised2 = 0;. Q T& R/ ^; O) c/ N
! O1 d3 j) K' s4 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `) E0 Y. W e o5 t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 _, z1 L& L# \" j5 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% D9 r& w6 H4 T. s7 G4 R
# M6 s) S, T- H+ u' z. L8 H: z- dma_addr_t dmaphyssrc1 = 0;3 n# n" C6 |: S" |! T% z$ ]* m
- dma_addr_t dmaphyssrc2 = 0;
& }3 o4 X' J8 q/ A a( v - dma_addr_t dmaphysdest1 = 0;4 v1 V7 b3 o; |# i0 V+ V2 Y
- dma_addr_t dmaphysdest2 = 0;& V5 G' K$ ?9 `0 O* X5 U8 y D0 D
# ~" k& G0 @5 y) P1 x1 n* l4 f- char *dmabufsrc1 = NULL;: o& Y% n- R" K: |, G4 M s
- char *dmabufsrc2 = NULL;! c% ~. v* c1 ~! w
- char *dmabufdest1 = NULL;6 P. z3 k# [9 V! q" |7 z, A3 `
- char *dmabufdest2 = NULL;
( U) o, a. L$ V. _ - ' g: p3 U. W1 { U3 ~2 L
- static int acnt = 512;9 H* F( M) Z; f( o
- static int bcnt = 8;6 Y' p% ]7 v8 n7 S! ^. t N( l9 f
- static int ccnt = 8;
- e$ B$ U% o& L; H* X) Q - . ~: ~) C" L$ G! A- a# l, v7 n+ I% m
- module_param(acnt, int, S_IRUGO);
; [+ g) ?1 w. v' W, U - module_param(bcnt, int, S_IRUGO);
, Y# Q1 E1 Q) Y, Y, W4 l- {* v - module_param(ccnt, int, S_IRUGO);
复制代码 - d$ m# Z- J0 a9 a, t& ?8 M6 f% R
. {# D5 s- ^+ D* c2 u i* J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! a7 C# t" {/ ]! j' }% {0 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 [1 r& H, ~) l! ^+ T) g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: m! C: K/ _- U
8 X( b" B2 f& `2 `! G! S
! P/ F: P: ^: M$ g$ u
|
|