mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-26 11:42:09 +00:00
sdmmc: More functions use the global emmc storage
This commit is contained in:
parent
796b15a861
commit
f3f1d4d4f0
5 changed files with 77 additions and 98 deletions
|
@ -770,9 +770,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
|||
// Get SD Card free space for Partial Backup.
|
||||
f_getfree("", &sd_fs.free_clst, NULL);
|
||||
|
||||
sdmmc_storage_t storage;
|
||||
sdmmc_t sdmmc;
|
||||
if (!sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400))
|
||||
if (!sdmmc_storage_init_mmc(&emmc_storage, &emmc_sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400))
|
||||
{
|
||||
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init eMMC!#");
|
||||
goto out;
|
||||
|
@ -781,16 +779,16 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
|||
int i = 0;
|
||||
char sdPath[OUT_FILENAME_SZ];
|
||||
// Create Restore folders, if they do not exist.
|
||||
emmcsn_path_impl(sdPath, "/restore", "", &storage);
|
||||
emmcsn_path_impl(sdPath, "/restore/partitions", "", &storage);
|
||||
emmcsn_path_impl(sdPath, "", "", &storage);
|
||||
emmcsn_path_impl(sdPath, "/restore", "", &emmc_storage);
|
||||
emmcsn_path_impl(sdPath, "/restore/partitions", "", &emmc_storage);
|
||||
emmcsn_path_impl(sdPath, "", "", &emmc_storage);
|
||||
gui->base_path = (char *)malloc(strlen(sdPath) + 1);
|
||||
strcpy(gui->base_path, sdPath);
|
||||
|
||||
timer = get_tmr_s();
|
||||
if (dumpType & PART_BOOT)
|
||||
{
|
||||
const u32 BOOT_PART_SIZE = storage.ext_csd.boot_mult << 17;
|
||||
const u32 BOOT_PART_SIZE = emmc_storage.ext_csd.boot_mult << 17;
|
||||
|
||||
emmc_part_t bootPart;
|
||||
memset(&bootPart, 0, sizeof(bootPart));
|
||||
|
@ -809,10 +807,10 @@ 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);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
sdmmc_storage_set_mmc_partition(&storage, i + 1);
|
||||
sdmmc_storage_set_mmc_partition(&emmc_storage, i + 1);
|
||||
|
||||
emmcsn_path_impl(sdPath, "", bootPart.name, &storage);
|
||||
res = _dump_emmc_part(gui, sdPath, i, &storage, &bootPart);
|
||||
emmcsn_path_impl(sdPath, "", bootPart.name, &emmc_storage);
|
||||
res = _dump_emmc_part(gui, sdPath, i, &emmc_storage, &bootPart);
|
||||
|
||||
if (!res)
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
|
@ -826,16 +824,16 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
|||
|
||||
if ((dumpType & PART_SYSTEM) || (dumpType & PART_USER) || (dumpType & PART_RAW))
|
||||
{
|
||||
sdmmc_storage_set_mmc_partition(&storage, EMMC_GPP);
|
||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
||||
|
||||
if ((dumpType & PART_SYSTEM) || (dumpType & PART_USER))
|
||||
{
|
||||
emmcsn_path_impl(sdPath, "/partitions", "", &storage);
|
||||
emmcsn_path_impl(sdPath, "/partitions", "", &emmc_storage);
|
||||
gui->base_path = (char *)malloc(strlen(sdPath) + 1);
|
||||
strcpy(gui->base_path, sdPath);
|
||||
|
||||
LIST_INIT(gpt);
|
||||
nx_emmc_gpt_parse(&gpt, &storage);
|
||||
nx_emmc_gpt_parse(&gpt, &emmc_storage);
|
||||
LIST_FOREACH_ENTRY(emmc_part_t, part, &gpt, link)
|
||||
{
|
||||
if ((dumpType & PART_USER) == 0 && !strcmp(part->name, "USER"))
|
||||
|
@ -851,8 +849,8 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
|||
manual_system_maintenance(true);
|
||||
i++;
|
||||
|
||||
emmcsn_path_impl(sdPath, "/partitions", part->name, &storage);
|
||||
res = _dump_emmc_part(gui, sdPath, 0, &storage, part);
|
||||
emmcsn_path_impl(sdPath, "/partitions", part->name, &emmc_storage);
|
||||
res = _dump_emmc_part(gui, sdPath, 0, &emmc_storage, part);
|
||||
// If a part failed, don't continue.
|
||||
if (!res)
|
||||
{
|
||||
|
@ -872,7 +870,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
|||
if (dumpType & PART_RAW)
|
||||
{
|
||||
// Get GP partition size dynamically.
|
||||
const u32 RAW_AREA_NUM_SECTORS = storage.sec_cnt;
|
||||
const u32 RAW_AREA_NUM_SECTORS = emmc_storage.sec_cnt;
|
||||
|
||||
emmc_part_t rawPart;
|
||||
memset(&rawPart, 0, sizeof(rawPart));
|
||||
|
@ -889,8 +887,8 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
|||
|
||||
i++;
|
||||
|
||||
emmcsn_path_impl(sdPath, "", rawPart.name, &storage);
|
||||
res = _dump_emmc_part(gui, sdPath, 2, &storage, &rawPart);
|
||||
emmcsn_path_impl(sdPath, "", rawPart.name, &emmc_storage);
|
||||
res = _dump_emmc_part(gui, sdPath, 2, &emmc_storage, &rawPart);
|
||||
|
||||
if (!res)
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
|
@ -904,7 +902,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
|
|||
}
|
||||
|
||||
timer = get_tmr_s() - timer;
|
||||
sdmmc_storage_end(&storage);
|
||||
sdmmc_storage_end(&emmc_storage);
|
||||
|
||||
if (res && n_cfg.verification && !gui->raw_emummc)
|
||||
s_printf(txt_buf, "Time taken: %dm %ds.\n#96FF00 Finished and verified!#", timer / 60, timer % 60);
|
||||
|
@ -1370,9 +1368,7 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
|||
goto out;
|
||||
}
|
||||
|
||||
sdmmc_storage_t storage;
|
||||
sdmmc_t sdmmc;
|
||||
if (!sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400))
|
||||
if (!sdmmc_storage_init_mmc(&emmc_storage, &emmc_sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400))
|
||||
{
|
||||
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init eMMC!#");
|
||||
goto out;
|
||||
|
@ -1381,14 +1377,14 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
|||
int i = 0;
|
||||
char sdPath[OUT_FILENAME_SZ];
|
||||
|
||||
emmcsn_path_impl(sdPath, "/restore", "", &storage);
|
||||
emmcsn_path_impl(sdPath, "/restore", "", &emmc_storage);
|
||||
gui->base_path = (char *)malloc(strlen(sdPath) + 1);
|
||||
strcpy(gui->base_path, sdPath);
|
||||
|
||||
timer = get_tmr_s();
|
||||
if (restoreType & PART_BOOT)
|
||||
{
|
||||
const u32 BOOT_PART_SIZE = storage.ext_csd.boot_mult << 17;
|
||||
const u32 BOOT_PART_SIZE = emmc_storage.ext_csd.boot_mult << 17;
|
||||
|
||||
emmc_part_t bootPart;
|
||||
memset(&bootPart, 0, sizeof(bootPart));
|
||||
|
@ -1407,10 +1403,10 @@ 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);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
sdmmc_storage_set_mmc_partition(&storage, i + 1);
|
||||
sdmmc_storage_set_mmc_partition(&emmc_storage, i + 1);
|
||||
|
||||
emmcsn_path_impl(sdPath, "/restore", bootPart.name, &storage);
|
||||
res = _restore_emmc_part(gui, sdPath, i, &storage, &bootPart, false);
|
||||
emmcsn_path_impl(sdPath, "/restore", bootPart.name, &emmc_storage);
|
||||
res = _restore_emmc_part(gui, sdPath, i, &emmc_storage, &bootPart, false);
|
||||
|
||||
if (!res)
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
|
@ -1424,14 +1420,14 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
|||
|
||||
if (restoreType & PART_GP_ALL)
|
||||
{
|
||||
emmcsn_path_impl(sdPath, "/restore/partitions", "", &storage);
|
||||
emmcsn_path_impl(sdPath, "/restore/partitions", "", &emmc_storage);
|
||||
gui->base_path = (char *)malloc(strlen(sdPath) + 1);
|
||||
strcpy(gui->base_path, sdPath);
|
||||
|
||||
sdmmc_storage_set_mmc_partition(&storage, EMMC_GPP);
|
||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
||||
|
||||
LIST_INIT(gpt);
|
||||
nx_emmc_gpt_parse(&gpt, &storage);
|
||||
nx_emmc_gpt_parse(&gpt, &emmc_storage);
|
||||
LIST_FOREACH_ENTRY(emmc_part_t, part, &gpt, link)
|
||||
{
|
||||
s_printf(txt_buf, "#00DDFF %02d: %s#\n#00DDFF Range: 0x%08X - 0x%08X#\n\n\n\n\n",
|
||||
|
@ -1442,8 +1438,8 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
|||
manual_system_maintenance(true);
|
||||
i++;
|
||||
|
||||
emmcsn_path_impl(sdPath, "/restore/partitions", part->name, &storage);
|
||||
res = _restore_emmc_part(gui, sdPath, 0, &storage, part, false);
|
||||
emmcsn_path_impl(sdPath, "/restore/partitions", part->name, &emmc_storage);
|
||||
res = _restore_emmc_part(gui, sdPath, 0, &emmc_storage, part, false);
|
||||
|
||||
if (!res)
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
|
@ -1459,7 +1455,7 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
|||
if (restoreType & PART_RAW)
|
||||
{
|
||||
// Get GP partition size dynamically.
|
||||
const u32 RAW_AREA_NUM_SECTORS = storage.sec_cnt;
|
||||
const u32 RAW_AREA_NUM_SECTORS = emmc_storage.sec_cnt;
|
||||
|
||||
emmc_part_t rawPart;
|
||||
memset(&rawPart, 0, sizeof(rawPart));
|
||||
|
@ -1475,8 +1471,8 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
|||
manual_system_maintenance(true);
|
||||
i++;
|
||||
|
||||
emmcsn_path_impl(sdPath, "/restore", rawPart.name, &storage);
|
||||
res = _restore_emmc_part(gui, sdPath, 2, &storage, &rawPart, true);
|
||||
emmcsn_path_impl(sdPath, "/restore", rawPart.name, &emmc_storage);
|
||||
res = _restore_emmc_part(gui, sdPath, 2, &emmc_storage, &rawPart, true);
|
||||
|
||||
if (!res)
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
|
@ -1489,7 +1485,7 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
|
|||
}
|
||||
|
||||
timer = get_tmr_s() - timer;
|
||||
sdmmc_storage_end(&storage);
|
||||
sdmmc_storage_end(&emmc_storage);
|
||||
|
||||
if (res && n_cfg.verification && !gui->raw_emummc)
|
||||
s_printf(txt_buf, "Time taken: %dm %ds.\n#96FF00 Finished and verified!#", timer / 60, timer % 60);
|
||||
|
|
|
@ -649,9 +649,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start)
|
|||
goto out;
|
||||
}
|
||||
|
||||
sdmmc_storage_t storage;
|
||||
sdmmc_t sdmmc;
|
||||
if (!sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400))
|
||||
if (!sdmmc_storage_init_mmc(&emmc_storage, &emmc_sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400))
|
||||
{
|
||||
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init eMMC!#");
|
||||
goto out;
|
||||
|
@ -667,7 +665,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start)
|
|||
strcpy(gui->base_path, sdPath);
|
||||
|
||||
timer = get_tmr_s();
|
||||
const u32 BOOT_PART_SIZE = storage.ext_csd.boot_mult << 17;
|
||||
const u32 BOOT_PART_SIZE = emmc_storage.ext_csd.boot_mult << 17;
|
||||
|
||||
emmc_part_t bootPart;
|
||||
memset(&bootPart, 0, sizeof(bootPart));
|
||||
|
@ -691,10 +689,10 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start)
|
|||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
sdmmc_storage_set_mmc_partition(&storage, i + 1);
|
||||
sdmmc_storage_set_mmc_partition(&emmc_storage, i + 1);
|
||||
|
||||
strcat(sdPath, bootPart.name);
|
||||
res = _dump_emummc_raw_part(gui, i, part_idx, sector_start, &storage, &bootPart);
|
||||
res = _dump_emummc_raw_part(gui, i, part_idx, sector_start, &emmc_storage, &bootPart);
|
||||
|
||||
if (!res)
|
||||
{
|
||||
|
@ -710,10 +708,10 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start)
|
|||
strcpy(sdPath, gui->base_path);
|
||||
}
|
||||
|
||||
sdmmc_storage_set_mmc_partition(&storage, EMMC_GPP);
|
||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
||||
|
||||
// Get GP partition size dynamically.
|
||||
const u32 RAW_AREA_NUM_SECTORS = storage.sec_cnt;
|
||||
const u32 RAW_AREA_NUM_SECTORS = emmc_storage.sec_cnt;
|
||||
|
||||
emmc_part_t rawPart;
|
||||
memset(&rawPart, 0, sizeof(rawPart));
|
||||
|
@ -728,7 +726,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start)
|
|||
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, txt_buf);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
res = _dump_emummc_raw_part(gui, 2, part_idx, sector_start, &storage, &rawPart);
|
||||
res = _dump_emummc_raw_part(gui, 2, part_idx, sector_start, &emmc_storage, &rawPart);
|
||||
|
||||
if (!res)
|
||||
s_printf(txt_buf, "#FFDD00 Failed!#\n");
|
||||
|
@ -741,7 +739,7 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start)
|
|||
|
||||
out_failed:
|
||||
timer = get_tmr_s() - timer;
|
||||
sdmmc_storage_end(&storage);
|
||||
sdmmc_storage_end(&emmc_storage);
|
||||
|
||||
if (res)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <libs/fatfs/ff.h>
|
||||
#include <mem/heap.h>
|
||||
#include <storage/mbr_gpt.h>
|
||||
#include "../storage/nx_emmc_bis.h"
|
||||
#include <storage/nx_sd.h>
|
||||
#include <storage/sdmmc.h>
|
||||
#include <utils/dirlist.h>
|
||||
|
@ -223,13 +224,11 @@ static void _create_mbox_emummc_raw()
|
|||
sdmmc_storage_read(&sd_storage, 0, 1, mbr);
|
||||
sd_unmount();
|
||||
|
||||
sdmmc_storage_t storage;
|
||||
sdmmc_t sdmmc;
|
||||
sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400);
|
||||
sdmmc_storage_init_mmc(&emmc_storage, &emmc_sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400);
|
||||
|
||||
u32 emmc_size_safe = storage.sec_cnt + 0xC000; // eMMC GPP size + BOOT0/1.
|
||||
u32 emmc_size_safe = emmc_storage.sec_cnt + 0xC000; // eMMC GPP size + BOOT0/1.
|
||||
|
||||
sdmmc_storage_end(&storage);
|
||||
sdmmc_storage_end(&emmc_storage);
|
||||
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
|
@ -762,9 +761,7 @@ static lv_res_t _create_mbox_emummc_migrate(lv_obj_t *btn)
|
|||
sd_mount();
|
||||
sdmmc_storage_read(&sd_storage, 0, 1, mbr);
|
||||
|
||||
sdmmc_storage_t storage;
|
||||
sdmmc_t sdmmc;
|
||||
sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400);
|
||||
sdmmc_storage_init_mmc(&emmc_storage, &emmc_sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400);
|
||||
|
||||
em_raw = false;
|
||||
em_file = false;
|
||||
|
@ -813,22 +810,22 @@ static lv_res_t _create_mbox_emummc_migrate(lv_obj_t *btn)
|
|||
if(!f_stat(path_buf, NULL))
|
||||
em_file = true;
|
||||
|
||||
emmcsn_path_impl(path_buf, "", "BOOT0", &storage);
|
||||
emmcsn_path_impl(path_buf, "", "BOOT0", &emmc_storage);
|
||||
if(!f_stat(path_buf, NULL))
|
||||
backup = true;
|
||||
|
||||
emmcsn_path_impl(path_buf, "", "rawnand.bin", &storage);
|
||||
emmcsn_path_impl(path_buf, "", "rawnand.bin", &emmc_storage);
|
||||
if(!f_stat(path_buf, NULL))
|
||||
rawnand_backup = true;
|
||||
|
||||
emmcsn_path_impl(path_buf, "", "rawnand.bin.00", &storage);
|
||||
emmcsn_path_impl(path_buf, "", "rawnand.bin.00", &emmc_storage);
|
||||
if(!f_stat(path_buf, NULL))
|
||||
rawnand_backup = true;
|
||||
|
||||
backup = backup && rawnand_backup;
|
||||
|
||||
sd_unmount();
|
||||
sdmmc_storage_end(&storage);
|
||||
sdmmc_storage_end(&emmc_storage);
|
||||
|
||||
// Check available types and enable the corresponding buttons.
|
||||
if (backup)
|
||||
|
|
|
@ -1214,8 +1214,6 @@ out:
|
|||
|
||||
static lv_res_t _create_mbox_benchmark(bool sd_bench)
|
||||
{
|
||||
sdmmc_t emmc_sdmmc;
|
||||
sdmmc_storage_t emmc_storage;
|
||||
sdmmc_storage_t *storage;
|
||||
|
||||
lv_obj_t *dark_bg = lv_obj_create(lv_scr_act(), NULL);
|
||||
|
@ -1325,8 +1323,6 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
|
|||
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
|
||||
|
||||
pct = 0;
|
||||
prevPct = 200;
|
||||
timer = 0;
|
||||
|
@ -1369,9 +1365,6 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
|
|||
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
manual_system_maintenance(true);
|
||||
|
||||
|
||||
|
||||
|
||||
u32 lba_idx = 0;
|
||||
u32 *random_offsets = malloc(0x20000 * sizeof(u32));
|
||||
u32 random_numbers[4];
|
||||
|
@ -1471,14 +1464,11 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
|
|||
lv_label_set_long_mode(lb_desc, LV_LABEL_LONG_BREAK);
|
||||
lv_label_set_recolor(lb_desc, true);
|
||||
|
||||
sdmmc_storage_t storage;
|
||||
sdmmc_t sdmmc;
|
||||
|
||||
char *txt_buf = (char *)malloc(0x4000);
|
||||
txt_buf[0] = '\n';
|
||||
txt_buf[1] = 0;
|
||||
|
||||
if (!sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400))
|
||||
if (!sdmmc_storage_init_mmc(&emmc_storage, &emmc_sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400))
|
||||
{
|
||||
lv_label_set_text(lb_desc, "#FFDD00 Failed to init eMMC!#");
|
||||
lv_obj_set_width(lb_desc, lv_obj_get_width(desc));
|
||||
|
@ -1489,15 +1479,15 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
|
|||
char *rsvd_blocks;
|
||||
char life_a_txt[8];
|
||||
char life_b_txt[8];
|
||||
u32 cache = storage.ext_csd.cache_size;
|
||||
u32 life_a = storage.ext_csd.dev_life_est_a;
|
||||
u32 life_b = storage.ext_csd.dev_life_est_b;
|
||||
u16 card_type = storage.ext_csd.card_type;
|
||||
u32 cache = emmc_storage.ext_csd.cache_size;
|
||||
u32 life_a = emmc_storage.ext_csd.dev_life_est_a;
|
||||
u32 life_b = emmc_storage.ext_csd.dev_life_est_b;
|
||||
u16 card_type = emmc_storage.ext_csd.card_type;
|
||||
char card_type_support[96];
|
||||
card_type_support[0] = 0;
|
||||
|
||||
// Identify manufacturer. Only official eMMCs.
|
||||
switch (storage.cid.manfid)
|
||||
switch (emmc_storage.cid.manfid)
|
||||
{
|
||||
case 0x11:
|
||||
strcat(txt_buf, "Toshiba ");
|
||||
|
@ -1514,11 +1504,11 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
|
|||
}
|
||||
|
||||
s_printf(txt_buf + strlen(txt_buf), "(%02X)\n%c%c%c%c%c%c\n%d.%d\n%04X\n%02d/%04d\n\n",
|
||||
storage.cid.manfid,
|
||||
storage.cid.prod_name[0], storage.cid.prod_name[1], storage.cid.prod_name[2],
|
||||
storage.cid.prod_name[3], storage.cid.prod_name[4], storage.cid.prod_name[5],
|
||||
storage.cid.prv & 0xF, storage.cid.prv >> 4,
|
||||
storage.cid.serial, storage.cid.month, storage.cid.year);
|
||||
emmc_storage.cid.manfid,
|
||||
emmc_storage.cid.prod_name[0], emmc_storage.cid.prod_name[1], emmc_storage.cid.prod_name[2],
|
||||
emmc_storage.cid.prod_name[3], emmc_storage.cid.prod_name[4], emmc_storage.cid.prod_name[5],
|
||||
emmc_storage.cid.prv & 0xF, emmc_storage.cid.prv >> 4,
|
||||
emmc_storage.cid.serial, emmc_storage.cid.month, emmc_storage.cid.year);
|
||||
|
||||
if (card_type & EXT_CSD_CARD_TYPE_HS_26)
|
||||
{
|
||||
|
@ -1564,7 +1554,7 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
|
|||
s_printf(life_b_txt, "%d%%", life_b);
|
||||
}
|
||||
|
||||
switch (storage.ext_csd.pre_eol_info)
|
||||
switch (emmc_storage.ext_csd.pre_eol_info)
|
||||
{
|
||||
case 1:
|
||||
rsvd_blocks = "Normal (< 80%)";
|
||||
|
@ -1582,11 +1572,11 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
|
|||
|
||||
s_printf(txt_buf + strlen(txt_buf),
|
||||
"#00DDFF V1.%d (rev 1.%d)#\n%02X\n%d MB/s (%d MHz)\n%d MB/s\n%s\n%d %s\n%d MiB\nA: %s, B: %s\n%s",
|
||||
storage.ext_csd.ext_struct, storage.ext_csd.rev,
|
||||
storage.csd.cmdclass, speed & 0xFFFF, (speed >> 16) & 0xFFFF,
|
||||
storage.csd.busspeed, card_type_support,
|
||||
emmc_storage.ext_csd.ext_struct, emmc_storage.ext_csd.rev,
|
||||
emmc_storage.csd.cmdclass, speed & 0xFFFF, (speed >> 16) & 0xFFFF,
|
||||
emmc_storage.csd.busspeed, card_type_support,
|
||||
!(cache % 1024) ? (cache / 1024) : cache, !(cache % 1024) ? "MiB" : "KiB",
|
||||
storage.ext_csd.max_enh_mult * 512 / 1024,
|
||||
emmc_storage.ext_csd.max_enh_mult * 512 / 1024,
|
||||
life_a_txt, life_b_txt, rsvd_blocks);
|
||||
|
||||
lv_label_set_static_text(lb_desc,
|
||||
|
@ -1624,18 +1614,18 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
|
|||
lv_obj_t * lb_desc2 = lv_label_create(desc2, lb_desc);
|
||||
lv_label_set_style(lb_desc2, &monospace_text);
|
||||
|
||||
u32 boot_size = storage.ext_csd.boot_mult << 17;
|
||||
u32 rpmb_size = storage.ext_csd.rpmb_mult << 17;
|
||||
u32 boot_size = emmc_storage.ext_csd.boot_mult << 17;
|
||||
u32 rpmb_size = emmc_storage.ext_csd.rpmb_mult << 17;
|
||||
strcpy(txt_buf, "#00DDFF eMMC Physical Partitions:#\n");
|
||||
s_printf(txt_buf + strlen(txt_buf), "1: #96FF00 BOOT0# Size: %6d KiB (Sect: 0x%08X)\n", boot_size / 1024, boot_size / 512);
|
||||
s_printf(txt_buf + strlen(txt_buf), "2: #96FF00 BOOT1# Size: %6d KiB (Sect: 0x%08X)\n", boot_size / 1024, boot_size / 512);
|
||||
s_printf(txt_buf + strlen(txt_buf), "3: #96FF00 RPMB# Size: %6d KiB (Sect: 0x%08X)\n", rpmb_size / 1024, rpmb_size / 512);
|
||||
s_printf(txt_buf + strlen(txt_buf), "0: #96FF00 GPP# Size: %6d MiB (Sect: 0x%08X)\n", storage.sec_cnt >> SECTORS_TO_MIB_COEFF, 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");
|
||||
|
||||
sdmmc_storage_set_mmc_partition(&storage, EMMC_GPP);
|
||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_GPP);
|
||||
LIST_INIT(gpt);
|
||||
nx_emmc_gpt_parse(&gpt, &storage);
|
||||
nx_emmc_gpt_parse(&gpt, &emmc_storage);
|
||||
|
||||
u32 idx = 0;
|
||||
LIST_FOREACH_ENTRY(emmc_part_t, part, &gpt, link)
|
||||
|
@ -1672,7 +1662,7 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
|
|||
lv_obj_align(desc2, val, LV_ALIGN_OUT_RIGHT_MID, LV_DPI / 6, 0);
|
||||
}
|
||||
|
||||
sdmmc_storage_end(&storage);
|
||||
sdmmc_storage_end(&emmc_storage);
|
||||
free(txt_buf);
|
||||
|
||||
return LV_RES_OK;
|
||||
|
|
|
@ -71,18 +71,16 @@ static lv_obj_t *_create_container(lv_obj_t *parent)
|
|||
bool get_autorcm_status(bool change)
|
||||
{
|
||||
u8 corr_mod0, mod1;
|
||||
sdmmc_storage_t storage;
|
||||
sdmmc_t sdmmc;
|
||||
bool enabled = false;
|
||||
|
||||
if (h_cfg.t210b01)
|
||||
return false;
|
||||
|
||||
sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400);
|
||||
sdmmc_storage_init_mmc(&emmc_storage, &emmc_sdmmc, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400);
|
||||
|
||||
u8 *tempbuf = (u8 *)malloc(0x200);
|
||||
sdmmc_storage_set_mmc_partition(&storage, EMMC_BOOT0);
|
||||
sdmmc_storage_read(&storage, 0x200 / NX_EMMC_BLOCKSIZE, 1, tempbuf);
|
||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_BOOT0);
|
||||
sdmmc_storage_read(&emmc_storage, 0x200 / NX_EMMC_BLOCKSIZE, 1, tempbuf);
|
||||
|
||||
// Get the correct RSA modulus byte masks.
|
||||
nx_emmc_get_autorcm_masks(&corr_mod0, &mod1);
|
||||
|
@ -103,20 +101,20 @@ bool get_autorcm_status(bool change)
|
|||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
sect = (0x200 + (0x4000 * i)) / NX_EMMC_BLOCKSIZE;
|
||||
sdmmc_storage_read(&storage, sect, 1, tempbuf);
|
||||
sdmmc_storage_read(&emmc_storage, sect, 1, tempbuf);
|
||||
|
||||
if (!enabled)
|
||||
tempbuf[0x10] = 0;
|
||||
else
|
||||
tempbuf[0x10] = corr_mod0;
|
||||
sdmmc_storage_write(&storage, sect, 1, tempbuf);
|
||||
sdmmc_storage_write(&emmc_storage, sect, 1, tempbuf);
|
||||
}
|
||||
enabled = !(enabled);
|
||||
}
|
||||
|
||||
out:
|
||||
free(tempbuf);
|
||||
sdmmc_storage_end(&storage);
|
||||
sdmmc_storage_end(&emmc_storage);
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue