summaryrefslogtreecommitdiff
path: root/ecos/packages/devs/watchdog/arm
diff options
context:
space:
mode:
Diffstat (limited to 'ecos/packages/devs/watchdog/arm')
-rw-r--r--ecos/packages/devs/watchdog/arm/aeb/current/ChangeLog33
-rw-r--r--ecos/packages/devs/watchdog/arm/aeb/current/cdl/watchdog_aeb.cdl101
-rw-r--r--ecos/packages/devs/watchdog/arm/aeb/current/src/watchdog_aeb.cxx160
-rw-r--r--ecos/packages/devs/watchdog/arm/at91/current/ChangeLog42
-rw-r--r--ecos/packages/devs/watchdog/arm/at91/current/cdl/watchdog_at91.cdl136
-rw-r--r--ecos/packages/devs/watchdog/arm/at91/current/src/watchdog_at91.cxx245
-rw-r--r--ecos/packages/devs/watchdog/arm/at91wdtc/current/ChangeLog38
-rw-r--r--ecos/packages/devs/watchdog/arm/at91wdtc/current/cdl/watchdog_at91wdtc.cdl146
-rw-r--r--ecos/packages/devs/watchdog/arm/at91wdtc/current/src/watchdog_at91wdtc.cxx198
-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
-rw-r--r--ecos/packages/devs/watchdog/arm/lpc2xxx/current/ChangeLog52
-rw-r--r--ecos/packages/devs/watchdog/arm/lpc2xxx/current/cdl/watchdog_lpc2xxx.cdl132
-rw-r--r--ecos/packages/devs/watchdog/arm/lpc2xxx/current/src/watchdog_lpc2xxx.cxx199
-rw-r--r--ecos/packages/devs/watchdog/arm/sa11x0/current/ChangeLog39
-rw-r--r--ecos/packages/devs/watchdog/arm/sa11x0/current/cdl/watchdog_sa11x0.cdl101
-rw-r--r--ecos/packages/devs/watchdog/arm/sa11x0/current/src/watchdog_sa11x0.cxx146
18 files changed, 2052 insertions, 0 deletions
diff --git a/ecos/packages/devs/watchdog/arm/aeb/current/ChangeLog b/ecos/packages/devs/watchdog/arm/aeb/current/ChangeLog
new file mode 100644
index 0000000..d14ecd5
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/aeb/current/ChangeLog
@@ -0,0 +1,33 @@
+2000-05-31 Jesper Skov <jskov@redhat.com>
+
+ * cdl/watchdog_aeb.cdl:
+ * src/watchdog_aeb.cxx:
+ Driver moved to devs/watchdog/arm/aeb. Stripped out
+ unrelated ChangeLog entries.
+
+1999-09-07 Jesper Skov <jskov@cygnus.co.uk>
+
+ * src/aeb1.cxx: [added]
+ Added watchdog driver for AEB-1 board.
+
+// ####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/aeb/current/cdl/watchdog_aeb.cdl b/ecos/packages/devs/watchdog/arm/aeb/current/cdl/watchdog_aeb.cdl
new file mode 100644
index 0000000..eeaa385
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/aeb/current/cdl/watchdog_aeb.cdl
@@ -0,0 +1,101 @@
+# ====================================================================
+#
+# watchdog_aeb.cdl
+#
+# eCos watchdog for ARM/AEB 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_AEB {
+ parent CYGPKG_IO_WATCHDOG
+ active_if CYGPKG_IO_WATCHDOG
+ display "AEB watchdog driver"
+ requires CYGPKG_HAL_ARM_AEB
+ requires CYGPKG_KERNEL
+ hardware
+ compile watchdog_aeb.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_AEB_OPTIONS {
+ display "AEB 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_AEB_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_AEB_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/aeb/current/src/watchdog_aeb.cxx b/ecos/packages/devs/watchdog/arm/aeb/current/src/watchdog_aeb.cxx
new file mode 100644
index 0000000..80fc7c7
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/aeb/current/src/watchdog_aeb.cxx
@@ -0,0 +1,160 @@
+//==========================================================================
+//
+// devs/watchdog/arm/aeb/watchdog_aeb.cxx
+//
+// Watchdog implementation for ARM AEB1 board (SHARP LH77790 CPU)
+//
+//==========================================================================
+// ####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: 1999-09-01
+// Purpose: Watchdog class implementation
+// Description: Contains an implementation of the Watchdog class for use
+// with the SHARP LH77790 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
+
+// -------------------------------------------------------------------------
+// Register definitions
+#define CYGARC_REG_WATCHDOG_BASE 0xFFFFAC00
+#define CYGARC_REG_WATCHDOG_WDCTLR (CYGARC_REG_WATCHDOG_BASE+0x30)
+#define CYGARC_REG_WATCHDOG_WDCNTR (CYGARC_REG_WATCHDOG_BASE+0x34)
+
+// Control register bits
+#define CYGARC_REG_WATCHDOG_WDCTLR_EN 0x01 // enable
+#define CYGARC_REG_WATCHDOG_WDCTLR_RSP_NMF 0x00 // non-maskable fiq
+#define CYGARC_REG_WATCHDOG_WDCTLR_RSP_ER 0x04 // external reset
+#define CYGARC_REG_WATCHDOG_WDCTLR_RSP_SR 0x06 // system reset
+#define CYGARC_REG_WATCHDOG_WDCTLR_FRZ 0x08 // lock enable bit
+#define CYGARC_REG_WATCHDOG_WDCTLR_TOP_MASK 0x70 // time out period
+
+#define CYGARC_REG_WATCHDOG_WDCTLR_TOP_17 0x00 // 2^17
+#define CYGARC_REG_WATCHDOG_WDCTLR_TOP_17_P 5242880 // = 5.2ms
+
+#define CYGARC_REG_WATCHDOG_WDCTLR_TOP_25 0x40 // 2^25
+#define CYGARC_REG_WATCHDOG_WDCTLR_TOP_25_P 1342177300 // = 1.3421773s
+
+
+// -------------------------------------------------------------------------
+// Constructor
+
+void
+Cyg_Watchdog::init_hw(void)
+{
+ CYG_REPORT_FUNCTION();
+
+ // No HW init.
+
+ resolution = CYGARC_REG_WATCHDOG_WDCTLR_TOP_25_P;
+
+ CYG_REPORT_RETURN();
+}
+
+// -------------------------------------------------------------------------
+// Start the watchdog running.
+
+void
+Cyg_Watchdog::start()
+{
+ CYG_REPORT_FUNCTION();
+
+ // Clear the watchdog counter.
+ HAL_WRITE_UINT32(CYGARC_REG_WATCHDOG_WDCNTR, 0);
+
+ // Enable the watchdog (and lock/FRZ it).
+ HAL_WRITE_UINT8(CYGARC_REG_WATCHDOG_WDCTLR,
+ (CYGARC_REG_WATCHDOG_WDCTLR_TOP_25
+ | CYGARC_REG_WATCHDOG_WDCTLR_FRZ
+ | CYGARC_REG_WATCHDOG_WDCTLR_RSP_SR
+ | CYGARC_REG_WATCHDOG_WDCTLR_EN));
+
+ 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(CYGARC_REG_WATCHDOG_WDCNTR, 0);
+
+ CYG_REPORT_RETURN();
+}
+
+#if 0
+// -------------------------------------------------------------------------
+// Action which will do a board reset. Application can register this
+// action to get a board reset on watchdog timeout.
+
+void
+Cyg_Watchdog::reset_action(void)
+{
+ CYG_REPORT_FUNCTION();
+
+ // Clear the watchdog counter.
+ HAL_WRITE_UINT32(CYGARC_REG_WATCHDOG_WDCNTR, 0);
+
+ // Enable the watchdog with the smallest timeout.
+ HAL_WRITE_UINT8(CYGARC_REG_WATCHDOG_WDCTLR,
+ (CYGARC_REG_WATCHDOG_WDCTLR_TOP_17
+ | CYGARC_REG_WATCHDOG_WDCTLR_FRZ
+ | CYGARC_REG_WATCHDOG_WDCTLR_RSP_SR
+ | CYGARC_REG_WATCHDOG_WDCTLR_EN));
+
+ CYG_REPORT_RETURN();
+}
+#endif
+
+// -------------------------------------------------------------------------
+// EOF watchdog_aeb.cxx
diff --git a/ecos/packages/devs/watchdog/arm/at91/current/ChangeLog b/ecos/packages/devs/watchdog/arm/at91/current/ChangeLog
new file mode 100644
index 0000000..1580453
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/at91/current/ChangeLog
@@ -0,0 +1,42 @@
+2009-04-28 John Dallaway <john@dallaway.org.uk>
+
+ * cdl/watchdog_at91.cdl: Give CYGIMP_WATCHDOG_HARDWARE a default
+ value rather than a calculated value to accommodate other
+ implementations of CYGINT_WATCHDOG_IMPLEMENTATIONS.
+
+2004-10-4 Andrea Michelotti <amichelotti@atmel.com>
+
+ * src/watchdog_at91.cxx:
+ * cdl/watchdog_at91.cdl: added JTST support
+
+2003-05-12 Nick Garnett <nickg@balti.calivar.com>
+
+ * src/watchdog_at91.cxx:
+ * cdl/watchdog_at91.cdl: Modified driver to work for EB40, EB40A
+ and EB55 boards. Generally tidied up a little.
+
+2002-08-06 Thomas Koeller <thomas@koeller.dyndns.org>
+
+ * Added watchdog driver for ARM AT91 board.
+
+// ####GPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2009 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/at91/current/cdl/watchdog_at91.cdl b/ecos/packages/devs/watchdog/arm/at91/current/cdl/watchdog_at91.cdl
new file mode 100644
index 0000000..7e5b737
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/at91/current/cdl/watchdog_at91.cdl
@@ -0,0 +1,136 @@
+# ====================================================================
+#
+# watchdog_at91.cdl
+#
+# eCos watchdog for ARM AT91 driver configuration data
+#
+# ====================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2009 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): tkoeller
+# Contributors: tkoeller, nickg
+# Date: 2000-05-05
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVICES_WATCHDOG_ARM_AT91 {
+ parent CYGPKG_IO_WATCHDOG
+ active_if CYGPKG_IO_WATCHDOG
+ display "ARM AT91 watchdog driver"
+ requires CYGPKG_HAL_ARM_AT91
+ requires CYGPKG_KERNEL
+ hardware
+ define_header devs_watchdog_arm_at91.h
+ compile watchdog_at91.cxx
+ implements CYGINT_WATCHDOG_HW_IMPLEMENTATIONS
+ active_if CYGIMP_WATCHDOG_HARDWARE
+ description "
+ This package uses the watchdog device integrated
+ in the AT91 to execute a predefined action if the
+ application fails to call the reset function for
+ longer than a given timeout interval. This package
+ currently only supports the AT91x408xx, AT91M55800A and Diopsis
+ devices found on the Atmel EB40, EB40A, EB55 and JTST evaluation
+ boards. The AT91M42800 found on the EB42 is not supported
+ since it uses a totally different watchdog device."
+
+ cdl_option CYGIMP_WATCHDOG_HARDWARE {
+ parent CYGPKG_IO_WATCHDOG_IMPLEMENTATION
+ display "Hardware watchdog"
+ default_value 1
+ implements CYGINT_WATCHDOG_IMPLEMENTATIONS
+ }
+
+ cdl_option CYGNUM_DEVS_WATCHDOG_ARM_AT91_DESIRED_TIMEOUT_MS {
+ display "Desired timeout value"
+ flavor data
+ legal_values 1 to 2047
+ default_value 100
+ description "
+ This parameter controls the watchdog timeout interval.
+ Note that you may not get the exact value requested
+ here, the timeout interval may have to be adjusted
+ because of hardware limitations. The actual timeout
+ used will be the smallest possible value that is not
+ less than this parameter."
+ }
+
+ cdl_option CYGSEM_DEVS_WATCHDOG_ARM_AT91_RESET {
+ display "Generate reset on watchdog expiration"
+ flavor bool
+ default_value 1
+ implements CYGINT_WATCHDOG_RESETS_ON_TIMEOUT
+ description "
+ Enabling this option changes the watchdog operation mode
+ to generate a system reset upon expiration instead of
+ invoking an application-defined action."
+ }
+
+ cdl_component CYGPKG_DEVICES_WATCHDOG_ARM_AT91_OPTIONS {
+ display "AT91 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_AT91_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_AT91_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."
+ }
+
+ }
+}
+
+# EOF watchdog_at91.cdl
diff --git a/ecos/packages/devs/watchdog/arm/at91/current/src/watchdog_at91.cxx b/ecos/packages/devs/watchdog/arm/at91/current/src/watchdog_at91.cxx
new file mode 100644
index 0000000..e5830d3
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/at91/current/src/watchdog_at91.cxx
@@ -0,0 +1,245 @@
+//==========================================================================
+//
+// devs/watchdog/arm/at91/watchdog_at91.cxx
+//
+// Watchdog implementation for ARM AT91 CPU
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 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): tkoeller
+// Contributors: tkoeller, nickg
+// Date: 2002-05-05
+// Purpose: Watchdog class implementation
+// Description: Contains an implementation of the Watchdog class for use
+// with the ATMEL AT91 watchdog timer.
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/kernel.h>
+#include <pkgconf/infra.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/watchdog.h>
+#include <pkgconf/devs_watchdog_arm_at91.h>
+
+#include <cyg/infra/cyg_type.h>
+#include <cyg/infra/cyg_ass.h>
+#include <cyg/infra/cyg_trac.h>
+#include <cyg/hal/hal_io.h>
+#include <cyg/hal/hal_diag.h>
+
+#include <cyg/io/watchdog.hxx>
+
+#if !defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT)
+#include <cyg/hal/hal_platform_ints.h>
+#include <cyg/kernel/intr.hxx>
+#endif
+
+//==========================================================================
+
+#define MCLK_FREQUENCY_KHZ (CYGNUM_HAL_ARM_AT91_CLOCK_SPEED/1000)
+#define MAX_TICKS 0x0000ffff
+#define BASE_TICKS (MCLK_FREQUENCY_KHZ * CYGNUM_DEVS_WATCHDOG_ARM_AT91_DESIRED_TIMEOUT_MS)
+
+#if defined(CYGHWR_HAL_ARM_AT91_R40008) || \
+ defined(CYGHWR_HAL_ARM_AT91_R40807)
+
+#if BASE_TICKS / 8 <= MAX_TICKS
+#define DIVIDER 0
+#define DIV_FACTOR 8
+#elif BASE_TICKS / 32 <= MAX_TICKS
+#define DIVIDER 1
+#define DIV_FACTOR 32
+#elif BASE_TICKS / 128 <= MAX_TICKS
+#define DIVIDER 2
+#define DIV_FACTOR 128
+#elif BASE_TICKS / 1024 <= MAX_TICKS
+#define DIVIDER 3
+#define DIV_FACTOR 1024
+#else
+#error Desired resolution beyond hardware capabilities
+#endif
+
+#elif defined(CYGHWR_HAL_ARM_AT91_M55800A)
+
+#if BASE_TICKS / 32 <= MAX_TICKS
+#define DIVIDER 0
+#define DIV_FACTOR 32
+#elif BASE_TICKS / 128 <= MAX_TICKS
+#define DIVIDER 1
+#define DIV_FACTOR 128
+#elif BASE_TICKS / 1024 <= MAX_TICKS
+#define DIVIDER 2
+#define DIV_FACTOR 1024
+#elif BASE_TICKS / 4096 <= MAX_TICKS
+#define DIVIDER 3
+#define DIV_FACTOR 4096
+#else
+#error Desired resolution beyond hardware capabilities
+#endif
+#elif defined(CYGHWR_HAL_ARM_AT91_JTST)
+#if BASE_TICKS / 32 <= MAX_TICKS
+#define DIVIDER 0
+#define DIV_FACTOR 32
+#elif BASE_TICKS / 128 <= MAX_TICKS
+#define DIVIDER 1
+#define DIV_FACTOR 128
+#elif BASE_TICKS / 1024 <= MAX_TICKS
+#define DIVIDER 2
+#define DIV_FACTOR 1024
+#elif BASE_TICKS / 2046 <= MAX_TICKS
+#define DIVIDER 3
+#define DIV_FACTOR 2046
+#else
+#error Desired resolution beyond hardware capabilities
+#endif
+
+#endif
+
+#define TICKS ((BASE_TICKS / DIV_FACTOR) | 0xfff)
+#define RESOLUTION ((cyg_uint64) (TICKS * DIV_FACTOR ) * 1000000 / MCLK_FREQUENCY_KHZ)
+
+//==========================================================================
+
+#if defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT)
+
+#define OMRVAL (AT91_WD_OMR_OKEY | AT91_WD_OMR_RSTEN | AT91_WD_OMR_WDEN)
+
+void
+Cyg_Watchdog::init_hw(void)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+ resolution = RESOLUTION;
+ CYG_REPORT_RETURN();
+}
+
+#else /* defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT) */
+
+//==========================================================================
+
+#define OMRVAL (AT91_WD_OMR_OKEY | AT91_WD_OMR_IRQEN | AT91_WD_OMR_WDEN)
+#define INT_PRIO 7
+
+//==========================================================================
+
+static Cyg_Watchdog *wd;
+
+//==========================================================================
+
+static cyg_uint32
+isr(cyg_vector vector, CYG_ADDRWORD data)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARG2XV(vector, data);
+
+ wd->trigger();
+ Cyg_Interrupt::acknowledge_interrupt(CYGNUM_HAL_INTERRUPT_WATCHDOG);
+ CYG_REPORT_RETVAL(Cyg_Interrupt::HANDLED);
+ return Cyg_Interrupt::HANDLED;
+}
+
+//==========================================================================
+
+static Cyg_Interrupt wdint(
+ CYGNUM_HAL_INTERRUPT_WATCHDOG,
+ INT_PRIO,
+ 0,
+ isr,
+ NULL
+ );
+
+//==========================================================================
+
+void
+Cyg_Watchdog::init_hw(void)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+
+ wd = this;
+ resolution = RESOLUTION;
+ wdint.configure_interrupt(CYGNUM_HAL_INTERRUPT_WATCHDOG, false, true);
+ wdint.attach();
+ wdint.acknowledge_interrupt(CYGNUM_HAL_INTERRUPT_WATCHDOG);
+ wdint.unmask_interrupt(CYGNUM_HAL_INTERRUPT_WATCHDOG);
+ CYG_REPORT_RETURN();
+}
+
+#endif /* defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT) */
+
+//==========================================================================
+/*
+ * Reset watchdog timer. This needs to be called regularly to prevent
+ * the watchdog from firing.
+ */
+
+void
+Cyg_Watchdog::reset(void)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+
+ /* Write magic code to reset the watchdog. */
+ HAL_WRITE_UINT32(AT91_WD + AT91_WD_CR, AT91_WD_CR_RSTKEY);
+ CYG_REPORT_RETURN();
+}
+
+//==========================================================================
+/*
+ * Start watchdog to generate a hardware reset
+ * or interrupt when expiring.
+ */
+
+void
+Cyg_Watchdog::start(void)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+
+ HAL_WRITE_UINT32(AT91_WD + AT91_WD_OMR, AT91_WD_OMR_OKEY);
+ HAL_WRITE_UINT32(
+ AT91_WD + AT91_WD_CMR,
+ AT91_WD_CMR_CKEY | ((TICKS >> 10) & AT91_WD_CMR_HPCV) | DIVIDER
+ );
+ HAL_WRITE_UINT32(AT91_WD + AT91_WD_CR, AT91_WD_CR_RSTKEY);
+ HAL_WRITE_UINT32(AT91_WD + AT91_WD_OMR, OMRVAL);
+ CYG_REPORT_RETURN();
+}
+
+//==========================================================================
+// End of watchdog_at91.cxx
diff --git a/ecos/packages/devs/watchdog/arm/at91wdtc/current/ChangeLog b/ecos/packages/devs/watchdog/arm/at91wdtc/current/ChangeLog
new file mode 100644
index 0000000..faa208d
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/at91wdtc/current/ChangeLog
@@ -0,0 +1,38 @@
+2009-04-28 John Dallaway <john@dallaway.org.uk>
+
+ * cdl/watchdog_at91wdtc.cdl: Give CYGIMP_WATCHDOG_HARDWARE a default
+ value rather than a calculated value to accommodate other
+ implementations of CYGINT_WATCHDOG_IMPLEMENTATIONS.
+
+2009-02-04 Bart Veer <bartv@ecoscentric.com>
+
+ * src/watchdog_at91wdtc.cxx: switch init priority to
+ CYG_INIT_INTERRUPTS.
+
+2006-02-18 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * Added watchdog driver for ARM AT91 devices which have the
+ Watchdog Timer Controller as opposed to the older devices which
+ have the Watchdog Timer Interface.
+
+// ####GPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2009 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/at91wdtc/current/cdl/watchdog_at91wdtc.cdl b/ecos/packages/devs/watchdog/arm/at91wdtc/current/cdl/watchdog_at91wdtc.cdl
new file mode 100644
index 0000000..7a113ce
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/at91wdtc/current/cdl/watchdog_at91wdtc.cdl
@@ -0,0 +1,146 @@
+# ====================================================================
+#
+# watchdog_at91wdtc.cdl
+#
+# eCos watchdog for ARM AT91 WDTC driver configuration data
+#
+# ====================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2009 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): tkoeller
+# Contributors: tkoeller, nickg, asl
+# Date: 2006-02-18
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVICES_WATCHDOG_ARM_AT91WDTC {
+ parent CYGPKG_IO_WATCHDOG
+ active_if CYGPKG_IO_WATCHDOG
+ display "ARM AT91 WDTC watchdog driver"
+ requires CYGPKG_HAL_ARM_AT91
+ requires CYGPKG_KERNEL
+ hardware
+ define_header devs_watchdog_arm_at91wdtc.h
+ compile watchdog_at91wdtc.cxx
+ implements CYGINT_WATCHDOG_HW_IMPLEMENTATIONS
+ active_if CYGIMP_WATCHDOG_HARDWARE
+ description "
+ This package uses the watchdog device integrated
+ in the AT91 to execute a predefined action if the
+ application fails to call the reset function for
+ longer than a given timeout interval. This package
+ currently only supports the AT91SAM7S device which
+ use the Watchdog Timer Controller."
+
+ cdl_option CYGIMP_WATCHDOG_HARDWARE {
+ parent CYGPKG_IO_WATCHDOG_IMPLEMENTATION
+ display "Hardware watchdog"
+ default_value 1
+ implements CYGINT_WATCHDOG_IMPLEMENTATIONS
+ }
+
+ cdl_option CYGNUM_DEVS_WATCHDOG_ARM_AT91WDTC_DESIRED_TIMEOUT_MS {
+ display "Desired timeout value"
+ flavor data
+ default_value 1000
+ description "
+ This parameter controls the watchdog timeout interval.
+ Note that you may not get the exact value requested
+ here, the timeout interval may have to be adjusted
+ because of hardware limitations. The actual timeout
+ used will be the smallest possible value that is not
+ less than this parameter. Since the timeout is derived
+ from the LC based slow clock don't expect great accuracy.
+ On my board a 1000ms timeout actually goes off after 550ms!"
+ }
+
+ cdl_option CYGNUM_DEVS_WATCHDOG_ARM_AT91WDTC_TIMEOUT_VALUE {
+ display "Calculated timeout value"
+ flavor data
+ calculated { (CYGNUM_HAL_ARM_AT91_SLOW_CLOCK / 128) *
+ (CYGNUM_DEVS_WATCHDOG_ARM_AT91WDTC_DESIRED_TIMEOUT_MS / 1000)
+ }
+ legal_values { 0 to 4096 }
+ description "
+ This is the calculated value that will be placed into
+ watchdog counter timer."
+ }
+
+ cdl_option CYGSEM_DEVS_WATCHDOG_ARM_AT91WDTC_RESET {
+ display "Generate reset on watchdog expiration"
+ flavor bool
+ default_value 1
+ implements CYGINT_WATCHDOG_RESETS_ON_TIMEOUT
+ description "
+ Enabling this option changes the watchdog operation mode
+ to generate a system reset upon expiration instead of
+ invoking an application-defined action."
+ }
+
+ cdl_component CYGPKG_DEVICES_WATCHDOG_ARM_AT91WDTC_OPTIONS {
+ display "AT91 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_AT91WDTC_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_AT91WDTC_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."
+ }
+ }
+}
+
+# EOF watchdog_at91WDTC.cdl
diff --git a/ecos/packages/devs/watchdog/arm/at91wdtc/current/src/watchdog_at91wdtc.cxx b/ecos/packages/devs/watchdog/arm/at91wdtc/current/src/watchdog_at91wdtc.cxx
new file mode 100644
index 0000000..34bc10b
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/at91wdtc/current/src/watchdog_at91wdtc.cxx
@@ -0,0 +1,198 @@
+//==========================================================================
+//
+// devs/watchdog/arm/at91/watchdog_at91wdtc.cxx
+//
+// Watchdog implementation for ARM AT91 CPUs using the WDTC
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2009 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): tkoeller
+// Contributors: tkoeller, nickg, asl
+// Date: 2006-02-18
+// Purpose: Watchdog class implementation
+// Description: Contains an implementation of the Watchdog class for use
+// with the ATMEL AT91 watchdog timer controller.
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/kernel.h>
+#include <pkgconf/infra.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/watchdog.h>
+#include <pkgconf/devs_watchdog_arm_at91wdtc.h>
+
+#include <cyg/infra/cyg_type.h>
+#include <cyg/infra/cyg_ass.h>
+#include <cyg/infra/cyg_trac.h>
+#include <cyg/hal/hal_io.h>
+#include <cyg/hal/hal_diag.h>
+
+#include <cyg/io/watchdog.hxx>
+
+#include <cyg/infra/diag.h>
+
+#if !defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT)
+#include <cyg/hal/hal_platform_ints.h>
+#include <cyg/kernel/intr.hxx>
+#endif
+
+//==========================================================================
+
+#if defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT)
+
+#define MRVAL (AT91_WDTC_WDMR_RSTEN | AT91_WDTC_WDMR_DBGHLT)
+
+void
+Cyg_Watchdog::init_hw(void)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+ resolution = CYGNUM_DEVS_WATCHDOG_ARM_AT91WDTC_DESIRED_TIMEOUT_MS * 1000000;
+ CYG_REPORT_RETURN();
+}
+
+#else /* defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT) */
+
+//==========================================================================
+
+#define MRVAL (AT91_WDTC_WDMR_FIEN | AT91_WDTC_WDMR_DBGHLT)
+#define INT_PRIO 7
+
+//==========================================================================
+
+static Cyg_Watchdog *wd;
+
+//==========================================================================
+
+static cyg_uint32
+isr(cyg_vector vector, CYG_ADDRWORD data)
+{
+ cyg_uint32 sr;
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARG2XV(vector, data);
+
+ // Read the status register to clear the interrupt
+ HAL_READ_UINT32(AT91_WDTC + AT91_WDTC_WDSR, sr);
+
+ wd->trigger();
+ Cyg_Interrupt::acknowledge_interrupt(CYGNUM_HAL_INTERRUPT_WDTC);
+ CYG_REPORT_RETVAL(Cyg_Interrupt::HANDLED);
+ return Cyg_Interrupt::HANDLED;
+}
+
+//==========================================================================
+
+static CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_INTERRUPTS)
+ Cyg_Interrupt wdint(
+ CYGNUM_HAL_INTERRUPT_WDTC,
+ INT_PRIO,
+ 0,
+ isr,
+ NULL
+ );
+
+//==========================================================================
+
+void
+Cyg_Watchdog::init_hw(void)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+
+ wd = this;
+
+ wdint.attach();
+ wdint.acknowledge_interrupt(CYGNUM_HAL_INTERRUPT_WDTC);
+ wdint.unmask_interrupt(CYGNUM_HAL_INTERRUPT_WDTC);
+ resolution = CYGNUM_DEVS_WATCHDOG_ARM_AT91WDTC_DESIRED_TIMEOUT_MS * 1000000;
+ CYG_REPORT_RETURN();
+}
+
+#endif /* defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT) */
+
+//==========================================================================
+/*
+ * Reset watchdog timer. This needs to be called regularly to prevent
+ * the watchdog from firing.
+ */
+
+void
+Cyg_Watchdog::reset(void)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+
+ /* Write magic code to reset the watchdog. */
+ HAL_WRITE_UINT32(AT91_WDTC + AT91_WDTC_WDCR,
+ AT91_WDTC_WDCR_RELOAD | AT91_WDTC_WDCR_KEY);
+
+ CYG_REPORT_RETURN();
+}
+
+//==========================================================================
+/*
+ * Start watchdog to generate a hardware reset
+ * or interrupt when expiring.
+ */
+
+void
+Cyg_Watchdog::start(void)
+{
+ cyg_uint32 val, val1;
+
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+
+ val = (MRVAL | CYGNUM_DEVS_WATCHDOG_ARM_AT91WDTC_TIMEOUT_VALUE |
+ (CYGNUM_DEVS_WATCHDOG_ARM_AT91WDTC_TIMEOUT_VALUE <<
+ AT91_WDTC_WDMR_WDD_SHIFT));
+
+ HAL_WRITE_UINT32(AT91_WDTC + AT91_WDTC_WDMR, val);
+ HAL_READ_UINT32(AT91_WDTC + AT91_WDTC_WDMR, val1);
+
+ // If this assert goes if it probably means something else has
+ // already programmed the watchdog. The mode register is only
+ // writeable once and once it is set it can only be reset by a
+ // processor reset.
+ CYG_ASSERT(val == val1, "Unable to configure watchdog");
+
+ CYG_REPORT_RETURN();
+}
+
+//==========================================================================
+// End of watchdog_at91.cxx
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
diff --git a/ecos/packages/devs/watchdog/arm/lpc2xxx/current/ChangeLog b/ecos/packages/devs/watchdog/arm/lpc2xxx/current/ChangeLog
new file mode 100644
index 0000000..cabbe95
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/lpc2xxx/current/ChangeLog
@@ -0,0 +1,52 @@
+2009-04-28 John Dallaway <john@dallaway.org.uk>
+
+ * cdl/watchdog_lpc2xxx.cdl: Give CYGIMP_WATCHDOG_HARDWARE a default
+ value rather than a calculated value to accommodate other
+ implementations of CYGINT_WATCHDOG_IMPLEMENTATIONS.
+
+2009-02-09 Bart Veer <bartv@ecoscentric.com>
+
+ * src/watchdog_lpc2xxx.cxx: switch init priority to
+ CYG_INIT_INTERRUPTS.
+
+2008-11-23 Sergei Gavrikov <sergei.gavrikov@gmail.com>
+ Andrew Lunn <andrew@lunn.ch>
+
+ * src/watchdog_lpc2xxx.cxx: Since CYG_HAL_ARM_LPC2XXX_PCLK()
+ macro has been removed from lpc2xxx_misc.h, insert a definition here.
+
+2008-09-03 Sergei Gavrikov <sergei.gavrikov@gmail.com>
+
+ * src/watchdog_lpc2xxx.cxx: Since CYG_HAL_ARM_LPC2XXX_PCLK()
+ macro had been gone away from lpc2xxx_misc.h, it is replaced by
+ an equal CYGNUM_HAL_ARM_LPC2XXX_PCLK constant.
+
+2007-08-19 Sergei Gavrikov <sg@sgs.gomel.by>
+
+ * src/watchdog_lpc2xxx.cxx: Fixed to work properly in WDINT mode.
+
+2004-10-04 Jani Monoses <jani@iv.ro>
+
+ * Added watchdog driver for ARM LPC2XXX based on the AT91 code.
+
+// ####GPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009 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/lpc2xxx/current/cdl/watchdog_lpc2xxx.cdl b/ecos/packages/devs/watchdog/arm/lpc2xxx/current/cdl/watchdog_lpc2xxx.cdl
new file mode 100644
index 0000000..a2c50a1
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/lpc2xxx/current/cdl/watchdog_lpc2xxx.cdl
@@ -0,0 +1,132 @@
+# ====================================================================
+#
+# watchdog_lpc2xxx.cdl
+#
+# eCos watchdog for ARM LPC2XXX driver configuration data
+#
+# ====================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009 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): tkoeller
+# Contributors: tkoeller, nickg
+# Date: 2000-05-05
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVICES_WATCHDOG_ARM_LPC2XXX {
+ parent CYGPKG_IO_WATCHDOG
+ active_if CYGPKG_IO_WATCHDOG
+ display "ARM LPC2XXX watchdog driver"
+ requires CYGPKG_HAL_ARM_LPC2XXX
+ requires CYGPKG_KERNEL
+ hardware
+ define_header devs_watchdog_arm_lpc2xxx.h
+ compile watchdog_lpc2xxx.cxx
+ implements CYGINT_WATCHDOG_HW_IMPLEMENTATIONS
+ active_if CYGIMP_WATCHDOG_HARDWARE
+ description "
+ This package uses the watchdog device integrated
+ in the LPC2XXX to execute a predefined action if the
+ application fails to call the reset function for
+ longer than a given timeout interval."
+
+ cdl_option CYGIMP_WATCHDOG_HARDWARE {
+ parent CYGPKG_IO_WATCHDOG_IMPLEMENTATION
+ display "Hardware watchdog"
+ default_value 1
+ implements CYGINT_WATCHDOG_IMPLEMENTATIONS
+ }
+
+ cdl_option CYGNUM_DEVS_WATCHDOG_ARM_LPC2XXX_DESIRED_TIMEOUT_MS {
+ display "Desired timeout value"
+ flavor data
+ legal_values 1 to 2047
+ default_value 100
+ description "
+ This parameter controls the watchdog timeout interval.
+ Note that you may not get the exact value requested
+ here, the timeout interval may have to be adjusted
+ because of hardware limitations. The actual timeout
+ used will be the smallest possible value that is not
+ less than this parameter."
+ }
+
+ cdl_option CYGSEM_DEVS_WATCHDOG_ARM_LPC2XXX_RESET {
+ display "Generate reset on watchdog expiration"
+ flavor bool
+ default_value 1
+ implements CYGINT_WATCHDOG_RESETS_ON_TIMEOUT
+ description "
+ Enabling this option changes the watchdog operation mode
+ to generate a system reset upon expiration instead of
+ invoking an application-defined action."
+ }
+
+ cdl_component CYGPKG_DEVICES_WATCHDOG_ARM_LPC2XXX_OPTIONS {
+ display "LPC2XXX 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_LPC2XXX_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_LPC2XXX_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."
+ }
+
+ }
+}
+
+# EOF watchdog_lpc2xxx.cdl
diff --git a/ecos/packages/devs/watchdog/arm/lpc2xxx/current/src/watchdog_lpc2xxx.cxx b/ecos/packages/devs/watchdog/arm/lpc2xxx/current/src/watchdog_lpc2xxx.cxx
new file mode 100644
index 0000000..a1240fa
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/lpc2xxx/current/src/watchdog_lpc2xxx.cxx
@@ -0,0 +1,199 @@
+//==========================================================================
+//
+// devs/watchdog/arm/lpc2xxx/watchdog_lpc2xxx.cxx
+//
+// Watchdog implementation for ARM LPC2XXX CPU
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009 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): jani
+// Contributors: tkoeller, nickg
+// Date: 2004-10-05
+// Purpose: Watchdog class implementation
+// Description: Contains an implementation of the Watchdog class for use
+// with the Philips LPC2XXX watchdog timer.
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/kernel.h>
+#include <pkgconf/infra.h>
+#include <pkgconf/kernel.h>
+#include <pkgconf/watchdog.h>
+#include <pkgconf/devs_watchdog_arm_lpc2xxx.h>
+
+#include <cyg/infra/cyg_type.h>
+#include <cyg/infra/cyg_ass.h>
+#include <cyg/infra/cyg_trac.h>
+#include <cyg/hal/hal_io.h>
+#include <cyg/hal/hal_diag.h>
+
+#include <cyg/io/watchdog.hxx>
+
+#include <cyg/hal/hal_var_ints.h>
+#if !defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT)
+#include <cyg/kernel/intr.hxx>
+#endif
+
+//==========================================================================
+
+#define TICKS (CYGNUM_HAL_ARM_LPC2XXX_PCLK/4000 * \
+ CYGNUM_DEVS_WATCHDOG_ARM_LPC2XXX_DESIRED_TIMEOUT_MS)
+
+#define RESOLUTION CYGNUM_DEVS_WATCHDOG_ARM_LPC2XXX_DESIRED_TIMEOUT_MS*1000000
+
+//==========================================================================
+
+#if defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT)
+
+#define MODVAL (CYGARC_HAL_LPC2XXX_REG_WDMOD_WDEN | \
+ CYGARC_HAL_LPC2XXX_REG_WDMOD_WDRESET)
+
+void
+Cyg_Watchdog::init_hw(void)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+ resolution = RESOLUTION;
+ CYG_REPORT_RETURN();
+}
+
+#else /* defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT) */
+
+//==========================================================================
+
+#define MODVAL (CYGARC_HAL_LPC2XXX_REG_WDMOD_WDEN | \
+ CYGARC_HAL_LPC2XXX_REG_WDMOD_WDINT)
+#define INT_PRIO 7
+
+//==========================================================================
+
+static Cyg_Watchdog *wd;
+
+//==========================================================================
+
+static cyg_uint32
+isr(cyg_vector vector, CYG_ADDRWORD data)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARG2XV(vector, data);
+
+ wd->trigger();
+ Cyg_Interrupt::acknowledge_interrupt(CYGNUM_HAL_INTERRUPT_WD);
+ CYG_REPORT_RETVAL(Cyg_Interrupt::HANDLED);
+ return Cyg_Interrupt::HANDLED;
+}
+
+//==========================================================================
+
+static CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_INTERRUPTS)
+ Cyg_Interrupt wdint(
+ CYGNUM_HAL_INTERRUPT_WD,
+ INT_PRIO,
+ 0,
+ isr,
+ NULL
+ );
+
+//==========================================================================
+
+void
+Cyg_Watchdog::init_hw(void)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+
+ wd = this;
+ resolution = RESOLUTION;
+ wdint.attach();
+ wdint.acknowledge_interrupt(CYGNUM_HAL_INTERRUPT_WD);
+ wdint.unmask_interrupt(CYGNUM_HAL_INTERRUPT_WD);
+ CYG_REPORT_RETURN();
+}
+
+#endif /* defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT) */
+
+//==========================================================================
+/*
+ * Reset watchdog timer. This needs to be called regularly to prevent
+ * the watchdog from firing.
+ */
+
+void
+Cyg_Watchdog::reset(void)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+
+ /* Feed magic values to reset the watchdog. */
+ HAL_WRITE_UINT32(CYGARC_HAL_LPC2XXX_REG_WD_BASE +
+ CYGARC_HAL_LPC2XXX_REG_WDFEED,
+ CYGARC_HAL_LPC2XXX_REG_WDFEED_MAGIC1);
+ HAL_WRITE_UINT32(CYGARC_HAL_LPC2XXX_REG_WD_BASE +
+ CYGARC_HAL_LPC2XXX_REG_WDFEED,
+ CYGARC_HAL_LPC2XXX_REG_WDFEED_MAGIC2);
+ CYG_REPORT_RETURN();
+}
+
+//==========================================================================
+/*
+ * Start watchdog to generate a hardware reset
+ * or interrupt when expiring.
+ */
+
+void
+Cyg_Watchdog::start(void)
+{
+ CYG_REPORT_FUNCTION();
+ CYG_REPORT_FUNCARGVOID();
+
+ HAL_WRITE_UINT32(CYGARC_HAL_LPC2XXX_REG_WD_BASE +
+ CYGARC_HAL_LPC2XXX_REG_WDTC, TICKS);
+ HAL_WRITE_UINT32(CYGARC_HAL_LPC2XXX_REG_WD_BASE +
+ CYGARC_HAL_LPC2XXX_REG_WDMOD, MODVAL);
+ /* Feed magic values to reset the watchdog. */
+ HAL_WRITE_UINT32(CYGARC_HAL_LPC2XXX_REG_WD_BASE +
+ CYGARC_HAL_LPC2XXX_REG_WDFEED,
+ CYGARC_HAL_LPC2XXX_REG_WDFEED_MAGIC1);
+ HAL_WRITE_UINT32(CYGARC_HAL_LPC2XXX_REG_WD_BASE +
+ CYGARC_HAL_LPC2XXX_REG_WDFEED,
+ CYGARC_HAL_LPC2XXX_REG_WDFEED_MAGIC2);
+ CYG_REPORT_RETURN();
+}
+
+//==========================================================================
+// End of watchdog_lpc2xxx.cxx
diff --git a/ecos/packages/devs/watchdog/arm/sa11x0/current/ChangeLog b/ecos/packages/devs/watchdog/arm/sa11x0/current/ChangeLog
new file mode 100644
index 0000000..7159705
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/sa11x0/current/ChangeLog
@@ -0,0 +1,39 @@
+2001-02-28 Hugo Tyson <hmt@redhat.com>
+
+ * src/watchdog_sa11x0.cxx: New file.
+ * cdl/watchdog_sa11x0.cdl: New file.
+ Copied from those referred to below.
+
+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/sa11x0/current/cdl/watchdog_sa11x0.cdl b/ecos/packages/devs/watchdog/arm/sa11x0/current/cdl/watchdog_sa11x0.cdl
new file mode 100644
index 0000000..e375964
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/sa11x0/current/cdl/watchdog_sa11x0.cdl
@@ -0,0 +1,101 @@
+# ====================================================================
+#
+# watchdog_sa11x0.cdl
+#
+# eCos watchdog for ARM/SA11X0 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: hmt, jskov
+# Date: 2001-02-27
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVICES_WATCHDOG_ARM_SA11X0 {
+ parent CYGPKG_IO_WATCHDOG
+ active_if CYGPKG_IO_WATCHDOG
+ display "SA11X0 watchdog driver"
+ requires CYGPKG_HAL_ARM_SA11X0
+ requires CYGPKG_KERNEL
+ hardware
+ compile watchdog_sa11x0.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_SA11X0_OPTIONS {
+ display "SA11X0 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_SA11X0_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_SA11X0_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/sa11x0/current/src/watchdog_sa11x0.cxx b/ecos/packages/devs/watchdog/arm/sa11x0/current/src/watchdog_sa11x0.cxx
new file mode 100644
index 0000000..1652676
--- /dev/null
+++ b/ecos/packages/devs/watchdog/arm/sa11x0/current/src/watchdog_sa11x0.cxx
@@ -0,0 +1,146 @@
+//==========================================================================
+//
+// watchdog/sa11x0.cxx
+//
+// Watchdog implementation for StrongARM SA11x0s
+//
+//==========================================================================
+// ####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): hmt, jskov (based on the MN10300 watchdog code by nickg)
+// Contributors: jskov, nickg
+// Date: 2001-02-27
+// Purpose: Watchdog class implementation
+// Description: Contains an implementation of the Watchdog class for use
+// with the SA11X0 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/hal/hal_intr.h> // Interrupts
+#include <cyg/hal/hal_sa11x0.h> // IO registers per se
+
+#include <cyg/io/watchdog.hxx> // watchdog API
+
+// -------------------------------------------------------------------------
+// SA11x0 watchdog works by enabling the watchdog (duh!) which means that
+// when OS Timer Match Register #3 "OSMR3" compares equal to the 3.6864MHz
+// clock in OSCR, then the system resets.
+//
+// To stay ahead of this, we must repeatedly set OSMR3 to OSCR + K where K
+// is the watchdog timeout. This REQUIRES that the OSCR be freerunning.
+//
+// OSCR runs at 3.6864MHz, so one second is 3686400 ticks.
+//
+// The match register is 32 bits, and wraps as an int32 does (the
+// comparison is exact, so you don't need to take special care.) So we can
+// literally do the addition in the obvious way.
+
+#define WATCHDOG_TIMER_TICKS 3686400
+#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)
+{
+ int old;
+ CYG_REPORT_FUNCTION();
+
+ HAL_DISABLE_INTERRUPTS( old );
+
+ // Init the watchdog timer.
+ *SA11X0_OSMR3 = *SA11X0_OSCR + WATCHDOG_TIMER_TICKS;
+ *SA11X0_OSSR = SA11X0_OSSR_TIMER3; // Ack any pending intr
+ *SA11X0_OIER |= SA11X0_OIER_TIMER3; // Enable interrupt is necessary
+
+ CYG_ASSERT( *SA11X0_OSCR < *SA11X0_OSMR3 ||
+ *SA11X0_OSMR3 <= WATCHDOG_TIMER_TICKS, "Watchdog wierdness" );
+
+ // Enable the watchdog.
+ *SA11X0_OWER = SA11X0_OWER_ENABLE;
+
+ HAL_RESTORE_INTERRUPTS( old );
+
+ CYG_REPORT_RETURN();
+}
+
+// -------------------------------------------------------------------------
+// Reset watchdog timer. This needs to be called regularly to prevent
+// the watchdog firing.
+
+void
+Cyg_Watchdog::reset()
+{
+ CYG_REPORT_FUNCTION();
+
+ *SA11X0_OSMR3 = *SA11X0_OSCR + WATCHDOG_TIMER_TICKS;
+
+ CYG_ASSERT( *SA11X0_OSCR < *SA11X0_OSMR3 ||
+ *SA11X0_OSMR3 <= WATCHDOG_TIMER_TICKS, "Watchdog wierdness" );
+
+ CYG_REPORT_RETURN();
+}
+
+
+// -------------------------------------------------------------------------
+// EOF watchdog_sa11x0.cxx