diff options
Diffstat (limited to 'stmhal/usbd_msc_storage.c')
| -rw-r--r-- | stmhal/usbd_msc_storage.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/stmhal/usbd_msc_storage.c b/stmhal/usbd_msc_storage.c index 2c0b29c1d..6ec9abc3d 100644 --- a/stmhal/usbd_msc_storage.c +++ b/stmhal/usbd_msc_storage.c @@ -112,6 +112,12 @@ int8_t FLASH_STORAGE_StopUnit(uint8_t lun) { return 0; } +int8_t FLASH_STORAGE_PreventAllowMediumRemoval(uint8_t lun, uint8_t param) { + // sync the flash so that the cache is cleared and the device can be unplugged/turned off + disk_ioctl(0, CTRL_SYNC, NULL); + return 0; +} + /** * @brief Read data from the medium * @param lun : logical unit number @@ -149,7 +155,6 @@ int8_t FLASH_STORAGE_Write (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16 } } */ - storage_flush(); // XXX hack for now so that the cache is always flushed return 0; } @@ -168,6 +173,7 @@ const USBD_StorageTypeDef USBD_FLASH_STORAGE_fops = { FLASH_STORAGE_IsReady, FLASH_STORAGE_IsWriteProtected, FLASH_STORAGE_StopUnit, + FLASH_STORAGE_PreventAllowMediumRemoval, FLASH_STORAGE_Read, FLASH_STORAGE_Write, FLASH_STORAGE_GetMaxLun, @@ -298,6 +304,10 @@ int8_t SDCARD_STORAGE_StopUnit(uint8_t lun) { return 0; } +int8_t SDCARD_STORAGE_PreventAllowMediumRemoval(uint8_t lun, uint8_t param) { + return 0; +} + /** * @brief Read data from the medium * @param lun : logical unit number @@ -343,6 +353,7 @@ const USBD_StorageTypeDef USBD_SDCARD_STORAGE_fops = { SDCARD_STORAGE_IsReady, SDCARD_STORAGE_IsWriteProtected, SDCARD_STORAGE_StopUnit, + SDCARD_STORAGE_PreventAllowMediumRemoval, SDCARD_STORAGE_Read, SDCARD_STORAGE_Write, SDCARD_STORAGE_GetMaxLun, |
