USBHost modified for vmRideR2016b

Dependencies:   FATFileSystem mbed-rtos

Dependents:  

Fork of USBHost by mbed official

Revision:
26:607951c26872
Parent:
24:868cbfe611a7
Child:
27:4206883f4cb7
--- a/USBHostMSD/USBHostMSD.cpp	Fri Jul 11 10:00:48 2014 +0100
+++ b/USBHostMSD/USBHostMSD.cpp	Mon Aug 18 13:45:26 2014 +0100
@@ -323,24 +323,34 @@
     return readCapacity();
 }
 
-int USBHostMSD::disk_write(const uint8_t *buffer, uint64_t block_number) {
-    USB_DBG("FILESYSTEM: write block: %lld", block_number);
+int USBHostMSD::disk_write(const uint8_t* buffer, uint64_t block_number, uint8_t count) {
+    USB_DBG("FILESYSTEM: write block: %lld, count: %d", block_number, count);
     if (!disk_init) {
         disk_initialize();
     }
     if (!disk_init)
         return -1;
-    return dataTransfer((uint8_t *)buffer, block_number, 1, HOST_TO_DEVICE);
+    for (uint64_t b = block_number; b < block_number + count; b++) {
+        if (dataTransfer((uint8_t*)buffer, b, 1, HOST_TO_DEVICE))
+            return -1;
+        buffer += 512;
+    }
+    return 0;
 }
 
-int USBHostMSD::disk_read(uint8_t * buffer, uint64_t block_number) {
-    USB_DBG("FILESYSTEM: read block %lld", block_number);
+int USBHostMSD::disk_read(uint8_t* buffer, uint64_t block_number, uint8_t count) {
+    USB_DBG("FILESYSTEM: read block: %lld, count: %d", block_number, count);
     if (!disk_init) {
         disk_initialize();
     }
     if (!disk_init)
         return -1;
-    return dataTransfer((uint8_t *)buffer, block_number, 1, DEVICE_TO_HOST);
+    for (uint64_t b = block_number; b < block_number + count; b++) {
+        if (dataTransfer((uint8_t*)buffer, b, 1, DEVICE_TO_HOST))
+            return -1;
+        buffer += 512;
+    }
+    return 0;
 }
 
 uint64_t USBHostMSD::disk_sectors() {