📄 ddlcdcmisc.cpp
字号:
return retval;
}
//------------------------------------------------------------------------------
//
// Function: IsBusy
//
// Method to determine whether LCDC is available
// to transfer the frame buffer to display panel.
//
// Parameters:
// None.
//
// Returns:
// TRUE busy
// FALSE not busy
//
//------------------------------------------------------------------------------
int MX27DDLcdc::IsBusy(VOID)
{
int result = FALSE;
UINT32 iIntrStatus = 0;
EnterCriticalSection(&m_CriticalSection);
if(!(m_nPreIntrStatus & LCDC_ISR_EOF_LSH))
{
iIntrStatus = m_pLcdcReg->ISR;
if(iIntrStatus & LCDC_ISR_EOF_LSH)
{
// update the global flag;
m_nPreIntrStatus = iIntrStatus;
}
else
{
result = TRUE; // busy!!!
}
}
LeaveCriticalSection(&m_CriticalSection);
return result;
}
//------------------------------------------------------------------------------
//
// Function: InVBlank
//
// Timing method.
//
// Parameters:
// None.
//
// Returns:
// TRUE busy
// FALSE not busy
//
//------------------------------------------------------------------------------
int MX27DDLcdc::InVBlank(VOID)
{
return (!IsBusy());
}
//------------------------------------------------------------------------------
//
// Function: WaitForNotBusy
//
// Method to wait for the frame buffer is ready to update.
//
// Parameters:
// None.
//
// Returns:
// None.
//
//------------------------------------------------------------------------------
VOID MX27DDLcdc::WaitForNotBusy(VOID)
{
UINT8 retry = MAX_BUSY_RETRY; // Wait for 5 milliseconds is long enough.
while(IsBusy() && retry--)
{
Sleep(0);
}
return;
}
//------------------------------------------------------------------------------
//
// Function: WaitForVerticalBlank
//
// This callback function helps the application synchronize itself
// with the vertical blanking interval (VBI).
//
// Parameters:
// pd
// [in, out] Pointer to a DDHAL_WAITFORVERTICALBLANKDATA structure
// that contains the vertical blank information.
//
// Returns:
// DDHAL_DRIVER_HANDLED
// DDHAL_DRIVER_NOTHANDLED
//
//------------------------------------------------------------------------------
DWORD MX27DDLcdc::WaitForVerticalBlank(LPDDHAL_WAITFORVERTICALBLANKDATA pd)
{
/*
typedef struct _DDHAL_WAITFORVERTICALBLANKDATA
{
LPDDRAWI_DIRECTDRAW_GBL lpDD; // driver struct
DWORD dwFlags; // flags
DWORD bIsInVB; // is in vertical blank
DWORD hEvent; // event
HRESUL ddRVal; // return value
LPDDHAL_WAITFORVERTICALBLANK WaitForVerticalBlank;
// PRIVATE: ptr to callback
} DDHAL_WAITFORVERTICALBLANKDATA;
*/
switch(pd->dwFlags)
{
case DDWAITVB_I_TESTVB:
// If TESTVB, it's just a request for the current vertical blank
if(InVBlank())
pd->bIsInVB = TRUE;
else
pd->bIsInVB = FALSE;
pd->ddRVal = DD_OK;
return DDHAL_DRIVER_HANDLED;
case DDWAITVB_BLOCKBEGIN:
// Returns when the vertical blank interval begins.
WaitForNotBusy();
pd->ddRVal = DD_OK;
return DDHAL_DRIVER_HANDLED;
case DDWAITVB_BLOCKEND:
// Returns when the vertical blank interval ends and display begins.
pd->ddRVal = DDERR_NOVSYNCHW;
return DDHAL_DRIVER_HANDLED;
}
return DDHAL_DRIVER_NOTHANDLED;
}
//------------------------------------------------------------------------------
//
// FUNCTION: GetModeFromRegistry
//
// DESCRIPTION: Get display mode information from registry
// requested by user
//
// PARAMETERS:
//
// RETURNS:
// TRUE: successful
// FALSE: failed
//
//------------------------------------------------------------------------------
/*
BOOL MX27DDLcdc::GetModeFromRegistry(VOID)
{
BOOL result = TRUE;
LONG error;
HKEY hKey;
DWORD dwSize;
// Open registry key for display driver
error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, DRIVER_REGISTRY_STRING, 0 , 0, &hKey);
if (error != ERROR_SUCCESS)
{
DEBUGMSG(GPE_ZONE_ERROR,(TEXT("MX27DDLcdc GetModeFromRegistry: Failed to open reg path:%s [Error:0x%x]\r\n"), DRIVER_REGISTRY_STRING, error));
result = FALSE;
goto _done;
}
// Retrieve screen width from registry
dwSize = sizeof(int);
error = RegQueryValueEx(hKey, DRIVER_REGISTRY_STRING_CX, NULL, NULL,(LPBYTE)&m_nScreenWidth, (LPDWORD)&dwSize);
if (error != ERROR_SUCCESS)
{
DEBUGMSG(GPE_ZONE_ERROR,(TEXT("MX27DDLcdc GetModeFromRegistry: Failed to get the screen width [Error:0x%x]\r\n"),error));
result = FALSE;
goto _done;
}
// Retrieve screen height from registry
dwSize = sizeof(int);
error = RegQueryValueEx(hKey, DRIVER_REGISTRY_STRING_CY, NULL, NULL,(LPBYTE)&m_nScreenHeight, (LPDWORD)&dwSize);
if (error != ERROR_SUCCESS)
{
DEBUGMSG(GPE_ZONE_ERROR,(TEXT("MX27DDLcdc GetModeFromRegistry: Failed to get the screen height [Error:0x%x]\r\n"),error));
result = FALSE;
goto _done;
}
// Retrieve color depth from registry
dwSize = sizeof(int);
error = RegQueryValueEx(hKey, DRIVER_REGISTRY_STRING_BPP, NULL, NULL,(LPBYTE)&m_nScreenBpp, (LPDWORD)&dwSize);
if (error != ERROR_SUCCESS)
{
DEBUGMSG(GPE_ZONE_ERROR,(TEXT("MX27DDLcdc GetModeFromRegistry: Failed to get the color depth [Error:0x%x]\r\n"),error));
result = FALSE;
goto _done;
}
_done:
// Close registry key
RegCloseKey(hKey);
DEBUGMSG(GPE_ZONE_INIT, (TEXT("MX27DDLcdc GetModeFromRegistry: %s!\r\n"), result ? L"succeeds" : L"fails"));
return result;
}
*/
//------------------------------------------------------------------------------
//
// FUNCTION: GetVMemSizeFromRegistry
//
// DESCRIPTION: Get the size of video RAM requested by user from
// registry.
//
// PARAMETERS:
//
// RETURNS:
// TRUE: successful
// FALSE: failed
//
//------------------------------------------------------------------------------
/*
BOOL MX27DDLcdc::GetVMemSizeFromRegistry(VOID)
{
BOOL result = TRUE;
LONG error;
HKEY hKey;
DWORD dwSize;
// Open registry key for display driver
error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, DRIVER_REGISTRY_STRING, 0 , 0, &hKey);
if (error != ERROR_SUCCESS)
{
DEBUGMSG(GPE_ZONE_ERROR,(TEXT("MX27DDLcdc GetVMemSizeFromRegistry: Failed to open reg path:%s [Error:0x%x]\r\n"), DRIVER_REGISTRY_STRING, error));
result = FALSE;
goto _done;
}
// Retrieve screen width from registry
dwSize = sizeof(int);
error = RegQueryValueEx(hKey, DRIVER_REGISTRY_STRING_MEM_SIZE, NULL, NULL,(LPBYTE)&m_nVideoMemorySize, (LPDWORD)&dwSize);
if (error != ERROR_SUCCESS)
{
DEBUGMSG(GPE_ZONE_ERROR,(TEXT("MX27DDLcdc GetVMemSizeFromRegistry: Failed to get the vidoe RAM size [Error:0x%x]\r\n"),error));
result = FALSE;
m_nVideoMemorySize = 0;
goto _done;
}
_done:
// Close registry key
RegCloseKey(hKey);
DEBUGMSG(GPE_ZONE_INIT, (TEXT("MX27DDLcdc GetVMemSizeFromRegistry: %s, size is %d!\r\n"), result ? L"succeeds" : L"fails", m_nVideoMemorySize));
return result;
}
*/
//------------------------------------------------------------------------------
//
// FUNCTION: LoadFreescaleLogo
//
// DESCRIPTION: Load the Freescale logon onto screen.
//
// PARAMETERS:
//
// RETURNS:
//
//------------------------------------------------------------------------------
/*
VOID MX27DDLcdc::LoadFreescaleLogo(GPESurf * pSurf)
{
if(pSurf)
{
LoadFreescaleLogo(pSurf->Buffer());
}
}
VOID MX27DDLcdc::LoadFreescaleLogo(VOID * pFramePointer)
{
if(pFramePointer)
{
BYTE *pfb = (BYTE *)pFramePointer;
int bmpWidth, bmpHeight;
int h, w, pixelBytes;
int i, j;
pixelBytes = m_nScreenBpp/8;
// Sainty check
if(bitmap_width * bitmap_height * pixelBytes != sizeof(bitmap_data))
{
DEBUGMSG(GPE_ZONE_WARNING, (TEXT("MX27DDLcdc LoadFreescaleLogo: un-matched logo, width %d, height %d, size %d\r\n"), bitmap_width, bitmap_height, sizeof(bitmap_data)));
DEBUGMSG(GPE_ZONE_WARNING, (TEXT("MX27DDLcdc LoadFreescaleLogo: Splash screen is NOT loaded!\r\n")));
return;
}
bmpWidth = (bitmap_width > m_nScreenWidthSave) ? m_nScreenWidthSave : bitmap_width;
bmpHeight = (bitmap_height > m_nScreenHeightSave) ? m_nScreenHeightSave : bitmap_height;
w = (m_nScreenWidthSave - bmpWidth) / 2;
h = (m_nScreenHeightSave - bmpHeight) / 2;
// Pre-set the whole screen as white color
memset(pfb, SPLASH_SCREEN_BACKGROUND, m_nScreenStride * m_nScreenHeightSave);
// Copy and centre splash screen in framebuffer.
j = bmpWidth * pixelBytes;
pfb += w * pixelBytes + h * m_nScreenStride;
for(i = 0; i < bmpHeight; i++)
{
memcpy(pfb, &bitmap_data[i * bitmap_width], j);
pfb += m_nScreenStride;
}
}
}
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -