mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 03:11:16 +00:00
hekate/nyx: slight refactor
This commit is contained in:
parent
6257d20db9
commit
f16159542c
12 changed files with 373 additions and 371 deletions
|
@ -169,7 +169,7 @@ void print_mmc_info()
|
||||||
gfx_put_small_sep();
|
gfx_put_small_sep();
|
||||||
gfx_printf("%kGPP (eMMC USER) partition table:%k\n", TXT_CLR_CYAN_L, TXT_CLR_DEFAULT);
|
gfx_printf("%kGPP (eMMC USER) partition table:%k\n", TXT_CLR_CYAN_L, TXT_CLR_DEFAULT);
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
emmc_set_partition(EMMC_GPP);
|
||||||
LIST_INIT(gpt);
|
LIST_INIT(gpt);
|
||||||
emmc_gpt_parse(&gpt);
|
emmc_gpt_parse(&gpt);
|
||||||
int gpp_idx = 0;
|
int gpp_idx = 0;
|
||||||
|
|
|
@ -44,7 +44,7 @@ void _toggle_autorcm(bool enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *tempbuf = (u8 *)malloc(0x200);
|
u8 *tempbuf = (u8 *)malloc(0x200);
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_BOOT0);
|
emmc_set_partition(EMMC_BOOT0);
|
||||||
|
|
||||||
int i, sect = 0;
|
int i, sect = 0;
|
||||||
u8 corr_mod0, mod1;
|
u8 corr_mod0, mod1;
|
||||||
|
@ -114,7 +114,7 @@ void menu_autorcm()
|
||||||
nx_emmc_get_autorcm_masks(&mod0, &mod1);
|
nx_emmc_get_autorcm_masks(&mod0, &mod1);
|
||||||
|
|
||||||
u8 *tempbuf = (u8 *)malloc(0x200);
|
u8 *tempbuf = (u8 *)malloc(0x200);
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_BOOT0);
|
emmc_set_partition(EMMC_BOOT0);
|
||||||
sdmmc_storage_read(&emmc_storage, 0x200 / EMMC_BLOCKSIZE, 1, tempbuf);
|
sdmmc_storage_read(&emmc_storage, 0x200 / EMMC_BLOCKSIZE, 1, tempbuf);
|
||||||
|
|
||||||
// Check if 2nd byte of modulus is correct.
|
// Check if 2nd byte of modulus is correct.
|
||||||
|
|
|
@ -20,7 +20,15 @@
|
||||||
#include <libs/compr/blz.h>
|
#include <libs/compr/blz.h>
|
||||||
#include "logos.h"
|
#include "logos.h"
|
||||||
|
|
||||||
u8 BOOTLOGO_BLZ[SZ_BOOTLOGO_BLZ] = {
|
// 68 x 192 @8bpp Grayscale RAW.
|
||||||
|
#define BOOTLOGO_WIDTH 68
|
||||||
|
#define BOOTLOGO_HEIGHT 192
|
||||||
|
#define BOOTLOGO_X ((720 - BOOTLOGO_WIDTH) / 2)
|
||||||
|
#define BOOTLOGO_Y ((1280 - BOOTLOGO_HEIGHT) / 2)
|
||||||
|
#define BOOTLOGO_SIZE 13056
|
||||||
|
#define BOOTLOGO_BLZ_SIZE 3988
|
||||||
|
|
||||||
|
u8 bootlogo_blz[] = {
|
||||||
0x0F, 0xF0, 0x80, 0x1B, 0x1B, 0x40, 0xF0, 0x1E, 0x1F, 0x48, 0x5A, 0x0F, 0xF0, 0x0F, 0xF0, 0xE4,
|
0x0F, 0xF0, 0x80, 0x1B, 0x1B, 0x40, 0xF0, 0x1E, 0x1F, 0x48, 0x5A, 0x0F, 0xF0, 0x0F, 0xF0, 0xE4,
|
||||||
0x17, 0xF0, 0x91, 0x13, 0x26, 0x28, 0x23, 0x1E, 0x0A, 0xA0, 0x0F, 0xF0, 0xC3, 0x22, 0xF0, 0xC3,
|
0x17, 0xF0, 0x91, 0x13, 0x26, 0x28, 0x23, 0x1E, 0x0A, 0xA0, 0x0F, 0xF0, 0xC3, 0x22, 0xF0, 0xC3,
|
||||||
0xA4, 0x1E, 0x29, 0x33, 0xDB, 0x2C, 0xEA, 0x53, 0x83, 0x0F, 0xF0, 0x38, 0xF0, 0xBC, 0x39, 0x21,
|
0xA4, 0x1E, 0x29, 0x33, 0xDB, 0x2C, 0xEA, 0x53, 0x83, 0x0F, 0xF0, 0x38, 0xF0, 0xBC, 0x39, 0x21,
|
||||||
|
@ -273,7 +281,7 @@ u8 BOOTLOGO_BLZ[SZ_BOOTLOGO_BLZ] = {
|
||||||
0x6C, 0x23, 0x00, 0x00
|
0x6C, 0x23, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 BATTERY_EMPTY_BLZ[SZ_BATTERY_EMPTY_BLZ] = {
|
u8 battery_icons_blz[] = {
|
||||||
0x17, 0xC0, 0x5D, 0x51, 0x79, 0x12, 0x79, 0x48, 0x69, 0x00, 0x0D, 0x46, 0xE3, 0x0F, 0xF0, 0x20,
|
0x17, 0xC0, 0x5D, 0x51, 0x79, 0x12, 0x79, 0x48, 0x69, 0x00, 0x0D, 0x46, 0xE3, 0x0F, 0xF0, 0x20,
|
||||||
0xF0, 0x35, 0x2E, 0x38, 0x3F, 0x40, 0xEF, 0xCF, 0x00, 0x89, 0x77, 0x00, 0x17, 0x01, 0x14, 0x09,
|
0xF0, 0x35, 0x2E, 0x38, 0x3F, 0x40, 0xEF, 0xCF, 0x00, 0x89, 0x77, 0x00, 0x17, 0x01, 0x14, 0x09,
|
||||||
0x90, 0x36, 0xF0, 0xA4, 0xF1, 0x62, 0x01, 0x38, 0xA1, 0x99, 0x84, 0x3E, 0x00, 0x23, 0x1F, 0x04,
|
0x90, 0x36, 0xF0, 0xA4, 0xF1, 0x62, 0x01, 0x38, 0xA1, 0x99, 0x84, 0x3E, 0x00, 0x23, 0x1F, 0x04,
|
||||||
|
@ -330,8 +338,8 @@ u8 *render_static_bootlogo()
|
||||||
|
|
||||||
// Set default logo.
|
// Set default logo.
|
||||||
u8 *logo_buf = (void *)malloc(SZ_16K);
|
u8 *logo_buf = (void *)malloc(SZ_16K);
|
||||||
blz_uncompress_srcdest(BOOTLOGO_BLZ, SZ_BOOTLOGO_BLZ, logo_buf, SZ_BOOTLOGO);
|
blz_uncompress_srcdest(bootlogo_blz, sizeof(bootlogo_blz), logo_buf, BOOTLOGO_SIZE);
|
||||||
gfx_set_rect_grey(logo_buf, X_BOOTLOGO, Y_BOOTLOGO, 326, 544);
|
gfx_set_rect_grey(logo_buf, BOOTLOGO_WIDTH, BOOTLOGO_HEIGHT, BOOTLOGO_X, BOOTLOGO_Y);
|
||||||
|
|
||||||
return logo_buf;
|
return logo_buf;
|
||||||
}
|
}
|
||||||
|
@ -341,22 +349,22 @@ bool render_ticker_logo(u32 boot_wait, u32 backlight)
|
||||||
u32 btn = 0;
|
u32 btn = 0;
|
||||||
|
|
||||||
u32 ticker_step_us = boot_wait * 1000000;
|
u32 ticker_step_us = boot_wait * 1000000;
|
||||||
ticker_step_us /= Y_BOOTLOGO;
|
ticker_step_us /= BOOTLOGO_HEIGHT;
|
||||||
|
|
||||||
// Set default logo.
|
// Set default logo.
|
||||||
u8 *logo_buf = render_static_bootlogo();
|
u8 *logo_buf = render_static_bootlogo();
|
||||||
|
|
||||||
// Clear line.
|
// Clear line.
|
||||||
u8 *grey = malloc(6 * Y_BOOTLOGO);
|
u8 *grey = malloc(6 * BOOTLOGO_HEIGHT);
|
||||||
memset(grey, 0x1B, 6 * Y_BOOTLOGO);
|
memset(grey, 0x1B, 6 * BOOTLOGO_HEIGHT);
|
||||||
gfx_set_rect_grey(grey, 6, Y_BOOTLOGO, 362, 544);
|
gfx_set_rect_grey(grey, 6, BOOTLOGO_HEIGHT, 362, BOOTLOGO_Y);
|
||||||
free(grey);
|
free(grey);
|
||||||
|
|
||||||
// Enable backlight to show first frame.
|
// Enable backlight to show first frame.
|
||||||
display_backlight_brightness(backlight, 1000);
|
display_backlight_brightness(backlight, 1000);
|
||||||
|
|
||||||
// Animated line as ticker.
|
// Animated line as ticker.
|
||||||
for (u32 i = 1; i <= Y_BOOTLOGO; i++)
|
for (u32 i = 1; i <= BOOTLOGO_HEIGHT; i++)
|
||||||
{
|
{
|
||||||
// If only VOL- was pressed, exit.
|
// If only VOL- was pressed, exit.
|
||||||
btn = btn_read_vol();
|
btn = btn_read_vol();
|
||||||
|
@ -367,7 +375,7 @@ bool render_ticker_logo(u32 boot_wait, u32 backlight)
|
||||||
usleep(ticker_step_us);
|
usleep(ticker_step_us);
|
||||||
|
|
||||||
// Set next ticker progress.
|
// Set next ticker progress.
|
||||||
gfx_set_rect_grey(logo_buf + X_BOOTLOGO * (Y_BOOTLOGO - i) + 36, 6, 1, 362, 544 + Y_BOOTLOGO - i);
|
gfx_set_rect_grey(logo_buf + BOOTLOGO_WIDTH * (BOOTLOGO_HEIGHT - i) + 36, 6, 1, 362, BOOTLOGO_Y + BOOTLOGO_HEIGHT - i);
|
||||||
}
|
}
|
||||||
free(logo_buf);
|
free(logo_buf);
|
||||||
|
|
||||||
|
|
|
@ -17,20 +17,13 @@
|
||||||
#ifndef _GFX_LOGOS_H_
|
#ifndef _GFX_LOGOS_H_
|
||||||
#define _GFX_LOGOS_H_
|
#define _GFX_LOGOS_H_
|
||||||
|
|
||||||
// 68 x 192 @8bpp Grayscale RAW.
|
|
||||||
#define X_BOOTLOGO 68
|
|
||||||
#define Y_BOOTLOGO 192
|
|
||||||
#define SZ_BOOTLOGO 13056
|
|
||||||
#define SZ_BOOTLOGO_BLZ 3988
|
|
||||||
extern u8 BOOTLOGO_BLZ[SZ_BOOTLOGO_BLZ];
|
|
||||||
|
|
||||||
// 21 x 50 @8bpp RGB.
|
// 21 x 50 @8bpp RGB.
|
||||||
#define X_BATTERY_EMPTY 21
|
#define BATTERY_EMPTY_WIDTH 21
|
||||||
#define Y_BATTERY_EMPTY_BATT 38
|
#define BATTERY_EMPTY_BATT_HEIGHT 38
|
||||||
#define Y_BATTERY_EMPTY_CHRG 12
|
#define BATTERY_EMPTY_CHRG_HEIGHT 12
|
||||||
#define SZ_BATTERY_EMPTY 3150
|
#define BATTERY_EMPTY_SIZE 3150
|
||||||
#define SZ_BATTERY_EMPTY_BLZ 740
|
#define BATTERY_EMPTY_BLZ_SIZE 740
|
||||||
extern u8 BATTERY_EMPTY_BLZ[SZ_BATTERY_EMPTY_BLZ];
|
extern u8 battery_icons_blz[];
|
||||||
|
|
||||||
u8 *render_static_bootlogo();
|
u8 *render_static_bootlogo();
|
||||||
bool render_ticker_logo(u32 boot_wait, u32 backlight);
|
bool render_ticker_logo(u32 boot_wait, u32 backlight);
|
||||||
|
|
|
@ -673,7 +673,6 @@ DPRINTF("Parsed GPT\n");
|
||||||
DPRINTF("pkg2 size on emmc is %08X\n", pkg2_size);
|
DPRINTF("pkg2 size on emmc is %08X\n", pkg2_size);
|
||||||
|
|
||||||
// Read in Boot Config.
|
// Read in Boot Config.
|
||||||
memset(bctBuf, 0, BCT_SIZE);
|
|
||||||
emmc_part_read(pkg2_part, 0, BCT_SIZE / EMMC_BLOCKSIZE, bctBuf);
|
emmc_part_read(pkg2_part, 0, BCT_SIZE / EMMC_BLOCKSIZE, bctBuf);
|
||||||
|
|
||||||
// Read in package2.
|
// Read in package2.
|
||||||
|
@ -909,7 +908,7 @@ int hos_launch(ini_sec_t *cfg)
|
||||||
if (!pkg1_warmboot_config(&ctxt, warmboot_base, ctxt.pkg1_id->fuses, kb))
|
if (!pkg1_warmboot_config(&ctxt, warmboot_base, ctxt.pkg1_id->fuses, kb))
|
||||||
{
|
{
|
||||||
// Can only happen on T210B01.
|
// Can only happen on T210B01.
|
||||||
_hos_crit_error("Failed to match warmboot with fuses!\nIf you continue, sleep wont work!");
|
_hos_crit_error("\nFailed to match warmboot with fuses!\nIf you continue, sleep wont work!");
|
||||||
|
|
||||||
gfx_puts("\nPress POWER to continue.\nPress VOL to go to the menu.\n");
|
gfx_puts("\nPress POWER to continue.\nPress VOL to go to the menu.\n");
|
||||||
display_backlight_brightness(h_cfg.backlight, 1000);
|
display_backlight_brightness(h_cfg.backlight, 1000);
|
||||||
|
|
|
@ -429,7 +429,7 @@ void pkg1_warmboot_rsa_mod(u32 warmboot_base)
|
||||||
// Set warmboot binary rsa modulus.
|
// Set warmboot binary rsa modulus.
|
||||||
u8 *rsa_mod = (u8 *)malloc(512);
|
u8 *rsa_mod = (u8 *)malloc(512);
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_BOOT0);
|
emmc_set_partition(EMMC_BOOT0);
|
||||||
|
|
||||||
u32 sector;
|
u32 sector;
|
||||||
u8 mod0, mod1;
|
u8 mod0, mod1;
|
||||||
|
|
|
@ -115,7 +115,7 @@ void check_power_off_from_hos()
|
||||||
|
|
||||||
static void *coreboot_addr;
|
static void *coreboot_addr;
|
||||||
|
|
||||||
void reloc_patcher(u32 payload_dst, u32 payload_src, u32 payload_size)
|
static void _reloc_patcher(u32 payload_dst, u32 payload_src, u32 payload_size)
|
||||||
{
|
{
|
||||||
memcpy((u8 *)payload_src, (u8 *)IPL_LOAD_ADDR, PATCHED_RELOC_SZ);
|
memcpy((u8 *)payload_src, (u8 *)IPL_LOAD_ADDR, PATCHED_RELOC_SZ);
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ bool is_ipl_updated(void *buf, char *path, bool force)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void launch_payload(char *path, bool update, bool clear_screen)
|
static void _launch_payload(char *path, bool update, bool clear_screen)
|
||||||
{
|
{
|
||||||
if (clear_screen)
|
if (clear_screen)
|
||||||
gfx_clear_grey(0x1B);
|
gfx_clear_grey(0x1B);
|
||||||
|
@ -226,13 +226,13 @@ void launch_payload(char *path, bool update, bool clear_screen)
|
||||||
if (update)
|
if (update)
|
||||||
memcpy((u8 *)(RCM_PAYLOAD_ADDR + PATCHED_RELOC_SZ), &b_cfg, sizeof(boot_cfg_t)); // Transfer boot cfg.
|
memcpy((u8 *)(RCM_PAYLOAD_ADDR + PATCHED_RELOC_SZ), &b_cfg, sizeof(boot_cfg_t)); // Transfer boot cfg.
|
||||||
else
|
else
|
||||||
reloc_patcher(PATCHED_RELOC_ENTRY, EXT_PAYLOAD_ADDR, ALIGN(size, 0x10));
|
_reloc_patcher(PATCHED_RELOC_ENTRY, EXT_PAYLOAD_ADDR, ALIGN(size, 0x10));
|
||||||
|
|
||||||
hw_reinit_workaround(false, byte_swap_32(*(u32 *)(buf + size - sizeof(u32))));
|
hw_reinit_workaround(false, byte_swap_32(*(u32 *)(buf + size - sizeof(u32))));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
reloc_patcher(PATCHED_RELOC_ENTRY, EXT_PAYLOAD_ADDR, 0x7000);
|
_reloc_patcher(PATCHED_RELOC_ENTRY, EXT_PAYLOAD_ADDR, 0x7000);
|
||||||
|
|
||||||
// Get coreboot seamless display magic.
|
// Get coreboot seamless display magic.
|
||||||
u32 magic = 0;
|
u32 magic = 0;
|
||||||
|
@ -265,7 +265,7 @@ out:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void launch_tools()
|
static void _launch_payloads()
|
||||||
{
|
{
|
||||||
u8 max_entries = 61;
|
u8 max_entries = 61;
|
||||||
char *filelist = NULL;
|
char *filelist = NULL;
|
||||||
|
@ -337,7 +337,7 @@ void launch_tools()
|
||||||
memcpy(dir + strlen(dir), "/", 2);
|
memcpy(dir + strlen(dir), "/", 2);
|
||||||
memcpy(dir + strlen(dir), file_sec, strlen(file_sec) + 1);
|
memcpy(dir + strlen(dir), file_sec, strlen(file_sec) + 1);
|
||||||
|
|
||||||
launch_payload(dir, false, true);
|
_launch_payload(dir, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
failed_sd_mount:
|
failed_sd_mount:
|
||||||
|
@ -347,7 +347,7 @@ failed_sd_mount:
|
||||||
btn_wait();
|
btn_wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ini_list_launcher()
|
static void _launch_ini_list()
|
||||||
{
|
{
|
||||||
u8 max_entries = 61;
|
u8 max_entries = 61;
|
||||||
char *payload_path = NULL;
|
char *payload_path = NULL;
|
||||||
|
@ -441,7 +441,7 @@ parse_failed:
|
||||||
if (payload_path)
|
if (payload_path)
|
||||||
{
|
{
|
||||||
// Try to launch Payload.
|
// Try to launch Payload.
|
||||||
launch_payload(payload_path, false, true);
|
_launch_payload(payload_path, false, true);
|
||||||
}
|
}
|
||||||
else if (!hos_launch(cfg_sec))
|
else if (!hos_launch(cfg_sec))
|
||||||
{
|
{
|
||||||
|
@ -458,7 +458,7 @@ out:
|
||||||
btn_wait();
|
btn_wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void launch_firmware()
|
static void _launch_config()
|
||||||
{
|
{
|
||||||
u8 max_entries = 61;
|
u8 max_entries = 61;
|
||||||
char *payload_path = NULL;
|
char *payload_path = NULL;
|
||||||
|
@ -491,11 +491,11 @@ void launch_firmware()
|
||||||
|
|
||||||
ments[2].type = MENT_HANDLER;
|
ments[2].type = MENT_HANDLER;
|
||||||
ments[2].caption = "Payloads...";
|
ments[2].caption = "Payloads...";
|
||||||
ments[2].handler = launch_tools;
|
ments[2].handler = _launch_payloads;
|
||||||
|
|
||||||
ments[3].type = MENT_HANDLER;
|
ments[3].type = MENT_HANDLER;
|
||||||
ments[3].caption = "More configs...";
|
ments[3].caption = "More configs...";
|
||||||
ments[3].handler = ini_list_launcher;
|
ments[3].handler = _launch_ini_list;
|
||||||
|
|
||||||
ments[4].type = MENT_CHGLINE;
|
ments[4].type = MENT_CHGLINE;
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ parse_failed:
|
||||||
if (payload_path)
|
if (payload_path)
|
||||||
{
|
{
|
||||||
// Try to launch Payload.
|
// Try to launch Payload.
|
||||||
launch_payload(payload_path, false, true);
|
_launch_payload(payload_path, false, true);
|
||||||
}
|
}
|
||||||
else if (!hos_launch(cfg_sec))
|
else if (!hos_launch(cfg_sec))
|
||||||
{
|
{
|
||||||
|
@ -594,7 +594,7 @@ out:
|
||||||
|
|
||||||
#define NYX_VER_OFF 0x9C
|
#define NYX_VER_OFF 0x9C
|
||||||
|
|
||||||
void nyx_load_run()
|
static void _nyx_load_run()
|
||||||
{
|
{
|
||||||
u8 *nyx = sd_file_read("bootloader/sys/nyx.bin", NULL);
|
u8 *nyx = sd_file_read("bootloader/sys/nyx.bin", NULL);
|
||||||
if (!nyx)
|
if (!nyx)
|
||||||
|
@ -661,7 +661,7 @@ void nyx_load_run()
|
||||||
(*nyx_ptr)();
|
(*nyx_ptr)();
|
||||||
}
|
}
|
||||||
|
|
||||||
static ini_sec_t *get_ini_sec_from_id(ini_sec_t *ini_sec, char **bootlogoCustomEntry, char **emummc_path)
|
static ini_sec_t *_get_ini_sec_from_id(ini_sec_t *ini_sec, char **bootlogoCustomEntry, char **emummc_path)
|
||||||
{
|
{
|
||||||
ini_sec_t *cfg_sec = NULL;
|
ini_sec_t *cfg_sec = NULL;
|
||||||
|
|
||||||
|
@ -703,7 +703,7 @@ static void _bootloader_corruption_protect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void auto_launch_update()
|
static void _check_for_updated_bootloader()
|
||||||
{
|
{
|
||||||
// Check if already chainloaded update and clear flag. Otherwise check for updates.
|
// Check if already chainloaded update and clear flag. Otherwise check for updates.
|
||||||
if (EMC(EMC_SCRATCH0) & EMC_HEKA_UPD)
|
if (EMC(EMC_SCRATCH0) & EMC_HEKA_UPD)
|
||||||
|
@ -712,7 +712,7 @@ void auto_launch_update()
|
||||||
{
|
{
|
||||||
// Check if update.bin exists and is newer and launch it. Otherwise create it.
|
// Check if update.bin exists and is newer and launch it. Otherwise create it.
|
||||||
if (!f_stat("bootloader/update.bin", NULL))
|
if (!f_stat("bootloader/update.bin", NULL))
|
||||||
launch_payload("bootloader/update.bin", true, false);
|
_launch_payload("bootloader/update.bin", true, false);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u8 *buf = calloc(0x200, 1);
|
u8 *buf = calloc(0x200, 1);
|
||||||
|
@ -722,7 +722,7 @@ void auto_launch_update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _auto_launch_firmware()
|
static void _auto_launch()
|
||||||
{
|
{
|
||||||
struct _bmp_data
|
struct _bmp_data
|
||||||
{
|
{
|
||||||
|
@ -740,7 +740,7 @@ static void _auto_launch_firmware()
|
||||||
char *bootlogoCustomEntry = NULL;
|
char *bootlogoCustomEntry = NULL;
|
||||||
bool config_entry_found = false;
|
bool config_entry_found = false;
|
||||||
|
|
||||||
auto_launch_update();
|
_check_for_updated_bootloader();
|
||||||
|
|
||||||
bool boot_from_id = (b_cfg.boot_cfg & BOOT_CFG_FROM_ID) && (b_cfg.boot_cfg & BOOT_CFG_AUTOBOOT_EN);
|
bool boot_from_id = (b_cfg.boot_cfg & BOOT_CFG_FROM_ID) && (b_cfg.boot_cfg & BOOT_CFG_AUTOBOOT_EN);
|
||||||
if (boot_from_id)
|
if (boot_from_id)
|
||||||
|
@ -815,7 +815,7 @@ static void _auto_launch_firmware()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boot_from_id)
|
if (boot_from_id)
|
||||||
cfg_sec = get_ini_sec_from_id(ini_sec, &bootlogoCustomEntry, &emummc_path);
|
cfg_sec = _get_ini_sec_from_id(ini_sec, &bootlogoCustomEntry, &emummc_path);
|
||||||
else if (h_cfg.autoboot == boot_entry_id && config_entry_found)
|
else if (h_cfg.autoboot == boot_entry_id && config_entry_found)
|
||||||
{
|
{
|
||||||
cfg_sec = ini_sec;
|
cfg_sec = ini_sec;
|
||||||
|
@ -859,7 +859,7 @@ static void _auto_launch_firmware()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (boot_from_id)
|
if (boot_from_id)
|
||||||
cfg_sec = get_ini_sec_from_id(ini_sec_list, &bootlogoCustomEntry, &emummc_path);
|
cfg_sec = _get_ini_sec_from_id(ini_sec_list, &bootlogoCustomEntry, &emummc_path);
|
||||||
else if (h_cfg.autoboot == boot_entry_id)
|
else if (h_cfg.autoboot == boot_entry_id)
|
||||||
{
|
{
|
||||||
h_cfg.emummc_force_disable = false;
|
h_cfg.emummc_force_disable = false;
|
||||||
|
@ -967,7 +967,7 @@ skip_list:
|
||||||
if (payload_path)
|
if (payload_path)
|
||||||
{
|
{
|
||||||
// Try to launch Payload.
|
// Try to launch Payload.
|
||||||
launch_payload(payload_path, false, false);
|
_launch_payload(payload_path, false, false);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1009,7 +1009,7 @@ out:
|
||||||
// L4T: Clear custom boot mode flags from PMC_SCRATCH0.
|
// L4T: Clear custom boot mode flags from PMC_SCRATCH0.
|
||||||
PMC(APBDEV_PMC_SCRATCH0) &= ~PMC_SCRATCH0_MODE_CUSTOM_ALL;
|
PMC(APBDEV_PMC_SCRATCH0) &= ~PMC_SCRATCH0_MODE_CUSTOM_ALL;
|
||||||
|
|
||||||
nyx_load_run();
|
_nyx_load_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EXCP_EN_ADDR 0x4003FFFC
|
#define EXCP_EN_ADDR 0x4003FFFC
|
||||||
|
@ -1171,8 +1171,8 @@ static void _check_low_battery()
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
// Prepare battery icon resources.
|
// Prepare battery icon resources.
|
||||||
u8 *battery_res = malloc(ALIGN(SZ_BATTERY_EMPTY, SZ_4K));
|
u8 *battery_res = malloc(ALIGN(BATTERY_EMPTY_SIZE, SZ_4K));
|
||||||
blz_uncompress_srcdest(BATTERY_EMPTY_BLZ, SZ_BATTERY_EMPTY_BLZ, battery_res, SZ_BATTERY_EMPTY);
|
blz_uncompress_srcdest(battery_icons_blz, BATTERY_EMPTY_BLZ_SIZE, battery_res, BATTERY_EMPTY_SIZE);
|
||||||
|
|
||||||
u8 *battery_icon = malloc(0x95A); // 21x38x3
|
u8 *battery_icon = malloc(0x95A); // 21x38x3
|
||||||
u8 *charging_icon = malloc(0x2F4); // 21x12x3
|
u8 *charging_icon = malloc(0x2F4); // 21x12x3
|
||||||
|
@ -1181,8 +1181,8 @@ static void _check_low_battery()
|
||||||
memcpy(charging_icon, battery_res, 0x2F4);
|
memcpy(charging_icon, battery_res, 0x2F4);
|
||||||
memcpy(battery_icon, battery_res + 0x2F4, 0x95A);
|
memcpy(battery_icon, battery_res + 0x2F4, 0x95A);
|
||||||
|
|
||||||
u32 battery_icon_y_pos = 1280 - 16 - Y_BATTERY_EMPTY_BATT;
|
u32 battery_icon_y_pos = 1280 - 16 - BATTERY_EMPTY_BATT_HEIGHT;
|
||||||
u32 charging_icon_y_pos = 1280 - 16 - Y_BATTERY_EMPTY_BATT - 12 - Y_BATTERY_EMPTY_CHRG;
|
u32 charging_icon_y_pos = 1280 - 16 - BATTERY_EMPTY_BATT_HEIGHT - 12 - BATTERY_EMPTY_CHRG_HEIGHT;
|
||||||
free(battery_res);
|
free(battery_res);
|
||||||
|
|
||||||
charge_status = !charge_status;
|
charge_status = !charge_status;
|
||||||
|
@ -1207,9 +1207,9 @@ static void _check_low_battery()
|
||||||
if (screen_on && (charge_status != current_charge_status))
|
if (screen_on && (charge_status != current_charge_status))
|
||||||
{
|
{
|
||||||
if (current_charge_status)
|
if (current_charge_status)
|
||||||
gfx_set_rect_rgb(charging_icon, X_BATTERY_EMPTY, Y_BATTERY_EMPTY_CHRG, 16, charging_icon_y_pos);
|
gfx_set_rect_rgb(charging_icon, BATTERY_EMPTY_WIDTH, BATTERY_EMPTY_CHRG_HEIGHT, 16, charging_icon_y_pos);
|
||||||
else
|
else
|
||||||
gfx_set_rect_rgb(no_charging_icon, X_BATTERY_EMPTY, Y_BATTERY_EMPTY_CHRG, 16, charging_icon_y_pos);
|
gfx_set_rect_rgb(no_charging_icon, BATTERY_EMPTY_WIDTH, BATTERY_EMPTY_CHRG_HEIGHT, 16, charging_icon_y_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it's time to turn off display.
|
// Check if it's time to turn off display.
|
||||||
|
@ -1238,11 +1238,11 @@ static void _check_low_battery()
|
||||||
u32 *fb = display_init_framebuffer_pitch();
|
u32 *fb = display_init_framebuffer_pitch();
|
||||||
gfx_init_ctxt(fb, 720, 1280, 720);
|
gfx_init_ctxt(fb, 720, 1280, 720);
|
||||||
|
|
||||||
gfx_set_rect_rgb(battery_icon, X_BATTERY_EMPTY, Y_BATTERY_EMPTY_BATT, 16, battery_icon_y_pos);
|
gfx_set_rect_rgb(battery_icon, BATTERY_EMPTY_WIDTH, BATTERY_EMPTY_BATT_HEIGHT, 16, battery_icon_y_pos);
|
||||||
if (current_charge_status)
|
if (current_charge_status)
|
||||||
gfx_set_rect_rgb(charging_icon, X_BATTERY_EMPTY, Y_BATTERY_EMPTY_CHRG, 16, charging_icon_y_pos);
|
gfx_set_rect_rgb(charging_icon, BATTERY_EMPTY_WIDTH, BATTERY_EMPTY_CHRG_HEIGHT, 16, charging_icon_y_pos);
|
||||||
else
|
else
|
||||||
gfx_set_rect_rgb(no_charging_icon, X_BATTERY_EMPTY, Y_BATTERY_EMPTY_CHRG, 16, charging_icon_y_pos);
|
gfx_set_rect_rgb(no_charging_icon, BATTERY_EMPTY_WIDTH, BATTERY_EMPTY_CHRG_HEIGHT, 16, charging_icon_y_pos);
|
||||||
|
|
||||||
display_backlight_pwm_init();
|
display_backlight_pwm_init();
|
||||||
display_backlight_brightness(100, 1000);
|
display_backlight_brightness(100, 1000);
|
||||||
|
@ -1272,7 +1272,7 @@ out:
|
||||||
max77620_low_battery_monitor_config(true);
|
max77620_low_battery_monitor_config(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ipl_reload()
|
static void _ipl_reload()
|
||||||
{
|
{
|
||||||
hw_reinit_workaround(false, 0);
|
hw_reinit_workaround(false, 0);
|
||||||
|
|
||||||
|
@ -1366,12 +1366,12 @@ power_state_t STATE_REBOOT_RCM = REBOOT_RCM;
|
||||||
power_state_t STATE_REBOOT_BYPASS_FUSES = REBOOT_BYPASS_FUSES;
|
power_state_t STATE_REBOOT_BYPASS_FUSES = REBOOT_BYPASS_FUSES;
|
||||||
|
|
||||||
ment_t ment_top[] = {
|
ment_t ment_top[] = {
|
||||||
MDEF_HANDLER("Launch", launch_firmware),
|
MDEF_HANDLER("Launch", _launch_config),
|
||||||
MDEF_CAPTION("---------------", TXT_CLR_GREY_DM),
|
MDEF_CAPTION("---------------", TXT_CLR_GREY_DM),
|
||||||
MDEF_MENU("Tools", &menu_tools),
|
MDEF_MENU("Tools", &menu_tools),
|
||||||
MDEF_MENU("Console info", &menu_cinfo),
|
MDEF_MENU("Console info", &menu_cinfo),
|
||||||
MDEF_CAPTION("---------------", TXT_CLR_GREY_DM),
|
MDEF_CAPTION("---------------", TXT_CLR_GREY_DM),
|
||||||
MDEF_HANDLER("Reload", ipl_reload),
|
MDEF_HANDLER("Reload", _ipl_reload),
|
||||||
MDEF_HANDLER_EX("Reboot (OFW)", &STATE_REBOOT_BYPASS_FUSES, power_set_state_ex),
|
MDEF_HANDLER_EX("Reboot (OFW)", &STATE_REBOOT_BYPASS_FUSES, power_set_state_ex),
|
||||||
MDEF_HANDLER_EX("Reboot (RCM)", &STATE_REBOOT_RCM, power_set_state_ex),
|
MDEF_HANDLER_EX("Reboot (RCM)", &STATE_REBOOT_RCM, power_set_state_ex),
|
||||||
MDEF_HANDLER_EX("Power off", &STATE_POWER_OFF, power_set_state_ex),
|
MDEF_HANDLER_EX("Power off", &STATE_POWER_OFF, power_set_state_ex),
|
||||||
|
@ -1448,7 +1448,7 @@ skip_lp0_minerva_config:
|
||||||
|
|
||||||
// Load saved configuration and auto boot if enabled.
|
// Load saved configuration and auto boot if enabled.
|
||||||
if (!(h_cfg.errors & ERR_SD_BOOT_EN))
|
if (!(h_cfg.errors & ERR_SD_BOOT_EN))
|
||||||
_auto_launch_firmware();
|
_auto_launch();
|
||||||
|
|
||||||
// Failed to launch Nyx, unmount SD Card.
|
// Failed to launch Nyx, unmount SD Card.
|
||||||
sd_end();
|
sd_end();
|
||||||
|
|
|
@ -273,7 +273,7 @@ int emummc_storage_write(u32 sector, u32 num_sectors, void *buf)
|
||||||
int emummc_storage_set_mmc_partition(u32 partition)
|
int emummc_storage_set_mmc_partition(u32 partition)
|
||||||
{
|
{
|
||||||
emu_cfg.active_part = partition;
|
emu_cfg.active_part = partition;
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, partition);
|
emmc_set_partition(partition);
|
||||||
|
|
||||||
if (!emu_cfg.enabled || h_cfg.emummc_force_disable || emu_cfg.sector)
|
if (!emu_cfg.enabled || h_cfg.emummc_force_disable || emu_cfg.sector)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -807,7 +807,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, i + 1);
|
emmc_set_partition(i + 1);
|
||||||
|
|
||||||
// Set filename to backup/{emmc_sn}/BOOT0/1 or backup/{emmc_sn}/emummc/BOOT0/1.
|
// Set filename to backup/{emmc_sn}/BOOT0/1 or backup/{emmc_sn}/emummc/BOOT0/1.
|
||||||
if (!gui->raw_emummc)
|
if (!gui->raw_emummc)
|
||||||
|
@ -829,7 +829,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
||||||
|
|
||||||
if ((dumpType & PART_SYSTEM) || (dumpType & PART_USER) || (dumpType & PART_RAW))
|
if ((dumpType & PART_SYSTEM) || (dumpType & PART_USER) || (dumpType & PART_RAW))
|
||||||
{
|
{
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
emmc_set_partition(EMMC_GPP);
|
||||||
|
|
||||||
if ((dumpType & PART_SYSTEM) || (dumpType & PART_USER))
|
if ((dumpType & PART_SYSTEM) || (dumpType & PART_USER))
|
||||||
{
|
{
|
||||||
|
@ -1454,7 +1454,7 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, i + 1);
|
emmc_set_partition(i + 1);
|
||||||
|
|
||||||
emmcsn_path_impl(sdPath, "/restore", bootPart.name, &emmc_storage);
|
emmcsn_path_impl(sdPath, "/restore", bootPart.name, &emmc_storage);
|
||||||
res = _restore_emmc_part(gui, sdPath, i, &emmc_storage, &bootPart, false);
|
res = _restore_emmc_part(gui, sdPath, i, &emmc_storage, &bootPart, false);
|
||||||
|
@ -1475,7 +1475,7 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
||||||
gui->base_path = (char *)malloc(strlen(sdPath) + 1);
|
gui->base_path = (char *)malloc(strlen(sdPath) + 1);
|
||||||
strcpy(gui->base_path, sdPath);
|
strcpy(gui->base_path, sdPath);
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
emmc_set_partition(EMMC_GPP);
|
||||||
|
|
||||||
LIST_INIT(gpt);
|
LIST_INIT(gpt);
|
||||||
emmc_gpt_parse(&gpt);
|
emmc_gpt_parse(&gpt);
|
||||||
|
|
|
@ -430,7 +430,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui)
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, i + 1);
|
emmc_set_partition(i + 1);
|
||||||
|
|
||||||
strcat(sdPath, bootPart.name);
|
strcat(sdPath, bootPart.name);
|
||||||
res = _dump_emummc_file_part(gui, sdPath, &emmc_storage, &bootPart);
|
res = _dump_emummc_file_part(gui, sdPath, &emmc_storage, &bootPart);
|
||||||
|
@ -450,7 +450,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get GP partition size dynamically.
|
// Get GP partition size dynamically.
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
emmc_set_partition(EMMC_GPP);
|
||||||
|
|
||||||
// Get GP partition size dynamically.
|
// Get GP partition size dynamically.
|
||||||
const u32 RAW_AREA_NUM_SECTORS = emmc_storage.sec_cnt;
|
const u32 RAW_AREA_NUM_SECTORS = emmc_storage.sec_cnt;
|
||||||
|
@ -782,7 +782,7 @@ static int _emummc_raw_derive_bis_keys(emmc_tool_gui_t *gui, u32 resized_count)
|
||||||
u8 *cal0_buf = malloc(SZ_64K);
|
u8 *cal0_buf = malloc(SZ_64K);
|
||||||
|
|
||||||
// Read and decrypt CAL0 for validation of working BIS keys.
|
// Read and decrypt CAL0 for validation of working BIS keys.
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
emmc_set_partition(EMMC_GPP);
|
||||||
LIST_INIT(gpt);
|
LIST_INIT(gpt);
|
||||||
emmc_gpt_parse(&gpt);
|
emmc_gpt_parse(&gpt);
|
||||||
emmc_part_t *cal0_part = emmc_part_find(&gpt, "PRODINFO"); // check if null
|
emmc_part_t *cal0_part = emmc_part_find(&gpt, "PRODINFO"); // check if null
|
||||||
|
@ -908,7 +908,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 r
|
||||||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, i + 1);
|
emmc_set_partition(i + 1);
|
||||||
|
|
||||||
strcat(sdPath, bootPart.name);
|
strcat(sdPath, bootPart.name);
|
||||||
res = _dump_emummc_raw_part(gui, i, part_idx, sector_start, &bootPart, 0);
|
res = _dump_emummc_raw_part(gui, i, part_idx, sector_start, &bootPart, 0);
|
||||||
|
@ -927,7 +927,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 r
|
||||||
strcpy(sdPath, gui->base_path);
|
strcpy(sdPath, gui->base_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
emmc_set_partition(EMMC_GPP);
|
||||||
|
|
||||||
// Get GP partition size dynamically.
|
// Get GP partition size dynamically.
|
||||||
const u32 RAW_AREA_NUM_SECTORS = emmc_storage.sec_cnt;
|
const u32 RAW_AREA_NUM_SECTORS = emmc_storage.sec_cnt;
|
||||||
|
|
|
@ -276,7 +276,7 @@ static lv_res_t _create_mbox_cal0(lv_obj_t *btn)
|
||||||
cal0_buf = malloc(SZ_64K);
|
cal0_buf = malloc(SZ_64K);
|
||||||
|
|
||||||
// Read and decrypt CAL0.
|
// Read and decrypt CAL0.
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
emmc_set_partition(EMMC_GPP);
|
||||||
LIST_INIT(gpt);
|
LIST_INIT(gpt);
|
||||||
emmc_gpt_parse(&gpt);
|
emmc_gpt_parse(&gpt);
|
||||||
emmc_part_t *cal0_part = emmc_part_find(&gpt, "PRODINFO"); // check if null
|
emmc_part_t *cal0_part = emmc_part_find(&gpt, "PRODINFO"); // check if null
|
||||||
|
@ -388,7 +388,7 @@ out:
|
||||||
|
|
||||||
static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
|
static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
|
||||||
{
|
{
|
||||||
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" HW & Cached Fuses Info");
|
lv_obj_t *win = nyx_create_standard_window(SYMBOL_CHIP" HW & Fuses Info");
|
||||||
lv_win_add_btn(win, NULL, SYMBOL_DOWNLOAD" Dump fuses", _fuse_dump_window_action);
|
lv_win_add_btn(win, NULL, SYMBOL_DOWNLOAD" Dump fuses", _fuse_dump_window_action);
|
||||||
lv_win_add_btn(win, NULL, SYMBOL_INFO" CAL0 Info", _create_mbox_cal0);
|
lv_win_add_btn(win, NULL, SYMBOL_INFO" CAL0 Info", _create_mbox_cal0);
|
||||||
|
|
||||||
|
@ -1315,7 +1315,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
|
||||||
storage = &emmc_storage;
|
storage = &emmc_storage;
|
||||||
res = !emmc_initialize(false);
|
res = !emmc_initialize(false);
|
||||||
if (!res)
|
if (!res)
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
emmc_set_partition(EMMC_GPP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
|
@ -1705,7 +1705,7 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
|
||||||
s_printf(txt_buf + strlen(txt_buf), "0: #96FF00 GPP# Size: %6d MiB (Sect: 0x%08X)\n", emmc_storage.sec_cnt >> SECTORS_TO_MIB_COEFF, emmc_storage.sec_cnt);
|
s_printf(txt_buf + strlen(txt_buf), "0: #96FF00 GPP# Size: %6d MiB (Sect: 0x%08X)\n", emmc_storage.sec_cnt >> SECTORS_TO_MIB_COEFF, emmc_storage.sec_cnt);
|
||||||
strcat(txt_buf, "\n#00DDFF GPP (eMMC USER) Partition Table:#\n");
|
strcat(txt_buf, "\n#00DDFF GPP (eMMC USER) Partition Table:#\n");
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
emmc_set_partition(EMMC_GPP);
|
||||||
LIST_INIT(gpt);
|
LIST_INIT(gpt);
|
||||||
emmc_gpt_parse(&gpt);
|
emmc_gpt_parse(&gpt);
|
||||||
|
|
||||||
|
@ -1807,299 +1807,301 @@ static lv_res_t _create_window_sdcard_info_status(lv_obj_t *btn)
|
||||||
manual_system_maintenance(true);
|
manual_system_maintenance(true);
|
||||||
|
|
||||||
if (!sd_mount())
|
if (!sd_mount())
|
||||||
lv_label_set_text(lb_desc, "#FFDD00 Failed to init SD!#");
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
lv_label_set_text(lb_desc,
|
lv_label_set_text(lb_desc, "#FFDD00 Failed to init SD!#");
|
||||||
"#00DDFF Card IDentification:#\n"
|
goto failed;
|
||||||
"Vendor ID:\n"
|
|
||||||
"Model:\n"
|
|
||||||
"OEM ID:\n"
|
|
||||||
"HW rev:\n"
|
|
||||||
"FW rev:\n"
|
|
||||||
"S/N:\n"
|
|
||||||
"Month/Year:\n\n"
|
|
||||||
"Bootloader bus:"
|
|
||||||
);
|
|
||||||
|
|
||||||
lv_obj_t *val = lv_cont_create(win, NULL);
|
|
||||||
lv_obj_set_size(val, LV_HOR_RES / 9 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 5 / 2);
|
|
||||||
|
|
||||||
lv_obj_t * lb_val = lv_label_create(val, lb_desc);
|
|
||||||
|
|
||||||
char *txt_buf = (char *)malloc(SZ_16K);
|
|
||||||
txt_buf[0] = '\n';
|
|
||||||
txt_buf[1] = 0;
|
|
||||||
|
|
||||||
// Identify manufacturer.
|
|
||||||
switch (sd_storage.cid.manfid)
|
|
||||||
{
|
|
||||||
case 0x00:
|
|
||||||
strcat(txt_buf, "Fake ");
|
|
||||||
break;
|
|
||||||
case 0x01:
|
|
||||||
strcat(txt_buf, "Panasonic ");
|
|
||||||
break;
|
|
||||||
case 0x02:
|
|
||||||
strcat(txt_buf, "Toshiba ");
|
|
||||||
break;
|
|
||||||
case 0x03:
|
|
||||||
strcat(txt_buf, "SanDisk ");
|
|
||||||
break;
|
|
||||||
case 0x06:
|
|
||||||
strcat(txt_buf, "Ritek ");
|
|
||||||
break;
|
|
||||||
case 0x09:
|
|
||||||
strcat(txt_buf, "ATP ");
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
strcat(txt_buf, "Kingmax ");
|
|
||||||
break;
|
|
||||||
case 0x19:
|
|
||||||
strcat(txt_buf, "Dynacard ");
|
|
||||||
break;
|
|
||||||
case 0x1A:
|
|
||||||
strcat(txt_buf, "Power Quotient ");
|
|
||||||
break;
|
|
||||||
case 0x1B:
|
|
||||||
strcat(txt_buf, "Samsung ");
|
|
||||||
break;
|
|
||||||
case 0x1D:
|
|
||||||
strcat(txt_buf, "AData ");
|
|
||||||
break;
|
|
||||||
case 0x27:
|
|
||||||
strcat(txt_buf, "Phison ");
|
|
||||||
break;
|
|
||||||
case 0x28:
|
|
||||||
strcat(txt_buf, "Barun Electronics ");
|
|
||||||
break;
|
|
||||||
case 0x31:
|
|
||||||
strcat(txt_buf, "Silicon Power ");
|
|
||||||
break;
|
|
||||||
case 0x41:
|
|
||||||
strcat(txt_buf, "Kingston ");
|
|
||||||
break;
|
|
||||||
case 0x51:
|
|
||||||
strcat(txt_buf, "STEC ");
|
|
||||||
break;
|
|
||||||
case 0x5D:
|
|
||||||
strcat(txt_buf, "SwissBit ");
|
|
||||||
break;
|
|
||||||
case 0x61:
|
|
||||||
strcat(txt_buf, "Netlist ");
|
|
||||||
break;
|
|
||||||
case 0x63:
|
|
||||||
strcat(txt_buf, "Cactus ");
|
|
||||||
break;
|
|
||||||
case 0x73:
|
|
||||||
strcat(txt_buf, "Bongiovi ");
|
|
||||||
break;
|
|
||||||
case 0x74:
|
|
||||||
strcat(txt_buf, "Jiaelec ");
|
|
||||||
break;
|
|
||||||
case 0x76:
|
|
||||||
strcat(txt_buf, "Patriot ");
|
|
||||||
break;
|
|
||||||
case 0x82:
|
|
||||||
strcat(txt_buf, "Jiang Tay ");
|
|
||||||
break;
|
|
||||||
case 0x83:
|
|
||||||
strcat(txt_buf, "Netcom ");
|
|
||||||
break;
|
|
||||||
case 0x84:
|
|
||||||
strcat(txt_buf, "Strontium ");
|
|
||||||
break;
|
|
||||||
//TODO: Investigate which OEM/ODM makes these.
|
|
||||||
case 0x9C: // BE, Angelbird | Barun Electronics? What about 0x28?
|
|
||||||
// LX512 SO, Lexar, Angelbird, Hoodman, Sony | Solidgear?
|
|
||||||
strcat(txt_buf, "Solidgear ");
|
|
||||||
break;
|
|
||||||
case 0x9F:
|
|
||||||
strcat(txt_buf, "Taishin ");
|
|
||||||
break;
|
|
||||||
case 0xAD: // Lexar LX512 LS. Longsys?
|
|
||||||
strcat(txt_buf, "Longsys ");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcat(txt_buf, "Unknown ");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_printf(txt_buf + strlen(txt_buf), "(%02X)\n%c%c%c%c%c\n%c%c (%04X)\n%X\n%X\n%08x\n%02d/%04d\n\n",
|
|
||||||
sd_storage.cid.manfid,
|
|
||||||
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.oemid >> 8) & 0xFF, sd_storage.cid.oemid & 0xFF, sd_storage.cid.oemid,
|
|
||||||
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));
|
|
||||||
lv_obj_align(val, desc, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
|
|
||||||
|
|
||||||
lv_obj_t *desc2 = lv_cont_create(win, NULL);
|
|
||||||
lv_obj_set_size(desc2, LV_HOR_RES / 2 / 4 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 5 / 2);
|
|
||||||
|
|
||||||
lv_obj_t * lb_desc2 = lv_label_create(desc2, lb_desc);
|
|
||||||
|
|
||||||
lv_label_set_static_text(lb_desc2,
|
|
||||||
"#00DDFF Card-Specific Data#\n"
|
|
||||||
"Cmd Classes:\n"
|
|
||||||
"Capacity:\n"
|
|
||||||
"Capacity (LBA):\n"
|
|
||||||
"Bus Width:\n"
|
|
||||||
"Current Rate:\n"
|
|
||||||
"Speed Class:\n"
|
|
||||||
"UHS Grade:\n"
|
|
||||||
"Video Class:\n"
|
|
||||||
"App perf class:\n"
|
|
||||||
"Write Protect:"
|
|
||||||
);
|
|
||||||
lv_obj_set_width(lb_desc2, lv_obj_get_width(desc2));
|
|
||||||
lv_obj_align(desc2, val, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 2, 0);
|
|
||||||
|
|
||||||
lv_obj_t *val2 = lv_cont_create(win, NULL);
|
|
||||||
lv_obj_set_size(val2, LV_HOR_RES / 13 * 3, LV_VER_RES - (LV_DPI * 11 / 8) * 5 / 2);
|
|
||||||
|
|
||||||
lv_obj_t * lb_val2 = lv_label_create(val2, lb_desc);
|
|
||||||
|
|
||||||
char *wp_info;
|
|
||||||
switch (sd_storage.csd.write_protect)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
wp_info = "Temporary";
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
wp_info = "Permanent";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
wp_info = "None";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool uhs_au_mb = false;
|
|
||||||
u32 uhs_au_size = sd_storage_get_ssr_au(&sd_storage);
|
|
||||||
if (uhs_au_size >= 1024)
|
|
||||||
{
|
|
||||||
uhs_au_mb = true;
|
|
||||||
uhs_au_size /= 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_printf(txt_buf,
|
|
||||||
"#00DDFF v%d.0#\n%02X\n%d MiB\n%X (CP %X)\n%d\n%d MB/s (%d MHz)\n%d (AU: %d %s\nU%d\nV%d\nA%d\n%s",
|
|
||||||
sd_storage.csd.structure + 1, sd_storage.csd.cmdclass,
|
|
||||||
sd_storage.sec_cnt >> 11, sd_storage.sec_cnt, sd_storage.ssr.protected_size >> 9,
|
|
||||||
sd_storage.ssr.bus_width, sd_storage.csd.busspeed,
|
|
||||||
(sd_storage.csd.busspeed > 10) ? (sd_storage.csd.busspeed * 2) : 50,
|
|
||||||
sd_storage.ssr.speed_class, uhs_au_size, uhs_au_mb ? "MiB)" : "KiB)", sd_storage.ssr.uhs_grade,
|
|
||||||
sd_storage.ssr.video_class, sd_storage.ssr.app_class, wp_info);
|
|
||||||
|
|
||||||
lv_label_set_text(lb_val2, txt_buf);
|
|
||||||
|
|
||||||
lv_obj_set_width(lb_val2, lv_obj_get_width(val2));
|
|
||||||
lv_obj_align(val2, desc2, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
|
|
||||||
|
|
||||||
lv_obj_t *line_sep = lv_line_create(win, NULL);
|
|
||||||
static const lv_point_t line_pp[] = { {0, 0}, { LV_HOR_RES - (LV_DPI - (LV_DPI / 4)) * 12, 0} };
|
|
||||||
lv_line_set_points(line_sep, line_pp, 2);
|
|
||||||
lv_line_set_style(line_sep, lv_theme_get_current()->line.decor);
|
|
||||||
lv_obj_align(line_sep, desc, LV_ALIGN_OUT_BOTTOM_LEFT, LV_DPI * 410 / 100, LV_DPI / 7);
|
|
||||||
|
|
||||||
lv_obj_t *desc3 = lv_cont_create(win, NULL);
|
|
||||||
lv_obj_set_size(desc3, LV_HOR_RES / 2 / 2 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
|
||||||
|
|
||||||
lv_obj_t * lb_desc3 = lv_label_create(desc3, lb_desc);
|
|
||||||
lv_label_set_text(lb_desc3, "#D4FF00 Acquiring FAT volume info...#");
|
|
||||||
lv_obj_set_width(lb_desc3, lv_obj_get_width(desc3));
|
|
||||||
|
|
||||||
lv_obj_align(desc3, desc, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 2);
|
|
||||||
|
|
||||||
manual_system_maintenance(true);
|
|
||||||
|
|
||||||
f_getfree("", &sd_fs.free_clst, NULL);
|
|
||||||
|
|
||||||
lv_label_set_text(lb_desc3,
|
|
||||||
"#00DDFF Found FAT volume:#\n"
|
|
||||||
"Filesystem:\n"
|
|
||||||
"Cluster:\n"
|
|
||||||
"Size free/total:"
|
|
||||||
);
|
|
||||||
lv_obj_set_size(desc3, LV_HOR_RES / 2 / 5 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
|
||||||
lv_obj_set_width(lb_desc3, lv_obj_get_width(desc3));
|
|
||||||
lv_obj_align(desc3, desc, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 2);
|
|
||||||
|
|
||||||
lv_obj_t *val3 = lv_cont_create(win, NULL);
|
|
||||||
lv_obj_set_size(val3, LV_HOR_RES / 13 * 3, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
|
||||||
|
|
||||||
lv_obj_t * lb_val3 = lv_label_create(val3, lb_desc);
|
|
||||||
|
|
||||||
s_printf(txt_buf, "\n%s\n%d %s\n%d/%d MiB",
|
|
||||||
sd_fs.fs_type == FS_EXFAT ? ("exFAT "SYMBOL_SHRK) : ("FAT32"),
|
|
||||||
(sd_fs.csize > 1) ? (sd_fs.csize >> 1) : 512,
|
|
||||||
(sd_fs.csize > 1) ? "KiB" : "B",
|
|
||||||
(u32)(sd_fs.free_clst * sd_fs.csize >> SECTORS_TO_MIB_COEFF),
|
|
||||||
(u32)(sd_fs.n_fatent * sd_fs.csize >> SECTORS_TO_MIB_COEFF));
|
|
||||||
|
|
||||||
lv_label_set_text(lb_val3, txt_buf);
|
|
||||||
|
|
||||||
lv_obj_set_width(lb_val3, lv_obj_get_width(val3));
|
|
||||||
lv_obj_align(val3, desc3, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
|
|
||||||
|
|
||||||
lv_obj_t *desc4 = lv_cont_create(win, NULL);
|
|
||||||
lv_obj_set_size(desc4, LV_HOR_RES / 2 / 2 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
|
||||||
|
|
||||||
lv_obj_t * lb_desc4 = lv_label_create(desc4, lb_desc);
|
|
||||||
lv_label_set_text(lb_desc4, "#D4FF00 Acquiring FAT volume info...#");
|
|
||||||
lv_obj_set_width(lb_desc4, lv_obj_get_width(desc4));
|
|
||||||
|
|
||||||
lv_label_set_text(lb_desc4,
|
|
||||||
"#00DDFF SDMMC1 Errors:#\n"
|
|
||||||
"Init fails:\n"
|
|
||||||
"Read/Write fails:\n"
|
|
||||||
"Read/Write errors:"
|
|
||||||
);
|
|
||||||
lv_obj_set_size(desc4, LV_HOR_RES / 2 / 5 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
|
||||||
lv_obj_set_width(lb_desc4, lv_obj_get_width(desc4));
|
|
||||||
lv_obj_align(desc4, val3, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 2, 0);
|
|
||||||
|
|
||||||
lv_obj_t *val4 = lv_cont_create(win, NULL);
|
|
||||||
lv_obj_set_size(val4, LV_HOR_RES / 13 * 3, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
|
||||||
|
|
||||||
lv_obj_t * lb_val4 = lv_label_create(val4, lb_desc);
|
|
||||||
|
|
||||||
u16 *sd_errors = sd_get_error_count();
|
|
||||||
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);
|
|
||||||
|
|
||||||
lv_obj_set_width(lb_val4, lv_obj_get_width(val4));
|
|
||||||
lv_obj_align(val4, desc4, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 2, 0);
|
|
||||||
|
|
||||||
free(txt_buf);
|
|
||||||
sd_unmount();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lv_label_set_text(lb_desc,
|
||||||
|
"#00DDFF Card IDentification:#\n"
|
||||||
|
"Vendor ID:\n"
|
||||||
|
"Model:\n"
|
||||||
|
"OEM ID:\n"
|
||||||
|
"HW rev:\n"
|
||||||
|
"FW rev:\n"
|
||||||
|
"S/N:\n"
|
||||||
|
"Month/Year:\n\n"
|
||||||
|
"Bootloader bus:"
|
||||||
|
);
|
||||||
|
|
||||||
|
lv_obj_t *val = lv_cont_create(win, NULL);
|
||||||
|
lv_obj_set_size(val, LV_HOR_RES / 9 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 5 / 2);
|
||||||
|
|
||||||
|
lv_obj_t * lb_val = lv_label_create(val, lb_desc);
|
||||||
|
|
||||||
|
char *txt_buf = (char *)malloc(SZ_16K);
|
||||||
|
txt_buf[0] = '\n';
|
||||||
|
txt_buf[1] = 0;
|
||||||
|
|
||||||
|
// Identify manufacturer.
|
||||||
|
switch (sd_storage.cid.manfid)
|
||||||
|
{
|
||||||
|
case 0x00:
|
||||||
|
strcat(txt_buf, "Fake ");
|
||||||
|
break;
|
||||||
|
case 0x01:
|
||||||
|
strcat(txt_buf, "Panasonic ");
|
||||||
|
break;
|
||||||
|
case 0x02:
|
||||||
|
strcat(txt_buf, "Toshiba ");
|
||||||
|
break;
|
||||||
|
case 0x03:
|
||||||
|
strcat(txt_buf, "SanDisk ");
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
strcat(txt_buf, "Ritek ");
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
strcat(txt_buf, "ATP ");
|
||||||
|
break;
|
||||||
|
case 0x13:
|
||||||
|
strcat(txt_buf, "Kingmax ");
|
||||||
|
break;
|
||||||
|
case 0x19:
|
||||||
|
strcat(txt_buf, "Dynacard ");
|
||||||
|
break;
|
||||||
|
case 0x1A:
|
||||||
|
strcat(txt_buf, "Power Quotient ");
|
||||||
|
break;
|
||||||
|
case 0x1B:
|
||||||
|
strcat(txt_buf, "Samsung ");
|
||||||
|
break;
|
||||||
|
case 0x1D:
|
||||||
|
strcat(txt_buf, "AData ");
|
||||||
|
break;
|
||||||
|
case 0x27:
|
||||||
|
strcat(txt_buf, "Phison ");
|
||||||
|
break;
|
||||||
|
case 0x28:
|
||||||
|
strcat(txt_buf, "Barun Electronics ");
|
||||||
|
break;
|
||||||
|
case 0x31:
|
||||||
|
strcat(txt_buf, "Silicon Power ");
|
||||||
|
break;
|
||||||
|
case 0x41:
|
||||||
|
strcat(txt_buf, "Kingston ");
|
||||||
|
break;
|
||||||
|
case 0x51:
|
||||||
|
strcat(txt_buf, "STEC ");
|
||||||
|
break;
|
||||||
|
case 0x5D:
|
||||||
|
strcat(txt_buf, "SwissBit ");
|
||||||
|
break;
|
||||||
|
case 0x61:
|
||||||
|
strcat(txt_buf, "Netlist ");
|
||||||
|
break;
|
||||||
|
case 0x63:
|
||||||
|
strcat(txt_buf, "Cactus ");
|
||||||
|
break;
|
||||||
|
case 0x73:
|
||||||
|
strcat(txt_buf, "Bongiovi ");
|
||||||
|
break;
|
||||||
|
case 0x74:
|
||||||
|
strcat(txt_buf, "Jiaelec ");
|
||||||
|
break;
|
||||||
|
case 0x76:
|
||||||
|
strcat(txt_buf, "Patriot ");
|
||||||
|
break;
|
||||||
|
case 0x82:
|
||||||
|
strcat(txt_buf, "Jiang Tay ");
|
||||||
|
break;
|
||||||
|
case 0x83:
|
||||||
|
strcat(txt_buf, "Netcom ");
|
||||||
|
break;
|
||||||
|
case 0x84:
|
||||||
|
strcat(txt_buf, "Strontium ");
|
||||||
|
break;
|
||||||
|
//TODO: Investigate which OEM/ODM makes these.
|
||||||
|
case 0x9C: // BE, Angelbird | Barun Electronics? What about 0x28?
|
||||||
|
// LX512 SO, Lexar, Angelbird, Hoodman, Sony | Solidgear?
|
||||||
|
strcat(txt_buf, "Solidgear ");
|
||||||
|
break;
|
||||||
|
case 0x9F:
|
||||||
|
strcat(txt_buf, "Taishin ");
|
||||||
|
break;
|
||||||
|
case 0xAD:
|
||||||
|
strcat(txt_buf, "Longsys ");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcat(txt_buf, "Unknown ");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_printf(txt_buf + strlen(txt_buf), "(%02X)\n%c%c%c%c%c\n%c%c (%04X)\n%X\n%X\n%08x\n%02d/%04d\n\n",
|
||||||
|
sd_storage.cid.manfid,
|
||||||
|
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.oemid >> 8) & 0xFF, sd_storage.cid.oemid & 0xFF, sd_storage.cid.oemid,
|
||||||
|
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));
|
||||||
|
lv_obj_align(val, desc, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
|
||||||
|
|
||||||
|
lv_obj_t *desc2 = lv_cont_create(win, NULL);
|
||||||
|
lv_obj_set_size(desc2, LV_HOR_RES / 2 / 4 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 5 / 2);
|
||||||
|
|
||||||
|
lv_obj_t * lb_desc2 = lv_label_create(desc2, lb_desc);
|
||||||
|
|
||||||
|
lv_label_set_static_text(lb_desc2,
|
||||||
|
"#00DDFF Card-Specific Data#\n"
|
||||||
|
"Cmd Classes:\n"
|
||||||
|
"Capacity:\n"
|
||||||
|
"Capacity (LBA):\n"
|
||||||
|
"Bus Width:\n"
|
||||||
|
"Current Rate:\n"
|
||||||
|
"Speed Class:\n"
|
||||||
|
"UHS Grade:\n"
|
||||||
|
"Video Class:\n"
|
||||||
|
"App perf class:\n"
|
||||||
|
"Write Protect:"
|
||||||
|
);
|
||||||
|
lv_obj_set_width(lb_desc2, lv_obj_get_width(desc2));
|
||||||
|
lv_obj_align(desc2, val, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 2, 0);
|
||||||
|
|
||||||
|
lv_obj_t *val2 = lv_cont_create(win, NULL);
|
||||||
|
lv_obj_set_size(val2, LV_HOR_RES / 13 * 3, LV_VER_RES - (LV_DPI * 11 / 8) * 5 / 2);
|
||||||
|
|
||||||
|
lv_obj_t * lb_val2 = lv_label_create(val2, lb_desc);
|
||||||
|
|
||||||
|
char *wp_info;
|
||||||
|
switch (sd_storage.csd.write_protect)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
wp_info = "Temporary";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
wp_info = "Permanent";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
wp_info = "None";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool uhs_au_mb = false;
|
||||||
|
u32 uhs_au_size = sd_storage_get_ssr_au(&sd_storage);
|
||||||
|
if (uhs_au_size >= 1024)
|
||||||
|
{
|
||||||
|
uhs_au_mb = true;
|
||||||
|
uhs_au_size /= 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_printf(txt_buf,
|
||||||
|
"#00DDFF v%d.0#\n%02X\n%d MiB\n%X (CP %X)\n%d\n%d MB/s (%d MHz)\n%d (AU: %d %s\nU%d\nV%d\nA%d\n%s",
|
||||||
|
sd_storage.csd.structure + 1, sd_storage.csd.cmdclass,
|
||||||
|
sd_storage.sec_cnt >> 11, sd_storage.sec_cnt, sd_storage.ssr.protected_size >> 9,
|
||||||
|
sd_storage.ssr.bus_width, sd_storage.csd.busspeed,
|
||||||
|
(sd_storage.csd.busspeed > 10) ? (sd_storage.csd.busspeed * 2) : 50,
|
||||||
|
sd_storage.ssr.speed_class, uhs_au_size, uhs_au_mb ? "MiB)" : "KiB)", sd_storage.ssr.uhs_grade,
|
||||||
|
sd_storage.ssr.video_class, sd_storage.ssr.app_class, wp_info);
|
||||||
|
|
||||||
|
lv_label_set_text(lb_val2, txt_buf);
|
||||||
|
|
||||||
|
lv_obj_set_width(lb_val2, lv_obj_get_width(val2));
|
||||||
|
lv_obj_align(val2, desc2, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
|
||||||
|
|
||||||
|
lv_obj_t *line_sep = lv_line_create(win, NULL);
|
||||||
|
static const lv_point_t line_pp[] = { {0, 0}, { LV_HOR_RES - (LV_DPI - (LV_DPI / 4)) * 12, 0} };
|
||||||
|
lv_line_set_points(line_sep, line_pp, 2);
|
||||||
|
lv_line_set_style(line_sep, lv_theme_get_current()->line.decor);
|
||||||
|
lv_obj_align(line_sep, desc, LV_ALIGN_OUT_BOTTOM_LEFT, LV_DPI * 410 / 100, LV_DPI / 7);
|
||||||
|
|
||||||
|
lv_obj_t *desc3 = lv_cont_create(win, NULL);
|
||||||
|
lv_obj_set_size(desc3, LV_HOR_RES / 2 / 2 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
||||||
|
|
||||||
|
lv_obj_t * lb_desc3 = lv_label_create(desc3, lb_desc);
|
||||||
|
lv_label_set_text(lb_desc3, "#D4FF00 Acquiring FAT volume info...#");
|
||||||
|
lv_obj_set_width(lb_desc3, lv_obj_get_width(desc3));
|
||||||
|
|
||||||
|
lv_obj_align(desc3, desc, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 2);
|
||||||
|
|
||||||
|
manual_system_maintenance(true);
|
||||||
|
|
||||||
|
f_getfree("", &sd_fs.free_clst, NULL);
|
||||||
|
|
||||||
|
lv_label_set_text(lb_desc3,
|
||||||
|
"#00DDFF Found FAT volume:#\n"
|
||||||
|
"Filesystem:\n"
|
||||||
|
"Cluster:\n"
|
||||||
|
"Size free/total:"
|
||||||
|
);
|
||||||
|
lv_obj_set_size(desc3, LV_HOR_RES / 2 / 5 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
||||||
|
lv_obj_set_width(lb_desc3, lv_obj_get_width(desc3));
|
||||||
|
lv_obj_align(desc3, desc, LV_ALIGN_OUT_BOTTOM_LEFT, 0, LV_DPI / 2);
|
||||||
|
|
||||||
|
lv_obj_t *val3 = lv_cont_create(win, NULL);
|
||||||
|
lv_obj_set_size(val3, LV_HOR_RES / 13 * 3, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
||||||
|
|
||||||
|
lv_obj_t * lb_val3 = lv_label_create(val3, lb_desc);
|
||||||
|
|
||||||
|
s_printf(txt_buf, "\n%s\n%d %s\n%d/%d MiB",
|
||||||
|
sd_fs.fs_type == FS_EXFAT ? ("exFAT "SYMBOL_SHRK) : ("FAT32"),
|
||||||
|
(sd_fs.csize > 1) ? (sd_fs.csize >> 1) : 512,
|
||||||
|
(sd_fs.csize > 1) ? "KiB" : "B",
|
||||||
|
(u32)(sd_fs.free_clst * sd_fs.csize >> SECTORS_TO_MIB_COEFF),
|
||||||
|
(u32)(sd_fs.n_fatent * sd_fs.csize >> SECTORS_TO_MIB_COEFF));
|
||||||
|
|
||||||
|
lv_label_set_text(lb_val3, txt_buf);
|
||||||
|
|
||||||
|
lv_obj_set_width(lb_val3, lv_obj_get_width(val3));
|
||||||
|
lv_obj_align(val3, desc3, LV_ALIGN_OUT_RIGHT_MID, 0, 0);
|
||||||
|
|
||||||
|
lv_obj_t *desc4 = lv_cont_create(win, NULL);
|
||||||
|
lv_obj_set_size(desc4, LV_HOR_RES / 2 / 2 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
||||||
|
|
||||||
|
lv_obj_t * lb_desc4 = lv_label_create(desc4, lb_desc);
|
||||||
|
lv_label_set_text(lb_desc4, "#D4FF00 Acquiring FAT volume info...#");
|
||||||
|
lv_obj_set_width(lb_desc4, lv_obj_get_width(desc4));
|
||||||
|
|
||||||
|
lv_label_set_text(lb_desc4,
|
||||||
|
"#00DDFF SDMMC1 Errors:#\n"
|
||||||
|
"Init fails:\n"
|
||||||
|
"Read/Write fails:\n"
|
||||||
|
"Read/Write errors:"
|
||||||
|
);
|
||||||
|
lv_obj_set_size(desc4, LV_HOR_RES / 2 / 5 * 2, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
||||||
|
lv_obj_set_width(lb_desc4, lv_obj_get_width(desc4));
|
||||||
|
lv_obj_align(desc4, val3, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 2, 0);
|
||||||
|
|
||||||
|
lv_obj_t *val4 = lv_cont_create(win, NULL);
|
||||||
|
lv_obj_set_size(val4, LV_HOR_RES / 13 * 3, LV_VER_RES - (LV_DPI * 11 / 8) * 4);
|
||||||
|
|
||||||
|
lv_obj_t * lb_val4 = lv_label_create(val4, lb_desc);
|
||||||
|
|
||||||
|
u16 *sd_errors = sd_get_error_count();
|
||||||
|
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);
|
||||||
|
|
||||||
|
lv_obj_set_width(lb_val4, lv_obj_get_width(val4));
|
||||||
|
lv_obj_align(val4, desc4, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 2, 0);
|
||||||
|
|
||||||
|
free(txt_buf);
|
||||||
|
sd_unmount();
|
||||||
|
|
||||||
|
failed:
|
||||||
nyx_window_toggle_buttons(win, false);
|
nyx_window_toggle_buttons(win, false);
|
||||||
|
|
||||||
return LV_RES_OK;
|
return LV_RES_OK;
|
||||||
|
|
|
@ -68,7 +68,7 @@ bool get_autorcm_status(bool toggle)
|
||||||
emmc_initialize(false);
|
emmc_initialize(false);
|
||||||
|
|
||||||
u8 *tempbuf = (u8 *)malloc(0x200);
|
u8 *tempbuf = (u8 *)malloc(0x200);
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_BOOT0);
|
emmc_set_partition(EMMC_BOOT0);
|
||||||
sdmmc_storage_read(&emmc_storage, 0x200 / EMMC_BLOCKSIZE, 1, tempbuf);
|
sdmmc_storage_read(&emmc_storage, 0x200 / EMMC_BLOCKSIZE, 1, tempbuf);
|
||||||
|
|
||||||
// Get the correct RSA modulus byte masks.
|
// Get the correct RSA modulus byte masks.
|
||||||
|
@ -1158,7 +1158,7 @@ static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_BOOT0);
|
emmc_set_partition(EMMC_BOOT0);
|
||||||
|
|
||||||
// Read package1.
|
// Read package1.
|
||||||
static const u32 BOOTLOADER_SIZE = SZ_256K;
|
static const u32 BOOTLOADER_SIZE = SZ_256K;
|
||||||
|
@ -1300,7 +1300,7 @@ static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump package2.1.
|
// Dump package2.1.
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
emmc_set_partition(EMMC_GPP);
|
||||||
// Parse eMMC GPT.
|
// Parse eMMC GPT.
|
||||||
LIST_INIT(gpt);
|
LIST_INIT(gpt);
|
||||||
emmc_gpt_parse(&gpt);
|
emmc_gpt_parse(&gpt);
|
||||||
|
|
Loading…
Reference in a new issue