From 99845e2fd5c89f78f5d34ea5c705e6d55aba5043 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 1 Jun 2012 21:45:36 -0700 Subject: Add a common watchdog file Some things about watchdogs are common across Cortex-M3, so create a common watchdog file to hold these. Put the watchdog task in there as the first customer. BUG=chrome-os-partner:10145 TEST=build for all boards Change-Id: Id55f71a807ee12bae3758afc213c30c731eadc07 Signed-off-by: Simon Glass Reviewed-on: https://gerrit.chromium.org/gerrit/24395 Reviewed-by: Randall Spangler --- core/cortex-m/build.mk | 1 + core/cortex-m/watchdog.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 core/cortex-m/watchdog.c (limited to 'core') diff --git a/core/cortex-m/build.mk b/core/cortex-m/build.mk index 5abd25ba08..65d3b06551 100644 --- a/core/cortex-m/build.mk +++ b/core/cortex-m/build.mk @@ -15,3 +15,4 @@ CFLAGS_CPU+=$(CFLAGS_FPU-y) core-y=init.o panic.o switch.o task.o timer.o core-$(CONFIG_FPU)+=fpu.o +core-$(CONFIG_TASK_WATCHDOG)+=watchdog.o diff --git a/core/cortex-m/watchdog.c b/core/cortex-m/watchdog.c new file mode 100644 index 0000000000..e0a58953fb --- /dev/null +++ b/core/cortex-m/watchdog.c @@ -0,0 +1,19 @@ +/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Watchdog common code */ + +#include "timer.h" +#include "watchdog.h" + + +/* Low priority task to reload the watchdog */ +void watchdog_task(void) +{ + while (1) { + usleep(WATCHDOG_RELOAD_MS * 1000); + watchdog_reload(); + } +} -- cgit v1.2.1