summaryrefslogtreecommitdiff
path: root/core/host/timer.c
diff options
context:
space:
mode:
authorVic (Chun-Ju) Yang <victoryang@chromium.org>2014-01-21 10:53:51 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-01-21 16:15:20 +0000
commita02d7fa1480380ef402118395870d742b3910fd9 (patch)
tree3e9761f26abbca0d5c196eeb11fe36b5cded3e03 /core/host/timer.c
parent8d3136f6b76c2749a725e22a55ba94bfdff31037 (diff)
downloadchrome-ec-a02d7fa1480380ef402118395870d742b3910fd9.tar.gz
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 <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/183271 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Diffstat (limited to 'core/host/timer.c')
-rw-r--r--core/host/timer.c6
1 files changed, 6 insertions, 0 deletions
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);
}