Browse Source

drivers: udc: add SOF Kconfig option and SOF event helper

Add helper to handle SOF interrupts/events and new Kconfig option to
disable SOF interrupt.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
pull/91613/merge
Johann Fischer 3 months ago committed by Fabio Baltieri
parent
commit
2d7995747e
  1. 6
      drivers/usb/udc/Kconfig
  2. 23
      drivers/usb/udc/udc_common.h

6
drivers/usb/udc/Kconfig

@ -42,6 +42,12 @@ config UDC_BUF_FORCE_NOCACHE @@ -42,6 +42,12 @@ config UDC_BUF_FORCE_NOCACHE
Place the buffer pools in the nocache memory region if the driver
cannot handle buffers in cached memory.
config UDC_ENABLE_SOF
bool "SOF interrupt processing"
help
Enabled SoF interrupts can cause a very high CPU load on high-speed
controllers because the interrupt rate would be 125 µs.
config UDC_WORKQUEUE
bool "Use a dedicate work queue for UDC drivers"
help

23
drivers/usb/udc/udc_common.h

@ -156,6 +156,29 @@ int udc_submit_event(const struct device *dev, @@ -156,6 +156,29 @@ int udc_submit_event(const struct device *dev,
int udc_submit_ep_event(const struct device *dev,
struct net_buf *const buf,
const int err);
/**
* @brief Helper function to send UDC SOF event to a higher level.
*
* Type of this event is hardcoded to UDC_EVT_SOF.
*
* @param[in] dev Pointer to device struct of the driver instance
*/
#if defined(CONFIG_UDC_ENABLE_SOF)
static inline void udc_submit_sof_event(const struct device *dev)
{
struct udc_data *data = dev->data;
struct udc_event drv_evt = {
.type = UDC_EVT_SOF,
.dev = dev,
};
(void)data->event_cb(dev, &drv_evt);
}
#else
#define udc_submit_sof_event(dev) ARG_UNUSED(dev)
#endif
/**
* @brief Helper function to enable endpoint.
*

Loading…
Cancel
Save