summaryrefslogtreecommitdiff
path: root/ecos/packages/devs/watchdog/arm/ebsa285
diff options
context:
space:
mode:
Diffstat (limited to 'ecos/packages/devs/watchdog/arm/ebsa285')
-rw-r--r--ecos/packages/devs/watchdog/arm/ebsa285/current/ChangeLog33
-rw-r--r--ecos/packages/devs/watchdog/arm/ebsa285/current/cdl/watchdog_ebsa285.cdl101
-rw-r--r--ecos/packages/devs/watchdog/arm/ebsa285/current/src/watchdog_ebsa285.cxx150
3 files changed, 284 insertions, 0 deletions
diff --git a/ecos/packages/devs/watchdog/arm/ebsa285/current/ChangeLog b/ecos/packages/devs/watchdog/arm/ebsa285/current/ChangeLog
new file mode 100644
index 0000000..ae4179a
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/ebsa285/current/ChangeLog
@@ -0,0 +1,33 @@
+2000-05-31 Jesper Skov <jskov@redhat.com>
+
+ * cdl/watchdog_ebsa285.cdl:
+ * src/watchdog_ebsa285.cxx:
+ Driver moved to devs/watchdog/arm/ebsa285. Stripped out
+ unrelated ChangeLog entries.
+
+1999-08-27 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/ebsa285.cxx:
+ Added watchdog device for 21285.
+
+// ####GPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc., 51 Franklin Street,
+// Fifth Floor, Boston, MA 02110-1301, USA.
+// -------------------------------------------
+// ####GPLCOPYRIGHTEND####
diff --git a/ecos/packages/devs/watchdog/arm/ebsa285/current/cdl/watchdog_ebsa285.cdl b/ecos/packages/devs/watchdog/arm/ebsa285/current/cdl/watchdog_ebsa285.cdl
new file mode 100644
index 0000000..632e48f
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/ebsa285/current/cdl/watchdog_ebsa285.cdl
@@ -0,0 +1,101 @@
+# ====================================================================
+#
+# watchdog_ebsa285.cdl
+#
+# eCos watchdog for ARM/EBSA285 driver configuration data
+#
+# ====================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later
+## version.
+##
+## eCos is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with eCos; if not, write to the Free Software Foundation, Inc.,
+## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+##
+## As a special exception, if other files instantiate templates or use
+## macros or inline functions from this file, or you compile this file
+## and link it with other works to produce a work based on this file,
+## this file does not by itself cause the resulting work to be covered by
+## the GNU General Public License. However the source code for this file
+## must still be made available in accordance with section (3) of the GNU
+## General Public License v2.
+##
+## This exception does not invalidate any other reasons why a work based
+## on this file might be covered by the GNU General Public License.
+## -------------------------------------------
+## ####ECOSGPLCOPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s): jskov
+# Contributors: jskov
+# Date: 2000-05-31
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285 {
+ parent CYGPKG_IO_WATCHDOG
+ active_if CYGPKG_IO_WATCHDOG
+ display "EBSA285 watchdog driver"
+ requires CYGPKG_HAL_ARM_EBSA285
+ requires CYGPKG_KERNEL
+ hardware
+ compile watchdog_ebsa285.cxx
+ implements CYGINT_WATCHDOG_HW_IMPLEMENTATIONS
+ implements CYGINT_WATCHDOG_RESETS_ON_TIMEOUT
+ active_if CYGIMP_WATCHDOG_HARDWARE
+
+ cdl_option CYGIMP_WATCHDOG_HARDWARE {
+ parent CYGPKG_IO_WATCHDOG_IMPLEMENTATION
+ display "Hardware watchdog"
+ default_value 1
+ implements CYGINT_WATCHDOG_IMPLEMENTATIONS
+ }
+
+ cdl_component CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285_OPTIONS {
+ display "EBSA285 watchdog build options"
+ flavor none
+ description "
+ Package specific build options including control over
+ compiler flags used only in building this package,
+ and details of which tests are built."
+
+
+ cdl_option CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285_CFLAGS_ADD {
+ display "Additional compiler flags"
+ flavor data
+ no_define
+ default_value { "" }
+ description "
+ This option modifies the set of compiler flags for
+ building the watchdog device. These flags are used in addition
+ to the set of global flags."
+ }
+
+ cdl_option CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285_CFLAGS_REMOVE {
+ display "Suppressed compiler flags"
+ flavor data
+ no_define
+ default_value { "" }
+ description "
+ This option modifies the set of compiler flags for
+ building the watchdog device. These flags are removed from
+ the set of global flags if present."
+ }
+
+ }
+}
diff --git a/ecos/packages/devs/watchdog/arm/ebsa285/current/src/watchdog_ebsa285.cxx b/ecos/packages/devs/watchdog/arm/ebsa285/current/src/watchdog_ebsa285.cxx
new file mode 100644
index 0000000..06f5527
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/ebsa285/current/src/watchdog_ebsa285.cxx
@@ -0,0 +1,150 @@
+//==========================================================================
+//
+// watchdog/ebsa285.cxx
+//
+// Watchdog implementation for Intel EBSA-285 StronARM board
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later
+// version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): jskov (based on the MN10300 watchdog code by nickg)
+// Contributors: jskov, nickg
+// Date: 1999-08-26
+// Purpose: Watchdog class implementation
+// Description: Contains an implementation of the Watchdog class for use
+// with the EBSA285/21285 hardware watchdog timer.
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h> // system configuration file
+#include <pkgconf/watchdog.h> // configuration for this package
+#include <pkgconf/kernel.h> // kernel config
+
+#include <cyg/infra/cyg_trac.h> // tracing macros
+#include <cyg/kernel/instrmnt.h> // instrumentation
+
+#include <cyg/hal/hal_io.h> // IO register access
+
+#include <cyg/io/watchdog.hxx> // watchdog API
+
+// -------------------------------------------------------------------------
+// 21285 watchdog works by letting timer4 run; if it ever underflows,
+// it resets the system.
+// Timer 4 is set to run at fclk_in/16 = 50MHz/16 = 3.125MHz
+// The timer register is 24 bits, so it can easily hold a value that
+// gives a 1s timeout.
+#define WATCHDOG_TIMER_TICKS 3125000
+#define WATCHDOG_RESOLUTION (1000000000)
+
+// -------------------------------------------------------------------------
+// Constructor
+
+void
+Cyg_Watchdog::init_hw(void)
+{
+ CYG_REPORT_FUNCTION();
+
+ // HW doesn't need init
+
+ resolution = WATCHDOG_RESOLUTION;
+
+ CYG_REPORT_RETURN();
+}
+
+
+
+// -------------------------------------------------------------------------
+// Start the watchdog running.
+
+void
+Cyg_Watchdog::start(void)
+{
+ CYG_REPORT_FUNCTION();
+
+ // Init the watchdog timer.
+ HAL_WRITE_UINT32(SA110_TIMER4_LOAD, WATCHDOG_TIMER_TICKS);
+ HAL_WRITE_UINT32(SA110_TIMER4_CLEAR, 0);
+ HAL_WRITE_UINT32(SA110_TIMER4_CONTROL,
+ SA110_TIMER_CONTROL_ENABLE|SA110_TIMER_CONTROL_SCALE_16);
+ // Enable the watchdog.
+ cyg_uint32 ctrl;
+ HAL_READ_UINT32(SA110_CONTROL, ctrl);
+ ctrl |= SA110_CONTROL_WATCHDOG;
+ HAL_WRITE_UINT32(SA110_CONTROL, ctrl);
+
+ CYG_REPORT_RETURN();
+}
+
+// -------------------------------------------------------------------------
+// Reset watchdog timer. This needs to be called regularly to prevent
+// the watchdog firing.
+
+void
+Cyg_Watchdog::reset()
+{
+ CYG_REPORT_FUNCTION();
+
+ HAL_WRITE_UINT32(SA110_TIMER4_LOAD, WATCHDOG_TIMER_TICKS);
+
+ CYG_REPORT_RETURN();
+}
+
+#if 0
+// -------------------------------------------------------------------------
+// Trigger the watchdog as if the timer had expired.
+
+void
+Cyg_Watchdog::reset_action(void)
+{
+ CYG_REPORT_FUNCTION();
+
+ // Init the watchdog timer.
+ HAL_WRITE_UINT32(SA110_TIMER4_LOAD, 1);
+ HAL_WRITE_UINT32(SA110_TIMER4_CONTROL, SA110_TIMER_CONTROL_ENABLE);
+ // Enable the watchdog.
+ cyg_uint32 ctrl;
+ HAL_READ_UINT32(SA110_CONTROL, ctrl);
+ ctrl |= SA110_CONTROL_WATCHDOG;
+ HAL_WRITE_UINT32(SA110_CONTROL, ctrl);
+
+ CYG_REPORT_RETURN();
+}
+#endif
+
+
+// -------------------------------------------------------------------------
+// EOF watchdog_ebsa285.cxx