aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/stm32/usbfs.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/stm32/usbfs.c b/src/stm32/usbfs.c
index aadc4027..baaa0c2b 100644
--- a/src/stm32/usbfs.c
+++ b/src/stm32/usbfs.c
@@ -16,17 +16,21 @@
#include "internal.h" // GPIO
#include "sched.h" // DECL_INIT
+#if CONFIG_MACH_STM32F103
+ // Transfer memory is accessed with 32bits, but contains only 16bits of data
+ typedef volatile uint32_t epmword_t;
+ #define USBx_IRQn USB_LP_IRQn
+#elif CONFIG_MACH_STM32F0
+ // Transfer memory is accessed with 16bits and contains 16bits of data
+ typedef volatile uint16_t epmword_t;
+ #define USBx_IRQn USB_IRQn
+#endif
+
/****************************************************************
* USB transfer memory
****************************************************************/
-#if CONFIG_MACH_STM32F103
-typedef volatile uint32_t epmword_t;
-#else
-typedef volatile uint16_t epmword_t;
-#endif
-
struct ep_desc {
epmword_t addr_tx, count_tx, addr_rx, count_rx;
};
@@ -293,10 +297,6 @@ usb_init(void)
USB->DADDR = 0;
USB->CNTR = USB_CNTR_RESETM;
USB->ISTR = 0;
-#if CONFIG_MACH_STM32F103
- armcm_enable_irq(USB_IRQHandler, USB_LP_IRQn, 1);
-#elif CONFIG_MACH_STM32F0
- armcm_enable_irq(USB_IRQHandler, USB_IRQn, 1);
-#endif
+ armcm_enable_irq(USB_IRQHandler, USBx_IRQn, 1);
}
DECL_INIT(usb_init);