| 313 | } |
| 314 | |
| 315 | int32_t usbReadCallback(uint32_t lba, uint32_t offset, void *buffer, uint32_t bufsize) { |
| 316 | const uint32_t secSize = SDM.sectorSize(); |
| 317 | if (secSize == 0 || offset != 0 || (bufsize % secSize) != 0) return -1; |
| 318 | |
| 319 | const uint32_t blocks = bufsize / secSize; |
| 320 | for (uint32_t x = 0; x < blocks; ++x) { |
| 321 | if (!SDM.readRAW(reinterpret_cast<uint8_t *>(buffer) + (x * secSize), lba + x)) { |
| 322 | return -1; // read error |
| 323 | } |
| 324 | } |
| 325 | return bufsize; |
| 326 | } |
| 327 | |
| 328 | bool usbStartStopCallback(uint8_t power_condition, bool start, bool load_eject) { |
| 329 | (void)power_condition; |