diff --git a/core/shared/platform/riot/riot_thread.c b/core/shared/platform/riot/riot_thread.c index e103a0965..0ebcf30e0 100644 --- a/core/shared/platform/riot/riot_thread.c +++ b/core/shared/platform/riot/riot_thread.c @@ -8,6 +8,8 @@ #include "platform_api_extension.h" #include +#include +#include /* clang-format off */ #define bh_assert(v) do { \ @@ -373,7 +375,7 @@ os_cond_wait_internal(korp_cond *cond, korp_mutex *mutex, bool timed, if (timed) sema_wait(&node->sem); else - sema_wait_timed(&node->sem, useconds); + sema_wait_timed_ztimer(&node->sem, ZTIMER_USEC, useconds); mutex_lock(mutex); /* Remove wait node from wait list */ diff --git a/core/shared/platform/riot/riot_time.c b/core/shared/platform/riot/riot_time.c index 24bc18416..1503495c1 100644 --- a/core/shared/platform/riot/riot_time.c +++ b/core/shared/platform/riot/riot_time.c @@ -5,10 +5,30 @@ */ #include "platform_api_vmcore.h" -#include +#include +#include +#if IS_USED(MODULE_ZTIMER64_USEC) uint64 os_time_get_boot_microsecond() { - return xtimer_now_usec64(); + return ztimer64_now(ZTIMER64_USEC); } +#elif IS_USED(MODULE_ZTIMER64_MSEC) +uint64 +os_time_get_boot_microsecond() +{ + return ztimer64_now(ZTIMER64_MSEC) * 1000; +} +#else +#ifdef __GNUC__ +__attribute__((weak)) uint64 +os_time_get_boot_microsecond(); +#endif +uint64 +os_time_get_boot_microsecond() +{ + static uint64_t times; + return ++times; +} +#endif diff --git a/product-mini/platforms/riot/Makefile b/product-mini/platforms/riot/Makefile index a6df95494..8c7aef30c 100644 --- a/product-mini/platforms/riot/Makefile +++ b/product-mini/platforms/riot/Makefile @@ -5,7 +5,8 @@ BOARD ?= native # This has to be the absolute path to the RIOT base directory: RIOTBASE ?= $(CURDIR)/../../../../RIOT -USEMODULE += xtimer +USEMODULE += ztimer64_msec +USEMODULE += ztimer_usec USEMODULE += sema WPEDANTIC := 0