summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hauser <[email protected]>2020-10-11 09:27:43 +0200
committerNiklas Hauser <[email protected]>2020-10-11 09:27:43 +0200
commit7fda95f508ee1548da4bc9296aa160b98f2bd8c2 (patch)
treefc53c5b8290a32325b3b1fccdddadc256464558b
parentf914e48d25cae6d5cda34d3193f46b74826e0e1a (diff)
Remap USB IRQs on STM32F303 BSP
-rw-r--r--hw/bsp/stm32f303disco/stm32f303disco.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/hw/bsp/stm32f303disco/stm32f303disco.c b/hw/bsp/stm32f303disco/stm32f303disco.c
index 1fe908bc3..33552bc07 100644
--- a/hw/bsp/stm32f303disco/stm32f303disco.c
+++ b/hw/bsp/stm32f303disco/stm32f303disco.c
@@ -31,27 +31,29 @@
// Forward USB interrupt events to TinyUSB IRQ Handler
//--------------------------------------------------------------------+
-// USB defaults to using interrupts 19, 20, and 42 (based on SYSCFG_CFGR1.USB_IT_RMP)
+// USB defaults to using interrupts 19, 20 and 42, however, this BSP sets the
+// SYSCFG_CFGR1.USB_IT_RMP bit remapping interrupts to 74, 75 and 76.
+
// FIXME: Do all three need to be handled, or just the LP one?
-// USB high-priority interrupt (Channel 19): Triggered only by a correct
+// USB high-priority interrupt (Channel 74): Triggered only by a correct
// transfer event for isochronous and double-buffer bulk transfer to reach
// the highest possible transfer rate.
-void USB_HP_CAN_TX_IRQHandler(void)
+void USB_HP_IRQHandler(void)
{
tud_int_handler(0);
}
-// USB low-priority interrupt (Channel 20): Triggered by all USB events
+// USB low-priority interrupt (Channel 75): Triggered by all USB events
// (Correct transfer, USB reset, etc.). The firmware has to check the
// interrupt source before serving the interrupt.
-void USB_LP_CAN_RX0_IRQHandler(void)
+void USB_LP_IRQHandler(void)
{
tud_int_handler(0);
}
-// USB wakeup interrupt (Channel 42): Triggered by the wakeup event from the USB
+// USB wakeup interrupt (Channel 76): Triggered by the wakeup event from the USB
// Suspend mode.
-void USBWakeUp_IRQHandler(void)
+void USBWakeUp_RMP_IRQHandler(void)
{
tud_int_handler(0);
}
@@ -127,6 +129,10 @@ void board_init(void)
SysTick_Config(SystemCoreClock / 1000);
#endif
+ // Remap the USB interrupts
+ __HAL_RCC_SYSCFG_CLK_ENABLE();
+ __HAL_REMAPINTERRUPT_USB_ENABLE();
+
// LED
__HAL_RCC_GPIOE_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStruct;