]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - fatfs/src/diskio.c
Import fatfs R0.10c
[z180-stamp.git] / fatfs / src / diskio.c
index 64194eb6ba7da03829f30dbb9976ebaa9352935f..169ae95ead6a9d5b584a871ab24216501509c20b 100644 (file)
@@ -1,10 +1,10 @@
 /*-----------------------------------------------------------------------*/\r
-/* Low level disk I/O module skeleton for FatFs     (C)ChaN, 2013        */\r
+/* Low level disk I/O module skeleton for FatFs     (C)ChaN, 2014        */\r
 /*-----------------------------------------------------------------------*/\r
 /* If a working storage control module is available, it should be        */\r
 /* attached to the FatFs via a glue function rather than modifying it.   */\r
 /* This is an example of glue functions to attach various exsisting      */\r
-/* storage control module to the FatFs module with a defined API.        */\r
+/* storage control modules to the FatFs module with a defined API.       */\r
 /*-----------------------------------------------------------------------*/\r
 \r
 #include "diskio.h"            /* FatFs lower layer API */\r
 #include "atadrive.h"  /* Example: ATA drive control */\r
 #include "sdcard.h"            /* Example: MMC/SDC contorl */\r
 \r
-/* Definitions of physical drive number for each media */\r
-#define ATA            0\r
-#define MMC            1\r
-#define USB            2\r
+/* Definitions of physical drive number for each drive */\r
+#define ATA            0       /* Example: Map ATA drive to drive number 0 */\r
+#define MMC            1       /* Example: Map MMC/SD card to drive number 1 */\r
+#define USB            2       /* Example: Map USB drive to drive number 2 */\r
 \r
 \r
 /*-----------------------------------------------------------------------*/\r
-/* Inidialize a Drive                                                    */\r
+/* Get Drive Status                                                      */\r
 /*-----------------------------------------------------------------------*/\r
 \r
-DSTATUS disk_initialize (\r
-       BYTE pdrv                               /* Physical drive nmuber (0..) */\r
+DSTATUS disk_status (\r
+       BYTE pdrv               /* Physical drive nmuber to identify the drive */\r
 )\r
 {\r
        DSTATUS stat;\r
@@ -31,21 +31,21 @@ DSTATUS disk_initialize (
 \r
        switch (pdrv) {\r
        case ATA :\r
-               result = ATA_disk_initialize();\r
+               result = ATA_disk_status();\r
 \r
                // translate the reslut code here\r
 \r
                return stat;\r
 \r
        case MMC :\r
-               result = MMC_disk_initialize();\r
+               result = MMC_disk_status();\r
 \r
                // translate the reslut code here\r
 \r
                return stat;\r
 \r
        case USB :\r
-               result = USB_disk_initialize();\r
+               result = USB_disk_status();\r
 \r
                // translate the reslut code here\r
 \r
@@ -57,11 +57,11 @@ DSTATUS disk_initialize (
 \r
 \r
 /*-----------------------------------------------------------------------*/\r
-/* Get Disk Status                                                       */\r
+/* Inidialize a Drive                                                    */\r
 /*-----------------------------------------------------------------------*/\r
 \r
-DSTATUS disk_status (\r
-       BYTE pdrv               /* Physical drive nmuber (0..) */\r
+DSTATUS disk_initialize (\r
+       BYTE pdrv                               /* Physical drive nmuber to identify the drive */\r
 )\r
 {\r
        DSTATUS stat;\r
@@ -69,21 +69,21 @@ DSTATUS disk_status (
 \r
        switch (pdrv) {\r
        case ATA :\r
-               result = ATA_disk_status();\r
+               result = ATA_disk_initialize();\r
 \r
                // translate the reslut code here\r
 \r
                return stat;\r
 \r
        case MMC :\r
-               result = MMC_disk_status();\r
+               result = MMC_disk_initialize();\r
 \r
                // translate the reslut code here\r
 \r
                return stat;\r
 \r
        case USB :\r
-               result = USB_disk_status();\r
+               result = USB_disk_initialize();\r
 \r
                // translate the reslut code here\r
 \r
@@ -99,10 +99,10 @@ DSTATUS disk_status (
 /*-----------------------------------------------------------------------*/\r
 \r
 DRESULT disk_read (\r
-       BYTE pdrv,              /* Physical drive nmuber (0..) */\r
+       BYTE pdrv,              /* Physical drive nmuber to identify the drive */\r
        BYTE *buff,             /* Data buffer to store read data */\r
-       DWORD sector,   /* Sector address (LBA) */\r
-       UINT count              /* Number of sectors to read (1..128) */\r
+       DWORD sector,   /* Sector address in LBA */\r
+       UINT count              /* Number of sectors to read */\r
 )\r
 {\r
        DRESULT res;\r
@@ -136,6 +136,7 @@ DRESULT disk_read (
 \r
                return res;\r
        }\r
+\r
        return RES_PARERR;\r
 }\r
 \r
@@ -147,10 +148,10 @@ DRESULT disk_read (
 \r
 #if _USE_WRITE\r
 DRESULT disk_write (\r
-       BYTE pdrv,                      /* Physical drive nmuber (0..) */\r
+       BYTE pdrv,                      /* Physical drive nmuber to identify the drive */\r
        const BYTE *buff,       /* Data to be written */\r
-       DWORD sector,           /* Sector address (LBA) */\r
-       UINT count                      /* Number of sectors to write (1..128) */\r
+       DWORD sector,           /* Sector address in LBA */\r
+       UINT count                      /* Number of sectors to write */\r
 )\r
 {\r
        DRESULT res;\r
@@ -184,6 +185,7 @@ DRESULT disk_write (
 \r
                return res;\r
        }\r
+\r
        return RES_PARERR;\r
 }\r
 #endif\r
@@ -205,32 +207,24 @@ DRESULT disk_ioctl (
 \r
        switch (pdrv) {\r
        case ATA :\r
-               // pre-process here\r
-\r
-               result = ATA_disk_ioctl(cmd, buff);\r
 \r
-               // post-process here\r
+               // Process of the command for the ATA drive\r
 \r
                return res;\r
 \r
        case MMC :\r
-               // pre-process here\r
 \r
-               result = MMC_disk_ioctl(cmd, buff);\r
-\r
-               // post-process here\r
+               // Process of the command for the MMC/SD card\r
 \r
                return res;\r
 \r
        case USB :\r
-               // pre-process here\r
-\r
-               result = USB_disk_ioctl(cmd, buff);\r
 \r
-               // post-process here\r
+               // Process of the command the USB drive\r
 \r
                return res;\r
        }\r
+\r
        return RES_PARERR;\r
 }\r
 #endif\r