[USB][STM32] Don't wrap direct function calls in MBED_ASSERT

dab09f3138 added checks on some functions in the form of MBED_ASSERT on the result.
Compiling with -NDEBUG elides the call, thus breaking the functionality

This patch restores it, while leaving the return check if compiled with standard profile.
pull/11829/head
Martino Facchin 2019-11-06 14:57:59 +01:00
parent 3254ec3cae
commit 8daa2d72ba
1 changed files with 11 additions and 5 deletions

View File

@ -239,7 +239,8 @@ void USBPhyHw::init(USBPhyEvents *events)
// Configure PCD and FIFOs
hpcd.pData = (void *)this;
hpcd.State = HAL_PCD_STATE_RESET;
MBED_ASSERT(HAL_PCD_Init(&hpcd) == HAL_OK);
HAL_StatusTypeDef ret = HAL_PCD_Init(&hpcd);
MBED_ASSERT(ret == HAL_OK);
uint32_t total_bytes = 0;
@ -272,7 +273,9 @@ void USBPhyHw::init(USBPhyEvents *events)
void USBPhyHw::deinit()
{
MBED_ASSERT(HAL_PCD_DeInit(&hpcd) == HAL_OK);
HAL_StatusTypeDef ret = HAL_PCD_DeInit(&hpcd);
MBED_ASSERT(ret == HAL_OK);
NVIC_DisableIRQ(USBHAL_IRQn);
if (events != NULL) {
@ -288,12 +291,14 @@ bool USBPhyHw::powered()
void USBPhyHw::connect()
{
MBED_ASSERT(HAL_PCD_Start(&hpcd) == HAL_OK);
HAL_StatusTypeDef ret = HAL_PCD_Start(&hpcd);
MBED_ASSERT(ret == HAL_OK);
}
void USBPhyHw::disconnect()
{
MBED_ASSERT(HAL_PCD_Stop(&hpcd) == HAL_OK);
HAL_StatusTypeDef ret = HAL_PCD_Stop(&hpcd);
MBED_ASSERT(ret == HAL_OK);
}
void USBPhyHw::configure()
@ -318,7 +323,8 @@ void USBPhyHw::sof_disable()
void USBPhyHw::set_address(uint8_t address)
{
MBED_ASSERT(HAL_PCD_SetAddress(&hpcd, address) == HAL_OK);
HAL_StatusTypeDef ret = HAL_PCD_SetAddress(&hpcd, address);
MBED_ASSERT(ret == HAL_OK);
}
void USBPhyHw::remote_wakeup()