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