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