diff --git a/ipl/di.c b/ipl/di.c
index fbdbb51..f66127d 100755
--- a/ipl/di.c
+++ b/ipl/di.c
@@ -14,6 +14,8 @@
* along with this program. If not, see .
*/
+#include
+
#include "di.h"
#include "t210.h"
#include "util.h"
@@ -131,9 +133,14 @@ void display_init()
exec_cfg((u32 *)DISPLAY_A_BASE, _display_config_11, 113);
}
+void display_backlight(u8 enable)
+{
+ GPIO_6(0x24) = (GPIO_6(0x24) & 0xFFFFFFFE) | (enable & 1);
+}
+
void display_end()
{
- GPIO_6(0x24) &= 0xFFFFFFFE;
+ display_backlight(0);
DSI(_DSIREG(DSI_VIDEO_MODE_CONTROL)) = 1;
DSI(_DSIREG(DSI_WR_DATA)) = 0x2805;
@@ -197,17 +204,20 @@ void display_color_screen(u32 color)
sleep(35000);
- GPIO_6(0x24) = GPIO_6(0x24) & 0xFFFFFFFE | 1;
+ display_backlight(1);
}
u32 *display_init_framebuffer(u32 *fb)
{
+ //Sanitize framebuffer area. Aligned to 4MB.
+ memset((u32 *)0xC0000000, 0, 0x400000);
//This configures the framebuffer @ 0xC0000000 with a resolution of 1280x720 (line stride 768).
exec_cfg((u32 *)DISPLAY_A_BASE, cfg_display_framebuffer, 32);
sleep(35000);
- GPIO_6(0x24) = GPIO_6(0x24) & 0xFFFFFFFE | 1;
+ //Enable backlight
+ //display_backlight(1);
return (u32 *)0xC0000000;
}
diff --git a/ipl/di.h b/ipl/di.h
index c110bbe..373f5d4 100755
--- a/ipl/di.h
+++ b/ipl/di.h
@@ -341,6 +341,9 @@ void display_end();
/*! Show one single color on the display. */
void display_color_screen(u32 color);
+/*! Switches screen backlight ON/OFF. */
+void display_backlight(u8 enable);
+
/*! Init display in full 1280x720 resolution (32bpp, line stride 768, framebuffer size = 1280*768*4 bytes). */
u32 *display_init_framebuffer();
diff --git a/ipl/gfx.c b/ipl/gfx.c
index ea98658..350323a 100755
--- a/ipl/gfx.c
+++ b/ipl/gfx.c
@@ -15,6 +15,7 @@
*/
#include
+#include
#include "gfx.h"
static const u8 _gfx_font[] = {
@@ -76,7 +77,12 @@ void gfx_init_ctxt(gfx_ctxt_t *ctxt, u32 *fb, u32 width, u32 height, u32 stride)
ctxt->stride = stride;
}
-void gfx_clear(gfx_ctxt_t *ctxt, u32 color)
+void gfx_clear_grey(gfx_ctxt_t *ctxt, u8 color)
+{
+ memset(ctxt->fb, color, 0x400000);
+}
+
+void gfx_clear_color(gfx_ctxt_t *ctxt, u32 color)
{
for (u32 i = 0; i < ctxt->height * ctxt->stride; i++)
ctxt->fb[i] = color;
diff --git a/ipl/gfx.h b/ipl/gfx.h
index bb14058..4e610fc 100755
--- a/ipl/gfx.h
+++ b/ipl/gfx.h
@@ -38,7 +38,8 @@ typedef struct _gfx_con_t
} gfx_con_t;
void gfx_init_ctxt(gfx_ctxt_t *ctxt, u32 *fb, u32 width, u32 height, u32 stride);
-void gfx_clear(gfx_ctxt_t *ctxt, u32 color);
+void gfx_clear_grey(gfx_ctxt_t *ctxt, u8 color);
+void gfx_clear_color(gfx_ctxt_t *ctxt, u32 color);
void gfx_con_init(gfx_con_t *con, gfx_ctxt_t *ctxt);
void gfx_con_setcol(gfx_con_t *con, u32 fgcol, int fillbg, u32 bgcol);
void gfx_con_getpos(gfx_con_t *con, u32 *x, u32 *y);
diff --git a/ipl/hos.c b/ipl/hos.c
index fb83617..8c1dab9 100755
--- a/ipl/hos.c
+++ b/ipl/hos.c
@@ -394,7 +394,7 @@ int hos_launch(ini_sec_t *cfg)
memset(&ctxt, 0, sizeof(launch_ctxt_t));
list_init(&ctxt.kip1_list);
- gfx_clear(&gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0);
if (cfg && !_config(&ctxt, cfg))
diff --git a/ipl/main.c b/ipl/main.c
index 82ac234..486f85b 100755
--- a/ipl/main.c
+++ b/ipl/main.c
@@ -336,7 +336,7 @@ void config_hw()
void print_fuseinfo()
{
- gfx_clear(&gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0);
gfx_printf(&gfx_con, "%k(Unlocked) fuse cache:\n\n%k", 0xFFFFDD00, 0xFFCCCCCC);
@@ -365,7 +365,7 @@ void print_fuseinfo()
void print_kfuseinfo()
{
- gfx_clear(&gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0);
gfx_printf(&gfx_con, "%kKFuse contents:\n\n%k", 0xFFFFDD00, 0xFFCCCCCC);
@@ -398,7 +398,7 @@ void print_kfuseinfo()
void print_mmc_info()
{
- gfx_clear(&gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0);
static const u32 SECTORS_TO_MIB_COEFF = 11;
@@ -541,7 +541,7 @@ out:
void print_sdcard_info()
{
- gfx_clear(&gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0);
static const u32 SECTORS_TO_MIB_COEFF = 11;
@@ -592,7 +592,7 @@ void print_sdcard_info()
void print_tsec_key()
{
- gfx_clear(&gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0);
sdmmc_storage_t storage;
@@ -1014,7 +1014,7 @@ static void dump_emmc_selected(dumpType_t dumpType)
{
int res = 0;
u32 timer = 0;
- gfx_clear(&gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0);
if (!sd_mount())
@@ -1123,7 +1123,7 @@ void dump_package1()
memset(secmon, 0, 0x40000);
memset(loader, 0, 0x40000);
- gfx_clear(&gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0);
if (!sd_mount())
@@ -1216,7 +1216,7 @@ void launch_firmware()
ini_sec_t *cfg_sec = NULL;
LIST_INIT(ini_sections);
- gfx_clear(&gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0);
if (sd_mount())
@@ -1257,8 +1257,8 @@ void launch_firmware()
if (!cfg_sec)
{
+ gfx_printf(&gfx_con, "\nUsing default launch configuration...\n");
sleep(3000000);
- gfx_printf(&gfx_con, "Using default launch configuration...\n");
}
if (!hos_launch(cfg_sec))
@@ -1328,7 +1328,7 @@ void about()
" (/` ( (` ) ) '-; %k[switchbrew]%k\n"
" ` '-; (-'%k";
- gfx_clear(&gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_setpos(&gfx_con, 0, 0);
gfx_printf(&gfx_con, octopus, 0xFFFFCC00, 0xFFCCCCCC,
@@ -1435,9 +1435,12 @@ void ipl_main()
//display_color_screen(0xAABBCCDD);
u32 *fb = display_init_framebuffer();
gfx_init_ctxt(&gfx_ctxt, fb, 720, 1280, 768);
- gfx_clear(&gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(&gfx_ctxt, 0x1B);
gfx_con_init(&gfx_con, &gfx_ctxt);
+ //Enable backlight after initializing gfx
+ display_backlight(1);
+
while (1)
tui_do_menu(&gfx_con, &menu_top);
diff --git a/ipl/sdmmc.c b/ipl/sdmmc.c
index 5362187..7f52374 100755
--- a/ipl/sdmmc.c
+++ b/ipl/sdmmc.c
@@ -174,8 +174,7 @@ static int _sdmmc_storage_readwrite(sdmmc_storage_t *storage, u32 sector, u32 nu
else
retries--;
- sleep(500000);
-
+ sleep(100000);
} while (retries);
return 0;
diff --git a/ipl/tui.c b/ipl/tui.c
index 3e3b3ad..3aed3bc 100755
--- a/ipl/tui.c
+++ b/ipl/tui.c
@@ -43,7 +43,7 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
int idx = 0, cnt;
int prev_idx = 0;
- gfx_clear(con->gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(con->gfx_ctxt, 0x1B);
while (1)
{
@@ -124,7 +124,7 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu)
default:
break;
}
- gfx_clear(con->gfx_ctxt, 0xFF1B1B1B);
+ gfx_clear_grey(con->gfx_ctxt, 0x1B);
}
}