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

Function spiWrite

xs/platforms/pico/xsHost.c:531–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

529}
530
531static txBoolean spiWrite(void *dst, size_t offset, void *buffer, size_t size)
532{
533 offset += (uintptr_t)dst;
534
535 if ((offset + kFlashSectorSize) > (uintptr_t)kModulesEnd)
536 return 0; // attempted write beyond end of available space
537
538 if (!(offset & (kFlashSectorSize - 1))) { // if offset is at start of a sector, erase that sector
539 if (!modSPIErase(offset - (uintptr_t)kFlashStart, kFlashSectorSize))
540 return 0;
541 }
542
543 return modSPIWrite(offset - (uintptr_t)kFlashStart, size, buffer);
544}
545
546void *modInstallMods(xsMachine *the, void *preparationIn, uint8_t *status)
547{

Callers

nothing calls this directly

Calls 2

modSPIEraseFunction · 0.70
modSPIWriteFunction · 0.70

Tested by

no test coverage detected