/*-----------------------------------------------------------------------/1/ Low level disk interface modlue include file (C)ChaN, 2014 /2/-----------------------------------------------------------------------*/34#ifndef _DISKIO_DEFINED5#define _DISKIO_DEFINED67#ifdef __cplusplus8extern "C" {9#endif1011#include <utils/types.h>1213/* Status of Disk Functions */14typedef BYTE DSTATUS;1516/* Results of Disk Functions */17typedef enum {18RES_OK = 0, /* 0: Successful */19RES_ERROR, /* 1: R/W Error */20RES_WRPRT, /* 2: Write Protected */21RES_NOTRDY, /* 3: Not Ready */22RES_PARERR /* 4: Invalid Parameter */23} DRESULT;2425typedef enum {26DRIVE_SD = 0,27DRIVE_RAM = 1,28DRIVE_EMMC = 2,29DRIVE_BIS = 3,30DRIVE_EMU = 431} DDRIVE;323334/*---------------------------------------*/35/* Prototypes for disk control functions */363738DSTATUS disk_initialize (BYTE pdrv);39DSTATUS disk_status (BYTE pdrv);40DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);41DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);42DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);43DRESULT disk_set_info (BYTE pdrv, BYTE cmd, void *buff);444546/* Disk Status Bits (DSTATUS) */4748#define STA_NOINIT 0x01 /* Drive not initialized */49#define STA_NODISK 0x02 /* No medium in the drive */50#define STA_PROTECT 0x04 /* Write protected */515253/* Command code for disk_ioctrl fucntion */5455/* Generic command (Used by FatFs) */56#define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */57#define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */58#define SET_SECTOR_COUNT 1 /* Set media size (needed at FF_USE_MKFS == 1) */59#define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */60#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */61#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */62#define SET_SECTOR_OFFSET 5 /* Set media logical offset */63#define SET_WRITE_PROTECT 6 /* Lock/Unlock media removal */6465#ifdef __cplusplus66}67#endif6869#endif707172