2019-03-29 16:10:31 +00:00
|
|
|
static void erase_storage_code_progress(void) {
|
|
|
|
flash_wait_for_last_operation();
|
|
|
|
flash_clear_status_flags();
|
|
|
|
flash_unlock();
|
|
|
|
// erase storage area
|
|
|
|
for (int i = FLASH_STORAGE_SECTOR_FIRST; i <= FLASH_STORAGE_SECTOR_LAST;
|
|
|
|
i++) {
|
|
|
|
layoutProgress("WIPING ... Please wait",
|
|
|
|
1000 * (i - FLASH_STORAGE_SECTOR_FIRST) /
|
|
|
|
(FLASH_CODE_SECTOR_LAST - FLASH_STORAGE_SECTOR_FIRST));
|
|
|
|
flash_erase_sector(i, FLASH_CR_PROGRAM_X32);
|
|
|
|
}
|
|
|
|
// erase code area
|
|
|
|
for (int i = FLASH_CODE_SECTOR_FIRST; i <= FLASH_CODE_SECTOR_LAST; i++) {
|
|
|
|
layoutProgress("WIPING ... Please wait",
|
|
|
|
1000 * (i - FLASH_STORAGE_SECTOR_FIRST) /
|
|
|
|
(FLASH_CODE_SECTOR_LAST - FLASH_STORAGE_SECTOR_FIRST));
|
|
|
|
flash_erase_sector(i, FLASH_CR_PROGRAM_X32);
|
|
|
|
}
|
|
|
|
flash_wait_for_last_operation();
|
|
|
|
flash_lock();
|
2019-01-27 10:58:30 +00:00
|
|
|
}
|
|
|
|
|
2019-03-29 16:10:31 +00:00
|
|
|
static void erase_code_progress(void) {
|
|
|
|
flash_wait_for_last_operation();
|
|
|
|
flash_clear_status_flags();
|
|
|
|
flash_unlock();
|
|
|
|
for (int i = FLASH_CODE_SECTOR_FIRST; i <= FLASH_CODE_SECTOR_LAST; i++) {
|
|
|
|
layoutProgress("PREPARING ... Please wait",
|
|
|
|
1000 * (i - FLASH_CODE_SECTOR_FIRST) /
|
|
|
|
(FLASH_CODE_SECTOR_LAST - FLASH_CODE_SECTOR_FIRST));
|
|
|
|
flash_erase_sector(i, FLASH_CR_PROGRAM_X32);
|
|
|
|
}
|
|
|
|
layoutProgress("INSTALLING ... Please wait", 0);
|
|
|
|
flash_wait_for_last_operation();
|
|
|
|
flash_lock();
|
2019-01-27 10:58:30 +00:00
|
|
|
}
|
|
|
|
|
2019-03-29 16:10:31 +00:00
|
|
|
static void erase_storage(void) {
|
|
|
|
flash_wait_for_last_operation();
|
|
|
|
flash_clear_status_flags();
|
|
|
|
flash_unlock();
|
|
|
|
for (int i = FLASH_STORAGE_SECTOR_FIRST; i <= FLASH_STORAGE_SECTOR_LAST;
|
|
|
|
i++) {
|
|
|
|
flash_erase_sector(i, FLASH_CR_PROGRAM_X32);
|
|
|
|
}
|
|
|
|
flash_wait_for_last_operation();
|
|
|
|
flash_lock();
|
2019-01-27 10:58:30 +00:00
|
|
|
}
|