diff options
author | Simon Glass <sjg@chromium.org> | 2012-05-02 19:26:32 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2012-05-02 19:43:39 -0700 |
commit | 4935a885ee74f6b803d1720de87ef6b1258b61e1 (patch) | |
tree | 9d88bd201f7be07aaa85023589ae274080d1a65f /core | |
parent | a5027ece4cb02a736db3db1e971bffd699422dec (diff) | |
download | chrome-ec-4935a885ee74f6b803d1720de87ef6b1258b61e1.tar.gz |
timer: Add timestamp_expired() to check for expiry
Rather than open code this each time, create a function for this. The
wrap-around condition may not be needed, if the timer starts at zero,
since we have 64 bits to play with.
BUG=chrome-os-partner:9424
TEST=build and boot on daisy
Change-Id: I84ae651212769b5927c452bc03f31f60a25a829e
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/cortex-m/timer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/cortex-m/timer.c b/core/cortex-m/timer.c index ba45bc8783..0078936f5a 100644 --- a/core/cortex-m/timer.c +++ b/core/cortex-m/timer.c @@ -37,6 +37,12 @@ static void expire_timer(task_id_t tskid) task_set_event(tskid, TASK_EVENT_TIMER, 0); } +int timestamp_expired(timestamp_t deadline) +{ + timestamp_t now = get_time(); + + return ((int64_t)(now.val - deadline.val) >= 0); +} void process_timers(int overflow) { |