From a02d7fa1480380ef402118395870d742b3910fd9 Mon Sep 17 00:00:00 2001 From: "Vic (Chun-Ju) Yang" Date: Tue, 21 Jan 2014 10:53:51 +0800 Subject: emulator: Use udelay() for usleep() if task hasn't started If the task scheduler hasn't started yet, use udelay() for any call to usleep(). This is what we do for real core now. BUG=chrome-os-partner:19235 TEST=Call usleep() in init hook BRANCH=None Change-Id: Ia5d14ee165ab25bfa231497af1aa8c87fbc324f0 Signed-off-by: Vic (Chun-Ju) Yang Reviewed-on: https://chromium-review.googlesource.com/183271 Reviewed-by: Yung-chieh Lo --- core/host/timer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/host/timer.c b/core/host/timer.c index dd8b88dbb4..ff17ddf068 100644 --- a/core/host/timer.c +++ b/core/host/timer.c @@ -28,8 +28,14 @@ static int time_set; void usleep(unsigned us) { + if (!task_start_called()) { + udelay(us); + return; + } + ASSERT(!in_interrupt_context() && task_get_current() != TASK_ID_INT_GEN); + task_wait_event(us); } -- cgit v1.2.1