|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 r$ Q5 Q q7 ^3 e( @
- [code]EDMA sample test application( I. s. D5 Q; ]9 g! ~/ \$ D
- /*
6 z" m! B1 `4 j. T6 u - * edma_test.c: G2 m8 ~# ]8 Q. j8 u' {8 c* n5 G( A
- *1 b2 Z) x; T( l& A3 V b
- * brief EDMA3 Test Application" e4 Y% i- j ]/ Y% Z
- *
, c8 a0 E1 \1 T7 E& C& K; N1 M - * This file contains EDMA3 Test code.0 {+ E& T+ k& }, |2 @
- *- L! o8 N) H- i1 k/ I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ^0 K- h; e) Y9 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 S2 l1 V6 B5 t1 Z( q - * TO CHANGE.- F! k- D+ R; | R0 |% a" C
- *
3 U3 w; X" d7 h& b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: e. z9 ~, _$ U Q7 E8 X - *
5 ^; b- X4 C6 P n+ c0 z6 t - * This program is free software; you can redistribute it and/or
6 `/ D* c+ s0 W7 ~* l - * modify it under the terms of the GNU General Public License as
. l0 e& Y+ G+ O; x& ?: S - * published by the Free Software Foundation version 2.
$ i1 O4 j# N2 w' A2 k) w8 {! Z - *& m9 Y2 L- X- R; e8 O) S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* J( S3 A. j F Q
- * kind, whether express or implied; without even the implied warranty7 S2 M' _( _( i5 k' \4 r# r# C! z8 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: k! D, J* B4 `6 Q2 R1 c
- * GNU General Public License for more details.3 s5 F* ]$ a% V# `5 v: u
- */8 I3 d( r; h6 k& E. G7 x, n& \
% j" N) q$ k% _! K' ]1 K2 e) o- n- #include <linux/module.h>
: e& H8 J, Y) \, F - #include <linux/init.h>
) M- | p3 C4 z0 S/ c - #include <linux/errno.h>" Z4 s1 x$ N3 ^! q( f
- #include <linux/types.h>/ s: o* \' |7 L9 @+ b5 t
- #include <linux/interrupt.h>7 V# ]" ?9 D3 n0 k, \9 s2 T9 C& L
- #include <asm/io.h>; ^( l7 `& S- e+ \3 j
- #include <linux/moduleparam.h>5 s0 D( r6 Q$ ]' S& L: d
- #include <linux/sysctl.h>6 w. r! c8 \+ j8 S/ Y. D- i
- #include <linux/mm.h>. X+ {& C/ Z1 B8 v
- #include <linux/dma-mapping.h>( w! X& F6 ^# B0 x* _
- - D$ E. L# O. s
- #include <mach/memory.h>8 h& y$ \, Y3 A* u# C3 P1 |
- #include <mach/hardware.h>6 N4 t% t4 j3 P1 S' U
- #include <mach/irqs.h>
% k y3 x$ I6 g - #include <asm/hardware/edma.h>; A; [; i. G1 I* u' I% g d8 \
4 w1 J: {9 _1 B6 t& u# a# }* \& j1 C( V- #undef EDMA3_DEBUG# K( \' J* q% R
- /*#define EDMA3_DEBUG*/! U& R' G3 H* s2 U
- . Q' w( h( w$ b- \" a
- #ifdef EDMA3_DEBUG
# v/ K+ I: N) p9 j4 g4 K' I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" ^1 E/ @& w/ }; a$ ~- L$ L% I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 d' ^( C: H/ U9 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 y( A; ^! g- c, n0 z5 G. @' U
- #else
/ t; |% |" U a l - #define DMA_PRINTK( x... )0 A3 \- N X5 T* K0 Y0 v
- #define DMA_FN_IN" Y8 z6 j; j$ P3 _9 ?
- #define DMA_FN_OUT* l" J9 b; J' C9 ?- X
- #endif
4 {( i9 i* o' J* K
; b$ Z7 f- K3 i5 n9 L1 E' ]) g9 [" _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" k, O4 e+ P2 r9 _ U- N: g
- #define STATIC_SHIFT 3; d' E8 j% v) L( @- o
- #define TCINTEN_SHIFT 20 `" Q* n3 k2 T3 {" ~
- #define ITCINTEN_SHIFT 21
, }& q+ w! m* s$ t% k; Q - #define TCCHEN_SHIFT 22: o* P% d6 @, u/ f3 M
- #define ITCCHEN_SHIFT 23$ X6 k+ W/ v" C) F* @4 M4 z5 Y
- # G. P4 t8 b6 I0 l3 {+ C
- static volatile int irqraised1 = 0;
' @" j, |7 Q. `& G6 B9 M' Y4 e/ X - static volatile int irqraised2 = 0;- t% ?- m9 C2 `( y; C! @
: o9 F' \1 u: p8 Z# I+ l5 n" H3 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. s& v( ]/ v* n( h3 A* V4 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Y4 o6 K7 Y+ M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ q# a3 A7 y1 E4 Z; {) V- Y- C - ( a2 `- s6 a3 l% G& X
- dma_addr_t dmaphyssrc1 = 0;
& S2 c8 Q5 I I: l - dma_addr_t dmaphyssrc2 = 0;
: W, [4 S& \" C4 _. }: D - dma_addr_t dmaphysdest1 = 0;9 F1 E. c; I D0 B9 n
- dma_addr_t dmaphysdest2 = 0;
4 I8 W1 Y$ @7 j0 B3 D- R9 J
; [6 a0 R1 w" }) _0 G& A% \- char *dmabufsrc1 = NULL;8 c! A2 K- P' O! s
- char *dmabufsrc2 = NULL;
) L2 r. P/ s: A - char *dmabufdest1 = NULL;; _8 r& ?$ C$ S* e+ J
- char *dmabufdest2 = NULL;
$ E+ v1 ?. T; K; Z4 L5 u - 1 p7 S+ W& Y, Y
- static int acnt = 512;
2 G$ `; W) l) `$ g1 r - static int bcnt = 8;: L6 P3 t' D q* E( ^; I. h" K
- static int ccnt = 8;
: j& ?( X V. M - - y& F$ O" s. V- |8 c
- module_param(acnt, int, S_IRUGO);
: |1 Z4 m1 p! G5 D# Y- w. C- V - module_param(bcnt, int, S_IRUGO);- @3 j; `4 ] a3 C
- module_param(ccnt, int, S_IRUGO);
复制代码
, h" _8 p/ M9 T: Z* M P( h# I
. M6 D( Y2 O# u3 {; l9 t7 g1 T& u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 `+ m& t ]. t r, Z+ ]' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 q9 m% {$ m- g2 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% V5 ~6 s! E$ I* a! ~8 t( O1 d/ G1 L
9 k( `9 r( `4 r* g, Q) [9 Q
|
|