| 529 | } |
| 530 | |
| 531 | static 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 | |
| 546 | void *modInstallMods(xsMachine *the, void *preparationIn, uint8_t *status) |
| 547 | { |
nothing calls this directly
no test coverage detected