summaryrefslogtreecommitdiff
path: root/fatfs/src/diskio.c
diff options
context:
space:
mode:
Diffstat (limited to 'fatfs/src/diskio.c')
-rw-r--r--fatfs/src/diskio.c61
1 files changed, 28 insertions, 33 deletions
diff --git a/fatfs/src/diskio.c b/fatfs/src/diskio.c
index 169ae95..25f5e53 100644
--- a/fatfs/src/diskio.c
+++ b/fatfs/src/diskio.c
@@ -1,5 +1,5 @@
/*-----------------------------------------------------------------------*/
-/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2014 */
+/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2016 */
/*-----------------------------------------------------------------------*/
/* If a working storage control module is available, it should be */
/* attached to the FatFs via a glue function rather than modifying it. */
@@ -8,14 +8,11 @@
/*-----------------------------------------------------------------------*/
#include "diskio.h" /* FatFs lower layer API */
-#include "usbdisk.h" /* Example: USB drive control */
-#include "atadrive.h" /* Example: ATA drive control */
-#include "sdcard.h" /* Example: MMC/SDC contorl */
/* Definitions of physical drive number for each drive */
-#define ATA 0 /* Example: Map ATA drive to drive number 0 */
-#define MMC 1 /* Example: Map MMC/SD card to drive number 1 */
-#define USB 2 /* Example: Map USB drive to drive number 2 */
+#define DEV_RAM 0 /* Example: Map Ramdisk to physical drive 0 */
+#define DEV_MMC 1 /* Example: Map MMC/SD card to physical drive 1 */
+#define DEV_USB 2 /* Example: Map USB MSD to physical drive 2 */
/*-----------------------------------------------------------------------*/
@@ -30,21 +27,21 @@ DSTATUS disk_status (
int result;
switch (pdrv) {
- case ATA :
- result = ATA_disk_status();
+ case DEV_RAM :
+ result = RAM_disk_status();
// translate the reslut code here
return stat;
- case MMC :
+ case DEV_MMC :
result = MMC_disk_status();
// translate the reslut code here
return stat;
- case USB :
+ case DEV_USB :
result = USB_disk_status();
// translate the reslut code here
@@ -68,21 +65,21 @@ DSTATUS disk_initialize (
int result;
switch (pdrv) {
- case ATA :
- result = ATA_disk_initialize();
+ case DEV_RAM :
+ result = RAM_disk_initialize();
// translate the reslut code here
return stat;
- case MMC :
+ case DEV_MMC :
result = MMC_disk_initialize();
// translate the reslut code here
return stat;
- case USB :
+ case DEV_USB :
result = USB_disk_initialize();
// translate the reslut code here
@@ -101,7 +98,7 @@ DSTATUS disk_initialize (
DRESULT disk_read (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
BYTE *buff, /* Data buffer to store read data */
- DWORD sector, /* Sector address in LBA */
+ DWORD sector, /* Start sector in LBA */
UINT count /* Number of sectors to read */
)
{
@@ -109,16 +106,16 @@ DRESULT disk_read (
int result;
switch (pdrv) {
- case ATA :
+ case DEV_RAM :
// translate the arguments here
- result = ATA_disk_read(buff, sector, count);
+ result = RAM_disk_read(buff, sector, count);
// translate the reslut code here
return res;
- case MMC :
+ case DEV_MMC :
// translate the arguments here
result = MMC_disk_read(buff, sector, count);
@@ -127,7 +124,7 @@ DRESULT disk_read (
return res;
- case USB :
+ case DEV_USB :
// translate the arguments here
result = USB_disk_read(buff, sector, count);
@@ -146,11 +143,10 @@ DRESULT disk_read (
/* Write Sector(s) */
/*-----------------------------------------------------------------------*/
-#if _USE_WRITE
DRESULT disk_write (
BYTE pdrv, /* Physical drive nmuber to identify the drive */
const BYTE *buff, /* Data to be written */
- DWORD sector, /* Sector address in LBA */
+ DWORD sector, /* Start sector in LBA */
UINT count /* Number of sectors to write */
)
{
@@ -158,16 +154,16 @@ DRESULT disk_write (
int result;
switch (pdrv) {
- case ATA :
+ case DEV_RAM :
// translate the arguments here
- result = ATA_disk_write(buff, sector, count);
+ result = RAM_disk_write(buff, sector, count);
// translate the reslut code here
return res;
- case MMC :
+ case DEV_MMC :
// translate the arguments here
result = MMC_disk_write(buff, sector, count);
@@ -176,7 +172,7 @@ DRESULT disk_write (
return res;
- case USB :
+ case DEV_USB :
// translate the arguments here
result = USB_disk_write(buff, sector, count);
@@ -188,14 +184,13 @@ DRESULT disk_write (
return RES_PARERR;
}
-#endif
+
/*-----------------------------------------------------------------------*/
/* Miscellaneous Functions */
/*-----------------------------------------------------------------------*/
-#if _USE_IOCTL
DRESULT disk_ioctl (
BYTE pdrv, /* Physical drive nmuber (0..) */
BYTE cmd, /* Control code */
@@ -206,19 +201,19 @@ DRESULT disk_ioctl (
int result;
switch (pdrv) {
- case ATA :
+ case DEV_RAM :
- // Process of the command for the ATA drive
+ // Process of the command for the RAM drive
return res;
- case MMC :
+ case DEV_MMC :
// Process of the command for the MMC/SD card
return res;
- case USB :
+ case DEV_USB :
// Process of the command the USB drive
@@ -227,4 +222,4 @@ DRESULT disk_ioctl (
return RES_PARERR;
}
-#endif
+