mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-02 01:32:32 +00:00
Transfer is an important concept of USB specification. During a transfer, several packets can be transmitted. Today the usb API only provides ep_read and ep_write functions but the transfer concept is missing. This is typically ok for basic drivers which don't have to take care of how data is transfered/splitted. However there are some drivers like CDC EEM, in which transfer concept is important for packet management. Moreover, current ep-write and ep_read method have a different implementation in usb_dc_dw and usb_dc_stm32 device drivers. For example usb_dc_dw supports only 1-data-packet transfers due to its implementation. This can increase latency and reduce performance. I think this is something we need to fix/improve by implementing better transfer management. This patch introduces usb_dc_ ep_transfer method which can be used to configure IN/OUT transfers. This allows to configure and request different transfer sizes and should prevent usage of the current stm32 temporary buffer. This method has asynchronous and synchronous mode. Synchronous mode waits for transfer completion before returning. Asynchronouse mode (irq safe) configures the transfer and returns immediately, the provided callback will be then called on transfer completion. This also update ep_write and ep_read stm32 implementation to use this new method but keep their behavior unchanged for legacy reasons. Note that for now this method is local to stm32 device driver, however the goal would be to expose this function as a new USB device driver API method so that class drivers use it. This will request same implementation in the usb_dc_dw_driver. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> |
||
---|---|---|
.. | ||
device | ||
CMakeLists.txt | ||
Kconfig |