fuse: Correct fuse array size for T210B01

This commit is contained in:
CTCaer 2020-07-04 21:04:20 +03:00
parent 528ddbe12c
commit 8d2230dc51
2 changed files with 23 additions and 7 deletions

View file

@ -115,7 +115,9 @@ u32 fuse_read(u32 addr)
void fuse_read_array(u32 *words)
{
for (u32 i = 0; i < 192; i++)
u32 array_size = (hw_get_chip_id() == GP_HIDREV_MAJOR_T210B01) ? 256 : 192;
for (u32 i = 0; i < array_size; i++)
words[i] = fuse_read(i);
}

View file

@ -190,17 +190,31 @@ static lv_res_t _bootrom_dump_window_action(lv_obj_t * btn)
static lv_res_t _fuse_dump_window_action(lv_obj_t * btn)
{
const u32 fuse_array_size_t210 = 192 * sizeof(u32);
const u32 fuse_array_size_t210b01 = 256 * sizeof(u32);
int error = !sd_mount();
if (!error)
{
char path[64];
emmcsn_path_impl(path, "/dumps", "fuse_cached.bin", NULL);
error = sd_save_to_file((u8 *)0x7000F900, 0x300, path);
char path[128];
if (!h_cfg.t210b01)
{
emmcsn_path_impl(path, "/dumps", "fuse_cached_t210.bin", NULL);
error = sd_save_to_file((u8 *)0x7000F900, 0x300, path);
}
else
{
emmcsn_path_impl(path, "/dumps", "fuse_cached_t210b01.bin", NULL);
error = sd_save_to_file((u8 *)0x7000F898, 0x368, path);
}
u32 words[192];
u32 words[fuse_array_size_t210b01 / sizeof(u32)];
fuse_read_array(words);
emmcsn_path_impl(path, "/dumps", "fuse_array_raw.bin", NULL);
int res = sd_save_to_file((u8 *)words, sizeof(words), path);
if (!h_cfg.t210b01)
emmcsn_path_impl(path, "/dumps", "fuse_array_raw_t210.bin", NULL);
else
emmcsn_path_impl(path, "/dumps", "fuse_array_raw_t210b01.bin", NULL);
int res = sd_save_to_file((u8 *)words, h_cfg.t210b01 ? fuse_array_size_t210b01 : fuse_array_size_t210, path);
if (!error)
error = res;