/* $Id$ */
/** @file
* VBox Sample Device.
*/
/*
* Copyright (C) 2009-2010 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
/*******************************************************************************
* Structures and Typedefs *
*******************************************************************************/
/**
* Device Instance Data.
*/
typedef struct VBOXSAMPLEDEVICE
{
/** Destruct instance - optional. */
{
/*
* Check the versions here as well since the destructor is *always* called.
*/
AssertMsgReturn(pDevIns->u32Version == PDM_DEVINS_VERSION, ("%#x, expected %#x\n", pDevIns->u32Version, PDM_DEVINS_VERSION), VERR_VERSION_MISMATCH);
AssertMsgReturn(pDevIns->pHlpR3->u32Version == PDM_DEVHLPR3_VERSION, ("%#x, expected %#x\n", pDevIns->pHlpR3->u32Version, PDM_DEVHLPR3_VERSION), VERR_VERSION_MISMATCH);
return VINF_SUCCESS;
}
{
/*
* Check that the device instance and device helper structures are compatible.
*/
AssertLogRelMsgReturn(pDevIns->u32Version == PDM_DEVINS_VERSION, ("%#x, expected %#x\n", pDevIns->u32Version, PDM_DEVINS_VERSION), VERR_VERSION_MISMATCH);
AssertLogRelMsgReturn(pDevIns->pHlpR3->u32Version == PDM_DEVHLPR3_VERSION, ("%#x, expected %#x\n", pDevIns->pHlpR3->u32Version, PDM_DEVHLPR3_VERSION), VERR_VERSION_MISMATCH);
/*
* Initialize the instance data so that the destructure won't mess up.
*/
/*
* Validate and read the configuration.
*/
if (!CFGMR3AreValuesValid(pCfg,
"Whatever1\0"
"Whatever2\0"))
return VINF_SUCCESS;
}
/**
* The device registration structure.
*/
{
/* u32Version */
/* szName */
"sample",
/* szRCMod */
"",
/* szR0Mod */
"",
/* pszDescription */
"VBox Sample Device.",
/* fFlags */
/* fClass */
/* cMaxInstances */
1,
/* cbInstance */
sizeof(VBOXSAMPLEDEVICE),
/* pfnConstruct */
/* pfnDestruct */
/* pfnRelocate */
NULL,
/* pfnMemSetup */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
NULL,
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnAttach */
NULL,
/* pfnDetach */
NULL,
/* pfnQueryInterface */
NULL,
/* pfnInitComplete */
NULL,
/* pfnPowerOff */
NULL,
/* pfnSoftReset */
NULL,
/* u32VersionEnd */
};
/**
* Register builtin devices.
*
* @returns VBox status code.
* @param pCallbacks Pointer to the callback table.
* @param u32Version VBox version number.
*/
{
LogFlow(("VBoxSampleDevice::VBoxDevicesRegister: u32Version=%#x pCallbacks->u32Version=%#x\n", u32Version, pCallbacks->u32Version));
}