From ac172f7799852bb0fc67246ca26d50e6cc379bd8 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 2 Mar 2026 11:36:47 +0700 Subject: [PATCH] fix board test without tusb_time_millis_api() --- hw/bsp/espressif/boards/family.c | 12 +++++++++++- hw/bsp/rp2040/family.c | 12 ++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/hw/bsp/espressif/boards/family.c b/hw/bsp/espressif/boards/family.c index a837417f4..623cdb8b9 100644 --- a/hw/bsp/espressif/boards/family.c +++ b/hw/bsp/espressif/boards/family.c @@ -351,5 +351,15 @@ bool tuh_max3421_spi_xfer_api(uint8_t rhport, uint8_t const* tx_buf, uint8_t* rx ESP_ERROR_CHECK(spi_device_transmit(max3421_spi, &xact)); return true; } - +#endif + +// board test example does not use both device and host stack +#if !CFG_TUD_ENABLED && !CFG_TUH_ENABLED +TU_ATTR_WEAK uint32_t tusb_time_millis_api(void) { + return osal_time_millis(); +} + +TU_ATTR_WEAK void tusb_time_delay_ms_api(uint32_t ms) { + osal_task_delay(ms); +} #endif diff --git a/hw/bsp/rp2040/family.c b/hw/bsp/rp2040/family.c index a51b3f758..d68b13dd1 100644 --- a/hw/bsp/rp2040/family.c +++ b/hw/bsp/rp2040/family.c @@ -377,3 +377,15 @@ bool tuh_max3421_spi_xfer_api(uint8_t rhport, uint8_t const* tx_buf, uint8_t* rx } #endif + + +// board test example does not use both device and host stack +#if !CFG_TUD_ENABLED && !CFG_TUH_ENABLED +TU_ATTR_WEAK uint32_t tusb_time_millis_api(void) { + return osal_time_millis(); +} + +TU_ATTR_WEAK void tusb_time_delay_ms_api(uint32_t ms) { + osal_task_delay(ms); +} +#endif