usb: device: msc: synchronize cache after writes

Flush disk cache when write command finishes.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
This commit is contained in:
Tomasz Moń 2022-10-26 11:47:25 +02:00 committed by Carles Cufí
parent 566c64f0c0
commit 04059ec8a7

View file

@ -772,6 +772,11 @@ static void thread_memory_write_done(void)
length -= size;
csw.DataResidue -= size;
if (!length) {
if (disk_access_ioctl(disk_pdrv, DISK_IOCTL_CTRL_SYNC, NULL)) {
LOG_ERR("!! Disk cache sync error !!");
}
}
if ((!length) || (stage != MSC_PROCESS_CBW)) {
csw.Status = (stage == MSC_ERROR) ? CSW_FAILED : CSW_PASSED;