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

📄 wavemdd.h

📁 Windows CE操作系统中适用的蓝牙驱动程序
💻 H
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft 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 LICENSE.RTF on your
// install media.
//
// -----------------------------------------------------------------------------
//
//      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.
//  
// -----------------------------------------------------------------------------
//
//  Module Name:  
//  
//      wavemdd.h
//  
//  Abstract:  
//  
//  Functions:
//  
//  Notes:
//  
// -----------------------------------------------------------------------------
#ifndef __WAVEMDD_H__
#define __WAVEMDD_H__

//
// Includes common to all the MDD files.
//
#include <windows.h>
#include <types.h>
#include <memory.h>
#include <string.h>
#include <nkintr.h>
#include <excpt.h>
#include <wavedbg.h>
#include <wavedev.h>
#include <waveddsi.h>
#include <mmddk.h>
#include <devload.h>
#include <pkfuncs.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct  {
    DWORD  dwOpenData;
    DWORD  dwCode;
    PBYTE  pBufIn;
    DWORD  dwLenIn;
    PBYTE  pBufOut;
    DWORD  dwLenOut;
    PDWORD pdwActualOut;
} IOCTL_PARAMS, *PIOCTL_PARAMS;


typedef struct {
    PWAVEHDR        pwh;
    PWAVEHDR        pwhReal;
    BOOL            bInLoop;
    BOOL            bStarted;
    BOOL            bPaused;            // Is stream paused?
    BOOL            bInMiddle;          // Slightly different than bStarted.
                                        //  used with bPaused.
    DRVCALLBACK*    pfnCallback;
    DWORD           dwInstance;         // callback instance data
    DWORD           dwOpenFlags;
    PWAVEFORMATEX   pwfx;
    HANDLE          hWave;
    DWORD           dwBytePosition;
} STREAM_INFO, *PSTREAM_INFO;


extern STREAM_INFO gsi[];
extern BOOL g_fInitSco;

// WaveDev thread priority
#define DEFAULT_THREAD_PRIORITY 210
#define REGISTRY_PRIORITY_VALUE TEXT("Priority256")

// DEVICE.EXE Driver status.
extern BOOL    g_bDriverInitialized;    //  whether it has been inited or not
extern BOOL    g_bDriverOpened;         // The driver WAV? has been opened.

extern CRITICAL_SECTION v_GSICritSect[];

#define   LOCK_GSI(apidir)  EnterCriticalSection(&(v_GSICritSect[apidir]))
#define UNLOCK_GSI(apidir)  LeaveCriticalSection(&(v_GSICritSect[apidir])) 

//
// 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)

DWORD
GetBytePosition(
    WAPI_INOUT apidir
    );

VOID
InitGSI(
    WAPI_INOUT apidir
    );


VOID
RemoveCompleteBlocks(
    WAPI_INOUT apidir
    );

VOID
MarkAllAsDone(
    WAPI_INOUT apidir
    );

VOID
MarkAllAsNotInLoop(
    WAPI_INOUT apidir
    );

VOID
MarkFullAsDone(
    WAPI_INOUT apidir
    );


VOID
WAPI_Callback(
    WAPI_INOUT apidir,
    UINT uMsg,
    DWORD dwParam1,
    DWORD dwParam2
    );

VOID
WMDD_PowerHandler(
    BOOL power_down
    );

BOOL
WMDD_Deinit(
    DWORD dwData
    );

DWORD
WMDD_Init(
    DWORD Index
    );

int InitSco(void);
int DeinitSco(void);

DWORD wdev_COMMON_GETDEVCAPS    (WAPI_INOUT apidir, UINT  uDeviceId, DWORD dwUser,DWORD dwParam1,DWORD dwParam2);
DWORD wdev_COMMON_GETPOS        (WAPI_INOUT apidir, UINT  uDeviceId, DWORD dwUser,DWORD dwParam1,DWORD dwParam2);
DWORD wdev_COMMON_OPEN          (WAPI_INOUT apidir, UINT  uDeviceId, DWORD dwUser,DWORD dwParam1,DWORD dwParam2);
DWORD wdev_COMMON_ADDBUFFER     (WAPI_INOUT apidir, UINT  uDeviceId, DWORD dwUser,DWORD dwParam1,DWORD dwParam2);
DWORD wdev_COMMON_CLOSE         (WAPI_INOUT apidir, UINT  uDeviceId, DWORD dwUser,DWORD dwParam1,DWORD dwParam2);
DWORD wdev_COMMON_GETNUMDEVS    (WAPI_INOUT apidir, UINT  uDeviceId, DWORD dwUser,DWORD dwParam1,DWORD dwParam2);
DWORD wdev_COMMON_PREPARE       (WAPI_INOUT apidir, UINT  uDeviceId, DWORD dwUser,DWORD dwParam1,DWORD dwParam2);
DWORD wdev_COMMON_UNPREPARE     (WAPI_INOUT apidir, UINT  uDeviceId, DWORD dwUser,DWORD dwParam1,DWORD dwParam2);

DWORD wdev_WODM_BREAKLOOP       (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WODM_GETPITCH        (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WODM_GETPLAYBACKRATE (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WODM_GETVOLUME       (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WODM_PAUSE           (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WODM_RESET           (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WODM_RESTART         (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WODM_SETPITCH        (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WODM_SETPLAYBACKRATE (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WODM_SETVOLUME       (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WODM_WRITE           (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WODM_GETEXTDEVCAPS    (WAPI_INOUT apidir, UINT  uDeviceId, DWORD dwUser,DWORD dwParam1,DWORD dwParam2);

DWORD wdev_WIDM_RESET           (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WIDM_START           (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD wdev_WIDM_STOP            (UINT uDeviceId, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);


//
// debug 
//

#define BSS_DECPARAM(x)             DEBUGMSG(ZONE_FUNCTION && ZONE_PARAMS,  (TEXT("BTSCOSND::\tPARAM : ")TEXT( #x )TEXT(" = %d\r\n"), x))
#define BSS_HEXPARAM(x)             DEBUGMSG(ZONE_FUNCTION && ZONE_PARAMS,  (TEXT("BTSCOSND::\tPARAM : ")TEXT( #x )TEXT(" = 0x%X\r\n"), x))
#define BSS_FUNC_WMDD(x)            DEBUGMSG(ZONE_FUNCTION && ZONE_MDD,     (TEXT("BTSCOSND::\t[FUNC] %a()\r\n"), x))
#define BSS_FUNC_WPDD(x)            DEBUGMSG(ZONE_FUNCTION && ZONE_PDD,     (TEXT("BTSCOSND::\t\t[FUNC] %a()\r\n"), x))
#define BSS_VERBOSE(str)            DEBUGMSG(ZONE_VERBOSE,  (TEXT("BTSCOSND:: ")TEXT( #str )TEXT("\r\n")))
#define BSS_VERBOSE1(str,x1)        DEBUGMSG(ZONE_VERBOSE,  (TEXT("BTSCOSND:: ")TEXT( #str )TEXT("\r\n"), x1))
#define BSS_VERBOSE2(str,x1,x2)     DEBUGMSG(ZONE_VERBOSE,  (TEXT("BTSCOSND:: ")TEXT( #str )TEXT("\r\n"), x1, x2))
#define BSS_ERRMSG(str)             DEBUGMSG(ZONE_ERROR,    (TEXT("BTSCOSND:: [ERROR] ")TEXT( #str )TEXT("\r\n")))
#define BSS_ERRMSG1(str,x1)         DEBUGMSG(ZONE_ERROR,    (TEXT("BTSCOSND:: [ERROR] ")TEXT( #str )TEXT("\r\n"), x1))
#define BSS_ERRMSG2(str,x1,x2)      DEBUGMSG(ZONE_ERROR,    (TEXT("BTSCOSND:: [ERROR] ")TEXT( #str )TEXT("\r\n"), x1, x2))
#define BSS_INTMSG(str)             DEBUGMSG(ZONE_INTERRUPT,(TEXT("BTSCOSND:: [INTR] ")TEXT( #str )TEXT("\r\n")))
#define BSS_INTMSG1(str,x1)         DEBUGMSG(ZONE_INTERRUPT,(TEXT("BTSCOSND:: [INTR] ")TEXT( #str )TEXT("\r\n"), x1))
#define BSS_INTMSG2(str,x1,x2)      DEBUGMSG(ZONE_INTERRUPT,(TEXT("BTSCOSND:: [INTR] ")TEXT( #str )TEXT("\r\n"), x1, x2))
#define BSS_WODM(str)               DEBUGMSG(ZONE_WODM,     (TEXT("BTSCOSND:: [WODM] ")TEXT( #str )TEXT("\r\n")))
#define BSS_WIDM(str)               DEBUGMSG(ZONE_WIDM,     (TEXT("BTSCOSND:: [WIDM] ")TEXT( #str )TEXT("\r\n")))
#define BSS_FUNCTION(str,x1)        DEBUGMSG(ZONE_FUNCTION, (TEXT("BTSCOSND:: [FUNC] ")TEXT( #str )TEXT("\r\n")))
#define BSS_FUNCTION1(str,x1)       DEBUGMSG(ZONE_FUNCTION, (TEXT("BTSCOSND:: [FUNC] ")TEXT( #str )TEXT("\r\n"), x1))
#define BSS_FUNCTION2(str,x1,x2)    DEBUGMSG(ZONE_FUNCTION, (TEXT("BTSCOSND:: [FUNC] ")TEXT( #str )TEXT("\r\n"), x1, x2))
#define BSS_FUNCTION3(str,x1,x2,x3) DEBUGMSG(ZONE_FUNCTION, (TEXT("BTSCOSND:: [FUNC] ")TEXT( #str )TEXT("\r\n"), x1, x2,x3))
#define BSS_MISC1(str,x1)           DEBUGMSG(ZONE_MISC,     (TEXT("BTSCOSND:: [MISC] ")TEXT( #str )TEXT("\r\n"), x1))
#define BSS_MISC2(str,x1,x2)        DEBUGMSG(ZONE_MISC,     (TEXT("BTSCOSND:: [MISC] ")TEXT( #str )TEXT("\r\n"), x1, x2))
#define BSS_MISC3(str,x1,x2,x3)     DEBUGMSG(ZONE_MISC,     (TEXT("BTSCOSND:: [MISC] ")TEXT( #str )TEXT("\r\n"), x1, x2,x3))
#define BSS_MISC4(str,x1,x2,x3,x4)  DEBUGMSG(ZONE_MISC,     (TEXT("BTSCOSND:: [MISC] ")TEXT( #str )TEXT("\r\n"), x1, x2,x3,x4))


#ifdef __cplusplus
}
#endif

#endif // __WAVEMDD_H__

⌨️ 快捷键说明

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