Fork of FATFileSystem by mbed official

Committer:
p3p
Date:
Sat Jul 30 20:47:51 2016 +0000
Revision:
9:e2ab678eb692
Parent:
6:a5fcdbf92056
_name is now private, use supplied getter

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 5:b3b3370574cf 1 /*-----------------------------------------------------------------------/
mbed_official 5:b3b3370574cf 2 / Low level disk interface modlue include file (C)ChaN, 2014 /
mbed_official 5:b3b3370574cf 3 /-----------------------------------------------------------------------*/
mbed_official 5:b3b3370574cf 4
mbed_official 5:b3b3370574cf 5 #ifndef _DISKIO_DEFINED
mbed_official 5:b3b3370574cf 6 #define _DISKIO_DEFINED
emilmont 1:46ce1e16c870 7
mbed_official 5:b3b3370574cf 8 #ifdef __cplusplus
mbed_official 5:b3b3370574cf 9 extern "C" {
mbed_official 5:b3b3370574cf 10 #endif
emilmont 1:46ce1e16c870 11
mbed_official 5:b3b3370574cf 12 #define _USE_WRITE 1 /* 1: Enable disk_write function */
mbed_official 5:b3b3370574cf 13 #define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */
emilmont 1:46ce1e16c870 14
emilmont 1:46ce1e16c870 15 #include "integer.h"
emilmont 1:46ce1e16c870 16
emilmont 1:46ce1e16c870 17
mbed_official 5:b3b3370574cf 18 /* Status of Disk Functions */
mbed_official 5:b3b3370574cf 19 typedef BYTE DSTATUS;
emilmont 1:46ce1e16c870 20
mbed_official 5:b3b3370574cf 21 /* Results of Disk Functions */
emilmont 1:46ce1e16c870 22 typedef enum {
mbed_official 5:b3b3370574cf 23 RES_OK = 0, /* 0: Successful */
mbed_official 5:b3b3370574cf 24 RES_ERROR, /* 1: R/W Error */
mbed_official 5:b3b3370574cf 25 RES_WRPRT, /* 2: Write Protected */
mbed_official 5:b3b3370574cf 26 RES_NOTRDY, /* 3: Not Ready */
mbed_official 5:b3b3370574cf 27 RES_PARERR /* 4: Invalid Parameter */
emilmont 1:46ce1e16c870 28 } DRESULT;
emilmont 1:46ce1e16c870 29
emilmont 1:46ce1e16c870 30
mbed_official 5:b3b3370574cf 31 /*---------------------------------------*/
mbed_official 5:b3b3370574cf 32 /* Prototypes for disk control functions */
emilmont 1:46ce1e16c870 33
emilmont 1:46ce1e16c870 34
mbed_official 5:b3b3370574cf 35 DSTATUS disk_initialize (BYTE pdrv);
mbed_official 5:b3b3370574cf 36 DSTATUS disk_status (BYTE pdrv);
mbed_official 5:b3b3370574cf 37 DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
mbed_official 5:b3b3370574cf 38 DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
mbed_official 5:b3b3370574cf 39 DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
emilmont 1:46ce1e16c870 40
mbed_official 5:b3b3370574cf 41
mbed_official 5:b3b3370574cf 42 /* Disk Status Bits (DSTATUS) */
mbed_official 5:b3b3370574cf 43
mbed_official 5:b3b3370574cf 44 #define STA_NOINIT 0x01 /* Drive not initialized */
mbed_official 5:b3b3370574cf 45 #define STA_NODISK 0x02 /* No medium in the drive */
mbed_official 5:b3b3370574cf 46 #define STA_PROTECT 0x04 /* Write protected */
emilmont 1:46ce1e16c870 47
emilmont 1:46ce1e16c870 48
mbed_official 5:b3b3370574cf 49 /* Command code for disk_ioctrl fucntion */
emilmont 1:46ce1e16c870 50
mbed_official 5:b3b3370574cf 51 /* Generic command (Used by FatFs) */
mbed_official 5:b3b3370574cf 52 #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
mbed_official 5:b3b3370574cf 53 #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
mbed_official 5:b3b3370574cf 54 #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
mbed_official 5:b3b3370574cf 55 #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
mbed_official 5:b3b3370574cf 56 #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
emilmont 1:46ce1e16c870 57
mbed_official 5:b3b3370574cf 58 /* Generic command (Not used by FatFs) */
mbed_official 5:b3b3370574cf 59 #define CTRL_POWER 5 /* Get/Set power status */
mbed_official 5:b3b3370574cf 60 #define CTRL_LOCK 6 /* Lock/Unlock media removal */
mbed_official 5:b3b3370574cf 61 #define CTRL_EJECT 7 /* Eject media */
mbed_official 5:b3b3370574cf 62 #define CTRL_FORMAT 8 /* Create physical format on the media */
emilmont 1:46ce1e16c870 63
mbed_official 5:b3b3370574cf 64 /* MMC/SDC specific ioctl command */
mbed_official 5:b3b3370574cf 65 #define MMC_GET_TYPE 10 /* Get card type */
mbed_official 5:b3b3370574cf 66 #define MMC_GET_CSD 11 /* Get CSD */
mbed_official 5:b3b3370574cf 67 #define MMC_GET_CID 12 /* Get CID */
mbed_official 5:b3b3370574cf 68 #define MMC_GET_OCR 13 /* Get OCR */
mbed_official 5:b3b3370574cf 69 #define MMC_GET_SDSTAT 14 /* Get SD status */
emilmont 1:46ce1e16c870 70
mbed_official 5:b3b3370574cf 71 /* ATA/CF specific ioctl command */
mbed_official 5:b3b3370574cf 72 #define ATA_GET_REV 20 /* Get F/W revision */
mbed_official 5:b3b3370574cf 73 #define ATA_GET_MODEL 21 /* Get model name */
mbed_official 5:b3b3370574cf 74 #define ATA_GET_SN 22 /* Get serial number */
emilmont 1:46ce1e16c870 75
mbed_official 5:b3b3370574cf 76 #ifdef __cplusplus
mbed_official 5:b3b3370574cf 77 }
mbed_official 5:b3b3370574cf 78 #endif
emilmont 1:46ce1e16c870 79
mbed_official 5:b3b3370574cf 80 #endif