fatfs: add vfs support

This commit is contained in:
Ivan Grokhotkov
2017-01-09 05:54:04 +08:00
parent d418776982
commit 44ce833d76
12 changed files with 1408 additions and 62 deletions

View File

@@ -44,16 +44,36 @@ DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
/**
* Structure of pointers to disk IO driver functions.
*
* See FatFs documentation for details about these functions
*/
typedef struct {
DSTATUS (*init) (BYTE pdrv);
DSTATUS (*status) (BYTE pdrv);
DRESULT (*read) (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
DRESULT (*write) (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
DRESULT (*ioctl) (BYTE pdrv, BYTE cmd, void* buff);
DSTATUS (*init) (BYTE pdrv); /*!< disk initialization function */
DSTATUS (*status) (BYTE pdrv); /*!< disk status check function */
DRESULT (*read) (BYTE pdrv, BYTE* buff, DWORD sector, UINT count); /*!< sector read function */
DRESULT (*write) (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count); /*!< sector write function */
DRESULT (*ioctl) (BYTE pdrv, BYTE cmd, void* buff); /*!< function to get info about disk and do some misc operations */
} ff_diskio_impl_t;
/**
* Register diskio driver for given drive number.
*
* When FATFS library calls one of disk_xxx functions for driver number pdrv,
* corresponding function in discio_impl for given pdrv will be called.
*
* @param pdrv drive number
* @param discio_impl pointer to ff_diskio_impl_t structure with diskio functions
*/
void ff_diskio_register(BYTE pdrv, const ff_diskio_impl_t* discio_impl);
/**
* Register SD/MMC diskio driver
*
* @param pdrv drive number
* @param card pointer to sdmmc_card_t structure describing a card; card should be initialized before calling f_mount.
*/
void ff_diskio_register_sdmmc(BYTE pdrv, sdmmc_card_t* card);
/* Disk Status Bits (DSTATUS) */