fix(storage/fatfs): check whether sdcard supports triming

Closes https://github.com/espressif/esp-idf/issues/12912
This commit is contained in:
Tomáš Rohlínek 2024-01-05 10:31:56 +01:00
parent db1e54a0c5
commit e5742d6f41
No known key found for this signature in database
GPG Key ID: BDE1CEDD10F7E372

View File

@ -105,6 +105,9 @@ DRESULT ff_sdmmc_ioctl (BYTE pdrv, BYTE cmd, void* buff)
return RES_ERROR; return RES_ERROR;
#if FF_USE_TRIM #if FF_USE_TRIM
case CTRL_TRIM: case CTRL_TRIM:
if (sdmmc_can_trim(card) != ESP_OK) {
return RES_PARERR;
}
return ff_sdmmc_trim (pdrv, *((DWORD*)buff), //start_sector return ff_sdmmc_trim (pdrv, *((DWORD*)buff), //start_sector
(*((DWORD*)buff + 1) - *((DWORD*)buff) + 1)); //sector_count (*((DWORD*)buff + 1) - *((DWORD*)buff) + 1)); //sector_count
#endif //FF_USE_TRIM #endif //FF_USE_TRIM