MCPcopy Create free account
hub / github.com/Santroller/Santroller / writeToFlash

Function writeToFlash

lib/FlashPROM/src/FlashPROM.cpp:12–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10volatile static spin_lock_t *flashLock = nullptr;
11
12int64_t writeToFlash(alarm_id_t id, void *flashCache)
13{
14 while (is_spin_locked(flashLock));
15
16 multicore_lockout_start_blocking();
17 uint32_t interrupts = spin_lock_blocking(flashLock);
18
19 flash_range_erase((intptr_t)EEPROM_ADDRESS_START - (intptr_t)XIP_BASE, EEPROM_SIZE_BYTES);
20 flash_range_program((intptr_t)EEPROM_ADDRESS_START - (intptr_t)XIP_BASE, reinterpret_cast<uint8_t *>(flashCache), EEPROM_SIZE_BYTES);
21
22 flashWriteAlarm = 0;
23
24 multicore_lockout_end_blocking();
25 spin_unlock(flashLock, interrupts);
26
27 return 0;
28}
29
30void FlashPROM::start()
31{

Callers 1

commit_nowMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected