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>
This commit is contained in:
Jonathan Neuschäfer 2017-09-19 15:19:53 +02:00 committed by Martin Roth
parent 6c521d3897
commit 109ba284a1
1 changed files with 9 additions and 0 deletions

View File

@ -165,6 +165,15 @@ static inline int stopwatch_expired(struct stopwatch *sw)
return !mono_time_before(&sw->current, &sw->expires);
}
/*
* 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.
*/