diff --git a/bdk/utils/util.c b/bdk/utils/util.c index e5cd868..d62fe51 100644 --- a/bdk/utils/util.c +++ b/bdk/utils/util.c @@ -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) diff --git a/bdk/utils/util.h b/bdk/utils/util.h index 20df76f..dbbb76c 100644 --- a/bdk/utils/util.h +++ b/bdk/utils/util.h @@ -21,6 +21,8 @@ #include #include +#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; diff --git a/bootloader/main.c b/bootloader/main.c index fd589e3..cd9c985 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -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); diff --git a/nyx/nyx_gui/frontend/gui_info.c b/nyx/nyx_gui/frontend/gui_info.c index edfa081..255ce04 100644 --- a/nyx/nyx_gui/frontend/gui_info.c +++ b/nyx/nyx_gui/frontend/gui_info.c @@ -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); diff --git a/nyx/nyx_gui/nyx.c b/nyx/nyx_gui/nyx.c index 9227e96..d239f30 100644 --- a/nyx/nyx_gui/nyx.c +++ b/nyx/nyx_gui/nyx.c @@ -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();