/***************************************************************************//** * @brief * Perform a remote wakeup signalling sequence. * * @note * It is the responsibility of the application to ensure that remote wakeup * is not attempted before the device has been suspended for at least 5 * miliseconds. This function should not be called from within an interrupt * handler. * * @return * @ref USB_STATUS_OK on success, else an appropriate error code. ******************************************************************************/ int USBD_RemoteWakeup( void ) { INT_Disable(); if ( ( dev->state != USBD_STATE_SUSPENDED ) || ( dev->remoteWakeupEnabled == false ) ) { INT_Enable(); DEBUG_USB_API_PUTS( "\nUSBD_RemoteWakeup(), Illegal remote wakeup" ); return USB_STATUS_ILLEGAL; } USBDHAL_SetRemoteWakeup(); INT_Enable(); USBTIMER_DelayMs( 10 ); INT_Disable(); USBDHAL_ClearRemoteWakeup(); INT_Enable(); return USB_STATUS_OK; }
/***************************************************************************//** * @brief * Perform a remote wakeup signalling sequence. * * @note * It is the responsibility of the application to ensure that remote wakeup * is not attempted before the device has been suspended for at least 5 * miliseconds. This function should not be called from within an interrupt * handler. * * @return * @ref USB_STATUS_OK on success, else an appropriate error code. ******************************************************************************/ int USBD_RemoteWakeup( void ) { CORE_DECLARE_IRQ_STATE; CORE_ENTER_CRITICAL(); if ( ( dev->state != USBD_STATE_SUSPENDED ) || ( dev->remoteWakeupEnabled == false ) ) { CORE_EXIT_CRITICAL(); DEBUG_USB_API_PUTS( "\nUSBD_RemoteWakeup(), Illegal remote wakeup" ); return USB_STATUS_ILLEGAL; } USBDHAL_SetRemoteWakeup(); CORE_EXIT_CRITICAL(); USBTIMER_DelayMs( 10 ); CORE_ENTER_CRITICAL(); USBDHAL_ClearRemoteWakeup(); CORE_EXIT_CRITICAL(); return USB_STATUS_OK; }