From 7da97fec6a03aaecd0238c5b7ac46651bbd080d5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 9 Sep 2017 11:20:03 +0000 Subject: Tentative implementation of USB host wake-up API. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10570 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/hal_usb.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'os/hal/src') diff --git a/os/hal/src/hal_usb.c b/os/hal/src/hal_usb.c index b32bfc09f..61f03d832 100644 --- a/os/hal/src/hal_usb.c +++ b/os/hal/src/hal_usb.c @@ -631,6 +631,29 @@ bool usbStallTransmitI(USBDriver *usbp, usbep_t ep) { return false; } +/** + * @brief Host wake-up procedure. + * @note It is silently ignored if the USB device is not in the + * @p USB_SUSPENDED state. + * + * @param[in] usbp pointer to the @p USBDriver object + * + * @api + */ +void usbWakeupHost(USBDriver *usbp) { + + if (usbp->state == USB_SUSPENDED) { + /* Starting host wakeup procedure.*/ + usb_lld_start_wakeup_host(usbp); + + /* Holding it for the configured time, it must be 2..15 msecs.*/ + osalThreadSleepMilliseconds(USB_HOST_WAKEUP_DURATION); + + /* Stopping host wake up procedure.*/ + usb_lld_stop_wakeup_host(usbp); + } +} + /** * @brief USB reset routine. * @details This function must be invoked when an USB bus reset condition is -- cgit v1.2.3