From 4ff0edce257f1e8ecf6fa49bcd61b750f1cc43a2 Mon Sep 17 00:00:00 2001 From: zhongan Date: Thu, 9 Apr 2020 09:41:50 +0800 Subject: [PATCH] arch/sim: add implemntation of 'host_sleep'. Change-Id: Ib82343565ca9541499dec52c753c3f15923f7d1c Signed-off-by: zhongan --- arch/sim/src/sim/up_hosttime.c | 9 +++++++++ arch/sim/src/sim/up_internal.h | 1 + arch/sim/src/sim/up_rptun.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/sim/src/sim/up_hosttime.c b/arch/sim/src/sim/up_hosttime.c index 9544b39a22..e0d7c4dc07 100644 --- a/arch/sim/src/sim/up_hosttime.c +++ b/arch/sim/src/sim/up_hosttime.c @@ -58,6 +58,15 @@ uint64_t host_gettime(bool rtc) return 1000000000ull * tp.tv_sec + tp.tv_nsec; } +/**************************************************************************** + * Name: host_sleep + ****************************************************************************/ + +void host_sleep(uint64_t nsec) +{ + usleep(nsec); +} + /**************************************************************************** * Name: host_sleepuntil ****************************************************************************/ diff --git a/arch/sim/src/sim/up_internal.h b/arch/sim/src/sim/up_internal.h index d7bedaafc7..9c80960259 100644 --- a/arch/sim/src/sim/up_internal.h +++ b/arch/sim/src/sim/up_internal.h @@ -231,6 +231,7 @@ void *host_alloc_heap(size_t sz); /* up_hosttime.c ************************************************************/ uint64_t host_gettime(bool rtc); +void host_sleep(uint64_t nsec); void host_sleepuntil(uint64_t nsec); /* up_simsmp.c **************************************************************/ diff --git a/arch/sim/src/sim/up_rptun.c b/arch/sim/src/sim/up_rptun.c index b89d81841e..07fe4af608 100644 --- a/arch/sim/src/sim/up_rptun.c +++ b/arch/sim/src/sim/up_rptun.c @@ -229,7 +229,7 @@ int up_rptun_init(void) while (g_dev.shmem->base == 0) { - up_hostusleep(1000); + host_sleep(1000); } s_addrenv[0].va = (uintptr_t)g_dev.shmem;