VBoxUsbDev.h revision ea011c6d420ca798e246c09234845dfdedcda4ac
/* $Id$ */
/** @file
* VBoxUsbDev.h - USB device.
*/
/*
* Copyright (C) 2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ___VBoxUsbDev_h___
#define ___VBoxUsbDev_h___
#include "VBoxUsbCmn.h"
typedef struct VBOXUSB_GLOBALS
{
extern VBOXUSB_GLOBALS g_VBoxUsbGlobals;
/* pnp state decls */
typedef enum
{
ENMVBOXUSB_PNPSTATE_FORSEDWORD = 0x8fffffff
#ifdef DEBUG
#else
#endif
typedef struct VBOXUSB_PNPSTATE
{
/* Current state */
volatile ENMVBOXUSB_PNPSTATE Curr;
/* Previous state, used to restore state info on cancell stop device */
typedef struct VBOXUSBDEV_DDISTATE
{
/* Lock */
/* current dev caps */
typedef struct VBOXUSBDEV_EXT
{
/* pnp state api */
{
return (ENMVBOXUSB_PNPSTATE)ASMAtomicUoReadU32((volatile uint32_t*)&pDevExt->DdiState.PnPState.Curr);
}
static DECLINLINE(ENMVBOXUSB_PNPSTATE) vboxUsbPnPStateSet(PVBOXUSBDEV_EXT pDevExt, ENMVBOXUSB_PNPSTATE enmState)
{
pDevExt->DdiState.PnPState.Prev = (ENMVBOXUSB_PNPSTATE)ASMAtomicUoReadU32((volatile uint32_t*)&pDevExt->DdiState.PnPState.Curr);
return enmState;
}
{
ASMAtomicWriteU32((volatile uint32_t*)&pDevExt->DdiState.PnPState.Curr, (uint32_t)pDevExt->DdiState.PnPState.Prev);
return enmNewState;
}
{
pDevExt->DdiState.PnPState.Curr = pDevExt->DdiState.PnPState.Prev = ENMVBOXUSB_PNPSTATE_START_PENDING;
}
{
}
{
bool bRetained = true;
{
}
else
{
bRetained = false;
}
return bRetained;
}
/* if device is removed - does nothing and returns zero,
* otherwise increments a ref counter and returns the current pnp state
* NOTE: never returns ENMVBOXUSB_PNPSTATE_REMOVED
* */
{
if (enmState != ENMVBOXUSB_PNPSTATE_REMOVED)
{
}
}
{
}
{
}
{
}
{
}
{
}
#endif /* #ifndef ___VBoxUsbDev_h___ */