Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers diskio.h Source File

diskio.h

00001 /*-----------------------------------------------------------------------/
00002 /  Low level disk interface modlue include file   (C)ChaN, 2014          /
00003 /-----------------------------------------------------------------------*/
00004 
00005 #ifndef _DISKIO_DEFINED
00006 #define _DISKIO_DEFINED
00007 
00008 #ifdef __cplusplus
00009 extern "C" {
00010 #endif
00011 
00012 #include "integer.h"
00013 
00014 
00015 /* Status of Disk Functions */
00016 typedef BYTE    DSTATUS;
00017 
00018 /* Results of Disk Functions */
00019 typedef enum {
00020     RES_OK = 0,     /* 0: Successful */
00021     RES_ERROR,      /* 1: R/W Error */
00022     RES_WRPRT,      /* 2: Write Protected */
00023     RES_NOTRDY,     /* 3: Not Ready */
00024     RES_PARERR      /* 4: Invalid Parameter */
00025 } DRESULT;
00026 
00027 
00028 /*---------------------------------------*/
00029 /* Prototypes for disk control functions */
00030 
00031 
00032 DSTATUS disk_initialize (BYTE pdrv);
00033 DSTATUS disk_status (BYTE pdrv);
00034 DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
00035 DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
00036 DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
00037 
00038 
00039 /* Disk Status Bits (DSTATUS) */
00040 
00041 #define STA_NOINIT      0x01    /* Drive not initialized */
00042 #define STA_NODISK      0x02    /* No medium in the drive */
00043 #define STA_PROTECT     0x04    /* Write protected */
00044 
00045 
00046 /* Command code for disk_ioctrl fucntion */
00047 
00048 /* Generic command (Used by FatFs) */
00049 #define CTRL_SYNC           0   /* Complete pending write process (needed at _FS_READONLY == 0) */
00050 #define GET_SECTOR_COUNT    1   /* Get media size (needed at _USE_MKFS == 1) */
00051 #define GET_SECTOR_SIZE     2   /* Get sector size (needed at _MAX_SS != _MIN_SS) */
00052 #define GET_BLOCK_SIZE      3   /* Get erase block size (needed at _USE_MKFS == 1) */
00053 #define CTRL_TRIM           4   /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
00054 
00055 /* Generic command (Not used by FatFs) */
00056 #define CTRL_POWER          5   /* Get/Set power status */
00057 #define CTRL_LOCK           6   /* Lock/Unlock media removal */
00058 #define CTRL_EJECT          7   /* Eject media */
00059 #define CTRL_FORMAT         8   /* Create physical format on the media */
00060 
00061 /* MMC/SDC specific ioctl command */
00062 #define MMC_GET_TYPE        10  /* Get card type */
00063 #define MMC_GET_CSD         11  /* Get CSD */
00064 #define MMC_GET_CID         12  /* Get CID */
00065 #define MMC_GET_OCR         13  /* Get OCR */
00066 #define MMC_GET_SDSTAT      14  /* Get SD status */
00067 #define ISDIO_READ          55  /* Read data form SD iSDIO register */
00068 #define ISDIO_WRITE         56  /* Write data to SD iSDIO register */
00069 #define ISDIO_MRITE         57  /* Masked write data to SD iSDIO register */
00070 
00071 /* ATA/CF specific ioctl command */
00072 #define ATA_GET_REV         20  /* Get F/W revision */
00073 #define ATA_GET_MODEL       21  /* Get model name */
00074 #define ATA_GET_SN          22  /* Get serial number */
00075 
00076 #ifdef __cplusplus
00077 }
00078 #endif
00079 
00080 #endif