usb: introduce batched request api

in order to implement iap digital audio interface, we have to send
a pcm packet every usb frame i.e. 1000 packets per second.
this rate can't be achieved with current standard request-response design,
even with fast_completion_handler.
this is why this new api is needed.

Change-Id: Id3d7dd037660871e2bdb69656f63ff13280c3804
This commit is contained in:
mojyack 2025-12-19 16:59:43 +09:00
parent 3f4d5a527b
commit d2b76a99f3

View file

@ -109,6 +109,27 @@ int usb_drv_deinit_endpoint(int endpoint);
int usb_drv_get_frame_number(void); int usb_drv_get_frame_number(void);
#endif #endif
#if USB_BATCH_SLOTS > 0
/* batched request api is for workloads that perform very high-frequency,
* performance-sensitive isochronous transactions continuously.
* this api allows multiple transaction requests to be buffered in udc driver.
* so that it can maximize the controller's performance. */
/* called when usb system requires more buffer */
typedef void(*usb_drv_batch_get_more)(const void** ptr, size_t* len);
/* prepare request queue */
int usb_drv_batch_init(int ep, usb_drv_batch_get_more get_more);
/* destroy request queue */
int usb_drv_batch_deinit(void);
/* start processing */
int usb_drv_batch_start(void);
/* stop processing */
int usb_drv_batch_stop(void);
#endif
/* USB_STRING_INITIALIZER(u"Example String") */ /* USB_STRING_INITIALIZER(u"Example String") */
#define USB_STRING_INITIALIZER(S) { \ #define USB_STRING_INITIALIZER(S) { \
sizeof(struct usb_string_descriptor) + sizeof(S) - sizeof(*S), \ sizeof(struct usb_string_descriptor) + sizeof(S) - sizeof(*S), \