MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / findStorageBlock

Function findStorageBlock

modules/io/storage/flash/storage-flash.c:92–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92static uint8_t findStorageBlock(uint32_t *offset)
93{
94 uint32_t magic;
95
96 modSPIRead(kStorageStartOffset, sizeof(magic), (uint8_t *)&magic);
97 if (kStorageMagic == magic) {
98 *offset = kStorageStartOffset;
99 return 1;
100 }
101
102 modSPIRead(kStorageStartOffset + kFlashSectorSize, sizeof(magic), (uint8_t *)&magic);
103 if (kStorageMagic == magic) {
104 *offset = kStorageStartOffset + kFlashSectorSize;
105 return 1;
106 }
107
108 resetStorage();
109
110 return 0;
111}
112
113static int getEntryValueSize(const uint8_t *pref)
114{

Callers 2

findEntryOffsetFunction · 0.85

Calls 2

resetStorageFunction · 0.85
modSPIReadFunction · 0.50

Tested by

no test coverage detected