summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-08-05 20:47:54 -0700
committerGerrit <chrome-bot@google.com>2012-08-06 18:55:00 -0700
commitdbc861c5f0115ec673be2a7c6837d19dc9e3c4c1 (patch)
tree5f1082ee2e4c0a6bc7e75c70ea42a92c1cd5dcd7 /core
parentd8e04f0db75a0088121981df3bd57c3dccb10945 (diff)
downloadchrome-ec-dbc861c5f0115ec673be2a7c6837d19dc9e3c4c1.tar.gz
add a function to fast forward system timer
When we wake up from a deep sleep mode, the system timer clock might have been stopped. We need to be able to set using another time source (e.g. the RTC). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=chrome-os-partner:8866 TEST=make BOARD=snow && make BOARD=link on Snow, on a software implementing STOP mode, check the system time is still accurate by comparing it to the wall clock. Change-Id: Ieddbb423d052c7aceb398470866b25b25a74c0a0 Reviewed-on: https://gerrit.chromium.org/gerrit/29314 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/cortex-m/timer.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/cortex-m/timer.c b/core/cortex-m/timer.c
index 994f9c1245..10370aeeb6 100644
--- a/core/cortex-m/timer.c
+++ b/core/cortex-m/timer.c
@@ -169,6 +169,14 @@ timestamp_t get_time(void)
}
+void force_time(timestamp_t ts)
+{
+ clksrc_high = ts.le.hi;
+ __hw_clock_source_set(ts.le.lo);
+ /* some timers might be already expired : process them */
+ task_trigger_irq(timer_irq);
+}
+
void timer_print_info(void)
{
uint64_t t = get_time().val;