Hopefully fix #466 - now it resets the GPU/LCD into a known state instead of leaving the previous one on

This commit is contained in:
Wolfvak 2019-10-13 18:32:41 -03:00
parent 4890e4116f
commit 915cb2d13e

View File

@ -19,6 +19,9 @@
#include <types.h>
#include <vram.h>
#include "arm/timer.h"
#include "hw/mcu.h"
#include "hw/gpulcd.h"
/* LCD Configuration Registers */
@ -48,7 +51,7 @@ void LCD_Deinitialize(void)
{
*REG_LCD(0x244) = 0;
*REG_LCD(0xA44) = 0;
*REG_LCD(0x00C) = 0;
*REG_LCD(0x00C) = 0x10001;
*REG_LCD(0x014) = 0;
}
@ -147,9 +150,16 @@ void GPU_SetFramebufferMode(u32 screen, u8 mode)
void GPU_Init(void)
{
if (*REG_GPU_CNT == 0x1007F) {
MCU_PushToLCD(false);
LCD_Deinitialize();
*REG_GPU_CNT = 0x10001;
TIMER_WaitTicks(CLK_MS_TO_TICKS(40));
}
LCD_Initialize(0x20);
if (*REG_GPU_CNT != 0x1007F) {
*REG_GPU_CNT = 0x1007F;
*GPU_PDC(0, 0x00) = 0x000001C2;
*GPU_PDC(0, 0x04) = 0x000000D1;
@ -218,5 +228,4 @@ void GPU_Init(void)
for (u32 i = 0; i < 256; i++)
*GPU_PDC(1, 0x84) = 0x10101 * i;
}
}