diff options
author | Simon Glass <sjg@chromium.org> | 2012-06-24 11:54:47 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-07-02 22:35:51 -0700 |
commit | 9b48067b09aaace6e1d5526a65473392f12389c1 (patch) | |
tree | 5424744113f2ee5318194ec258de305fa5bef796 /include/hwtimer.h | |
parent | 184eeb65acea77989673920a05f279f5b4fbaef2 (diff) | |
download | chrome-ec-9b48067b09aaace6e1d5526a65473392f12389c1.tar.gz |
stm32: Use a timer as the watchdog warning
The WWDG is not ideal for this purpose, since if we fail to handle its
interrupt withint 60ms or so, we get a reset. This can be a problem when we
are reporting a panic, since the uart output takes a long time.
Change to using timer 9, which is free, and make it print a watchdog warning
after one second.
BUG=chrome-os-partner:10146
TEST=manual:
build and boot on snow; waitms 1200 and see that a watchdog timeout is
reported correctly.
See that the panic message is displayed in full without a reset happening
before the end.
Change-Id: Ifc3671098e1f3a7ef409b8d1fb919d22eaa90358
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26172
Diffstat (limited to 'include/hwtimer.h')
-rw-r--r-- | include/hwtimer.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/hwtimer.h b/include/hwtimer.h index 4ebc254fa5..fdf1d94852 100644 --- a/include/hwtimer.h +++ b/include/hwtimer.h @@ -8,6 +8,35 @@ #ifndef __CROS_EC_HWTIMER_H #define __CROS_EC_HWTIMER_H +struct timer_ctlr { + unsigned cr1; + unsigned cr2; + unsigned smcr; + unsigned dier; + + unsigned sr; + unsigned egr; + unsigned ccmr1; + unsigned ccmr2; + + unsigned ccer; + unsigned cnt; + unsigned psc; + unsigned arr; + + unsigned reserved30; + unsigned ccr1; + unsigned ccr2; + unsigned ccr3; + + unsigned ccr4; + unsigned reserved44; + unsigned dcr; + unsigned dmar; + + unsigned or; +}; + /** * Programs when the next timer should fire an interrupt. * deadline: timestamp of the event. @@ -41,4 +70,19 @@ int __hw_clock_source_init(uint32_t start_t); */ void process_timers(int overflow); +/** + * Set up the timer that we will use as a watchdog warning. + * + * Once this has been set up, we will print a warning shortly before the + * real watchdog fires. To avoid this, hwtimer_reset_watchdog() must be + * called periodically. + * + * This is needed since the real watchdog timer (IWDG) does not provide + * an interrupt to warn of an impending watchdog reset. + */ +void hwtimer_setup_watchdog(void); + +/* Reset the watchdog timer, to avoid the watchdog warning */ +void hwtimer_reset_watchdog(void); + #endif /* __CROS_EC_HWTIMER_H */ |