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

Function spiWrite

xs/platforms/nrf52/xsHost.c:554–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554static txBoolean spiWrite(void *dst, size_t offset, void *buffer, size_t size)
555{
556 offset += (uintptr_t)dst;
557
558 if ((offset + kFlashSectorSize) > (uintptr_t)kModulesEnd)
559 return 0; // attempted write beyond end of available space
560
561 if (!(offset & (kFlashSectorSize - 1))) { // if offset is at start of a sector, erase that sector
562 if (!modSPIErase(offset - (uintptr_t)kFlashStart, kFlashSectorSize))
563 return 0;
564 }
565
566 return modSPIWrite(offset - (uintptr_t)kFlashStart, size, buffer);
567}
568
569void *modInstallMods(xsMachine *the, void *preparationIn, uint8_t *status)
570{

Callers

nothing calls this directly

Calls 2

modSPIEraseFunction · 0.70
modSPIWriteFunction · 0.70

Tested by

no test coverage detected