X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/a870134af740aa65f57aa7edeb2f566a749d06a0..976db69ffa80c4d499e53f6f22c26d784fdac0a1:/include/diskio.h diff --git a/include/diskio.h b/include/diskio.h index f7a764c..ad89e4b 100644 --- a/include/diskio.h +++ b/include/diskio.h @@ -1,14 +1,15 @@ -/*----------------------------------------------------------------------- -/ Low level disk interface modlue include file R0.07 (C)ChaN, 2009 +/*-----------------------------------------------------------------------/ +/ Low level disk interface modlue include file (C)ChaN, 2019 / /-----------------------------------------------------------------------*/ -#ifndef _DISKIO_H -#define _DISKIO_H +#ifndef _DISKIO_DEFINED +#define _DISKIO_DEFINED -#define _USE_WRITE 1 /* 1: Enable disk_write function */ -#define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */ +#ifdef __cplusplus +extern "C" { +#endif -#include "integer.h" +#include "ff.h" /* Status of Disk Functions */ @@ -27,15 +28,11 @@ typedef enum { /*---------------------------------------*/ /* Prototypes for disk control functions */ -DSTATUS disk_initialize (BYTE drv); -DSTATUS disk_status (BYTE drv); -DRESULT disk_read (BYTE drv, BYTE* buff, DWORD sector, UINT count); -#if _USE_WRITE -DRESULT disk_write (BYTE drv, const BYTE* buff, DWORD sector, UINT count); -#endif -#if _USE_IOCTL -DRESULT disk_ioctl (BYTE drv, BYTE cmd, void* buff); -#endif +DSTATUS disk_initialize (BYTE pdrv); +DSTATUS disk_status (BYTE pdrv); +DRESULT disk_read (BYTE pdrv, BYTE* buff, LBA_t sector, UINT count); +DRESULT disk_write (BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count); +DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); void disk_timerproc (void); @@ -46,16 +43,17 @@ void disk_timerproc (void); #define STA_NODISK 0x02 /* No medium in the drive */ #define STA_PROTECT 0x04 /* Write protected */ #define STA_FAST 0x08 /* Fast SPI clock */ +#define STAT_MASK (STA_NOINIT | STA_NODISK | STA_PROTECT) -/* Command code for disk_ioctrl() */ +/* Command code for disk_ioctrl function */ /* Generic command (Used by FatFs) */ -#define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */ -#define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */ -#define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */ -#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */ -#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */ +#define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */ +#define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */ +#define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */ +#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */ +#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */ /* Generic command (Not used by FatFs) */ #define CTRL_FORMAT 5 /* Create physical format on the media */