1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-12-23 00:22:01 +00:00

nyx: Add SD init info from bootloader

This shows info about the sd initialization process that happened on hekate main
This commit is contained in:
CTCaer 2020-12-11 17:46:44 +02:00
parent ba984d02eb
commit 14a048a496
5 changed files with 49 additions and 4 deletions

View file

@ -44,7 +44,7 @@ u32 get_tmr_ms()
u32 get_tmr_us()
{
return TMR(TIMERUS_CNTR_1US); //TIMERUS_CNTR_1US
return TMR(TIMERUS_CNTR_1US);
}
void msleep(u32 ms)

View file

@ -21,6 +21,8 @@
#include <utils/types.h>
#include <mem/minerva.h>
#define NYX_NEW_INFO 0x3058594E
typedef enum
{
NYX_CFG_BIS = BIT(5),
@ -49,6 +51,10 @@ typedef struct _cfg_op_t
typedef struct _nyx_info_t
{
u32 magic;
u32 sd_init;
u32 sd_errors[3];
u8 rsvd[0x1000];
u32 disp_id;
u32 errors;
} nyx_info_t;

View file

@ -741,6 +741,13 @@ void nyx_load_run()
// Set hekate version used to boot Nyx.
nyx_str->version = ipl_ver.version - 0x303030; // Convert ASCII to numbers.
// Set SD card initialization info.
nyx_str->info.magic = NYX_NEW_INFO;
nyx_str->info.sd_init = sd_get_mode();
u16 *sd_errors = sd_get_error_count();
for (u32 i = 0; i < 3; i++)
nyx_str->info.sd_errors[i] = sd_errors[i];
//memcpy((u8 *)nyx_str->irama, (void *)IRAM_BASE, 0x8000);
volatile reloc_meta_t *reloc = (reloc_meta_t *)(IPL_LOAD_ADDR + RELOC_META_OFF);
memcpy((u8 *)nyx_str->hekate, (u8 *)reloc->start, reloc->end - reloc->start);

View file

@ -1468,7 +1468,8 @@ static lv_res_t _create_window_sdcard_info_status(lv_obj_t *btn)
"HW rev:\n"
"FW rev:\n"
"S/N:\n"
"Month/Year:"
"Month/Year:\n\n"
"Bootloader bus:"
);
lv_obj_t *val = lv_cont_create(win, NULL);
@ -1521,13 +1522,31 @@ static lv_res_t _create_window_sdcard_info_status(lv_obj_t *btn)
break;
}
s_printf(txt_buf + strlen(txt_buf), "(%02X)\n%c%c\n%c%c%c%c%c\n%X\n%X\n%08x\n%02d/%04d",
s_printf(txt_buf + strlen(txt_buf), "(%02X)\n%c%c\n%c%c%c%c%c\n%X\n%X\n%08x\n%02d/%04d\n\n",
sd_storage.cid.manfid, (sd_storage.cid.oemid >> 8) & 0xFF, sd_storage.cid.oemid & 0xFF,
sd_storage.cid.prod_name[0], sd_storage.cid.prod_name[1], sd_storage.cid.prod_name[2],
sd_storage.cid.prod_name[3], sd_storage.cid.prod_name[4],
sd_storage.cid.hwrev, sd_storage.cid.fwrev, sd_storage.cid.serial,
sd_storage.cid.month, sd_storage.cid.year);
switch (nyx_str->info.sd_init)
{
case SD_1BIT_HS25:
strcat(txt_buf, "HS25 1bit");
break;
case SD_4BIT_HS25:
strcat(txt_buf, "HS25");
break;
case SD_UHS_SDR82: // Report as SDR104.
case SD_UHS_SDR104:
strcat(txt_buf, "SDR104");
break;
case 0:
default:
strcat(txt_buf, "Undefined");
break;
}
lv_label_set_text(lb_val, txt_buf);
lv_obj_set_width(lb_val, lv_obj_get_width(val));
@ -1664,7 +1683,8 @@ static lv_res_t _create_window_sdcard_info_status(lv_obj_t *btn)
lv_obj_t * lb_val4 = lv_label_create(val4, lb_desc);
u16 *sd_errors = sd_get_error_count();
s_printf(txt_buf, "\n%d\n%d\n%d", sd_errors[0], sd_errors[1], sd_errors[2]);
s_printf(txt_buf, "\n%d (%d)\n%d (%d)\n%d (%d)",
sd_errors[0], nyx_str->info.sd_errors[0], sd_errors[1], nyx_str->info.sd_errors[1], sd_errors[2], nyx_str->info.sd_errors[2]);
lv_label_set_text(lb_val4, txt_buf);

View file

@ -355,6 +355,18 @@ void nyx_init_load_res()
set_default_configuration();
set_nyx_default_configuration();
// Reset new info if magic not correct.
if (nyx_str->info.magic != NYX_NEW_INFO)
{
nyx_str->info.sd_init = 0;
for (u32 i = 0; i < 3; i++)
nyx_str->info.sd_errors[i] = 0;
}
// Clear info magic.
nyx_str->info.magic = 0;
// Initialize gfx console.
gfx_init_ctxt((u32 *)LOG_FB_ADDRESS, 1280, 656, 656);
gfx_con_init();