| 1365 | } |
| 1366 | |
| 1367 | static txBoolean spiWrite(void *dst, size_t offset, void *buffer, size_t size) |
| 1368 | { |
| 1369 | const esp_partition_t *partition = dst; |
| 1370 | |
| 1371 | if (!(offset & (kFlashSectorSize - 1))) { // if offset is at start of a sector, erase that sector |
| 1372 | int result = esp_partition_erase_range(partition, (uintptr_t)offset, (size + kFlashSectorSize - 1) & ~(kFlashSectorSize - 1)); |
| 1373 | if (ESP_OK != result) |
| 1374 | return 0; |
| 1375 | } |
| 1376 | |
| 1377 | if (ESP_OK != esp_partition_write(partition, (uintptr_t)offset, buffer, size)) { |
| 1378 | modLog("write fail"); |
| 1379 | return 0; |
| 1380 | } |
| 1381 | |
| 1382 | return 1; |
| 1383 | } |
| 1384 | |
| 1385 | void *modInstallMods(xsMachine *the, void *preparationIn, uint8_t *status) |
| 1386 | { |
nothing calls this directly
no test coverage detected