[101] | 1 | /*-----------------------------------------------------------------------
|
---|
| 2 | / PFF - Low level disk interface modlue include file (C)ChaN, 2014
|
---|
| 3 | /-----------------------------------------------------------------------*/
|
---|
| 4 |
|
---|
| 5 | #ifndef _DISKIO_DEFINED
|
---|
| 6 | #define _DISKIO_DEFINED
|
---|
| 7 |
|
---|
| 8 | #ifdef __cplusplus
|
---|
| 9 | extern "C" {
|
---|
| 10 | #endif
|
---|
| 11 |
|
---|
| 12 | #include "integer.h"
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 | /* Status of Disk Functions */
|
---|
| 16 | typedef BYTE DSTATUS;
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | /* Results of Disk Functions */
|
---|
| 20 | typedef enum {
|
---|
[154] | 21 | RES_OK = 0, /* 0: Successful */
|
---|
| 22 | RES_ERROR, /* 1: R/W Error */
|
---|
| 23 | RES_WRPRT, /* 2: Write Protected */
|
---|
| 24 | RES_NOTRDY, /* 3: Not Ready */
|
---|
| 25 | RES_PARERR /* 4: Invalid Parameter */
|
---|
[101] | 26 | } DRESULT;
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | /*---------------------------------------*/
|
---|
| 30 | /* Prototypes for disk control functions */
|
---|
| 31 |
|
---|
[154] | 32 | DSTATUS ramdisk_initialize (void);
|
---|
| 33 | DSTATUS ramdisk_get_status (void);
|
---|
| 34 | DRESULT ramdisk_readp (BYTE* buff, DWORD sector, UINT offset, UINT count);
|
---|
| 35 | DRESULT ramdisk_writep (const BYTE* buff, DWORD sc);
|
---|
[101] | 36 |
|
---|
| 37 | #define STA_NOINIT 0x01 /* Drive not initialized */
|
---|
| 38 | #define STA_NODISK 0x02 /* No medium in the drive */
|
---|
[154] | 39 | #define STA_PROTECT 0x04 /* Write protected */
|
---|
[101] | 40 |
|
---|
[154] | 41 | /* Generic command (Used by FatFs) */
|
---|
| 42 | #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
|
---|
| 43 | #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
|
---|
| 44 | #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
|
---|
| 45 | #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
|
---|
| 46 | #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
|
---|
[101] | 47 |
|
---|
[154] | 48 | /* MMC/SDC specific command (Not used by FatFs) */
|
---|
| 49 | #define MMC_GET_TYPE 50 /* Get card type */
|
---|
| 50 | #define MMC_GET_CSD 51 /* Get CSD */
|
---|
| 51 | #define MMC_GET_CID 52 /* Get CID */
|
---|
| 52 | #define MMC_GET_OCR 53 /* Get OCR */
|
---|
| 53 | #define MMC_GET_SDSTAT 54 /* Get SD status */
|
---|
| 54 |
|
---|
| 55 | /* MMC card type flags (MMC_GET_TYPE) */
|
---|
| 56 | #define CT_MMC 0x01 /* MMC ver 3 */
|
---|
| 57 | #define CT_SD1 0x02 /* SD ver 1 */
|
---|
| 58 | #define CT_SD2 0x04 /* SD ver 2 */
|
---|
| 59 | #define CT_SDC (CT_SD1|CT_SD2) /* SD */
|
---|
| 60 | #define CT_BLOCK 0x08 /* Block addressing */
|
---|
| 61 |
|
---|
[101] | 62 | #ifdef __cplusplus
|
---|
| 63 | }
|
---|
| 64 | #endif
|
---|
| 65 |
|
---|
| 66 | #endif /* _DISKIO_DEFINED */
|
---|