diff options
author | Nick Brassel <nick@tzarc.org> | 2022-07-14 00:41:08 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 00:41:08 +1000 |
commit | dc70ba612a929fdd365275d412e68c61836ed5b8 (patch) | |
tree | 344b138bded7f2f7b59c05a5a95f5a4ce550da4f /platforms/chibios/drivers/wear_leveling | |
parent | 2a0d490eb3dba85b09454449ffb60cac03972c0f (diff) |
Post-bootloader EFL/SPI fixes. (#17661)
* Fixup read address for EFL driver.
* Fixup sequencing of SPI.
* Lock during init of EFL backing store.
Diffstat (limited to 'platforms/chibios/drivers/wear_leveling')
-rw-r--r-- | platforms/chibios/drivers/wear_leveling/wear_leveling_efl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/platforms/chibios/drivers/wear_leveling/wear_leveling_efl.c b/platforms/chibios/drivers/wear_leveling/wear_leveling_efl.c index 4b5639ee4a..cdd1e26a7d 100644 --- a/platforms/chibios/drivers/wear_leveling/wear_leveling_efl.c +++ b/platforms/chibios/drivers/wear_leveling/wear_leveling_efl.c @@ -43,6 +43,9 @@ bool backing_store_init(void) { bs_dprintf("Init\n"); flash = (BaseFlash *)&EFLD1; + // Need to re-lock the EFL, as if we've just had the bootloader executing it'll already be unlocked. + backing_store_lock(); + const flash_descriptor_t *desc = flashGetDescriptor(flash); uint32_t counter = 0; @@ -132,7 +135,7 @@ bool backing_store_lock(void) { bool backing_store_read(uint32_t address, backing_store_int_t *value) { uint32_t offset = (base_offset + address); - backing_store_int_t *loc = (backing_store_int_t *)offset; + backing_store_int_t *loc = (backing_store_int_t *)flashGetOffsetAddress(flash, offset); *value = ~(*loc); bs_dprintf("Read "); wl_dump(offset, value, sizeof(backing_store_int_t)); |