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

📄 debug.cpp

📁 hidclass source code for windows ce use
💻 CPP
字号:
//
// 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:  

    debug.cpp

Abstract:  
    USB Client Driver for Human Interface Device (HID) Class.

Functions:

Notes: 

--*/

#include "usbhid.h"


#ifdef DEBUG


// Debug Zones
#define DBG_ERROR              0x0001
#define DBG_WARNING            0x0002
#define DBG_INIT               0x0004
#define DBG_FUNCTION           0x0008

#define DBG_HID_DATA           0x0010
#define DBG_COMMENT            0x0020

#define DBG_PARSE              0x0100

#define DBG_USB_CLIENT         0x8000

DBGPARAM dpCurSettings = {
    _T("UsbHid"), 
    {
        _T("Errors"), _T("Warnings"), _T("Init"), _T("Function"),
        _T("HID Data"), _T("Comments"), _T(""), _T(""),
        _T("Parsing"), _T(""), _T(""), _T(""),
        _T(""), _T(""), _T(""), _T("USB Client") 
    },
    DBG_ERROR | DBG_WARNING 
};


//
// ***** Debug utility functions *****
//


// Returns true if the Hid context is locked
BOOL
IsUsbHidContextLocked(
    const USBHID_CONTEXT *pUsbHid
    )
{
    PREFAST_DEBUGCHK(pUsbHid != NULL);
    return DebugIsLocked(pUsbHid->cInCS);
}


// Take the Hid context lock
void
LockUsbHidContext(
    USBHID_CONTEXT *pUsbHid
    )
{
    DEBUGCHK(pUsbHid != NULL);
    DebugLock(&pUsbHid->csLock, &pUsbHid->cInCS);
}


// Release the Hid context lock
void
UnlockUsbHidContext(
    USBHID_CONTEXT *pUsbHid
    )
{
    DEBUGCHK(pUsbHid != NULL);
    DebugUnlock(&pUsbHid->csLock, &pUsbHid->cInCS);
}


// Verify the integrity of a device context.
void
ValidateUsbHidContext(
    PUSBHID_CONTEXT pUsbHid 
    )
{
    PREFAST_DEBUGCHK(pUsbHid != NULL);

    LockUsbHidContext(pUsbHid);

    DEBUGCHK(pUsbHid->Sig == USB_HID_SIG);
    DEBUGCHK(pUsbHid->hEP0Event != NULL);
    DEBUGCHK(pUsbHid->hUsbDevice != NULL);
    DEBUGCHK(pUsbHid->InterruptIn.hPipe != NULL);
    DEBUGCHK(pUsbHid->InterruptIn.hEvent != NULL);
    DEBUGCHK(pUsbHid->pUsbFuncs != NULL);
    DEBUGCHK(pUsbHid->pUsbInterface != NULL);
	if (pUsbHid->fhThreadInited == TRUE) {
		DEBUGCHK(pUsbHid->hThread != NULL);
	}

    UnlockUsbHidContext(pUsbHid);
}


#endif // DEBUG


⌨️ 快捷键说明

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