meh

Fork of FATFileSystem by mbed official

Revision:
4:3ff2606d5713
Parent:
2:b6669c987c8e
Child:
5:b3b3370574cf
diff -r e960e2b81a3c -r 3ff2606d5713 ChaN/diskio.cpp
--- a/ChaN/diskio.cpp	Mon Mar 17 14:09:00 2014 +0000
+++ b/ChaN/diskio.cpp	Thu Aug 28 13:15:31 2014 +0100
@@ -14,7 +14,7 @@
 
 DSTATUS disk_initialize (
     BYTE drv                /* Physical drive nmuber (0..) */
-) 
+)
 {
     debug_if(FFS_DBG, "disk_initialize on drv [%d]\n", drv);
     return (DSTATUS)FATFileSystem::_ffs[drv]->disk_initialize();
@@ -22,7 +22,7 @@
 
 DSTATUS disk_status (
     BYTE drv        /* Physical drive nmuber (0..) */
-) 
+)
 {
     debug_if(FFS_DBG, "disk_status on drv [%d]\n", drv);
     return (DSTATUS)FATFileSystem::_ffs[drv]->disk_status();
@@ -36,15 +36,10 @@
 )
 {
     debug_if(FFS_DBG, "disk_read(sector %d, count %d) on drv [%d]\n", sector, count, drv);
-    for(DWORD s=sector; s<sector+count; s++) {
-        debug_if(FFS_DBG, " disk_read(sector %d)\n", s);
-        int res = FATFileSystem::_ffs[drv]->disk_read((uint8_t*)buff, s);
-        if(res) {
-            return RES_PARERR;
-        }
-        buff += 512;
-    }
-    return RES_OK;
+    if (FATFileSystem::_ffs[drv]->disk_read((uint8_t*)buff, sector, count))
+        return RES_PARERR;
+    else
+        return RES_OK;
 }
 
 #if _READONLY == 0
@@ -56,15 +51,10 @@
 )
 {
     debug_if(FFS_DBG, "disk_write(sector %d, count %d) on drv [%d]\n", sector, count, drv);
-    for(DWORD s = sector; s < sector + count; s++) {
-        debug_if(FFS_DBG, " disk_write(sector %d)\n", s);
-        int res = FATFileSystem::_ffs[drv]->disk_write((uint8_t*)buff, s);
-        if(res) {
-            return RES_PARERR;
-        }
-        buff += 512;
-    }
-    return RES_OK;
+    if (FATFileSystem::_ffs[drv]->disk_write((uint8_t*)buff, sector, count))
+        return RES_PARERR;
+    else
+        return RES_OK;
 }
 #endif /* _READONLY */