This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 99a8c00807302130204d769c86f905aeaed1ab5f
Author: Petteri Aimonen <[email protected]>
AuthorDate: Fri Dec 8 13:57:18 2023 +0200

    usbdev: Add callback for CONFIG_USBDEV_SOFINTERRUPT
    
    Previously CONFIG_USBDEV_SOFINTERRUPT existed in many platform
    drivers but did nothing. This commit adds a callback function
    usbdev_sof_irq() that can be used to take action on this interrupt.
---
 drivers/usbdev/Kconfig     |  8 ++++++++
 include/nuttx/usb/usbdev.h | 13 +++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/drivers/usbdev/Kconfig b/drivers/usbdev/Kconfig
index f61f66f7d8..f38475f42d 100644
--- a/drivers/usbdev/Kconfig
+++ b/drivers/usbdev/Kconfig
@@ -50,6 +50,14 @@ config USBDEV_MAXPOWER
                the device is bus powered (USBDEV_BUSPOWERED).  It is, however, 
used
                unconditionally in several USB device drivers.
 
+config USBDEV_SOFINTERRUPT
+       bool "Enable USB device SOF interrupts"
+       default n
+       ---help---
+               Enable USB start-of-frame interrupts.
+               Can be used for synchronizing to host clock rate.
+               Board logic must provide usbdev_sof_irq() function.
+
 config USBDEV_DMA
        bool "Enable DMA methods"
        default n
diff --git a/include/nuttx/usb/usbdev.h b/include/nuttx/usb/usbdev.h
index 01fcd7eae4..318d24dd46 100644
--- a/include/nuttx/usb/usbdev.h
+++ b/include/nuttx/usb/usbdev.h
@@ -480,6 +480,19 @@ FAR void *usbdev_dma_alloc(size_t size);
 void usbdev_dma_free(FAR void *memory);
 #endif
 
+/****************************************************************************
+ * Name: up_usbdev_sof_irq
+ *
+ * Description:
+ *   If CONFIG_USBDEV_SOFINTERRUPT is enabled, board logic must provide
+ *   this function. It gets called in interrupt mode by USB device code
+ *   every time start-of-frame USB packet is received from host.
+ *
+ ****************************************************************************/
+#ifdef CONFIG_USBDEV_SOFINTERRUPT
+void usbdev_sof_irq(FAR struct usbdev_s *dev, uint16_t frameno);
+#endif
+
 #undef EXTERN
 #if defined(__cplusplus)
 }

Reply via email to