summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-11-11 16:07:33 +0700
committerhathach <[email protected]>2024-11-11 16:07:33 +0700
commit13f78e2e7716fda1c0ee1ef09a8bc76fde4f4c57 (patch)
treedaba893e87bc07ab74d256bd23877820dc2ce724 /hw
parenta8903d3152cbaa93d4d9d7e347dd09529d4ca887 (diff)
add esp32p4 to hil
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/espressif/boards/espressif_p4_function_ev/board.h4
-rw-r--r--hw/bsp/espressif/boards/family.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/hw/bsp/espressif/boards/espressif_p4_function_ev/board.h b/hw/bsp/espressif/boards/espressif_p4_function_ev/board.h
index 9c8aa409f..0022f0d2d 100644
--- a/hw/bsp/espressif/boards/espressif_p4_function_ev/board.h
+++ b/hw/bsp/espressif/boards/espressif_p4_function_ev/board.h
@@ -36,6 +36,10 @@
#define BUTTON_PIN 0
#define BUTTON_STATE_ACTIVE 0
+// For CI hardware test, to test both device and host on the same HS port with help of
+#define HIL_DEVICE_HOST_MUX_PIN 47
+#define HIL_DEVICE_STATE 1
+
#ifdef __cplusplus
}
#endif
diff --git a/hw/bsp/espressif/boards/family.c b/hw/bsp/espressif/boards/family.c
index 0b1e8badb..729b3539d 100644
--- a/hw/bsp/espressif/boards/family.c
+++ b/hw/bsp/espressif/boards/family.c
@@ -105,6 +105,12 @@ void board_init(void) {
usb_init();
#endif
+#ifdef HIL_DEVICE_HOST_MUX_PIN
+ gpio_reset_pin(HIL_DEVICE_HOST_MUX_PIN);
+ gpio_set_direction(HIL_DEVICE_HOST_MUX_PIN, GPIO_MODE_OUTPUT);
+ gpio_set_level(HIL_DEVICE_HOST_MUX_PIN, CFG_TUD_ENABLED ? HIL_DEVICE_STATE : (1-HIL_DEVICE_STATE));
+#endif
+
#if CFG_TUH_ENABLED && CFG_TUH_MAX3421
max3421_init();
#endif