diff options
author | Gabe Black <gabeblack@google.com> | 2013-08-09 00:48:06 -0700 |
---|---|---|
committer | Isaac Christensen <isaac.christensen@se-eng.com> | 2014-07-31 18:32:52 +0200 |
commit | 6ccc45d7d57056c2b9f172859894739d94cc723e (patch) | |
tree | a1f19900fceaacfe8770a3813e9c0323f40f88a4 /src/include | |
parent | 82683ab9d4435d46d4d61cf58de32d405cbda84f (diff) |
timer: Add functions to initialize absolute timer structures.
Otherwise there's no good way to create an absolute timer structure without
fiddling with its internal structure or assuming a zero initialized structure
has a value of zero.
Old-Change-Id: Iffe3b6b25ed7963fcfb66f749c531ea445ea4aeb
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/65301
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Commit-Queue: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Stefan Reinauer <reinauer@google.com>
(cherry picked from commit e2e5c1ef3bb2df95fdf0e33cb2d975a990d07a4a)
exynos: Simplify the monotonic timer implementation.
The previous implementation was overly complicated, and when used in the
timestamp implementation produced some weird and broken results.
Old-Change-Id: I3048028ddea0657b01b0c94f312764b38d1397e4
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/65302
Reviewed-by: Ronald G. Minnich <rminnich@chromium.org>
Commit-Queue: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Tested-by: Stefan Reinauer <reinauer@google.com>
(cherry picked from commit 6a3fde9a5b80cdac76d79c65d20d7dd1f1d9e557)
Squashed two closely related commits.
Change-Id: Ifc32d773f4f93d34275a81781001d080357fe8ef
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
Reviewed-on: http://review.coreboot.org/6406
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/timer.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/include/timer.h b/src/include/timer.h index 06128ce6c3..b37cea45da 100644 --- a/src/include/timer.h +++ b/src/include/timer.h @@ -67,6 +67,18 @@ int timers_run(void); * 0 returned on success, < 0 on error. */ int timer_sched_callback(struct timeout_callback *tocb, unsigned long us); +/* Set an absolute time to a number of microseconds. */ +static inline void mono_time_set_usecs(struct mono_time *mt, long us) +{ + mt->microseconds = us; +} + +/* Set an absolute time to a number of milliseconds. */ +static inline void mono_time_set_msecs(struct mono_time *mt, long ms) +{ + mt->microseconds = ms * USECS_PER_MSEC; +} + /* Add microseconds to an absolute time. */ static inline void mono_time_add_usecs(struct mono_time *mt, long us) { |