mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-11-26 15:32:05 +00:00
Adapt to RIOT ztimer and ztimer64 (#988)
RIOT-OS currently changes xtimer to ztimer
This commit is contained in:
parent
c2d041ce94
commit
770ca8c90c
|
@ -8,6 +8,8 @@
|
|||
#include "platform_api_extension.h"
|
||||
|
||||
#include <panic.h>
|
||||
#include <sema.h>
|
||||
#include <ztimer.h>
|
||||
|
||||
/* 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 */
|
||||
|
|
|
@ -5,10 +5,30 @@
|
|||
*/
|
||||
|
||||
#include "platform_api_vmcore.h"
|
||||
#include <xtimer.h>
|
||||
#include <ztimer64.h>
|
||||
#include <kernel_defines.h>
|
||||
|
||||
#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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user