RAMDisk example for the USBFileSystem

Dependencies:   mbed USBFileSystem

Fork of USBFileSystem_RAMDISK_HelloWorld by Erik -

Files at this revision

API Documentation at this revision

Comitter:
Sissors
Date:
Sun Jan 18 21:43:26 2015 +0000
Parent:
4:69b7cece8e72
Commit message:
Actually use count argument
;

Changed in this revision

RAM_DISK/USBFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
RAM_DISK/USBMSD_Ram.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/RAM_DISK/USBFileSystem.lib	Sun Jan 18 21:32:10 2015 +0000
+++ b/RAM_DISK/USBFileSystem.lib	Sun Jan 18 21:43:26 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/Sissors/code/USBFileSystem/#da1f3328a496
+http://mbed.org/users/Sissors/code/USBFileSystem/#a9e1dffac4bd
--- a/RAM_DISK/USBMSD_Ram.cpp	Sun Jan 18 21:32:10 2015 +0000
+++ b/RAM_DISK/USBMSD_Ram.cpp	Sun Jan 18 21:43:26 2015 +0000
@@ -252,12 +252,14 @@
 }
 
 int USBMSD_Ram::_disk_write(const uint8_t * buffer, uint64_t block_number, uint8_t count) { 
-    memcpy((void *)&disk_image[block_number*512], buffer, 512);
+    for (int i = 0; i<count; i++)
+        memcpy((void *)&disk_image[(block_number+i)*512], buffer, 512);
     return 0;    
 }
 
 int USBMSD_Ram::disk_read(uint8_t * buffer, uint64_t block_number, uint8_t count) {
-    memcpy(buffer, &disk_image[block_number*512], 512);
+    for (int i = 0; i<count; i++)
+        memcpy(buffer, &disk_image[(block_number+i)*512], 512);
     return 0;
 }