📄 init.cpp
字号:
/***************************************************************************
* Name : init.cpp
* Title : MBX WinCE driver GPE class
* Author(s) : Imagination Technologies
* Created : 6th January 2003
*
* Copyright : 2003 by Imagination Technologies. All rights reserved.
* : No part of this software, either material or conceptual
* : may be copied or distributed, transmitted, transcribed,
* : stored in a retrieval system or translated into any
* : human or computer language in any form by any means,
* : electronic, mechanical, manual or other-wise, or
* : disclosed to third parties without the express written
* : permission of Imagination Technologies Limited, Unit 8,
* : HomePark Industrial Estate, King's Langley, Hertfordshire,
* : WD4 8LZ, U.K.
*
* Description : MBX WinCE driver GPE class.
*
* Platform : WinCE
*
* Modifications:-
* $Log: init.cpp $
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
* --- Revision Logs Removed ---
*
****************************************************************************/
#include "precomp.h"
#include "regpaths.h"
extern "C"
{
#include "cgating.h"
}
#ifdef SW_SIM
extern "C"
{
PPVRSRV_DEV_INFO gpsDevInfo = NULL;
}
#endif
/*****************************************************************************
FUNCTION : InitializeHardware
PURPOSE : This top-level function coordinates locating the device, initializing it,
reading it's configuration data, and making sure the driver data
structures are initialize correcrtly. We expect to only be called ONCE.
PARAMETERS :
RETURNS :
*****************************************************************************/
BOOL MBX::InitializeHardware(void)
{
BOOL bRetVal = FALSE; // Return value for this function.
//////////DPFENTER((L"->InitializeHardware"));
if (FindDevice())
{
#ifdef SW_SIM
gpsDevInfo = m_sDevData.psDevInfoKM;
#endif
if(m_clDisplay.PDP_Init() == PDP_ERROR_OK)
{
ULONG ulStrategy;
m_ulPrefFBStrategy = 0; // use default strategy
m_ulReqFBStrategy = 0; // use default strategy
if (ReadRegistryDword( FBALLOC_STRATEGY_KEY, &ulStrategy))
{
if (ulStrategy != 0)
{
m_ulReqFBStrategy = (ulStrategy & FBALLOC_STRATEGY_MASK) |
FBALLOC_STRATEGY_INTN;
m_ulPrefFBStrategy = ((ulStrategy >> FBALLOC_STRATEGY_PREF_SHIFT) &
FBALLOC_STRATEGY_MASK);
}
}
if (InitializeModes())
{
#if defined NO_2D_CLOCKCONTROL
/* turn on 2D core */
SysCoreEnable(m_sDevData.psDevInfoKM, DEV_CGCORE_MBX_2D, IMG_TRUE);
#else
#if defined TIMED2DGATING
CreateGatingThread (m_sDevData.psDevInfoKM);
#endif
#endif /* NO_2D_CLOCKCONTROL */
bRetVal = TRUE;
DPFINFO((L"mbx1 hardware initialized."));
}
else
{
DPFERROR((L"Unable to initialize mbx1 display mode handler!"));
}
}
else
{
DPFERROR((L"Unable to Initialize display pipeline."));
}
}
else
{
DPFERROR((L"Unable to locate mbx1 device on PCI bus!"));
}
/////DPFEXIT((L"<-InitializeHardware"));
return (bRetVal);
}
BOOL MBX::DeInitializeHardware(void)
{
BOOL bRetVal = FALSE; // Return value for this function.
//////////DPFENTER((L"->DeInitializeHardware"));
#if defined NO_2D_CLOCKCONTROL
/* turn off 2D core */
SysCoreDisable(m_sDevData.psDevInfoKM, DEV_CGCORE_MBX_2D, IMG_FALSE);
#else
#if defined TIMED2DGATING
DestroyGatingThread (m_sDevData.psDevInfoKM);
#endif
#endif /* NO_2D_CLOCKCONTROL */
DeInitializeModes();
m_clDisplay.PDP_Deinit();
PVRSRVReleaseDeviceData (&m_sDevData);
//////////DPFEXIT((L"<-DeInitializeHardware"));
return (TRUE);
}
/*****************************************************************************
FUNCTION : FindDevice
PURPOSE :
PARAMETERS :
RETURNS :
*****************************************************************************/
BOOL MBX::FindDevice(void)
{
/* Check parameters. */
//////////DPFENTER ((L"->FindDevice"));
PVRSRVAcquireDeviceData ( NULL,///hServices,
0,//uiDevIndex,
&m_sDevData,
PVRSRV_DEVICE_TYPE_UNKNOWN);
m_pbyFBPhysBase = (PBYTE)m_sDevData.psDevInfoKM->sDevLocation.sPhysicalBase.uiAddr;
/////DPFEXIT ((L"<-FindDevice"));
return (TRUE);
}
BOOL ReadRegistryDword (LPCWSTR pszwSubKey, PULONG pulResult)
{
HKEY hk;
ULONG ulStatus, ulSize, ulValue, ulType;
BOOL bRet = FALSE;
// look for our priority in the registry
ulStatus = RegOpenKeyEx (HKEY_LOCAL_MACHINE, TEXT(POWERVR_REG_ROOT), 0, 0, &hk);
if (ulStatus == ERROR_SUCCESS)
{
ulSize = sizeof(ulValue);
ulStatus = RegQueryValueEx (hk, pszwSubKey, NULL, &ulType, (LPBYTE) &ulValue, &ulSize);
if (ulStatus == ERROR_SUCCESS)
{
if (ulType == REG_DWORD) // Binary format
{
*pulResult = ulValue;
bRet = TRUE;
}
}
RegCloseKey(hk);
}
return (bRet);
} /* ReadRegistryDword */
#ifdef SUPPORT_POWER_STATE
void MBX::GPE_Power (PVR_POWER_STATE eState, ULONG ulFlags)
{
if (ulFlags == (PVRSRV_SEVERE_LOSS_OF_CONTEXT | PVRSRV_PRE_STATE_CHANGE_MASK))
{
if (eState != PVRSRV_POWER_STATE_D3)
{
m_bMBXBltActioned = TRUE; /* force a sync */
SyncWithHost();
}
/* do we need a flag here to flag that Blits should be disabled ? */
}
else if ((ulFlags & PVRSRV_PRE_STATE_CHANGE_MASK) == 0)
{
/* unmask Blit disable flag */
}
}
#endif
/********************************** end of file ******************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -