Move display_end before secmon + add boolean supp.

Currently bpmp loses access to the relevant registers when secmon or exosphere is launched.

This change provides support for all firmwares and properly sanitizes the display.
This commit is contained in:
Kostas Missos
2018-08-13 12:12:53 +03:00
parent e5abdd938e
commit 6b8887b5d8
15 changed files with 83 additions and 86 deletions

View File

@@ -137,18 +137,16 @@ void display_init()
exec_cfg((u32 *)DISPLAY_A_BASE, _display_config_11, 113);
}
void display_backlight(u8 enable)
void display_backlight(bool enable)
{
gpio_write(GPIO_PORT_V, GPIO_PIN_0, enable ? GPIO_HIGH : GPIO_LOW); // Backlight PWM.
}
void display_end()
{
display_backlight(0);
display_backlight(false);
//TODO: figure out why this freezes.
/*DSI(_DSIREG(DSI_VIDEO_MODE_CONTROL)) = 1;
DSI(_DSIREG(DSI_VIDEO_MODE_CONTROL)) = 1;
DSI(_DSIREG(DSI_WR_DATA)) = 0x2805;
u32 end = HOST1X(0x30A4) + 5;
@@ -171,17 +169,17 @@ void display_end()
usleep(50000);
//gpio_write(GPIO_PORT_V, GPIO_PIN_2, GPIO_LOW); //Backlight Reset disable.
gpio_write(GPIO_PORT_V, GPIO_PIN_2, GPIO_LOW); //Backlight Reset disable.
//usleep(10000);
usleep(10000);
//gpio_write(GPIO_PORT_I, GPIO_PIN_1, GPIO_LOW); //Backlight -5V disable.
gpio_write(GPIO_PORT_I, GPIO_PIN_1, GPIO_LOW); //Backlight -5V disable.
//usleep(10000);
usleep(10000);
//gpio_write(GPIO_PORT_I, GPIO_PIN_0, GPIO_LOW); //Backlight +5V disable.
gpio_write(GPIO_PORT_I, GPIO_PIN_0, GPIO_LOW); //Backlight +5V disable.
//usleep(10000);
usleep(10000);
//Disable clocks.
CLOCK(CLK_RST_CONTROLLER_RST_DEV_H_SET) = 0x1010000;
@@ -190,7 +188,7 @@ void display_end()
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_L_CLR) = 0x18000000;
DSI(_DSIREG(DSI_PAD_CONTROL_0)) = DSI_PAD_CONTROL_VS1_PULLDN_CLK | DSI_PAD_CONTROL_VS1_PULLDN(0xF) | DSI_PAD_CONTROL_VS1_PDIO_CLK | DSI_PAD_CONTROL_VS1_PDIO(0xF);
DSI(_DSIREG(DSI_POWER_CONTROL)) = 0;*/
DSI(_DSIREG(DSI_POWER_CONTROL)) = 0;
gpio_config(GPIO_PORT_V, GPIO_PIN_0, GPIO_MODE_SPIO); // Backlight PWM.
@@ -211,7 +209,7 @@ void display_color_screen(u32 color)
usleep(35000);
display_backlight(1);
display_backlight(true);
}
u32 *display_init_framebuffer()

View File

@@ -345,7 +345,7 @@ void display_end();
void display_color_screen(u32 color);
/*! Switches screen backlight ON/OFF. */
void display_backlight(u8 enable);
void display_backlight(bool enable);
/*! Init display in full 1280x720 resolution (B8G8R8A8, line stride 768, framebuffer size = 1280*768*4 bytes). */
u32 *display_init_framebuffer();

View File

@@ -31,7 +31,7 @@ extern u8 *Kc_MENU_LOGO;
extern hekate_config h_cfg;
void tui_sbar(gfx_con_t *con, int force_update)
void tui_sbar(gfx_con_t *con, bool force_update)
{
u32 timePassed = get_tmr_s() - h_cfg.sbar_time_keeping;
if (!force_update)
@@ -90,7 +90,7 @@ void tui_pbar(gfx_con_t *con, int x, int y, u32 val, u32 fgcol, u32 bgcol)
gfx_con_setpos(con, cx, cy);
// Update status bar.
tui_sbar(con, 0);
tui_sbar(con, false);
}
void *tui_do_menu(gfx_con_t *con, menu_t *menu)
@@ -98,7 +98,7 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
int idx = 0, prev_idx = 0, cnt = 0x7FFFFFFF;
gfx_clear_partial_grey(con->gfx_ctxt, 0x1B, 0, 1256);
tui_sbar(con, 1);
tui_sbar(con, true);
#ifdef MENU_LOGO_ENABLE
gfx_set_rect_rgb(con->gfx_ctxt, Kc_MENU_LOGO,
@@ -197,7 +197,7 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
X_MENU_LOGO, Y_MENU_LOGO, X_POS_MENU_LOGO, Y_POS_MENU_LOGO);
#endif //MENU_LOGO_ENABLE
}
tui_sbar(con, 0);
tui_sbar(con, false);
}
return NULL;

View File

@@ -58,7 +58,7 @@ typedef struct _menu_t
#define MDEF_CAPTION(caption, color) { MENT_CAPTION, caption, color }
#define MDEF_CHGLINE() {MENT_CHGLINE}
void tui_sbar(gfx_con_t *con, int force_update);
void tui_sbar(gfx_con_t *con, bool force_update);
void tui_pbar(gfx_con_t *con, int x, int y, u32 val, u32 fgcol, u32 bgcol);
void *tui_do_menu(gfx_con_t *con, menu_t *menu);