summaryrefslogtreecommitdiff
path: root/src/portable
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-10-02 12:23:30 +0700
committerGitHub <[email protected]>2019-10-02 12:23:30 +0700
commite59742f200ec4635dffb50b09d40bc05f6ac5eda (patch)
tree98c51edf61378f73c944595a73b76e6c12be8c18 /src/portable
parentd84a31fd5fd62b9458504615983591a4c4c34f89 (diff)
parent820a3705f56c01525825723007025247e055a0d2 (diff)
Merge pull request #193 from hathach/develop
ported stm32f1, tested with f103 blue pill
Diffstat (limited to 'src/portable')
-rw-r--r--src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c17
-rw-r--r--src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h4
2 files changed, 18 insertions, 3 deletions
diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
index c33f9b865..ec182960e 100644
--- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
+++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
@@ -261,6 +261,12 @@ void dcd_int_enable (uint8_t rhport)
NVIC_EnableIRQ(USB_HP_CAN_TX_IRQn);
NVIC_EnableIRQ(USB_LP_CAN_RX0_IRQn);
NVIC_EnableIRQ(USBWakeUp_IRQn);
+#elif CFG_TUSB_MCU == OPT_MCU_STM32F1
+ NVIC_EnableIRQ(USB_HP_CAN1_TX_IRQn);
+ NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn);
+ NVIC_EnableIRQ(USBWakeUp_IRQn);
+#else
+ #error Unknown arch in USB driver
#endif
}
@@ -275,9 +281,14 @@ void dcd_int_disable(uint8_t rhport)
NVIC_DisableIRQ(USB_HP_CAN_TX_IRQn);
NVIC_DisableIRQ(USB_LP_CAN_RX0_IRQn);
NVIC_DisableIRQ(USBWakeUp_IRQn);
+#elif CFG_TUSB_MCU == OPT_MCU_STM32F1
+ NVIC_DisableIRQ(USB_HP_CAN1_TX_IRQn);
+ NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn);
+ NVIC_DisableIRQ(USBWakeUp_IRQn);
#else
#error Unknown arch in USB driver
#endif
+
// CMSIS has a membar after disabling interrupts
}
@@ -822,7 +833,7 @@ void USB_IRQHandler(void)
dcd_fs_irqHandler();
}
-#elif (CFG_TUSB_MCU) == (OPT_MCU_STM32F1)
+#elif CFG_TUSB_MCU == OPT_MCU_STM32F1
void USB_HP_IRQHandler(void)
{
dcd_fs_irqHandler();
@@ -854,14 +865,16 @@ 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?
+ #error Which IRQ handler do you need?
#endif
#endif
diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h
index bbaa52eae..36dca8cd8 100644
--- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h
+++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h
@@ -57,7 +57,9 @@
#define PMA_LENGTH (512u)
// NO internal Pull-ups
// *B, and *C: 2 x 16 bits/word
- #error The F102/F103 driver is expected not to work, but it might? Try it?
+
+ // F1 names this differently from the rest
+ #define USB_CNTR_LPMODE USB_CNTR_LP_MODE
#elif defined(STM32F302xB) || defined(STM32F302xC) || \
defined(STM32F303xB) || defined(STM32F303xC) || \