Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/libs/fatfs/diskio.h
3694 views
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
#include <utils/types.h>
13
14
/* Status of Disk Functions */
15
typedef BYTE DSTATUS;
16
17
/* Results of Disk Functions */
18
typedef enum {
19
RES_OK = 0, /* 0: Successful */
20
RES_ERROR, /* 1: R/W Error */
21
RES_WRPRT, /* 2: Write Protected */
22
RES_NOTRDY, /* 3: Not Ready */
23
RES_PARERR /* 4: Invalid Parameter */
24
} DRESULT;
25
26
typedef enum {
27
DRIVE_SD = 0,
28
DRIVE_RAM = 1,
29
DRIVE_EMMC = 2,
30
DRIVE_BIS = 3,
31
DRIVE_EMU = 4
32
} DDRIVE;
33
34
35
/*---------------------------------------*/
36
/* Prototypes for disk control functions */
37
38
39
DSTATUS disk_initialize (BYTE pdrv);
40
DSTATUS disk_status (BYTE pdrv);
41
DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
42
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
43
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
44
DRESULT disk_set_info (BYTE pdrv, BYTE cmd, void *buff);
45
46
47
/* Disk Status Bits (DSTATUS) */
48
49
#define STA_NOINIT 0x01 /* Drive not initialized */
50
#define STA_NODISK 0x02 /* No medium in the drive */
51
#define STA_PROTECT 0x04 /* Write protected */
52
53
54
/* Command code for disk_ioctrl fucntion */
55
56
/* Generic command (Used by FatFs) */
57
#define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */
58
#define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */
59
#define SET_SECTOR_COUNT 1 /* Set media size (needed at FF_USE_MKFS == 1) */
60
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */
61
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */
62
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */
63
#define SET_SECTOR_OFFSET 5 /* Set media logical offset */
64
#define SET_WRITE_PROTECT 6 /* Lock/Unlock media removal */
65
66
#ifdef __cplusplus
67
}
68
#endif
69
70
#endif
71
72