drivers: usb_dc_stm32: add support for SoF event

Add support for SoF events to the USB STM32 device driver. When
CONFIG_USB_DEVICE_SOF is enabled, enable the corresponding interrupt
and provide a non-weak callback function calling status_cb.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
Aurelien Jarno 2018-12-14 23:40:22 +01:00 committed by Kumar Gala
commit c52a64624e

View file

@ -185,6 +185,13 @@ static void usb_dc_stm32_isr(void *arg)
HAL_PCD_IRQHandler(&usb_dc_stm32_state.pcd);
}
#ifdef CONFIG_USB_DEVICE_SOF
void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd)
{
usb_dc_stm32_state.status_cb(USB_DC_SOF, NULL);
}
#endif
static int usb_dc_stm32_clock_enable(void)
{
struct device *clk = device_get_binding(STM32_CLOCK_CONTROL_NAME);
@ -345,6 +352,10 @@ static int usb_dc_stm32_init(void)
#endif /* USB */
#ifdef CONFIG_USB_DEVICE_SOF
usb_dc_stm32_state.pcd.Init.Sof_enable = 1;
#endif /* CONFIG_USB_DEVICE_SOF */
LOG_DBG("HAL_PCD_Init");
status = HAL_PCD_Init(&usb_dc_stm32_state.pcd);
if (status != HAL_OK) {