mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
add a blank check step before issuing a sector erase
this should significantly speed up the initial on-boarding for first-time users
This commit is contained in:
parent
a8d7c7e9e2
commit
f53f86077d
1 changed files with 12 additions and 1 deletions
|
|
@ -1238,7 +1238,18 @@ impl PddbOs {
|
|||
modals.update_progress(offset as u32).expect("couldn't update progress bar");
|
||||
}
|
||||
}
|
||||
self.spinor.bulk_erase(offset, SPINOR_BULK_ERASE_SIZE).expect("couldn't erase memory");
|
||||
// do a blank check first to see if the sector really needs erasing
|
||||
let mut blank = true;
|
||||
let slice_start = (offset - xous::PDDB_LOC) as usize / size_of::<u32>();
|
||||
for word in self.pddb_mr.as_slice::<u32>()[slice_start..slice_start + SPINOR_BULK_ERASE_SIZE as usize / size_of::<u32>()].iter() {
|
||||
if *word != 0xFFFF_FFFF {
|
||||
blank = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if !blank {
|
||||
self.spinor.bulk_erase(offset, SPINOR_BULK_ERASE_SIZE).expect("couldn't erase memory");
|
||||
}
|
||||
}
|
||||
if let Some(modals) = progress {
|
||||
modals.update_progress(xous::PDDB_LOC + PDDB_A_LEN as u32).expect("couldn't update progress bar");
|
||||
|
|
|
|||
Loading…
Reference in a new issue