MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / usbWriteCallback

Function usbWriteCallback

src/massStorage.cpp:302–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302int32_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
315int32_t usbReadCallback(uint32_t lba, uint32_t offset, void *buffer, uint32_t bufsize) {
316 const uint32_t secSize = SDM.sectorSize();

Callers 1

tud_msc_write10_cbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected