⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wavecommon.h

📁 CIRRUS 93XX系列windows mobile 6.0 BSP
💻 H
字号:
//**********************************************************************
//                                                                      
// Filename: wavecommon.h
//                                                                      
// Description: Include file common to all audio drivers.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Use of this source code is subject to the terms of the Cirrus end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to 
// use this source code. For a copy of the EULA, please see the 
// EULA.RTF on your install media.
//
// Copyright(c) Cirrus Logic Corporation 2005, All Rights Reserved                       
//                                                                      
//**********************************************************************
#ifndef _H_WAVECOMMON
#define _H_WAVECOMMON

//
// Includes common to all the MDD files.
//
#include <windows.h>
#include <ceddk.h>
#include <nkintr.h>
#include <mmddk.h>
#include <wavedev.h>
#include <oalintr.h>
#include <kfuncs.h>
#include <mmreg.h>
#include <hwdefs.h>
#include <clocks.h>
#include <haluser.h>
#include <audiopio.h>

#include <waveddsi.h>

#include "src.h"
#include "pingpongdma.h"
#include "pingpongpio.h"
#include "codecinterface.h"
#include "waveout.h"
#include "wavein.h"
#include "i2saudio.h"
#include "ac97codec.h"
#include "mixer.h"

//
// dwBytesRecorded is being used to indicate how far output has progressed
//
#define IS_BUFFER_SENT(pwh)      ((pwh)->dwBytesRecorded >= (pwh)->dwBufferLength)
#define IS_BUFFER_FULL(pwh)      ((pwh)->dwBytesRecorded >= (pwh)->dwBufferLength)
#define IS_BUFFER_DONE(pwh)      ((pwh)->dwFlags & WHDR_DONE)
#define IS_BUFFER_PREPARED(pwh)  ((pwh)->dwFlags & WHDR_PREPARED)
#define IS_BUFFER_QUEUED(pwh)    ((pwh)->dwFlags & WHDR_INQUEUE)
#define IS_BUFFER_BEGINLOOP(pwh) ((pwh)->dwFlags & WHDR_BEGINLOOP)
#define IS_BUFFER_ENDLOOP(pwh)   ((pwh)->dwFlags & WHDR_ENDLOOP)
#define IS_BUFFER_INLOOP(pwh)    ((pwh)->reserved)

#define MARK_BUFFER_FULL(pwh)       ((pwh)->dwBytesRecorded = (pwh)->dwBufferLength)
#define MARK_BUFFER_EMPTY(pwh)      ((pwh)->dwBytesRecorded = 0)
#define MARK_BUFFER_NOT_INLOOP(pwh) ((pwh)->reserved = 0)
#define MARK_BUFFER_INLOOP(pwh)     ((pwh)->reserved = 1)
#define MARK_BUFFER_DONE(pwh)       ((pwh)->dwFlags |=  WHDR_DONE)
#define MARK_BUFFER_NOT_DONE(pwh)   ((pwh)->dwFlags &= ~WHDR_DONE)
#define MARK_BUFFER_PREPARED(pwh)   ((pwh)->dwFlags |=  WHDR_PREPARED)
#define MARK_BUFFER_UNPREPARED(pwh) ((pwh)->dwFlags &= ~WHDR_PREPARED)
#define MARK_BUFFER_QUEUED(pwh)     ((pwh)->dwFlags |=  WHDR_INQUEUE)
#define MARK_BUFFER_DEQUEUED(pwh)   ((pwh)->dwFlags &= ~WHDR_INQUEUE)

//
// DEBUG message support
//

#ifdef DEBUG
//
// For debug builds, use the real zones.
//
#define ZONE_MXDM       DEBUGZONE(0)
#define ZONE_PARAMS     DEBUGZONE(1)
#define ZONE_VERBOSE    DEBUGZONE(2)
#define ZONE_INTERRUPT  DEBUGZONE(3)
#define ZONE_WODM       DEBUGZONE(4)
#define ZONE_WIDM       DEBUGZONE(5)
#define ZONE_AC97       DEBUGZONE(6)
#define ZONE_I2S        DEBUGZONE(7)
#define ZONE_DMA        DEBUGZONE(8)
#define ZONE_IOCTL      DEBUGZONE(12)
#define ZONE_FUNCTION   DEBUGZONE(13)
#define ZONE_WARN       DEBUGZONE(14)
#define ZONE_ERROR      DEBUGZONE(15)

#else
//
// For retail builds, use forced messages based on the zones turned on below.
//
#define BIG_SWITCH      0 
#define ZONE_MXDM       BIG_SWITCH
#define ZONE_PARAMS     BIG_SWITCH
#define ZONE_VERBOSE    BIG_SWITCH
#define ZONE_INTERRUPT  BIG_SWITCH
#define ZONE_WODM       BIG_SWITCH
#define ZONE_WIDM       BIG_SWITCH
#define ZONE_AC97       BIG_SWITCH
#define ZONE_I2S        BIG_SWITCH
#define ZONE_DMA        BIG_SWITCH
#define ZONE_IOCTL      BIG_SWITCH
#define ZONE_ALLOC      BIG_SWITCH
#define ZONE_FUNCTION   1
#define ZONE_WARN       1
#define ZONE_ERROR      1
#endif

//#define PRINTMSG(cond, printf_exp)       ((void)((cond)?(NKDbgPrintfW printf_exp),1:0))
#define PRINTMSG(cond, printf_exp)       DEBUGMSG(cond, printf_exp)


#define FUNC(x)         PRINTMSG(ZONE_FUNCTION,  x)  
#define FUNC_WAVEIN(x)  PRINTMSG(ZONE_FUNCTION && ZONE_WIDM, x)
#define FUNC_WAVEOUT(x) PRINTMSG(ZONE_FUNCTION && ZONE_WODM, x)  
#define FUNC_DMA(x)     PRINTMSG(ZONE_FUNCTION && ZONE_DMA, x)  
#define FUNC_AC97(x)    PRINTMSG(ZONE_FUNCTION && ZONE_AC97, x)
#define FUNC_I2S(x)     PRINTMSG(ZONE_FUNCTION && ZONE_I2S, x)
#define WIDM_MSG(x)     PRINTMSG(ZONE_WIDM, x)
#define WODM_MSG(x)     PRINTMSG(ZONE_WODM, x)
#define AC97_MSG(x)     PRINTMSG(ZONE_AC97, x)
#define I2S_MSG(x)      PRINTMSG(ZONE_I2S, x)
#define ERRMSG(x)       PRINTMSG(ZONE_ERROR, x )
#define PARAMS_MSG(x)   PRINTMSG(ZONE_PARAMS, x )

//#define BUFFER_SIZE       2048
//#define BUFFER_SIZE       4096
//#define BUFFER_SIZE         8192      

//
// Buffer size in samples
//
#define DMA_BUFFER_SIZE         2048
//#define I2S_BUFFER_SIZE     8192
//#define AC97_BUFFER_
//#define BUFFER_SIZE         0x10000

//
// These numbers really don't matter.
//
#define     MM_CRYSTAL_EP9312_WAVEIN        1
#define     MM_CRYSTAL_EP9312_WAVEOUT       2
#define     MM_CRYSTAL_EP9312_MIXER         3


//
// Wave helper routines.
//
void MarkAllAsDone( PWAVEHDR  pWave);
void MarkAllAsNotInLoop( PWAVEHDR    pWave);
void MarkAllAsFull( PWAVEHDR  pWave);
void MarkFullAsDone(PWAVEHDR  pWave);

#define MMSUCCESS(x)        (x == MMSYSERR_NOERROR)

#endif // _H_WAVECOMMON

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -