USB-Cypress: Lock sleep when USB is initialized

None of the USB drivers currently support entering deep sleep mode
while USB is active. To protect USB from malfunctioning lock deep
sleep in USBPhyHw::init.This is done for similar

This was done for all other implementations as part of
https://github.com/ARMmbed/mbed-os/commit/8ffbe5c6033
pull/11697/head
Hugues Kamba 2019-10-16 13:23:26 +01:00
parent 16568da47f
commit 7e0b56fa0c
1 changed files with 11 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "cy_usb_phy_hw.h"
#include "mbed_assert.h"
#include "mbed_power_mgmt.h"
#if defined(DEVICE_USBDEVICE)
@ -64,6 +65,10 @@ void USBPhyHw::init(USBPhyEvents *events)
// Initialize instance to access class data
instance = this;
if (this->events == NULL) {
sleep_manager_lock_deep_sleep();
}
// Store events
instance->events = events;
@ -176,6 +181,12 @@ void USBPhyHw::usb_dev_execute_ep_callbacks(void)
void USBPhyHw::deinit()
{
cyhal_usb_dev_free(&obj);
if (events != NULL) {
sleep_manager_unlock_deep_sleep();
}
events = NULL;
}
bool USBPhyHw::powered()