1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

core: check whether USB structures are correct to avoid faults in shutdown

This commit is contained in:
Ondrej Mikle 2019-12-18 17:11:11 +01:00 committed by Pavol Rusnak
parent 9d461f548e
commit 0064fda203
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 23 additions and 7 deletions

View File

@ -214,7 +214,9 @@ uint64_t sdcard_get_capacity_in_bytes(void) {
void SDIO_IRQHandler(void) {
IRQ_ENTER(SDIO_IRQn);
if (sd_handle.Instance) {
HAL_SD_IRQHandler(&sd_handle);
}
IRQ_EXIT(SDIO_IRQn);
}

View File

@ -706,12 +706,20 @@ void USBD_LL_Delay(uint32_t Delay)
*/
#if defined(USE_USB_FS)
void OTG_FS_IRQHandler(void) {
IRQ_ENTER(OTG_FS_IRQn);
if (pcd_fs_handle.Instance) {
HAL_PCD_IRQHandler(&pcd_fs_handle);
}
IRQ_EXIT(OTG_FS_IRQn);
}
#endif
#if defined(USE_USB_HS)
void OTG_HS_IRQHandler(void) {
IRQ_ENTER(OTG_HS_IRQn);
if (pcd_hs_handle.Instance) {
HAL_PCD_IRQHandler(&pcd_hs_handle);
}
IRQ_EXIT(OTG_HS_IRQn);
}
#endif
@ -760,18 +768,24 @@ static void OTG_CMD_WKUP_Handler(PCD_HandleTypeDef *pcd_handle) {
*/
#if defined(USE_USB_FS)
void OTG_FS_WKUP_IRQHandler(void) {
IRQ_ENTER(OTG_FS_WKUP_IRQn);
if (pcd_fs_handle.Instance) {
OTG_CMD_WKUP_Handler(&pcd_fs_handle);
}
/* Clear EXTI pending Bit*/
__HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG();
IRQ_EXIT(OTG_FS_WKUP_IRQn);
}
#endif
#if defined(USE_USB_HS)
void OTG_HS_WKUP_IRQHandler(void) {
IRQ_ENTER(OTG_HS_WKUP_IRQn);
if (pcd_hs_handle.Instance) {
OTG_CMD_WKUP_Handler(&pcd_hs_handle);
}
/* Clear EXTI pending Bit*/
__HAL_USB_HS_EXTI_CLEAR_FLAG();
IRQ_EXIT(OTG_HS_WKUP_IRQn);
}
#endif