fatfs: Add mock option to ff_sdmmc_status function to increase IO speed

Adds `disk_status_check_enable` field to `esp_vfs_fat_mount_config_t` struct to control if ff_sdmmc_status is mocked or not.
This commit is contained in:
Adam Múdry
2022-06-05 14:37:21 +02:00
committed by BOT
parent 3e78898d2c
commit 8af790da45
6 changed files with 39 additions and 16 deletions

View File

@@ -85,6 +85,17 @@ typedef struct {
* sector size.
*/
size_t allocation_unit_size;
/**
* Enables real ff_disk_status function implementation for SD cards
* (ff_sdmmc_status). Possibly slows down IO performance.
*
* Try to enable if you need to handle situations when SD cards
* are not unmounted properly before physical removal
* or you are experiencing issues with SD cards.
*
* Doesn't do anything for other memory storage media.
*/
bool disk_status_check_enable;
} esp_vfs_fat_mount_config_t;
// Compatibility definition

View File

@@ -85,6 +85,7 @@ static esp_err_t mount_to_vfs_fat(const esp_vfs_fat_mount_config_t *mount_config
FATFS* fs = NULL;
esp_err_t err;
ff_diskio_register_sdmmc(pdrv, card);
ff_sdmmc_set_disk_status_check(pdrv, mount_config->disk_status_check_enable);
ESP_LOGD(TAG, "using pdrv=%i", pdrv);
char drv[3] = {(char)('0' + pdrv), ':', 0};