Performance fixes

This commit is contained in:
Kostas Missos 2019-03-08 22:18:54 +02:00
parent f139f9c56f
commit dfb5640bfe
3 changed files with 10 additions and 7 deletions

View file

@ -31,9 +31,9 @@
#include "../utils/btn.h" #include "../utils/btn.h"
#include "../utils/util.h" #include "../utils/util.h"
#define EMMC_BUF_ALIGNED 0x85000000 #define EMMC_BUF_ALIGNED 0xB5000000
#define SDXC_BUF_ALIGNED 0x86000000 #define SDXC_BUF_ALIGNED 0xB6000000
#define MIXD_BUF_ALIGNED 0x87000000 #define MIXD_BUF_ALIGNED 0xB7000000
extern sdmmc_t sd_sdmmc; extern sdmmc_t sd_sdmmc;
extern sdmmc_storage_t sd_storage; extern sdmmc_storage_t sd_storage;
@ -51,6 +51,7 @@ static int _dump_emmc_verify(sdmmc_storage_t *storage, u32 lba_curr, char *outFi
u32 btn = 0; u32 btn = 0;
u32 prevPct = 200; u32 prevPct = 200;
int res = 0; int res = 0;
u32 sdFileSector = 0;
u8 hashEm[0x20]; u8 hashEm[0x20];
u8 hashSd[0x20]; u8 hashSd[0x20];
@ -86,6 +87,7 @@ static int _dump_emmc_verify(sdmmc_storage_t *storage, u32 lba_curr, char *outFi
f_close(&fp); f_close(&fp);
return 1; return 1;
} }
f_lseek(&fp, sdFileSector);
if (f_read(&fp, bufSd, num << 9, NULL)) if (f_read(&fp, bufSd, num << 9, NULL))
{ {
gfx_con.fntsz = 16; gfx_con.fntsz = 16;
@ -110,6 +112,7 @@ static int _dump_emmc_verify(sdmmc_storage_t *storage, u32 lba_curr, char *outFi
} }
sparseShouldVerify++; sparseShouldVerify++;
sdFileSector += NUM_SECTORS_PER_ITER << 9;
pct = (u64)((u64)(lba_curr - part->lba_start) * 100u) / (u64)(part->lba_end - part->lba_start); pct = (u64)((u64)(lba_curr - part->lba_start) * 100u) / (u64)(part->lba_end - part->lba_start);
if (pct != prevPct) if (pct != prevPct)
@ -715,7 +718,7 @@ static void _restore_emmc_selected(emmcPartType_t restoreType)
tui_sbar(&gfx_con, true); tui_sbar(&gfx_con, true);
gfx_con_setpos(&gfx_con, 0, 0); gfx_con_setpos(&gfx_con, 0, 0);
gfx_printf(&gfx_con, "%kThis is a dangerous operation\nand may render your device inoperative!\n\n", 0xFFFFDD00); gfx_printf(&gfx_con, "%kThis may render your device inoperative!\n\n", 0xFFFFDD00);
gfx_printf(&gfx_con, "Are you really sure?\n\n%k", 0xFFCCCCCC); gfx_printf(&gfx_con, "Are you really sure?\n\n%k", 0xFFCCCCCC);
if ((restoreType & PART_BOOT) || (restoreType & PART_GP_ALL)) if ((restoreType & PART_BOOT) || (restoreType & PART_GP_ALL))
{ {

View file

@ -1124,7 +1124,7 @@ menu_t menu_top = {
#define IPL_STACK_TOP 0x90010000 #define IPL_STACK_TOP 0x90010000
#define IPL_HEAP_START 0x90020000 #define IPL_HEAP_START 0x90020000
#define IPL_HEAP_END 0xB8000000 #define IPL_HEAP_END 0xB5000000
extern void pivot_stack(u32 stack_top); extern void pivot_stack(u32 stack_top);

View file

@ -64,13 +64,13 @@ u8 btn_wait_timeout(u32 time_ms, u8 mask)
u32 timeout = get_tmr_ms() + time_ms; u32 timeout = get_tmr_ms() + time_ms;
u8 res = btn_read() & mask; u8 res = btn_read() & mask;
do while (get_tmr_ms() < timeout)
{ {
if (res == mask) if (res == mask)
break; break;
else else
res = btn_read() & mask; res = btn_read() & mask;
} while (get_tmr_ms() < timeout); };
return res; return res;
} }