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