| 300 | } |
| 301 | |
| 302 | int32_t usbWriteCallback(uint32_t lba, uint32_t offset, uint8_t *buffer, uint32_t bufsize) { |
| 303 | const uint32_t secSize = SDM.sectorSize(); |
| 304 | if (secSize == 0 || offset != 0 || (bufsize % secSize) != 0) return -1; |
| 305 | |
| 306 | const uint32_t blocks = bufsize / secSize; |
| 307 | for (uint32_t x = 0; x < blocks; ++x) { |
| 308 | if (!SDM.writeRAW(buffer + (secSize * x), lba + x)) { |
| 309 | return -1; // write error |
| 310 | } |
| 311 | } |
| 312 | return bufsize; |
| 313 | } |
| 314 | |
| 315 | int32_t usbReadCallback(uint32_t lba, uint32_t offset, void *buffer, uint32_t bufsize) { |
| 316 | const uint32_t secSize = SDM.sectorSize(); |
no outgoing calls
no test coverage detected