hekate/nyx: adjust handling of sdmmc return values

This commit is contained in:
CTCaer
2026-02-22 08:47:22 +02:00
parent 25fda88e46
commit 63c6cfedef
17 changed files with 94 additions and 93 deletions

View File

@@ -65,7 +65,7 @@ void print_mmc_info()
static const u32 SECTORS_TO_MIB_COEFF = 11;
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
EPRINTF("Failed to init eMMC.");
goto out;
@@ -194,7 +194,7 @@ void print_sdcard_info()
gfx_clear_partial_grey(0x1B, 0, 1256);
gfx_con_setpos(0, 0);
if (sd_initialize(false))
if (!sd_initialize(false))
{
gfx_printf("%kCard IDentification:%k\n", TXT_CLR_CYAN_L, TXT_CLR_DEFAULT);
gfx_printf(

View File

@@ -110,7 +110,7 @@ void menu_autorcm()
return;
}
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
EPRINTF("Failed to init eMMC.");
btn_wait();

View File

@@ -137,12 +137,12 @@ static int _hos_eks_rw_try(u8 *buf, bool write)
{
if (!write)
{
if (sdmmc_storage_read(&sd_storage, 0, 1, buf))
if (!sdmmc_storage_read(&sd_storage, 0, 1, buf))
return 0;
}
else
{
if (sdmmc_storage_write(&sd_storage, 0, 1, buf))
if (!sdmmc_storage_write(&sd_storage, 0, 1, buf))
return 0;
}
}

View File

@@ -43,7 +43,7 @@ DRESULT disk_read (
UINT count /* Number of sectors to read */
)
{
return sdmmc_storage_read(&sd_storage, sector, count, buff) ? RES_OK : RES_ERROR;
return sdmmc_storage_read(&sd_storage, sector, count, buff);
}
/*-----------------------------------------------------------------------*/
@@ -56,7 +56,7 @@ DRESULT disk_write (
UINT count /* Number of sectors to write */
)
{
return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff);
}
/*-----------------------------------------------------------------------*/

View File

@@ -228,7 +228,7 @@ static void _launch_payloads()
gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0);
if (!sd_mount())
if (sd_mount())
goto failed_sd_mount;
ments = (ment_t *)malloc(sizeof(ment_t) * (max_entries + 3));
@@ -310,7 +310,7 @@ static void _launch_ini_list()
gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0);
if (!sd_mount())
if (sd_mount())
goto parse_failed;
// Check that ini files exist and parse them.
@@ -440,7 +440,7 @@ static void _launch_config()
gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0);
if (!sd_mount())
if (sd_mount())
goto parse_failed;
// Load emuMMC configuration.
@@ -1466,7 +1466,7 @@ void ipl_main()
bpmp_clk_rate_set(h_cfg.t210b01 ? ipl_ver.rcfg.bclk_t210b01 : ipl_ver.rcfg.bclk_t210);
// Mount SD Card.
if (!sd_mount())
if (sd_mount())
h_cfg.errors |= ERR_SD_BOOT_EN;
// Check if watchdog was fired previously.

View File

@@ -137,13 +137,13 @@ int emummc_storage_init_mmc()
emu_cfg.active_part = 0;
// Always init eMMC even when in emuMMC. eMMC is needed from the emuMMC driver anyway.
if (!emmc_initialize(false))
if (emmc_initialize(false))
return 2;
if (!emu_cfg.enabled || h_cfg.emummc_force_disable)
return 0;
if (!sd_mount())
if (sd_mount())
goto out;
if (!emu_cfg.sector)
@@ -180,7 +180,7 @@ int emummc_storage_end()
else
sd_end();
return 1;
return 0;
}
int emummc_storage_read(u32 sector, u32 num_sectors, void *buf)
@@ -211,21 +211,19 @@ int emummc_storage_read(u32 sector, u32 num_sectors, void *buf)
if (f_open(&fp, emu_cfg.emummc_file_based_path, FA_READ))
{
EPRINTF("Failed to open emuMMC image.");
return 0;
return 1;
}
f_lseek(&fp, (u64)sector << 9);
if (f_read(&fp, buf, (u64)num_sectors << 9, NULL))
{
EPRINTF("Failed to read emuMMC image.");
f_close(&fp);
return 0;
return 1;
}
f_close(&fp);
return 1;
return 0;
}
return 1;
}
int emummc_storage_write(u32 sector, u32 num_sectors, void *buf)
@@ -255,17 +253,17 @@ int emummc_storage_write(u32 sector, u32 num_sectors, void *buf)
}
if (f_open(&fp, emu_cfg.emummc_file_based_path, FA_WRITE))
return 0;
return 1;
f_lseek(&fp, (u64)sector << 9);
if (f_write(&fp, buf, (u64)num_sectors << 9, NULL))
{
f_close(&fp);
return 0;
return 1;
}
f_close(&fp);
return 1;
return 0;
}
}
@@ -275,7 +273,7 @@ int emummc_storage_set_mmc_partition(u32 partition)
emmc_set_partition(partition);
if (!emu_cfg.enabled || h_cfg.emummc_force_disable || emu_cfg.sector)
return 1;
return 0;
else
{
strcpy(emu_cfg.emummc_file_based_path, emu_cfg.path);
@@ -294,8 +292,6 @@ int emummc_storage_set_mmc_partition(u32 partition)
break;
}
return 1;
return 0;
}
return 1;
}

View File

@@ -188,7 +188,7 @@ int create_nyx_config_entry(bool force_unmount)
{
bool sd_mounted = sd_get_card_mounted();
if (!sd_mount())
if (sd_mount())
return 1;
char lbuf[64];

View File

@@ -211,7 +211,7 @@ static int _emmc_sd_copy_verify(emmc_tool_gui_t *gui, sdmmc_storage_t *storage,
// Full provides all that, plus protection from extremely rare I/O corruption.
if ((n_cfg.verification >= 2) || !(sparseShouldVerify % 4))
{
if (!sdmmc_storage_read(storage, lba_curr, num, bufEm))
if (sdmmc_storage_read(storage, lba_curr, num, bufEm))
{
s_printf(gui->txt_buf,
"\n#FF0000 Failed to read %d blocks (@LBA %08X),#\n"
@@ -629,9 +629,9 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
int res_read;
if (!gui->raw_emummc)
res_read = !sdmmc_storage_read(storage, lba_curr, num, buf);
res_read = sdmmc_storage_read(storage, lba_curr, num, buf);
else
res_read = !sdmmc_storage_read(&sd_storage, lba_curr + sd_sector_off, num, buf);
res_read = sdmmc_storage_read(&sd_storage, lba_curr + sd_sector_off, num, buf);
while (res_read)
{
@@ -671,8 +671,13 @@ static int _dump_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_part,
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
}
if (!gui->raw_emummc)
res_read = sdmmc_storage_read(storage, lba_curr, num, buf);
else
res_read = sdmmc_storage_read(&sd_storage, lba_curr + sd_sector_off, num, buf);
manual_system_maintenance(false);
}
manual_system_maintenance(false);
res = f_write_fast(&fp, buf, EMMC_BLOCKSIZE * num);
@@ -781,7 +786,7 @@ void dump_emmc_selected(emmcPartType_t dumpType, emmc_tool_gui_t *gui)
lv_label_set_text(gui->label_info, "Checking for available free space...");
manual_system_maintenance(true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init SD!#");
goto out;
@@ -790,7 +795,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);
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init eMMC!#");
goto out;
@@ -1302,9 +1307,9 @@ multipart_not_allowed:
return 1;
}
if (!gui->raw_emummc)
res = !sdmmc_storage_write(storage, lba_curr, num, buf);
res = sdmmc_storage_write(storage, lba_curr, num, buf);
else
res = !sdmmc_storage_write(&sd_storage, lba_curr + sd_sector_off, num, buf);
res = sdmmc_storage_write(&sd_storage, lba_curr + sd_sector_off, num, buf);
manual_system_maintenance(false);
@@ -1337,9 +1342,9 @@ multipart_not_allowed:
manual_system_maintenance(true);
}
if (!gui->raw_emummc)
res = !sdmmc_storage_write(storage, lba_curr, num, buf);
res = sdmmc_storage_write(storage, lba_curr, num, buf);
else
res = !sdmmc_storage_write(&sd_storage, lba_curr + sd_sector_off, num, buf);
res = sdmmc_storage_write(&sd_storage, lba_curr + sd_sector_off, num, buf);
manual_system_maintenance(false);
}
pct = (u64)((u64)(lba_curr - part->lba_start) * 100u) / (u64)(lba_end - part->lba_start);
@@ -1457,13 +1462,13 @@ void restore_emmc_selected(emmcPartType_t restoreType, emmc_tool_gui_t *gui)
lv_obj_del(warn_mbox_bg);
manual_system_maintenance(true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init SD!#");
goto out;
}
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init eMMC!#");
goto out;

View File

@@ -270,7 +270,7 @@ static int _dump_emummc_file_part(emmc_tool_gui_t *gui, char *sd_path, sdmmc_sto
retryCount = 0;
num = MIN(totalSectors, NUM_SECTORS_PER_ITER);
while (!sdmmc_storage_read(storage, lba_curr, num, buf))
while (sdmmc_storage_read(storage, lba_curr, num, buf))
{
s_printf(gui->txt_buf,
"\n#FFDD00 Error reading %d blocks @ LBA %08X,#\n"
@@ -368,7 +368,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui)
manual_system_maintenance(true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init SD!#");
goto out;
@@ -380,7 +380,7 @@ void dump_emummc_file(emmc_tool_gui_t *gui)
// Get SD Card free space for file based emuMMC.
f_getfree("", &sd_fs.free_clst, NULL);
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init eMMC!#");
goto out;
@@ -570,7 +570,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
num = MIN(totalSectors, NUM_SECTORS_PER_ITER);
// Read data from eMMC.
while (!sdmmc_storage_read(&emmc_storage, lba_curr, num, buf))
while (sdmmc_storage_read(&emmc_storage, lba_curr, num, buf))
{
s_printf(gui->txt_buf,
"\n#FFDD00 Error reading %d blocks @LBA %08X,#\n"
@@ -600,7 +600,7 @@ static int _dump_emummc_raw_part(emmc_tool_gui_t *gui, int active_part, int part
// Write data to SD card.
retryCount = 0;
while (!sdmmc_storage_write(&sd_storage, sd_sector_off + lba_curr, num, buf))
while (sdmmc_storage_write(&sd_storage, sd_sector_off + lba_curr, num, buf))
{
s_printf(gui->txt_buf,
"\n#FFDD00 Error writing %d blocks @LBA %08X,#\n"
@@ -837,13 +837,13 @@ void dump_emummc_raw(emmc_tool_gui_t *gui, int part_idx, u32 sector_start, u32 r
manual_system_maintenance(true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init SD!#");
goto out;
}
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(gui->label_info, "#FFDD00 Failed to init eMMC!#");
goto out;

View File

@@ -1448,7 +1448,7 @@ static lv_res_t _create_mbox_payloads(lv_obj_t *btn)
lv_obj_set_size(list, LV_HOR_RES * 3 / 7, LV_VER_RES * 3 / 7);
lv_list_set_single_mode(list, true);
if (!sd_mount())
if (sd_mount())
{
lv_mbox_set_text(mbox, "#FFDD00 Failed to init SD!#");
@@ -1760,7 +1760,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
u32 curr_btn_idx = 0; // Active buttons.
LIST_INIT(ini_sections);
if (!sd_mount())
if (sd_mount())
goto failed_sd_mount;
// Check if we use custom system icons.
@@ -2138,10 +2138,10 @@ static lv_res_t _save_options_action(lv_obj_t *btn)
int res = 0;
if (sd_mount())
res = !create_config_entry();
if (!sd_mount())
res = create_config_entry();
if (res)
if (!res)
lv_mbox_set_text(mbox, "#FF8000 hekate Configuration#\n\n#96FF00 The configuration was saved to sd card!#");
else
lv_mbox_set_text(mbox, "#FF8000 hekate Configuration#\n\n#FFDD00 Failed to save the configuration#\n#FFDD00 to sd card!#");

View File

@@ -74,7 +74,7 @@ static lv_res_t _cal0_dump_window_action(lv_obj_t *btns, const char * txt)
if (btn_idx == 1)
{
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
@@ -94,7 +94,7 @@ static lv_res_t _cal0_dump_window_action(lv_obj_t *btns, const char * txt)
static lv_res_t _battery_dump_window_action(lv_obj_t * btn)
{
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
@@ -118,7 +118,7 @@ static lv_res_t _bootrom_dump_window_action(lv_obj_t * btn)
{
static const u32 BOOTROM_SIZE = 0x18000;
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
char path[64];
@@ -179,7 +179,7 @@ static void _unlock_reserved_odm_fuses(bool lock)
static lv_res_t _fuse_dump_window_action(lv_obj_t * btn)
{
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
char path[128];
@@ -230,7 +230,7 @@ static lv_res_t _kfuse_dump_window_action(lv_obj_t * btn)
int error = kfuse_read(buf);
if (!error)
error = !sd_mount();
error = sd_mount();
if (!error)
{
@@ -1444,7 +1444,7 @@ static lv_res_t _create_mbox_emmc_sandisk_report(lv_obj_t * btn)
lv_obj_align(lb_desc2, lb_desc, LV_ALIGN_OUT_RIGHT_TOP, 0, 0);
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init eMMC!#");
@@ -1454,7 +1454,7 @@ static lv_res_t _create_mbox_emmc_sandisk_report(lv_obj_t * btn)
int res = sdmmc_storage_vendor_sandisk_report(&emmc_storage, buf);
emmc_end();
if (!res)
if (res)
{
lv_label_set_text(lb_desc, "#FFDD00 Device Report not supported!#");
lv_label_set_text(lb_desc2, " ");
@@ -1638,12 +1638,12 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
// Re-initialize to update trimmers.
sd_end();
res = !sd_mount();
res = sd_mount();
}
else
{
storage = &emmc_storage;
res = !emmc_initialize(false);
res = emmc_initialize(false);
if (!res)
emmc_set_partition(EMMC_GPP);
}
@@ -1707,7 +1707,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
while (data_remaining)
{
u32 time_taken = get_tmr_us();
error = !sdmmc_storage_read(storage, sector_off + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
error = sdmmc_storage_read(storage, sector_off + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
time_taken = get_tmr_us() - time_taken;
timer += time_taken;
@@ -1754,7 +1754,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
while (data_remaining)
{
u32 time_taken = get_tmr_us();
error = !sdmmc_storage_read(storage, sector_off + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
error = sdmmc_storage_read(storage, sector_off + lba_curr, sector_num, (u8 *)MIXD_BUF_ALIGNED);
time_taken = get_tmr_us() - time_taken;
timer += time_taken;
@@ -1829,7 +1829,7 @@ static lv_res_t _create_mbox_benchmark(bool sd_bench)
while (data_remaining)
{
u32 time_taken = get_tmr_us();
error = !sdmmc_storage_read(storage, sector_off + random_offsets[lba_idx], sector_num, (u8 *)MIXD_BUF_ALIGNED);
error = sdmmc_storage_read(storage, sector_off + random_offsets[lba_idx], sector_num, (u8 *)MIXD_BUF_ALIGNED);
time_taken = get_tmr_us() - time_taken;
timer += time_taken;
@@ -1965,7 +1965,7 @@ static lv_res_t _create_window_emmc_info_status(lv_obj_t *btn)
txt_buf[1] = 0;
u16 *emmc_errors;
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init eMMC!#");
lv_obj_set_width(lb_desc, lv_obj_get_width(desc));
@@ -2234,7 +2234,7 @@ static lv_res_t _create_window_sdcard_info_status(lv_obj_t *btn)
manual_system_maintenance(true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init SD!#");
goto failed;
@@ -2879,7 +2879,7 @@ static bool _lockpick_exists_check()
bool found = false;
void *buf = malloc(0x200);
if (sd_mount())
if (!sd_mount())
{
FIL fp;
if (f_open(&fp, "bootloader/payloads/Lockpick_RCM.bin", FA_READ))

View File

@@ -1180,7 +1180,7 @@ static lv_res_t _joycon_info_dump_action(lv_obj_t * btn)
jc_pad->bt_conn_r.type = is_r_hos ? jc_pad->bt_conn_r.type : 0;
save_data:
error = !sd_mount() ? 5 : 0;
error = sd_mount() ? 5 : 0;
if (!error)
{

View File

@@ -483,7 +483,7 @@ static lv_res_t _action_ums_emuemmc_boot0(lv_obj_t *btn)
usb_ctxt_t usbs;
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
emummc_cfg_t emu_info;
@@ -530,7 +530,7 @@ static lv_res_t _action_ums_emuemmc_boot1(lv_obj_t *btn)
usb_ctxt_t usbs;
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
emummc_cfg_t emu_info;
@@ -577,7 +577,7 @@ static lv_res_t _action_ums_emuemmc_gpp(lv_obj_t *btn)
usb_ctxt_t usbs;
int error = !sd_mount();
int error = sd_mount();
if (!error)
{
emummc_cfg_t emu_info;
@@ -593,7 +593,7 @@ static lv_res_t _action_ums_emuemmc_gpp(lv_obj_t *btn)
usbs.offset = emu_info.sector + 0x4000;
u8 *gpt = malloc(SD_BLOCKSIZE);
if (sdmmc_storage_read(&sd_storage, usbs.offset + 1, 1, gpt))
if (!sdmmc_storage_read(&sd_storage, usbs.offset + 1, 1, gpt))
{
if (!memcmp(gpt, "EFI PART", 8))
{
@@ -938,7 +938,7 @@ static lv_res_t _create_window_unset_abit_tool(lv_obj_t *btn)
lv_label_set_long_mode(lb_desc, LV_LABEL_LONG_BREAK);
lv_label_set_recolor(lb_desc, true);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init SD!#");
lv_obj_set_width(lb_desc, lv_obj_get_width(desc));
@@ -1141,7 +1141,7 @@ static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn)
lv_obj_align(lb_desc2, lb_desc, LV_ALIGN_OUT_RIGHT_TOP, 0, 0);
if (!sd_mount())
if (sd_mount())
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init SD!#");
@@ -1159,7 +1159,7 @@ static lv_res_t _create_window_dump_pk12_tool(lv_obj_t *btn)
char *txt_buf = (char *)malloc(SZ_16K);
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(lb_desc, "#FFDD00 Failed to init eMMC!#");

View File

@@ -887,7 +887,7 @@ static lv_res_t _action_flash_linux_data(lv_obj_t * btns, const char * txt)
}
// Write data block to L4T partition.
res = !sdmmc_storage_write(part_info.storage, lba_curr + l4t_flash_ctxt.offset_sct, num, buf);
res = sdmmc_storage_write(part_info.storage, lba_curr + l4t_flash_ctxt.offset_sct, num, buf);
manual_system_maintenance(false);
@@ -907,7 +907,7 @@ static lv_res_t _action_flash_linux_data(lv_obj_t * btns, const char * txt)
goto exit;
}
res = !sdmmc_storage_write(part_info.storage, lba_curr + l4t_flash_ctxt.offset_sct, num, buf);
res = sdmmc_storage_write(part_info.storage, lba_curr + l4t_flash_ctxt.offset_sct, num, buf);
manual_system_maintenance(false);
}
@@ -1922,7 +1922,7 @@ static lv_res_t _emmc_create_mbox_start_partitioning()
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
manual_system_maintenance(true);
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_label_set_text(lbl_extra, "#FFDD00 Failed to init eMMC!#");
goto exit;
@@ -2661,7 +2661,7 @@ static lv_res_t _action_fix_mbr_gpt(lv_obj_t *btn)
int gpt_emummc_migrate_no = 0;
// Try to init sd card. No need for valid MBR.
if (!sd_mount() && !sd_get_card_initialized())
if (sd_mount() && !sd_get_card_initialized())
{
lv_label_set_text(lbl_status, "#FFDD00 Failed to init SD!#");
goto out;
@@ -3044,7 +3044,7 @@ lv_res_t create_window_partition_manager(bool emmc)
u32 emmc_size = 0;
if (!emmc)
{
if (!sd_mount())
if (sd_mount())
{
lv_obj_t *lbl = lv_label_create(h1, NULL);
lv_label_set_recolor(lbl, true);
@@ -3052,7 +3052,7 @@ lv_res_t create_window_partition_manager(bool emmc)
return LV_RES_OK;
}
if (emmc_initialize(false))
if (!emmc_initialize(false))
{
emmc_set_partition(EMMC_GPP);
emmc_size = emmc_storage.sec_cnt >> 11;
@@ -3061,7 +3061,7 @@ lv_res_t create_window_partition_manager(bool emmc)
}
else
{
if (!emmc_initialize(false))
if (emmc_initialize(false))
{
lv_obj_t *lbl = lv_label_create(h1, NULL);
lv_label_set_recolor(lbl, true);

View File

@@ -178,12 +178,12 @@ static int _hos_eks_rw_try(u8 *buf, bool write)
{
if (!write)
{
if (sdmmc_storage_read(&sd_storage, 0, 1, buf))
if (!sdmmc_storage_read(&sd_storage, 0, 1, buf))
return 0;
}
else
{
if (sdmmc_storage_write(&sd_storage, 0, 1, buf))
if (!sdmmc_storage_write(&sd_storage, 0, 1, buf))
return 0;
}
}
@@ -666,7 +666,7 @@ void hos_bis_keys_clear()
int hos_dump_cal0()
{
// Init eMMC.
if (!emmc_initialize(false))
if (emmc_initialize(false))
return 1;
// Generate BIS keys

View File

@@ -55,14 +55,14 @@ DRESULT disk_read (
switch (pdrv)
{
case DRIVE_SD:
return sdmmc_storage_read(&sd_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
return sdmmc_storage_read(&sd_storage, sector, count, (void *)buff);
case DRIVE_RAM:
return ram_disk_read(sector, count, (void *)buff);
case DRIVE_EMMC:
return sdmmc_storage_read(&emmc_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
return sdmmc_storage_read(&emmc_storage, sector, count, (void *)buff);
case DRIVE_BIS:
case DRIVE_EMU:
return nx_emmc_bis_read(sector, count, (void *)buff) ? RES_OK : RES_ERROR;
return nx_emmc_bis_read(sector, count, (void *)buff);
}
return RES_ERROR;
@@ -81,7 +81,7 @@ DRESULT disk_write (
switch (pdrv)
{
case DRIVE_SD:
return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff) ? RES_OK : RES_ERROR;
return sdmmc_storage_write(&sd_storage, sector, count, (void *)buff);
case DRIVE_RAM:
return ram_disk_write(sector, count, (void *)buff);
case DRIVE_EMMC:
@@ -90,7 +90,7 @@ DRESULT disk_write (
case DRIVE_EMU:
if (pdrv == DRIVE_BIS && !bis_write_allowed)
return RES_WRPRT;
return nx_emmc_bis_write(sector, count, (void *)buff) ? RES_OK : RES_ERROR;
return nx_emmc_bis_write(sector, count, (void *)buff);
}
return RES_ERROR;

View File

@@ -52,7 +52,7 @@ char *emmcsn_path_impl(char *path, char *sub_dir, char *filename, sdmmc_storage_
// Get actual eMMC S/N.
if (!storage)
{
if (!emmc_initialize(false))
if (emmc_initialize(false))
strcpy(emmc_sn, "00000000");
else
{
@@ -121,7 +121,7 @@ lv_res_t launch_payload(lv_obj_t *list)
strcpy(path,"bootloader/payloads/");
strcat(path, filename);
if (!sd_mount())
if (sd_mount())
goto out;
// Read payload.
@@ -425,13 +425,13 @@ void nyx_init_load_res()
_show_errors(SD_NO_ERROR);
// Try 2 times to mount SD card.
if (!sd_mount())
if (sd_mount())
{
// Restore speed to SDR104.
sd_end();
// Retry.
if (!sd_mount())
if (sd_mount())
_show_errors(SD_MOUNT_ERROR); // Fatal.
}