EEPROM: Don't erase if we don't have to. Adding eeprom_driver_format abstraction. (#18332)
This commit is contained in:
parent
6921c8a7dd
commit
267dffda15
10 changed files with 63 additions and 4 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "debug.h"
|
||||
#include "eeprom_legacy_emulated_flash.h"
|
||||
#include "legacy_flash_ops.h"
|
||||
#include "eeprom_driver.h"
|
||||
|
||||
/*
|
||||
* We emulate eeprom by writing a snapshot compacted view of eeprom contents,
|
||||
|
@ -564,6 +565,12 @@ void eeprom_driver_init(void) {
|
|||
EEPROM_Init();
|
||||
}
|
||||
|
||||
void eeprom_driver_format(bool erase) {
|
||||
/* emulated eepron requires the write log data structures to be erased before use. */
|
||||
(void)erase;
|
||||
eeprom_driver_erase();
|
||||
}
|
||||
|
||||
void eeprom_driver_erase(void) {
|
||||
EEPROM_Erase();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,12 @@ static inline void STM32_L0_L1_EEPROM_Lock(void) {
|
|||
|
||||
void eeprom_driver_init(void) {}
|
||||
|
||||
void eeprom_driver_format(bool erase) {
|
||||
if (erase) {
|
||||
eeprom_driver_erase();
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_driver_erase(void) {
|
||||
STM32_L0_L1_EEPROM_Unlock();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue