diff options
author | Fabien Poussin <fabien.poussin@gmail.com> | 2018-03-08 17:09:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 17:09:10 +0100 |
commit | 14c851fdabae5799830103c208c6a900b1fb4159 (patch) | |
tree | 5d4e2fd01ec83fdeeb83ccab5c05e66d0aa470a9 /os/hal/ports | |
parent | b5a45b547245bc395c37da69df8871240739ea99 (diff) | |
parent | 432bc1762f17eb7b506e8fbca8ec30a3d61629b8 (diff) | |
download | ChibiOS-Contrib-14c851fdabae5799830103c208c6a900b1fb4159.tar.gz ChibiOS-Contrib-14c851fdabae5799830103c208c6a900b1fb4159.tar.bz2 ChibiOS-Contrib-14c851fdabae5799830103c208c6a900b1fb4159.zip |
Merge pull request #141 from qmk/17.6.3_fixes
Add usb_lld_wakeup_host for Kinetis
Diffstat (limited to 'os/hal/ports')
-rw-r--r-- | os/hal/ports/KINETIS/LLD/hal_usb_lld.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/os/hal/ports/KINETIS/LLD/hal_usb_lld.h b/os/hal/ports/KINETIS/LLD/hal_usb_lld.h index 961490e..bd4eb39 100644 --- a/os/hal/ports/KINETIS/LLD/hal_usb_lld.h +++ b/os/hal/ports/KINETIS/LLD/hal_usb_lld.h @@ -76,6 +76,13 @@ #define KINETIS_USB_ENDPOINTS USB_MAX_ENDPOINTS+1
#endif
+/**
+ * @brief Host wake-up procedure duration.
+ */
+#if !defined(USB_HOST_WAKEUP_DURATION) || defined(__DOXYGEN__)
+#define USB_HOST_WAKEUP_DURATION 2
+#endif
+
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
@@ -97,6 +104,10 @@ #error "KINETIS_USB_IRQ_VECTOR not defined"
#endif
+#if (USB_HOST_WAKEUP_DURATION < 2) || (USB_HOST_WAKEUP_DURATION > 15)
+#error "invalid USB_HOST_WAKEUP_DURATION setting, it must be between 2 and 15"
+#endif
+
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
@@ -394,6 +405,18 @@ struct USBDriver { #endif /* KINETIS_USB0_IS_USBOTG */
#endif
+/**
+ * @brief Start of host wake-up procedure.
+ *
+ * @notapi
+ */
+#define usb_lld_wakeup_host(usbp) \
+ do{ \
+ USB0->CTL |= USBx_CTL_RESUME; \
+ osalThreadSleepMilliseconds(USB_HOST_WAKEUP_DURATION); \
+ USB0->CTL &= ~USBx_CTL_RESUME; \
+ } while (false)
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
|