]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - fatfs/src/diskio.c
Import fatfs R0.12b
[z180-stamp.git] / fatfs / src / diskio.c
index 169ae95ead6a9d5b584a871ab24216501509c20b..25f5e53bc032bd3fcdacd3c53582e63e73ae8dcc 100644 (file)
@@ -1,5 +1,5 @@
 /*-----------------------------------------------------------------------*/\r
-/* Low level disk I/O module skeleton for FatFs     (C)ChaN, 2014        */\r
+/* Low level disk I/O module skeleton for FatFs     (C)ChaN, 2016        */\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
@@ -8,14 +8,11 @@
 /*-----------------------------------------------------------------------*/\r
 \r
 #include "diskio.h"            /* FatFs lower layer API */\r
-#include "usbdisk.h"   /* Example: USB drive control */\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 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
+#define DEV_RAM                0       /* Example: Map Ramdisk to physical drive 0 */\r
+#define DEV_MMC                1       /* Example: Map MMC/SD card to physical drive 1 */\r
+#define DEV_USB                2       /* Example: Map USB MSD to physical drive 2 */\r
 \r
 \r
 /*-----------------------------------------------------------------------*/\r
@@ -30,21 +27,21 @@ DSTATUS disk_status (
        int result;\r
 \r
        switch (pdrv) {\r
-       case ATA :\r
-               result = ATA_disk_status();\r
+       case DEV_RAM :\r
+               result = RAM_disk_status();\r
 \r
                // translate the reslut code here\r
 \r
                return stat;\r
 \r
-       case MMC :\r
+       case DEV_MMC :\r
                result = MMC_disk_status();\r
 \r
                // translate the reslut code here\r
 \r
                return stat;\r
 \r
-       case USB :\r
+       case DEV_USB :\r
                result = USB_disk_status();\r
 \r
                // translate the reslut code here\r
@@ -68,21 +65,21 @@ DSTATUS disk_initialize (
        int result;\r
 \r
        switch (pdrv) {\r
-       case ATA :\r
-               result = ATA_disk_initialize();\r
+       case DEV_RAM :\r
+               result = RAM_disk_initialize();\r
 \r
                // translate the reslut code here\r
 \r
                return stat;\r
 \r
-       case MMC :\r
+       case DEV_MMC :\r
                result = MMC_disk_initialize();\r
 \r
                // translate the reslut code here\r
 \r
                return stat;\r
 \r
-       case USB :\r
+       case DEV_USB :\r
                result = USB_disk_initialize();\r
 \r
                // translate the reslut code here\r
@@ -101,7 +98,7 @@ DSTATUS disk_initialize (
 DRESULT disk_read (\r
        BYTE pdrv,              /* Physical drive nmuber to identify the drive */\r
        BYTE *buff,             /* Data buffer to store read data */\r
-       DWORD sector,   /* Sector address in LBA */\r
+       DWORD sector,   /* Start sector in LBA */\r
        UINT count              /* Number of sectors to read */\r
 )\r
 {\r
@@ -109,16 +106,16 @@ DRESULT disk_read (
        int result;\r
 \r
        switch (pdrv) {\r
-       case ATA :\r
+       case DEV_RAM :\r
                // translate the arguments here\r
 \r
-               result = ATA_disk_read(buff, sector, count);\r
+               result = RAM_disk_read(buff, sector, count);\r
 \r
                // translate the reslut code here\r
 \r
                return res;\r
 \r
-       case MMC :\r
+       case DEV_MMC :\r
                // translate the arguments here\r
 \r
                result = MMC_disk_read(buff, sector, count);\r
@@ -127,7 +124,7 @@ DRESULT disk_read (
 \r
                return res;\r
 \r
-       case USB :\r
+       case DEV_USB :\r
                // translate the arguments here\r
 \r
                result = USB_disk_read(buff, sector, count);\r
@@ -146,11 +143,10 @@ DRESULT disk_read (
 /* Write Sector(s)                                                       */\r
 /*-----------------------------------------------------------------------*/\r
 \r
-#if _USE_WRITE\r
 DRESULT disk_write (\r
        BYTE pdrv,                      /* Physical drive nmuber to identify the drive */\r
        const BYTE *buff,       /* Data to be written */\r
-       DWORD sector,           /* Sector address in LBA */\r
+       DWORD sector,           /* Start sector in LBA */\r
        UINT count                      /* Number of sectors to write */\r
 )\r
 {\r
@@ -158,16 +154,16 @@ DRESULT disk_write (
        int result;\r
 \r
        switch (pdrv) {\r
-       case ATA :\r
+       case DEV_RAM :\r
                // translate the arguments here\r
 \r
-               result = ATA_disk_write(buff, sector, count);\r
+               result = RAM_disk_write(buff, sector, count);\r
 \r
                // translate the reslut code here\r
 \r
                return res;\r
 \r
-       case MMC :\r
+       case DEV_MMC :\r
                // translate the arguments here\r
 \r
                result = MMC_disk_write(buff, sector, count);\r
@@ -176,7 +172,7 @@ DRESULT disk_write (
 \r
                return res;\r
 \r
-       case USB :\r
+       case DEV_USB :\r
                // translate the arguments here\r
 \r
                result = USB_disk_write(buff, sector, count);\r
@@ -188,14 +184,13 @@ DRESULT disk_write (
 \r
        return RES_PARERR;\r
 }\r
-#endif\r
+\r
 \r
 \r
 /*-----------------------------------------------------------------------*/\r
 /* Miscellaneous Functions                                               */\r
 /*-----------------------------------------------------------------------*/\r
 \r
-#if _USE_IOCTL\r
 DRESULT disk_ioctl (\r
        BYTE pdrv,              /* Physical drive nmuber (0..) */\r
        BYTE cmd,               /* Control code */\r
@@ -206,19 +201,19 @@ DRESULT disk_ioctl (
        int result;\r
 \r
        switch (pdrv) {\r
-       case ATA :\r
+       case DEV_RAM :\r
 \r
-               // Process of the command for the ATA drive\r
+               // Process of the command for the RAM drive\r
 \r
                return res;\r
 \r
-       case MMC :\r
+       case DEV_MMC :\r
 \r
                // Process of the command for the MMC/SD card\r
 \r
                return res;\r
 \r
-       case USB :\r
+       case DEV_USB :\r
 \r
                // Process of the command the USB drive\r
 \r
@@ -227,4 +222,4 @@ DRESULT disk_ioctl (
 \r
        return RES_PARERR;\r
 }\r
-#endif\r
+\r