ReactOS  0.4.15-dev-1206-g731eddf
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 
15 #include <typedefs.h>
16 
17 
18 /* Status of Disk Functions */
19 typedef BYTE DSTATUS;
20 
21 /* Results of Disk Functions */
22 typedef enum {
23  RES_OK = 0, /* 0: Successful */
24  RES_ERROR, /* 1: R/W Error */
25  RES_WRPRT, /* 2: Write Protected */
26  RES_NOTRDY, /* 3: Not Ready */
27  RES_PARERR /* 4: Invalid Parameter */
28 } DRESULT;
29 
30 
31 /*---------------------------------------*/
32 /* Prototypes for disk control functions */
33 
34 DSTATUS disk_openimage(BYTE pdrv, const char* imageFileName);
35 VOID disk_cleanup(BYTE pdrv);
36 
38 DSTATUS disk_status (BYTE pdrv);
41 DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
42 
43 
44 /* Disk Status Bits (DSTATUS) */
45 
46 #define STA_NOINIT 0x01 /* Drive not initialized */
47 #define STA_NODISK 0x02 /* No medium in the drive */
48 #define STA_PROTECT 0x04 /* Write protected */
49 
50 
51 /* Command code for disk_ioctrl fucntion */
52 
53 /* Generic command (Used by FatFs) */
54 #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
55 #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
56 #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
57 #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
58 #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
59 
60 /* Custom command for image file resizing */
61 #define SET_SECTOR_COUNT 126
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 #endif
uint32_t sector
Definition: isohybrid.c:61
DRESULT disk_write(BYTE pdrv, const BYTE *buff, DWORD sector, UINT count)
Definition: diskio.c:134
Definition: ftp_var.h:139
GLuint GLuint GLsizei count
Definition: gl.h:1545
DSTATUS disk_status(BYTE pdrv)
Definition: diskio.c:83
BYTE DSTATUS
Definition: diskio.h:19
DRESULT
Definition: diskio.h:22
DRESULT disk_read(BYTE pdrv, BYTE *buff, DWORD sector, UINT count)
Definition: diskio.c:99
Definition: diskio.h:23
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID disk_cleanup(BYTE pdrv)
Definition: diskio.c:48
DSTATUS disk_initialize(BYTE pdrv)
Definition: diskio.c:66
DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void *buff)
Definition: diskio.c:169
DSTATUS disk_openimage(BYTE pdrv, const char *imageFileName)
Definition: diskio.c:24
unsigned char BYTE
Definition: xxhash.c:193
unsigned int UINT
Definition: ndis.h:50
static unsigned char buff[32768]
Definition: fatten.c:17