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