summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>2017-09-19 15:19:53 +0200
committerMartin Roth <martinroth@google.com>2017-09-26 16:53:16 +0000
commit109ba284a155aab71676894f39735f119cd57405 (patch)
tree963814f509f0e2089a0ddd144ab389beaae28841 /src
parent6c521d3897b6427cf154b2980a035ba62acbf7b3 (diff)
downloadcoreboot-109ba284a155aab71676894f39735f119cd57405.tar.xz
timer: Add helper function stopwatch_wait_until_expired
Change-Id: Ia888907028d687e3d17e5a088657086a3c839ad3 Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-on: https://review.coreboot.org/21589 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Mario Scheithauer <mario.scheithauer@siemens.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/include/timer.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/include/timer.h b/src/include/timer.h
index 6b7baaf9fd..65ce9b4b79 100644
--- a/src/include/timer.h
+++ b/src/include/timer.h
@@ -166,6 +166,15 @@ static inline int stopwatch_expired(struct stopwatch *sw)
}
/*
+ * Tick and check the stopwatch as long as it has not expired.
+ */
+static inline void stopwatch_wait_until_expired(struct stopwatch *sw)
+{
+ while (!stopwatch_expired(sw))
+ ;
+}
+
+/*
* Return number of microseconds since starting the stopwatch.
*/
static inline long stopwatch_duration_usecs(struct stopwatch *sw)