ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
diskio.h
Go to the documentation of this file.
1 /*-----------------------------------------------------------------------
2 / 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 #define _USE_WRITE 1 /* 1: Enable disk_write function */
13 #define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */
14 #define _USE_ISDIO 1 /* 1: Enable iSDIO controls via disk_ioctl */
15 
16 #include "integer.h"
17 
18 
19 /* Status of Disk Functions */
20 typedef BYTE DSTATUS;
21 
22 /* Results of Disk Functions */
23 typedef enum {
24  RES_OK = 0, /* 0: Successful */
25  RES_ERROR, /* 1: R/W Error */
26  RES_WRPRT, /* 2: Write Protected */
27  RES_NOTRDY, /* 3: Not Ready */
28  RES_PARERR /* 4: Invalid Parameter */
29 } DRESULT;
30 
31 /* Command structure for iSDIO ioctl command */
32 typedef struct {
33  BYTE func; /* Function number: 0..7 */
34  WORD ndata; /* Number of bytes to transfer: 1..512, or mask + data */
35  DWORD addr; /* Register address: 0..0x1FFFF */
36  void* data; /* Pointer to the data (to be written | read buffer) */
37 } SDIO_CTRL;
38 
39 
40 /*---------------------------------------*/
41 /* Prototypes for disk control functions */
42 
43 
44 DSTATUS disk_initialize (BYTE pdrv);
45 DSTATUS disk_status (BYTE pdrv);
46 DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
47 DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
48 DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
49 void disk_timerproc (void);
50 
51 
52 /* Disk Status Bits (DSTATUS) */
53 #define STA_NOINIT 0x01 /* Drive not initialized */
54 #define STA_NODISK 0x02 /* No medium in the drive */
55 #define STA_PROTECT 0x04 /* Write protected */
56 
57 
58 /* Command code for disk_ioctrl fucntion */
59 
60 /* Generic command (Used by FatFs) */
61 #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
62 #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
63 #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
64 #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
65 #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
66 
67 /* Generic command (Not used by FatFs) */
68 #define CTRL_FORMAT 5 /* Create physical format on the media */
69 #define CTRL_POWER_IDLE 6 /* Put the device idle state */
70 #define CTRL_POWER_OFF 7 /* Put the device off state */
71 #define CTRL_LOCK 8 /* Lock media removal */
72 #define CTRL_UNLOCK 9 /* Unlock media removal */
73 #define CTRL_EJECT 10 /* Eject media */
74 
75 /* MMC/SDC specific command (Not used by FatFs) */
76 #define MMC_GET_TYPE 50 /* Get card type */
77 #define MMC_GET_CSD 51 /* Get CSD */
78 #define MMC_GET_CID 52 /* Get CID */
79 #define MMC_GET_OCR 53 /* Get OCR */
80 #define MMC_GET_SDSTAT 54 /* Get SD status */
81 #define ISDIO_READ 55 /* Read data form SD iSDIO register */
82 #define ISDIO_WRITE 56 /* Write data to SD iSDIO register */
83 #define ISDIO_MRITE 57 /* Masked write data to SD iSDIO register */
84 
85 /* ATA/CF specific command (Not used by FatFs) */
86 #define ATA_GET_REV 60 /* Get F/W revision */
87 #define ATA_GET_MODEL 61 /* Get model name */
88 #define ATA_GET_SN 62 /* Get serial number */
89 
90 
91 /* MMC card type flags (MMC_GET_TYPE) */
92 #define CT_MMC 0x01 /* MMC ver 3 */
93 #define CT_SD1 0x02 /* SD ver 1 */
94 #define CT_SD2 0x04 /* SD ver 2 */
95 #define CT_SDC (CT_SD1|CT_SD2) /* SD */
96 #define CT_BLOCK 0x08 /* Block addressing */
97 
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif
unsigned short WORD
Definition: integer.h:26
DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
Definition: diskio.c:104
DWORD addr
Definition: diskio.h:35
unsigned long DWORD
Definition: integer.h:31
BYTE func
Definition: diskio.h:33
DSTATUS disk_status(BYTE pdrv)
Definition: diskio.c:31
BYTE DSTATUS
Definition: diskio.h:20
DRESULT
Definition: diskio.h:23
void disk_timerproc(void)
Definition: diskio.c:157
unsigned char BYTE
Definition: integer.h:22
DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
Definition: diskio.c:77
Definition: diskio.h:24
DSTATUS disk_initialize(BYTE pdrv)
Definition: diskio.c:54
DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
Definition: diskio.c:131
WORD ndata
Definition: diskio.h:34
unsigned int UINT
Definition: integer.h:19
void * data
Definition: diskio.h:36