From: notaz Date: Sun, 1 Sep 2013 16:41:29 +0000 (+0300) Subject: mx_flasher: set mode after other writes X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee7bd6b03730c9caeee249adf71c868b9a6d96c3;p=megadrive.git mx_flasher: set mode after other writes seems to improve reliability (less random write errors) --- diff --git a/mx/linux/mx_flasher.c b/mx/linux/mx_flasher.c index 7bebc9c..1bec278 100644 --- a/mx/linux/mx_flasher.c +++ b/mx/linux/mx_flasher.c @@ -1072,28 +1072,6 @@ breakloop: goto end; } - /* set mode */ - if (mx_mode || w_fsize > 0x200000) { - if (mx_mode == 0) - mx_mode = '3'; - printf("MX mode set to "); - switch (mx_mode) { - case '1': - printf("2M with RAM.\n"); - mx_mode = C_MODE_2M_RAM; - break; - case '2': - printf("4M, no RAM.\n"); - mx_mode = C_MODE_4M_NORAM; - break; - default: - printf("4M with RAM.\n"); - mx_mode = C_MODE_4M_RAM; - break; - } - set_ram_mode(device, mx_mode); - } - /* erase */ if (do_erase_size != 0) { if (erase_method) @@ -1149,6 +1127,28 @@ breakloop: fprintf(stderr, "warning: failed to save RAM filename\n"); } + /* set mode */ + if (mx_mode || w_fsize > 0x200000) { + if (mx_mode == 0) + mx_mode = '3'; + printf("MX mode set to "); + switch (mx_mode) { + case '1': + printf("2M with RAM.\n"); + mx_mode = C_MODE_2M_RAM; + break; + case '2': + printf("4M, no RAM.\n"); + mx_mode = C_MODE_4M_NORAM; + break; + default: + printf("4M with RAM.\n"); + mx_mode = C_MODE_4M_RAM; + break; + } + set_ram_mode(device, mx_mode); + } + /* read flash */ if (do_read && r_fname == NULL) { ret = read_filename(device, fname_buff, sizeof(fname_buff), FILENAME_ROM0);