Ejemplo n.º 1
0
PVRSRV_ERROR IMG_CALLCONV PVRSRVInit(PSYS_DATA psSysData)
{
	PVRSRV_ERROR	eError;

	eError = PVRSRVCreateSysfsEntry();
	if (eError != PVRSRV_OK)
	{
		goto Error;
	}

	eError = ResManInit();
	if (eError != PVRSRV_OK)
	{
		goto Error;
	}

	eError = PVRSRVPerProcessDataInit();
	if(eError != PVRSRV_OK)
	{
		goto Error;
	}

	
	eError = PVRSRVHandleInit();
	if(eError != PVRSRV_OK)
	{
		goto Error;
	}

	
	eError = OSCreateResource(&psSysData->sPowerStateChangeResource);
	if (eError != PVRSRV_OK)
	{
		goto Error;
	}

	
	psSysData->eCurrentPowerState = PVRSRV_SYS_POWER_STATE_D0;
	psSysData->eFailedPowerState = PVRSRV_SYS_POWER_STATE_Unspecified;

	
	if(OSAllocMem( PVRSRV_PAGEABLE_SELECT,
					 sizeof(PVRSRV_EVENTOBJECT) ,
					 (IMG_VOID **)&psSysData->psGlobalEventObject, 0,
					 "Event Object") != PVRSRV_OK)
	{

		goto Error;
	}

	if(OSEventObjectCreateKM("PVRSRV_GLOBAL_EVENTOBJECT", psSysData->psGlobalEventObject) != PVRSRV_OK)
	{
		goto Error;
	}

	
	psSysData->pfnHighResTimerCreate = OSFuncHighResTimerCreate;
	psSysData->pfnHighResTimerGetus = OSFuncHighResTimerGetus;
	psSysData->pfnHighResTimerDestroy = OSFuncHighResTimerDestroy;

#if defined(TTRACE)
	eError = PVRSRVTimeTraceInit();
	if (eError != PVRSRV_OK)
		goto Error;
	g_ui32InitFlags |= INIT_DATA_ENABLE_TTARCE;
#endif

	
	PDUMPINIT();
	g_ui32InitFlags |= INIT_DATA_ENABLE_PDUMPINIT;

	PERFINIT();
	return eError;

Error:
	PVRSRVDeInit(psSysData);
	return eError;
}
Ejemplo n.º 2
0
/*!
******************************************************************************

 @Function	PVRSRVInit

 @Description	Initialise services

 @Input	   psSysData	: sysdata structure

 @Return   PVRSRV_ERROR	:

******************************************************************************/
PVRSRV_ERROR IMG_CALLCONV PVRSRVInit(PSYS_DATA psSysData)
{
	PVRSRV_ERROR	eError;

	/* Initialise Resource Manager */
	eError = ResManInit();
	if (eError != PVRSRV_OK)
	{
		goto Error;
	}

	eError = PVRSRVPerProcessDataInit();
	if(eError != PVRSRV_OK)
	{
		goto Error;
	}

	/* Initialise handles */
	eError = PVRSRVHandleInit();
	if(eError != PVRSRV_OK)
	{
		goto Error;
	}

	/* Initialise Power Manager Lock */
	eError = OSCreateResource(&psSysData->sPowerStateChangeResource);
	if (eError != PVRSRV_OK)
	{
		goto Error;
	}

	/* Initialise system power state */
	psSysData->eCurrentPowerState = PVRSRV_SYS_POWER_STATE_D0;
	psSysData->eFailedPowerState = PVRSRV_SYS_POWER_STATE_Unspecified;

	/* Create an event object */
	if(OSAllocMem( PVRSRV_PAGEABLE_SELECT,
					 sizeof(PVRSRV_EVENTOBJECT) ,
					 (IMG_VOID **)&psSysData->psGlobalEventObject, 0,
					 "Event Object") != PVRSRV_OK)
	{

		goto Error;
	}

	if(OSEventObjectCreateKM("PVRSRV_GLOBAL_EVENTOBJECT", psSysData->psGlobalEventObject) != PVRSRV_OK)
	{
		goto Error;
	}

	/* Store OS high res timer fallbacks, the system is free to overide these */
	psSysData->pfnHighResTimerCreate = OSFuncHighResTimerCreate;
	psSysData->pfnHighResTimerGetus = OSFuncHighResTimerGetus;
	psSysData->pfnHighResTimerDestroy = OSFuncHighResTimerDestroy;

#if defined(TTRACE)
	eError = PVRSRVTimeTraceInit();
	if (eError != PVRSRV_OK)
		goto Error;
	g_ui32InitFlags |= INIT_DATA_ENABLE_TTARCE;
#endif

	/* Initialise pdump */
	PDUMPINIT();
	g_ui32InitFlags |= INIT_DATA_ENABLE_PDUMPINIT;

#if defined(SUPPORT_ION)
	eError = PVRSRVInitDeviceMem();
	if (eError != PVRSRV_OK)
		goto Error;
	g_ui32InitFlags |= INIT_DATA_ENABLE_DEVMEM;
#endif

	PERFINIT();
	return eError;

Error:
	PVRSRVDeInit(psSysData);
	return eError;
}