MSC Device: Add asynchronous IO support
Describe the PR
Currently, mixing the MSC class with other classes could be problematic since IO operations could block tud_task() for a long time and degrade real-time performance, especially for isochronous and interrupt transfer-based classes.
Now, it's possible to delegate IO operations to a background task.
The cdc_msc_freertos example has been updated for demonstration. One can change CFG_EXAMPLE_MSC_IO_DELAY_MS to a high value and type in the console while doing disk IO. With CFG_EXAMPLE_MSC_ASYNC_IO ON and OFF, the latency difference should be very noticeable.
I'm using this in a work project. I'd love to see something around these lines landed.
This is a very practical feature, and I also hope that it can be implemented as soon as possible.
Thank you, use cbw.command[0] for pending IO command made it easier to for command extension :)
Without usbd_defer_func proc_read_io_data\proc_write_io_data will be executed in IO task's context, I think it's risky to have both IO task and TUSB task to modify class internal state simultaneously.
Thank you,
use cbw.command[0] for pending IO commandmade it easier to for command extension :)Without
usbd_defer_funcproc_read_io_data\proc_write_io_datawill be executed in IO task's context, I think it's risky to have both IO task and TUSB task to modify class internal state simultaneously.
Yeah, I think you are right, I will revert that to force usbd defer