include/timer.h: Guard `timer_monotonic_get()` calls by `CONFIG_HAVE_MONOTONIC_TIMER`

Some platforms do not have `timer_monotonic_get()` implemented. So only
call `timer_monotonic_get()` if `CONFIG_HAVE_MONOTONIC_TIMER` is
selected and set the times to 0 otherwise.

Change-Id: If9cba4c0c17a7011aa357079d8fdd0aa47ad1b66
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/12105
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Paul Menzel 2015-10-20 22:27:05 +02:00 committed by Aaron Durbin
parent dcc63b6cb7
commit be70646ccc
1 changed files with 9 additions and 2 deletions

View File

@ -130,7 +130,11 @@ struct stopwatch {
static inline void stopwatch_init(struct stopwatch *sw) static inline void stopwatch_init(struct stopwatch *sw)
{ {
timer_monotonic_get(&sw->start); if (IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER))
timer_monotonic_get(&sw->start);
else
sw->start.microseconds = 0;
sw->current = sw->expires = sw->start; sw->current = sw->expires = sw->start;
} }
@ -150,7 +154,10 @@ static inline void stopwatch_init_msecs_expire(struct stopwatch *sw, long ms)
*/ */
static inline void stopwatch_tick(struct stopwatch *sw) static inline void stopwatch_tick(struct stopwatch *sw)
{ {
timer_monotonic_get(&sw->current); if (IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER))
timer_monotonic_get(&sw->current);
else
sw->current.microseconds = 0;
} }
/* /*