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