From b4c8a09f2011088080b6a93d929cf0ee3b3bc487 Mon Sep 17 00:00:00 2001 From: Nathan Conrad Date: Mon, 9 Sep 2019 13:29:26 -0400 Subject: Remove STM32 F3 port. --- src/tusb_option.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tusb_option.h') diff --git a/src/tusb_option.h b/src/tusb_option.h index fbd48a8fa..e72c9540c 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -52,7 +52,7 @@ #define OPT_MCU_SAMD51 201 ///< MicroChip SAMD51 #define OPT_MCU_STM32F4 300 ///< ST STM32F4 -#define OPT_MCU_STM32F3 301 ///< ST STM32F3 +#define OPT_MCU_STM32_FSDEV 301 ///< ST STM32F3 #define OPT_MCU_STM32H7 302 ///< ST STM32H7 /** @} */ -- cgit v1.3.1 From 4517d504b875022ecbf7b18447e26be7af5f4aa7 Mon Sep 17 00:00:00 2001 From: Nathan Conrad Date: Mon, 9 Sep 2019 13:34:30 -0400 Subject: Fix typo of ENDOINT --- src/device/usbd_control.c | 4 ++-- src/tusb_option.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/tusb_option.h') diff --git a/src/device/usbd_control.c b/src/device/usbd_control.c index f4b9d6219..4ec432185 100644 --- a/src/device/usbd_control.c +++ b/src/device/usbd_control.c @@ -51,7 +51,7 @@ typedef struct static usbd_control_xfer_t _control_state; -CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN uint8_t _usbd_ctrl_buf[CFG_TUD_ENDOINT0_SIZE]; +CFG_TUSB_MEM_SECTION CFG_TUSB_MEM_ALIGN uint8_t _usbd_ctrl_buf[CFG_TUD_ENDPOINT0_SIZE]; void usbd_control_reset (uint8_t rhport) { @@ -68,7 +68,7 @@ bool tud_control_status(uint8_t rhport, tusb_control_request_t const * request) // Each transaction is up to endpoint0's max packet size static bool start_control_data_xact(uint8_t rhport) { - uint16_t const xact_len = tu_min16(_control_state.total_len - _control_state.total_transferred, CFG_TUD_ENDOINT0_SIZE); + uint16_t const xact_len = tu_min16(_control_state.total_len - _control_state.total_transferred, CFG_TUD_ENDPOINT0_SIZE); uint8_t ep_addr = EDPT_CTRL_OUT; diff --git a/src/tusb_option.h b/src/tusb_option.h index e72c9540c..0cd462ed1 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -145,8 +145,8 @@ // DEVICE OPTIONS //-------------------------------------------------------------------- -#ifndef CFG_TUD_ENDOINT0_SIZE - #define CFG_TUD_ENDOINT0_SIZE 64 +#ifndef CFG_TUD_ENDPOINT0_SIZE + #define CFG_TUD_ENDPOINT0_SIZE 64 #endif #ifndef CFG_TUD_CDC @@ -198,7 +198,7 @@ //------------------------------------------------------------------ // Configuration Validation //------------------------------------------------------------------ -#if CFG_TUD_ENDOINT0_SIZE > 64 +#if CFG_TUD_ENDPOINT0_SIZE > 64 #error Control Endpoint Max Packet Size cannot be larger than 64 #endif -- cgit v1.3.1 From 65e72de7ce0209683896393d982448088f7609d8 Mon Sep 17 00:00:00 2001 From: Nathan Conrad Date: Tue, 10 Sep 2019 09:35:52 -0400 Subject: Move interrupt handler into device driver, and rename the OPT_MCU_STM32 constants. --- hw/bsp/stm32f070rbnucleo/board.mk | 2 +- hw/bsp/stm32f070rbnucleo/stm32f070rbnucleo.c | 6 --- hw/bsp/stm32f303disco/board.mk | 2 +- hw/bsp/stm32f303disco/stm32f303disco.c | 25 ----------- src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c | 64 ++++++++++++++++++++++++++- src/tusb_option.h | 22 ++++++++- 6 files changed, 86 insertions(+), 35 deletions(-) (limited to 'src/tusb_option.h') diff --git a/hw/bsp/stm32f070rbnucleo/board.mk b/hw/bsp/stm32f070rbnucleo/board.mk index b8044acc2..a9fca5f8d 100644 --- a/hw/bsp/stm32f070rbnucleo/board.mk +++ b/hw/bsp/stm32f070rbnucleo/board.mk @@ -6,7 +6,7 @@ CFLAGS += \ -mcpu=cortex-m0 \ -mfloat-abi=soft \ -nostdlib -nostartfiles \ - -DCFG_TUSB_MCU=OPT_MCU_STM32_FSDEV + -DCFG_TUSB_MCU=OPT_MCU_STM32F0x0 ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F0xx diff --git a/hw/bsp/stm32f070rbnucleo/stm32f070rbnucleo.c b/hw/bsp/stm32f070rbnucleo/stm32f070rbnucleo.c index 9f3dd30dc..50f174b34 100644 --- a/hw/bsp/stm32f070rbnucleo/stm32f070rbnucleo.c +++ b/hw/bsp/stm32f070rbnucleo/stm32f070rbnucleo.c @@ -95,12 +95,6 @@ void board_init(void) __HAL_RCC_USB_CLK_ENABLE(); } -void dcd_fs_irqHandler(void); -void USB_IRQHandler(void) -{ - dcd_fs_irqHandler(); -} - //--------------------------------------------------------------------+ // Board porting API //--------------------------------------------------------------------+ diff --git a/hw/bsp/stm32f303disco/board.mk b/hw/bsp/stm32f303disco/board.mk index 718ff27a3..7a1899a18 100644 --- a/hw/bsp/stm32f303disco/board.mk +++ b/hw/bsp/stm32f303disco/board.mk @@ -7,7 +7,7 @@ CFLAGS += \ -mfloat-abi=hard \ -mfpu=fpv4-sp-d16 \ -nostdlib -nostartfiles \ - -DCFG_TUSB_MCU=OPT_MCU_STM32_FSDEV + -DCFG_TUSB_MCU=OPT_MCU_STM32F3x3 ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F3xx_HAL_Driver ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F3xx diff --git a/hw/bsp/stm32f303disco/stm32f303disco.c b/hw/bsp/stm32f303disco/stm32f303disco.c index e8a647a99..509110d7d 100644 --- a/hw/bsp/stm32f303disco/stm32f303disco.c +++ b/hw/bsp/stm32f303disco/stm32f303disco.c @@ -109,31 +109,6 @@ void board_init(void) #endif } -// 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? -void dcd_fs_irqHandler(void); -// 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(); -} - //--------------------------------------------------------------------+ // Board porting API //--------------------------------------------------------------------+ diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c index 2b4eea4cb..5e8226563 100644 --- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c +++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c @@ -103,7 +103,18 @@ #include "tusb_option.h" -#if (TUSB_OPT_DEVICE_ENABLED) && ((CFG_TUSB_MCU) == (OPT_MCU_STM32_FSDEV)) +#if (TUSB_OPT_DEVICE_ENABLED) && ( \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x0)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x2)) || \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x8)) || \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32F1x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F1x3)) || \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32F3x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F3x3)) || \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32L0x1)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32L0x2)) || \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32L1x0)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32L1x1)) || \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32L1x2)) || \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32L4x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32L4x3)) || \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32G1x1)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32G1x3)) || \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32G1x4)) \ + ) // In order to reduce the dependance on HAL, we undefine this. // Some definitions are copied to our private include file. @@ -778,5 +789,56 @@ static void dcd_read_packet_memory(void *__restrict dst, uint16_t src, size_t wN } } + +// Interrupt handlers +#if ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x0)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x2)) || \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x8)) || \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32L0x1)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32L0x2)) +void USB_IRQHandler(void) +{ + dcd_fs_irqHandler(); +} + +#elif ((CFG_TUSB_MCU) == (OPT_MCU_STM32F1x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F1x3)) +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_STM32F3x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F3x3)) +// 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 diff --git a/src/tusb_option.h b/src/tusb_option.h index 0cd462ed1..9ca4fc56f 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -51,9 +51,29 @@ #define OPT_MCU_SAMD21 200 ///< MicroChip SAMD21 #define OPT_MCU_SAMD51 201 ///< MicroChip SAMD51 +// ST Synopsis OTG devices #define OPT_MCU_STM32F4 300 ///< ST STM32F4 -#define OPT_MCU_STM32_FSDEV 301 ///< ST STM32F3 #define OPT_MCU_STM32H7 302 ///< ST STM32H7 +// ST FSDEV Devices +#define OPT_MCU_STM32F0x0 330 ///< ST STM32F0x0 +#define OPT_MCU_STM32F0x2 331 ///< ST STM32F0x2 +#define OPT_MCU_STM32F0x8 332 ///< ST STM32F0x8 +#define OPT_MCU_STM32F1x2 333 ///< ST STM32F1x2 +#define OPT_MCU_STM32F1x3 334 ///< ST STM32F1x3 +#define OPT_MCU_STM32F3x2 335 ///< ST STM32F3x2 +#define OPT_MCU_STM32F3x3 336 ///< ST STM32F3x3 +#define OPT_MCU_STM32L0x1 337 ///< ST STM32L3x1 +#define OPT_MCU_STM32L0x2 338 ///< ST STM32L3x2 +#define OPT_MCU_STM32L1x0 339 ///< ST STM32L1x0 +#define OPT_MCU_STM32L1x1 340 ///< ST STM32L1x1 +#define OPT_MCU_STM32L1x2 341 ///< ST STM32L1x2 +#define OPT_MCU_STM32L4x2 342 ///< ST STM32L4x2 +#define OPT_MCU_STM32L4x3 343 ///< ST STM32L4x3 +#define OPT_MCU_STM32G4x1 344 ///< ST STM32G4x1 +#define OPT_MCU_STM32G4x3 345 ///< ST STM32G4x3 +#define OPT_MCU_STM32G4x4 346 ///< ST STM32G4x4 + + /** @} */ -- cgit v1.3.1 From 23d39f2b15807f3f2fe295f0d0da469e9535d202 Mon Sep 17 00:00:00 2001 From: Nathan Conrad Date: Tue, 10 Sep 2019 12:13:36 -0400 Subject: Remove OPT_MCU_STM for L and G series. --- src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c | 15 ++++----------- src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h | 2 +- src/tusb_option.h | 11 ----------- 3 files changed, 5 insertions(+), 23 deletions(-) (limited to 'src/tusb_option.h') diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c index 5e8226563..389acb176 100644 --- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c +++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c @@ -35,7 +35,7 @@ * STM32F070RB * * - * It also should work with minimal changes for any ST MCU with an "USB A" peripheral. This + * It also should work with minimal changes for any ST MCU with an "USB A"/"PCD"/"HCD" peripheral. This * covers: * * F04x, F072, F078, 070x6/B 1024 byte buffer @@ -44,7 +44,7 @@ * F302x6/8, F302xD/E2, F303xD/E 1024 byte buffer; no internal D+ pull-up * L0x2, L0x3 1024 byte buffer * L1 512 byte buffer - * 2L4x2, 2L4x3 1024 byte buffer + * L4x2, L4x3 1024 byte buffer * * Assumptions of the driver: * - dcd_fs_irqHandler() is called by the USB interrupt handler @@ -107,13 +107,7 @@ ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x0)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x2)) || \ ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x8)) || \ ((CFG_TUSB_MCU) == (OPT_MCU_STM32F1x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F1x3)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32F3x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F3x3)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32L0x1)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32L0x2)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32L1x0)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32L1x1)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32L1x2)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32L4x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32L4x3)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32G1x1)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32G1x3)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32G1x4)) \ + ((CFG_TUSB_MCU) == (OPT_MCU_STM32F3x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F3x3)) \ ) // In order to reduce the dependance on HAL, we undefine this. @@ -792,8 +786,7 @@ static void dcd_read_packet_memory(void *__restrict dst, uint16_t src, size_t wN // Interrupt handlers #if ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x0)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x2)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x8)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32L0x1)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32L0x2)) + ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x8)) void USB_IRQHandler(void) { dcd_fs_irqHandler(); 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 1e3c90b6d..4f46e81c4 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 @@ -78,7 +78,7 @@ // When CAN clock is enabled, USB can use first 768 bytes ONLY. #else #error You are using an untested or unimplemented STM32 variant. Please update the driver. -// This includes for L0x2, L0x3, L1, L4x2 and L4x3 +// This includes L0x2, L0x3, L1x0, L1x1, L1x2, L4x2 and L4x3, G1x1, G1x3, and G1x4 #endif // For purposes of accessing the packet diff --git a/src/tusb_option.h b/src/tusb_option.h index 9ca4fc56f..af2df19c9 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -62,17 +62,6 @@ #define OPT_MCU_STM32F1x3 334 ///< ST STM32F1x3 #define OPT_MCU_STM32F3x2 335 ///< ST STM32F3x2 #define OPT_MCU_STM32F3x3 336 ///< ST STM32F3x3 -#define OPT_MCU_STM32L0x1 337 ///< ST STM32L3x1 -#define OPT_MCU_STM32L0x2 338 ///< ST STM32L3x2 -#define OPT_MCU_STM32L1x0 339 ///< ST STM32L1x0 -#define OPT_MCU_STM32L1x1 340 ///< ST STM32L1x1 -#define OPT_MCU_STM32L1x2 341 ///< ST STM32L1x2 -#define OPT_MCU_STM32L4x2 342 ///< ST STM32L4x2 -#define OPT_MCU_STM32L4x3 343 ///< ST STM32L4x3 -#define OPT_MCU_STM32G4x1 344 ///< ST STM32G4x1 -#define OPT_MCU_STM32G4x3 345 ///< ST STM32G4x3 -#define OPT_MCU_STM32G4x4 346 ///< ST STM32G4x4 - /** @} */ -- cgit v1.3.1 From 4f6bedeac9a683ffd11efded8650f1aa95dc2f5d Mon Sep 17 00:00:00 2001 From: Nathan Conrad Date: Tue, 10 Sep 2019 12:57:43 -0400 Subject: Rename the STM32 MCU options. --- hw/bsp/stm32f070rbnucleo/board.mk | 2 +- hw/bsp/stm32f303disco/board.mk | 2 +- src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c | 19 +++++++++++-------- src/tusb_option.h | 11 +++-------- 4 files changed, 16 insertions(+), 18 deletions(-) (limited to 'src/tusb_option.h') diff --git a/hw/bsp/stm32f070rbnucleo/board.mk b/hw/bsp/stm32f070rbnucleo/board.mk index a9fca5f8d..e4036982e 100644 --- a/hw/bsp/stm32f070rbnucleo/board.mk +++ b/hw/bsp/stm32f070rbnucleo/board.mk @@ -6,7 +6,7 @@ CFLAGS += \ -mcpu=cortex-m0 \ -mfloat-abi=soft \ -nostdlib -nostartfiles \ - -DCFG_TUSB_MCU=OPT_MCU_STM32F0x0 + -DCFG_TUSB_MCU=OPT_MCU_STM32F0 ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F0xx_HAL_Driver ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F0xx diff --git a/hw/bsp/stm32f303disco/board.mk b/hw/bsp/stm32f303disco/board.mk index 7a1899a18..f8f689a92 100644 --- a/hw/bsp/stm32f303disco/board.mk +++ b/hw/bsp/stm32f303disco/board.mk @@ -7,7 +7,7 @@ CFLAGS += \ -mfloat-abi=hard \ -mfpu=fpv4-sp-d16 \ -nostdlib -nostartfiles \ - -DCFG_TUSB_MCU=OPT_MCU_STM32F3x3 + -DCFG_TUSB_MCU=OPT_MCU_STM32F3 ST_HAL_DRIVER = hw/mcu/st/st_driver/STM32F3xx_HAL_Driver ST_CMSIS = hw/mcu/st/st_driver/CMSIS/Device/ST/STM32F3xx diff --git a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c index 389acb176..1681d6412 100644 --- a/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c +++ b/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c @@ -104,10 +104,13 @@ #include "tusb_option.h" #if (TUSB_OPT_DEVICE_ENABLED) && ( \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x0)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x2)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x8)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32F1x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F1x3)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32F3x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F3x3)) \ + ((CFG_TUSB_MCU) == OPT_MCU_STM32F0) || \ + (((CFG_TUSB_MCU) == OPT_MCU_STM32F1) && ( \ + defined(stm32f102x6) || defined(stm32f102xb) || \ + defined(stm32f103x6) || defined(stm32f103xb) || \ + defined(stm32f103xe) || defined(stm32f103xg) \ + )) || \ + ((CFG_TUSB_MCU) == OPT_MCU_STM32F3) \ ) // In order to reduce the dependance on HAL, we undefine this. @@ -785,14 +788,13 @@ static void dcd_read_packet_memory(void *__restrict dst, uint16_t src, size_t wN // Interrupt handlers -#if ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x0)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x2)) || \ - ((CFG_TUSB_MCU) == (OPT_MCU_STM32F0x8)) +#if (CFG_TUSB_MCU) == (OPT_MCU_STM32F0) void USB_IRQHandler(void) { dcd_fs_irqHandler(); } -#elif ((CFG_TUSB_MCU) == (OPT_MCU_STM32F1x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F1x3)) +#elif (CFG_TUSB_MCU) == (OPT_MCU_STM32F1) void USB_HP_IRQHandler(void) { dcd_fs_irqHandler(); @@ -805,7 +807,8 @@ void USBWakeUp_IRQHandler(void) { dcd_fs_irqHandler(); } -#elif((CFG_TUSB_MCU) == (OPT_MCU_STM32F3x2)) || ((CFG_TUSB_MCU) == (OPT_MCU_STM32F3x3)) + +#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 diff --git a/src/tusb_option.h b/src/tusb_option.h index af2df19c9..dc76ce5f6 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -53,15 +53,10 @@ // ST Synopsis OTG devices #define OPT_MCU_STM32F4 300 ///< ST STM32F4 +#define OPT_MCU_STM32F3 301 ///< ST STM32F0x0 #define OPT_MCU_STM32H7 302 ///< ST STM32H7 -// ST FSDEV Devices -#define OPT_MCU_STM32F0x0 330 ///< ST STM32F0x0 -#define OPT_MCU_STM32F0x2 331 ///< ST STM32F0x2 -#define OPT_MCU_STM32F0x8 332 ///< ST STM32F0x8 -#define OPT_MCU_STM32F1x2 333 ///< ST STM32F1x2 -#define OPT_MCU_STM32F1x3 334 ///< ST STM32F1x3 -#define OPT_MCU_STM32F3x2 335 ///< ST STM32F3x2 -#define OPT_MCU_STM32F3x3 336 ///< ST STM32F3x3 +#define OPT_MCU_STM32F0 303 ///< ST STM32F0 +#define OPT_MCU_STM32F1 304 ///< ST STM32F1 /** @} */ -- cgit v1.3.1