rusEFI
The most advanced open source ECU
|
Higher-level logic of saving data into internal flash memory.
Definition in file flash_main.cpp.
Enumerations | |
enum class | FlashState { Ok , CrcFailed , IncompatibleVersion , BlankChip } |
Functions | |
void | boardInitMfs (void) |
const MFSConfig * | boardGetMfsConfig (void) |
static uint32_t | flashStateCrc (const persistent_config_container_s &state) |
chibios_rt::BinarySemaphore | flashWriteSemaphore (true) |
static | THD_WORKING_AREA (flashWriteStack, 3 *UTILITY_THREAD_STACK_SIZE) |
static | THD_WORKING_AREA (flashWriteStack, UTILITY_THREAD_STACK_SIZE) |
static void | flashWriteThread (void *) |
bool | allowFlashWhileRunning () |
void | setNeedToWriteConfiguration () |
bool | getNeedToWriteConfiguration () |
void | writeToFlashIfPending () |
template<typename TStorage > | |
int | eraseAndFlashCopy (flashaddr_t storageAddress, const TStorage &data) |
void | writeToFlashNow () |
static void | doResetConfiguration () |
static FlashState | validatePersistentState () |
static FlashState | readOneConfigurationCopy (flashaddr_t address) |
static FlashState | readConfiguration () |
void | readFromFlash () |
static void | rewriteConfig () |
static void | eraseConfig () |
void | initFlash () |
Variables | |
static bool | needToWriteConfiguration = false |
MFSDriver | mfsd |
bool | burnWithoutFlash = false |
|
strong |
Enumerator | |
---|---|
Ok | |
CrcFailed | |
IncompatibleVersion | |
BlankChip |
Definition at line 234 of file flash_main.cpp.
bool allowFlashWhileRunning | ( | ) |
Definition at line 94 of file flash_main.cpp.
Referenced by initFlash(), setNeedToWriteConfiguration(), and writeToFlashIfPending().
const MFSConfig* boardGetMfsConfig | ( | void | ) |
Definition at line 34 of file board_storage.cpp.
Referenced by initFlash().
void boardInitMfs | ( | void | ) |
Definition at line 28 of file board_storage.cpp.
Referenced by initFlash().
|
static |
Definition at line 230 of file flash_main.cpp.
Referenced by initFlash(), and rewriteConfig().
int eraseAndFlashCopy | ( | flashaddr_t | storageAddress, |
const TStorage & | data | ||
) |
Definition at line 139 of file flash_main.cpp.
Referenced by writeToFlashNow().
|
static |
Definition at line 372 of file flash_main.cpp.
Referenced by initFlash().
|
static |
https://sourceforge.net/p/rusefi/tickets/335/
In order to preserve at least one copy of the tune in case of electrical issues address of second configuration copy should be in a different sector of flash since complete flash sectors are erased on write.
Definition at line 66 of file flash_main.cpp.
Referenced by validatePersistentState(), and writeToFlashNow().
chibios_rt::BinarySemaphore flashWriteSemaphore | ( | true | ) |
Referenced by flashWriteThread(), and setNeedToWriteConfiguration().
|
static |
Definition at line 80 of file flash_main.cpp.
Referenced by initFlash().
bool getNeedToWriteConfiguration | ( | ) |
Definition at line 112 of file flash_main.cpp.
Referenced by updateFlags(), and writeToFlashIfPending().
void initFlash | ( | ) |
This would write NOW (you should not be doing this while connected to real engine)
This would schedule write to flash once the engine is stopped
Definition at line 384 of file flash_main.cpp.
Referenced by initHardwareNoConfig().
|
static |
this method could and should be executed before we have any connectivity so no console output here
in this method we read first copy of configuration in flash. if that first copy has CRC or other issues we read second copy.
Definition at line 283 of file flash_main.cpp.
Referenced by readFromFlash().
void readFromFlash | ( | ) |
Definition at line 323 of file flash_main.cpp.
Referenced by initFlash(), and loadConfiguration().
|
static |
Read single copy of rusEFI configuration from interan flash using custom driver
Definition at line 263 of file flash_main.cpp.
Referenced by readConfiguration().
|
static |
Definition at line 366 of file flash_main.cpp.
Referenced by initFlash().
void setNeedToWriteConfiguration | ( | ) |
Definition at line 100 of file flash_main.cpp.
Referenced by requestBurn().
|
static |
|
static |
|
static |
Definition at line 242 of file flash_main.cpp.
Referenced by readConfiguration(), and readOneConfigurationCopy().
void writeToFlashIfPending | ( | ) |
Definition at line 116 of file flash_main.cpp.
Referenced by doPeriodicSlowCallback().
void writeToFlashNow | ( | ) |
Because of hardware-related issues, stm32f4 chip is totally frozen while we are writing to internal flash. Writing the configuration takes about 1-2 seconds, we cannot afford to do that while the engine is running so we postpone the write until the engine is stopped.
Definition at line 162 of file flash_main.cpp.
Referenced by flashWriteThread(), handleCommandX14(), initFlash(), loadConfiguration(), rewriteConfig(), setEngineType(), and writeToFlashIfPending().
bool burnWithoutFlash = false |
Definition at line 160 of file flash_main.cpp.
Referenced by handleCommandX14(), and writeToFlashNow().
MFSDriver mfsd |
Definition at line 50 of file flash_main.cpp.
Referenced by eraseConfig(), initFlash(), readConfiguration(), and writeToFlashNow().
|
static |
Definition at line 44 of file flash_main.cpp.
Referenced by getNeedToWriteConfiguration(), setNeedToWriteConfiguration(), and writeToFlashNow().