summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-10-31 12:11:47 +0700
committerhathach <[email protected]>2024-10-31 12:11:47 +0700
commit9897a36ac4cf0dcc469f46d381c4b13d72298acb (patch)
tree8f279b060e442d64984d7b3a3531989e9d2a62cc
parent92e7ac6c237bdba001660894d6be4008480ad7ba (diff)
fix f7 ci build
-rw-r--r--hw/bsp/stm32f7/boards/stm32f723disco/board.h2
-rw-r--r--hw/bsp/stm32f7/family.c3
-rw-r--r--hw/bsp/stm32h7/boards/stm32h743eval/board.h15
-rw-r--r--hw/bsp/stm32h7/family.c10
4 files changed, 17 insertions, 13 deletions
diff --git a/hw/bsp/stm32f7/boards/stm32f723disco/board.h b/hw/bsp/stm32f7/boards/stm32f723disco/board.h
index 178fd6e5e..37f18fedf 100644
--- a/hw/bsp/stm32f7/boards/stm32f723disco/board.h
+++ b/hw/bsp/stm32f7/boards/stm32f723disco/board.h
@@ -122,7 +122,7 @@ static board_pindef_t vbus_pindef[] = {
},
};
-static inline void board_vbus_set(uint8_t rhport, bool state) {
+void board_vbus_set(uint8_t rhport, bool state) {
static bool pin_inited[2] = { false, false };
board_pindef_t* pindef = &vbus_pindef[rhport];
if (!pin_inited[rhport]) {
diff --git a/hw/bsp/stm32f7/family.c b/hw/bsp/stm32f7/family.c
index 1f49d7693..f1671b362 100644
--- a/hw/bsp/stm32f7/family.c
+++ b/hw/bsp/stm32f7/family.c
@@ -28,6 +28,9 @@
#include "stm32f7xx_hal.h"
#include "bsp/board_api.h"
+
+void board_vbus_set(uint8_t rhport, bool state) TU_ATTR_WEAK;
+
#include "board.h"
//--------------------------------------------------------------------+
diff --git a/hw/bsp/stm32h7/boards/stm32h743eval/board.h b/hw/bsp/stm32h7/boards/stm32h743eval/board.h
index 9e2649d14..2e2d4aebd 100644
--- a/hw/bsp/stm32h7/boards/stm32h743eval/board.h
+++ b/hw/bsp/stm32h7/boards/stm32h743eval/board.h
@@ -60,14 +60,6 @@
{GPIOB, GPIO_PIN_5 }, {GPIOB, GPIO_PIN_10}, {GPIOB, GPIO_PIN_11}, {GPIOB, GPIO_PIN_12}, \
{GPIOB, GPIO_PIN_13}, {GPIOC, GPIO_PIN_0 }, {GPIOH, GPIO_PIN_4 }, {GPIOI, GPIO_PIN_11}
-// vbus drive
-#define BOARD_VBUS_DRIVE(_rhport, _on) do { \
- if ( mfx_io_drv ) { \
- uint32_t io_pin = (_rhport) ? MFXSTM32L152_GPIO_PIN_9 : MFXSTM32L152_GPIO_PIN_7; \
- mfx_io_drv->IO_WritePin(&Io_CompObj, io_pin, _on); \
- }\
- } while(0)
-
/* Definition for I2C1 Pins */
#define BUS_I2C1_SCL_PIN GPIO_PIN_6
#define BUS_I2C1_SDA_PIN GPIO_PIN_7
@@ -283,6 +275,13 @@ static inline void board_init2(void) {
#endif
}
+// vbus drive
+void board_vbus_set(uint8_t rhport, bool state) {
+ if ( mfx_io_drv ) {
+ uint32_t io_pin = (_rhport) ? MFXSTM32L152_GPIO_PIN_9 : MFXSTM32L152_GPIO_PIN_7;
+ mfx_io_drv->IO_WritePin(&Io_CompObj, io_pin, _on);
+ }
+}
#ifdef __cplusplus
}
diff --git a/hw/bsp/stm32h7/family.c b/hw/bsp/stm32h7/family.c
index c8b7c6fe3..27e7d0a49 100644
--- a/hw/bsp/stm32h7/family.c
+++ b/hw/bsp/stm32h7/family.c
@@ -30,8 +30,8 @@
#include "stm32h7xx_hal.h"
#include "bsp/board_api.h"
-TU_ATTR_UNUSED static void Error_Handler(void) {
-}
+TU_ATTR_UNUSED static void Error_Handler(void) { }
+void board_vbus_set(uint8_t rhport, bool state) TU_ATTR_WEAK;
#include "board.h"
@@ -196,6 +196,7 @@ void board_init(void) {
#endif // vbus sense
//------------- USB HS -------------//
+#if (CFG_TUD_ENABLED && BOARD_TUD_RHPORT == 1) || (CFG_TUH_ENABLED && BOARD_TUH_RHPORT == 1)
// Despite being call USB2_OTG
// OTG_HS is marked as RHPort1 by TinyUSB to be consistent across stm32 port
struct {
@@ -232,14 +233,15 @@ void board_init(void) {
// Force device mode
USB_OTG_HS->GUSBCFG &= ~USB_OTG_GUSBCFG_FHMOD;
USB_OTG_HS->GUSBCFG |= USB_OTG_GUSBCFG_FDMOD;
+#endif
HAL_PWREx_EnableUSBVoltageDetector();
// For waveshare openh743 ULPI PHY reset walkaround
board_init2();
-#if CFG_TUH_ENABLED && defined(BOARD_VBUS_DRIVE)
- BOARD_VBUS_DRIVE(BOARD_TUH_RHPORT, 1);
+#if CFG_TUH_ENABLED
+ board_vbus_set(BOARD_TUH_RHPORT, 1);
#endif
}