};\r
// -- Options\r
tPAddr gPL110_PhysBase = PL110_BASE;\r
+ int gbPL110_IsVersatile = 1;\r
// -- KeyVal parse rules\r
const tKeyVal_ParseRules gPL110_KeyValueParser = {\r
NULL,\r
{\r
{"Base", "P", &gPL110_PhysBase},\r
+ {"IsVersatile", "i", &gbPL110_IsVersatile},\r
{NULL, NULL, NULL}\r
}\r
};\r
//\r
\r
/**\r
+ * \brief Set the LCD controller resolution\r
+ * \param W Width (aligned to 16 pixels, cipped to 1024)\r
+ * \param H Height (clipped to 768)\r
+ * \return Boolean failure\r
*/\r
int PL110_int_SetResolution(int W, int H)\r
{\r
- W = (W + 15)/16;\r
+ W = (W + 15) & ~0xF;\r
+ if(W <= 0 || H <= 0) {\r
+ Log_Warning("PL110", "Attempted to set invalid resolution (%ix%i)", W, H);\r
+ return 1;\r
+ }\r
if(W > 1024) W = 1024;\r
if(H > 768) H = 768;\r
\r
gpPL110_IOMem->LCDUPBase = gPL110_FramebufferPhys;\r
gpPL110_IOMem->LCDLPBase = 0;\r
\r
- gpPL110_IOMem->LCDIMSC = 0;\r
- gpPL110_IOMem->LCDControl = (1 << 11)|(1 << 5)|(5<<1)|1;\r
+ // Power on, BGR mode, ???, ???, enabled\r
+ Uint32 controlWord = (1 << 11)|(1 << 8)|(1 << 5)|(5 << 1)|1;\r
+ // According to qemu, the Versatile version has these two the wrong\r
+ // way around\r
+ if( gbPL110_IsVersatile )\r
+ {\r
+ gpPL110_IOMem->LCDIMSC = controlWord; // Actually LCDControl\r
+ gpPL110_IOMem->LCDControl = 0; // Actually LCDIMSC\r
+ }\r
+ else\r
+ {\r
+ gpPL110_IOMem->LCDIMSC = 0;\r
+ gpPL110_IOMem->LCDControl = controlWord;\r
+ }\r
\r
giPL110_Width = W;\r
giPL110_Height = H;\r