diff options
author | Simon Glass <sjg@chromium.org> | 2012-06-01 21:43:25 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-06-05 09:30:21 -0700 |
commit | fb425cf11f5a0f9ea2a1a7dc19789b328b3bc859 (patch) | |
tree | 7af3ade8e5bf3820b288ad7bd7ddc0a9db7f40da /chip | |
parent | 76abf8f8cc3003fa3bb00d5c4902335a933707e8 (diff) | |
download | chrome-ec-fb425cf11f5a0f9ea2a1a7dc19789b328b3bc859.tar.gz |
Unify the watchdog API over stm32 and lm4
Use the same prototype for watchdog_init() everywhere. One version takes
a parameters and one doesn't. We don't need the parameter since we have
a #define. Tidy this up.
Also move watchdog defines into watchdog.h.
BUG=chrome-os-partner:10145
TEST=build for all boards
Change-Id: I38ae63d7cc137b93017c850e767703d5f90f56ad
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/24394
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/lm4/watchdog.c | 6 | ||||
-rw-r--r-- | chip/stm32/watchdog.c | 6 |
2 files changed, 5 insertions, 7 deletions
diff --git a/chip/lm4/watchdog.c b/chip/lm4/watchdog.c index 6591de64ac..915c7e3489 100644 --- a/chip/lm4/watchdog.c +++ b/chip/lm4/watchdog.c @@ -16,6 +16,7 @@ #include "timer.h" #include "uart.h" #include "util.h" +#include "watchdog.h" /* * We use watchdog 0 which is clocked on the system clock @@ -25,11 +26,6 @@ /* magic value to unlock the watchdog registers */ #define LM4_WATCHDOG_MAGIC_WORD 0x1ACCE551 -#define WATCHDOG_PERIOD_MS 1100 /* Watchdog period in ms */ -#define WATCHDOG_RELOAD_MS 500 /* Interval in ms between reloads of the - * watchdog timer. Should be less than half - * of the watchdog period. */ - static uint32_t watchdog_period; /* Watchdog counter initial value */ /* Watchdog debug trace. This is triggered if the watchdog has not been diff --git a/chip/stm32/watchdog.c b/chip/stm32/watchdog.c index ae5442f471..d23d12edbe 100644 --- a/chip/stm32/watchdog.c +++ b/chip/stm32/watchdog.c @@ -13,6 +13,7 @@ #include "task.h" #include "timer.h" #include "util.h" +#include "watchdog.h" /* LSI oscillator frequency is typically 38 kHz * but might vary from 28 to 56kHz. @@ -33,12 +34,13 @@ void watchdog_reload(void) } -int watchdog_init(int period_ms) +int watchdog_init(void) { uint32_t watchdog_period; /* set the time-out period */ - watchdog_period = period_ms * (LSI_CLOCK / IWDG_PRESCALER_DIV) / 1000; + watchdog_period = WATCHDOG_PERIOD_MS * + (LSI_CLOCK / IWDG_PRESCALER_DIV) / 1000; /* Unlock watchdog registers */ STM32_IWDG_KR = 0x5555; |