disk_status

The disk_status function returns the current drive status.

DSTATUS disk_status (
  BYTE pdrv     /* [IN] Physical drive number */
);

Parameter

pdrv
Physical drive number to identify the target device. Always zero at single drive system.

Return Values

The current drive status is returned in combination of status flags described below. FatFs refers only STA_NOINIT and STA_PROTECT.

STA_NOINIT
Indicates that the device is not initialized. This flag is set on system reset, media removal or failure of disk_initialize function. It is cleared on disk_initialize function succeeded. Media change that occurs asynchronously must be captured and reflect it to the status flags, or auto-mount feature will not work correctly. If the system does not support media change detect feature, application program needs to force de-initialize the file system object with f_mount function after the media change.
STA_NODISK
Indicates that no medium in the drive. This is always cleared on fixed disk drive. Note that FatFs does not refer this flag.
STA_PROTECT
Indicates that the medium is write protected. This is always cleared on the drives without write protect feature. Not valid if no medium in the drive.

Return