summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-10-02 12:01:34 +0700
committerhathach <[email protected]>2019-10-02 12:01:34 +0700
commit0673be772475671c34a88f4fc2c16d2055dcc682 (patch)
tree877856c572d45fa116b5aaa2f759ee14eda660ba /src
parent204791b3e787ed75b0f9d722392a601458417ceb (diff)
ported stm32f1, tested with f103 blue pill
Diffstat (limited to 'src')
-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 9debef2ae..a705694b6 100644
--- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
+++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c
@@ -259,6 +259,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
}
@@ -273,9 +279,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
+
// I'm not convinced that memory synchronization is completely necessary, but
// it isn't a bad idea.
__DSB();
@@ -821,7 +832,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();
@@ -853,14 +864,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) || \