summaryrefslogtreecommitdiff
path: root/src/portable/st/stm32_fsdev
diff options
context:
space:
mode:
authorNathan Conrad <[email protected]>2020-04-14 10:22:03 -0400
committerNathan Conrad <[email protected]>2020-04-14 10:22:03 -0400
commit16f65890eb161e14157f3f10872218ce3c2a981b (patch)
treec8b359f92347868898df867fcdae32bb30c9cdcb /src/portable/st/stm32_fsdev
parentbbc59f1ceb73131b5fc2158cdd3483b61408d59d (diff)
parent57ffa94a5251c2b28cddf63b1897282988019e4d (diff)
Merge branch 'master' into edpt_close
Diffstat (limited to 'src/portable/st/stm32_fsdev')
-rw-r--r--src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c80
1 files changed, 21 insertions, 59 deletions
diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
index defdfe057..e1f459b6c 100644
--- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
+++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
@@ -257,17 +257,29 @@ void dcd_init (uint8_t rhport)
}
USB->CNTR |= USB_CNTR_RESETM | USB_CNTR_SOFM | USB_CNTR_ESOFM | USB_CNTR_CTRM | USB_CNTR_SUSPM | USB_CNTR_WKUPM;
dcd_handle_bus_reset();
+
+ // Data-line pull-up is left disconnected.
+}
- // And finally enable pull-up, which may trigger the RESET IRQ if the host is connected.
- // (if this MCU has an internal pullup)
+// Define only on MCU with internal pull-up. BSP can define on MCU without internal PU.
#if defined(USB_BCDR_DPPU)
- USB->BCDR |= USB_BCDR_DPPU;
-#else
- // FIXME: callback to the user to ask them to twiddle a GPIO to disable/enable D+???
-#endif
+// Disable internal D+ PU
+void dcd_disconnect(uint8_t rhport)
+{
+ (void) rhport;
+ USB->BCDR &= ~(USB_BCDR_DPPU);
}
+// Enable internal D+ PU
+void dcd_connect(uint8_t rhport)
+{
+ (void) rhport;
+ USB->BCDR |= USB_BCDR_DPPU;
+}
+
+#endif
+
// Enable device interrupt
void dcd_int_enable (uint8_t rhport)
{
@@ -506,7 +518,9 @@ static void dcd_ep_ctr_handler(void)
}
}
-static void dcd_fs_irqHandler(void) {
+void dcd_irq_handler(uint8_t rhport) {
+
+ (void) rhport;
uint32_t int_status = USB->ISTR;
//const uint32_t handled_ints = USB_ISTR_CTR | USB_ISTR_RESET | USB_ISTR_WKUP
@@ -869,57 +883,5 @@ static bool dcd_read_packet_memory(void *__restrict dst, uint16_t src, size_t wN
return true;
}
-
-// Interrupt handlers
-#if CFG_TUSB_MCU == OPT_MCU_STM32F0 || CFG_TUSB_MCU == OPT_MCU_STM32L0
-void USB_IRQHandler(void)
-{
- dcd_fs_irqHandler();
-}
-
-#elif CFG_TUSB_MCU == OPT_MCU_STM32F1
-void USB_HP_IRQHandler(void)
-{
- dcd_fs_irqHandler();
-}
-void USB_LP_IRQHandler(void)
-{
- dcd_fs_irqHandler();
-}
-void USBWakeUp_IRQHandler(void)
-{
- dcd_fs_irqHandler();
-}
-
-#elif (CFG_TUSB_MCU) == (OPT_MCU_STM32F3)
-// USB defaults to using interrupts 19, 20, and 42 (based on SYSCFG_CFGR1.USB_IT_RMP)
-// FIXME: Do all three need to be handled, or just the LP one?
-// USB high-priority interrupt (Channel 19): 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)
-{
- dcd_fs_irqHandler();
-}
-
-// USB low-priority interrupt (Channel 20): 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)
-{
- dcd_fs_irqHandler();
-}
-
-// USB wakeup interrupt (Channel 42): Triggered by the wakeup event from the USB
-// Suspend mode.
-void USBWakeUp_IRQHandler(void)
-{
- dcd_fs_irqHandler();
-}
-
-#else
- #error Which IRQ handler do you need?
-#endif
-
#endif