本文整理汇总了C++中PVRSRV_DEVICE_NODE::pfnDeInitDevice方法的典型用法代码示例。如果您正苦于以下问题:C++ PVRSRV_DEVICE_NODE::pfnDeInitDevice方法的具体用法?C++ PVRSRV_DEVICE_NODE::pfnDeInitDevice怎么用?C++ PVRSRV_DEVICE_NODE::pfnDeInitDevice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PVRSRV_DEVICE_NODE
的用法示例。
在下文中一共展示了PVRSRV_DEVICE_NODE::pfnDeInitDevice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PVRSRVDeinitialiseDevice
PVRSRV_ERROR IMG_CALLCONV PVRSRVDeinitialiseDevice(IMG_UINT32 ui32DevIndex)
{
PVRSRV_DEVICE_NODE *psDeviceNode;
SYS_DATA *psSysData;
PVRSRV_ERROR eError;
SysAcquireData(&psSysData);
psDeviceNode = (PVRSRV_DEVICE_NODE*)
List_PVRSRV_DEVICE_NODE_Any_va(psSysData->psDeviceNodeList,
&MatchDeviceKM_AnyVaCb,
ui32DevIndex,
IMG_TRUE);
if (!psDeviceNode)
{
PVR_DPF((PVR_DBG_ERROR,"PVRSRVDeinitialiseDevice: requested device %d is not present", ui32DevIndex));
return PVRSRV_ERROR_DEVICEID_NOT_FOUND;
}
eError = PVRSRVSetDevicePowerStateKM(ui32DevIndex,
PVRSRV_DEV_POWER_STATE_OFF,
KERNEL_ID,
IMG_FALSE);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"PVRSRVDeinitialiseDevice: Failed PVRSRVSetDevicePowerStateKM call"));
return eError;
}
eError = ResManFreeResByCriteria(psDeviceNode->hResManContext,
RESMAN_CRITERIA_RESTYPE,
RESMAN_TYPE_DEVICEMEM_ALLOCATION,
IMG_NULL, 0);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"PVRSRVDeinitialiseDevice: Failed ResManFreeResByCriteria call"));
return eError;
}
if(psDeviceNode->pfnDeInitDevice != IMG_NULL)
{
eError = psDeviceNode->pfnDeInitDevice(psDeviceNode);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"PVRSRVDeinitialiseDevice: Failed DeInitDevice call"));
return eError;
}
}
PVRSRVResManDisconnect(psDeviceNode->hResManContext, IMG_TRUE);
psDeviceNode->hResManContext = IMG_NULL;
List_PVRSRV_DEVICE_NODE_Remove(psDeviceNode);
(IMG_VOID)FreeDeviceID(psSysData, ui32DevIndex);
OSFreeMem(PVRSRV_OS_NON_PAGEABLE_HEAP,
sizeof(PVRSRV_DEVICE_NODE), psDeviceNode, IMG_NULL);
return (PVRSRV_OK);
}
示例2: PVRSRVDeinitialiseDevice
/*!
******************************************************************************
@Function PVRSRVDeinitialiseDevice
@Description
This De-inits device
@Input ui32DevIndex : Index to the required device
@Return PVRSRV_ERROR :
******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVDeinitialiseDevice(IMG_UINT32 ui32DevIndex)
{
PVRSRV_DEVICE_NODE *psDeviceNode;
SYS_DATA *psSysData;
PVRSRV_ERROR eError;
SysAcquireData(&psSysData);
psDeviceNode = (PVRSRV_DEVICE_NODE*)
List_PVRSRV_DEVICE_NODE_Any_va(psSysData->psDeviceNodeList,
&MatchDeviceKM_AnyVaCb,
ui32DevIndex,
IMG_TRUE);
if (!psDeviceNode)
{
PVR_DPF((PVR_DBG_ERROR,"PVRSRVDeinitialiseDevice: requested device %d is not present", ui32DevIndex));
return PVRSRV_ERROR_DEVICEID_NOT_FOUND;
}
eError = PVRSRVPowerLock(KERNEL_ID, IMG_FALSE);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"PVRSRVDeinitialiseDevice: Failed PVRSRVPowerLock call"));
return eError;
}
/*
Power down the device if necessary.
*/
eError = PVRSRVSetDevicePowerStateKM(ui32DevIndex,
PVRSRV_DEV_POWER_STATE_OFF);
PVRSRVPowerUnlock(KERNEL_ID);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"PVRSRVDeinitialiseDevice: Failed PVRSRVSetDevicePowerStateKM call"));
return eError;
}
/*
Free the dissociated device memory.
*/
eError = ResManFreeResByCriteria(psDeviceNode->hResManContext,
RESMAN_CRITERIA_RESTYPE,
RESMAN_TYPE_DEVICEMEM_ALLOCATION,
IMG_NULL, 0);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"PVRSRVDeinitialiseDevice: Failed ResManFreeResByCriteria call"));
return eError;
}
/*
De-init the device.
*/
if(psDeviceNode->pfnDeInitDevice != IMG_NULL)
{
eError = psDeviceNode->pfnDeInitDevice(psDeviceNode);
if (eError != PVRSRV_OK)
{
PVR_DPF((PVR_DBG_ERROR,"PVRSRVDeinitialiseDevice: Failed DeInitDevice call"));
return eError;
}
}
/*
Close the device's resource manager context.
*/
PVRSRVResManDisconnect(psDeviceNode->hResManContext, IMG_TRUE);
psDeviceNode->hResManContext = IMG_NULL;
/* remove node from list */
List_PVRSRV_DEVICE_NODE_Remove(psDeviceNode);
/* deallocate id and memory */
(IMG_VOID)FreeDeviceID(psSysData, ui32DevIndex);
OSFreeMem(PVRSRV_OS_NON_PAGEABLE_HEAP,
sizeof(PVRSRV_DEVICE_NODE), psDeviceNode, IMG_NULL);
/*not nulling pointer, out of scope*/
return (PVRSRV_OK);
}