diff options
Diffstat (limited to 'ports/stm32/stm32_it.c')
| -rw-r--r-- | ports/stm32/stm32_it.c | 39 | 
1 files changed, 38 insertions, 1 deletions
diff --git a/ports/stm32/stm32_it.c b/ports/stm32/stm32_it.c index 470df4758..19778020d 100644 --- a/ports/stm32/stm32_it.c +++ b/ports/stm32/stm32_it.c @@ -80,7 +80,13 @@  #include "uart.h"  #include "storage.h"  #include "dma.h" + +#if MICROPY_HW_TINYUSB_STACK +#include "tusb.h" +#include "shared/tinyusb/mp_usbd.h" +#else  #include "usb.h" +#endif  #if defined(MICROPY_HW_USB_FS)  extern PCD_HandleTypeDef pcd_fs_handle; @@ -145,7 +151,7 @@ void HardFault_C_Handler(ExceptionRegisters_t *regs) {          powerctrl_mcu_reset();      } -    #if MICROPY_HW_ENABLE_USB +    #if MICROPY_HW_STM_USB_STACK      // We need to disable the USB so it doesn't try to write data out on      // the VCP and then block indefinitely waiting for the buffer to drain.      pyb_usb_flags = 0; @@ -299,7 +305,11 @@ void DebugMon_Handler(void) {  #if MICROPY_HW_USB_FS  void USB_UCPD1_2_IRQHandler(void) { +    #if MICROPY_HW_TINYUSB_STACK +    tud_int_handler(0); +    #else      HAL_PCD_IRQHandler(&pcd_fs_handle); +    #endif  }  #endif @@ -307,7 +317,11 @@ void USB_UCPD1_2_IRQHandler(void) {  #if MICROPY_HW_USB_FS  void USB_DRD_FS_IRQHandler(void) { +    #if MICROPY_HW_TINYUSB_STACK +    tud_int_handler(0); +    #else      HAL_PCD_IRQHandler(&pcd_fs_handle); +    #endif  }  #endif @@ -315,7 +329,11 @@ void USB_DRD_FS_IRQHandler(void) {  #if MICROPY_HW_USB_FS  void USB_IRQHandler(void) { +    #if MICROPY_HW_TINYUSB_STACK +    tud_int_handler(0); +    #else      HAL_PCD_IRQHandler(&pcd_fs_handle); +    #endif  }  #endif @@ -323,7 +341,11 @@ void USB_IRQHandler(void) {  #if MICROPY_HW_USB_FS  void USB_LP_IRQHandler(void) { +    #if MICROPY_HW_TINYUSB_STACK +    tud_int_handler(0); +    #else      HAL_PCD_IRQHandler(&pcd_fs_handle); +    #endif  }  #endif @@ -337,7 +359,11 @@ void USB_LP_IRQHandler(void) {  #if MICROPY_HW_USB_FS  void OTG_FS_IRQHandler(void) {      IRQ_ENTER(OTG_FS_IRQn); +    #if MICROPY_HW_TINYUSB_STACK +    tud_int_handler(0); +    #else      HAL_PCD_IRQHandler(&pcd_fs_handle); +    #endif      IRQ_EXIT(OTG_FS_IRQn);  }  #endif @@ -345,13 +371,21 @@ void OTG_FS_IRQHandler(void) {  #if defined(STM32N6)  void USB1_OTG_HS_IRQHandler(void) {      IRQ_ENTER(USB1_OTG_HS_IRQn); +    #if MICROPY_HW_TINYUSB_STACK +    tud_int_handler(0); +    #else      HAL_PCD_IRQHandler(&pcd_hs_handle); +    #endif      IRQ_EXIT(USB1_OTG_HS_IRQn);  }  #else  void OTG_HS_IRQHandler(void) {      IRQ_ENTER(OTG_HS_IRQn); +    #if MICROPY_HW_TINYUSB_STACK +    tud_int_handler(0); +    #else      HAL_PCD_IRQHandler(&pcd_hs_handle); +    #endif      IRQ_EXIT(OTG_HS_IRQn);  }  #endif @@ -414,6 +448,9 @@ static void OTG_CMD_WKUP_Handler(PCD_HandleTypeDef *pcd_handle) {          /* ungate PHY clock */          __HAL_PCD_UNGATE_PHYCLOCK(pcd_handle);      } +    #if MICROPY_HW_TINYUSB_STACK +    tud_int_handler(0); +    #endif  }  #endif  | 
