This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
LPC2xxx serial and watchdog drivers
- From: Jani Monoses <jani at iv dot ro>
- To: ecos-patches at ecos dot sourceware dot org
- Date: Fri, 08 Oct 2004 14:42:45 +0300
- Subject: LPC2xxx serial and watchdog drivers
Serial driver uses the generic 16x5x driver
Watchdog based on AT91 watchdog code
comments/testing welcome
Jani
--- orig/packages/ecos.db
+++ mod/packages/ecos.db
@@ -916,6 +916,15 @@
description "Atmel AT91 on-chip serial device driver."
}
+package CYGPKG_IO_SERIAL_ARM_LPC2XXX {
+ alias { "ARM LPC2XXX serial device drivers"
+ devs_serial_arm_lpc2xxx lpc2xxx_serial_driver }
+ hardware
+ directory devs/serial/arm/lpc2xxx
+ script ser_arm_lpc2xxx.cdl
+ description "ARM LPC2XXX serial device drivers"
+}
+
package CYGPKG_IO_SERIAL_POWERPC_COGENT {
alias { "Cogent PowerPC serial device drivers"
devs_serial_powerpc_cogent cogent_serial_driver }
@@ -1932,6 +1941,16 @@
ARM AT91 CPU."
}
+package CYGPKG_DEVICES_WATCHDOG_ARM_LPC2XXX {
+ alias { "Watchdog driver for ARM LPC2XXX CPU" devices_watchdog_lpc2xxx device_watchdog_lpc2xxx }
+ directory devs/watchdog/arm/lpc2xxx
+ script watchdog_lpc2xxx.cdl
+ hardware
+ description "
+ This package provides a watchdog driver implementation for the
+ ARM LPC2XXX CPU."
+}
+
package CYGPKG_DEVICES_WATCHDOG_ARM_EBSA285 {
alias { "Watchdog driver for ARM/EBSA285 board" devices_watchdog_ebsa285 device_watchdog_ebsa285 }
directory devs/watchdog/arm/ebsa285
--- /dev/null
+++ /home/jani/work/ecoswork/cvs/,,what-changed.ecos--official--2.1--patch-30--jani@iv.ro--ecos/new-files-archive/./packages/devs/serial/arm/lpc2xxx/current/ChangeLog
@@ -0,0 +1,39 @@
+2004-09-12 Jani Monoses <jani@iv.ro>
+
+ * include/arm_lpc2xxx_ser.inl:
+ Serial driver for ARM LPC2XXX, using generic 16X5X driver.
+
+//===========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, 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.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//===========================================================================
--- /dev/null
+++ /home/jani/work/ecoswork/cvs/,,what-changed.ecos--official--2.1--patch-30--jani@iv.ro--ecos/new-files-archive/./packages/devs/serial/arm/lpc2xxx/current/cdl/ser_arm_lpc2xxx.cdl
@@ -0,0 +1,196 @@
+# ====================================================================
+#
+# ser_arm_lpc2xxx.cdl
+#
+# eCos serial ARM/LPC2XXX configuration data
+#
+# ====================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, 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.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s): jskov
+# Original data: gthomas
+# Contributors:
+# Date: 1999-07-07
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+
+cdl_package CYGPKG_IO_SERIAL_ARM_LPC2XXX {
+ display "ARM LPC2XXX serial device drivers"
+
+ parent CYGPKG_IO_SERIAL_DEVICES
+ active_if CYGPKG_IO_SERIAL
+ active_if CYGPKG_HAL_ARM_LPC2XXX
+
+ requires CYGPKG_ERROR
+ include_dir cyg/io
+
+ description "
+ This option enables the serial device drivers for the
+ ARM LPC2XXX."
+
+ # FIXME: This really belongs in the GENERIC_16X5X package
+ cdl_interface CYGINT_IO_SERIAL_GENERIC_16X5X_REQUIRED {
+ display "Generic 16x5x serial driver required"
+ }
+ define_proc {
+ puts $::cdl_header "#define CYGPRI_IO_SERIAL_GENERIC_16X5X_STEP 4"
+ }
+
+
+ define_proc {
+ puts $::cdl_system_header "/***** serial driver proc output start *****/"
+ puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_GENERIC_16X5X_INL <cyg/io/arm_lpc2xxx_ser.inl>"
+ puts $::cdl_system_header "#define CYGDAT_IO_SERIAL_GENERIC_16X5X_CFG <pkgconf/io_serial_arm_lpc2xxx.h>"
+ puts $::cdl_system_header "/***** serial driver proc output end *****/"
+ }
+
+ cdl_component CYGPKG_IO_SERIAL_ARM_LPC2XXX_SERIAL0 {
+ display "ARM LPC2XXX serial port 0 driver"
+ flavor bool
+ default_value 1
+
+ implements CYGINT_IO_SERIAL_GENERIC_16X5X_REQUIRED
+ implements CYGINT_IO_SERIAL_FLOW_CONTROL_HW
+ implements CYGINT_IO_SERIAL_LINE_STATUS_HW
+
+ description "
+ This option includes the serial device driver for the ARM
+ LPC2XXX port 0."
+
+ cdl_option CYGDAT_IO_SERIAL_ARM_LPC2XXX_SERIAL0_NAME {
+ display "Device name for ARM LPC2XXX serial port 0 driver"
+ flavor data
+ default_value {"\"/dev/ser0\""}
+ description "
+ This option specifies the name of the serial device
+ for the ARM LPC2XXX port 0."
+ }
+
+ cdl_option CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL0_BAUD {
+ display "Baud rate for the ARM LPC2XXX serial port 0 driver"
+ flavor data
+ legal_values { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400
+ 3600 4800 7200 9600 14400 19200 38400
+ 57600 115200 230400 }
+ default_value 38400
+ description "
+ This option specifies the default baud rate (speed)
+ for the ARM LPC2XXX port 0."
+ }
+
+ cdl_option CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL0_BUFSIZE {
+ display "Buffer size for the ARM LPC2XXX serial port 0 driver"
+ flavor data
+ legal_values 0 to 8192
+ default_value 128
+ description "
+ This option specifies the size of the internal buffers
+ used for the ARM LPC2XXX port 0."
+ }
+ }
+
+ cdl_component CYGPKG_IO_SERIAL_ARM_LPC2XXX_SERIAL1 {
+ display "ARM LPC2XXX serial port 1 driver"
+ flavor bool
+ default_value 1
+
+ implements CYGINT_IO_SERIAL_GENERIC_16X5X_REQUIRED
+ implements CYGINT_IO_SERIAL_FLOW_CONTROL_HW
+ implements CYGINT_IO_SERIAL_LINE_STATUS_HW
+
+ description "
+ This option includes the serial device driver for the ARM
+ LPC2XXX port 1."
+
+ cdl_option CYGDAT_IO_SERIAL_ARM_LPC2XXX_SERIAL1_NAME {
+ display "Device name for ARM LPC2XXX serial port 1 driver"
+ flavor data
+ default_value {"\"/dev/ser1\""}
+ description "
+ This option specifies the name of the serial device
+ for the ARM LPC2XXX port 1."
+ }
+
+ cdl_option CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_BAUD {
+ display "Baud rate for the ARM LPC2XXX serial port 1 driver"
+ flavor data
+ legal_values { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400
+ 3600 4800 7200 9600 14400 19200 38400
+ 57600 115200 230400 }
+ default_value 38400
+ description "
+ This option specifies the default baud rate (speed)
+ for the ARM LPC2XXX port 1."
+ }
+
+ cdl_option CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_BUFSIZE {
+ display "Buffer size for the ARM LPC2XXX serial port 1 driver"
+ flavor data
+ legal_values 0 to 8192
+ default_value 128
+ description "
+ This option specifies the size of the internal
+ buffers used for the ARM LPC2XXX port 1."
+ }
+ }
+
+ cdl_component CYGPKG_IO_SERIAL_ARM_LPC2XXX_TESTING {
+ display "Testing parameters"
+ flavor bool
+ calculated 1
+ active_if CYGPKG_IO_SERIAL_ARM_LPC2XXX_SERIAL0
+
+ implements CYGINT_IO_SERIAL_TEST_SKIP_9600
+ implements CYGINT_IO_SERIAL_TEST_SKIP_115200
+ implements CYGINT_IO_SERIAL_TEST_SKIP_PARITY_EVEN
+
+ cdl_option CYGPRI_SER_TEST_SER_DEV {
+ display "Serial device used for testing"
+ flavor data
+ default_value { CYGDAT_IO_SERIAL_ARM_LPC2XXX_SERIAL0_NAME }
+ }
+
+ define_proc {
+ puts $::cdl_header "#define CYGPRI_SER_TEST_CRASH_ID \"armlpc2xxx\""
+ puts $::cdl_header "#define CYGPRI_SER_TEST_TTY_DEV \"/dev/tty0\""
+ }
+ }
+}
+
+# EOF ser_arm_lpc2xxx.cdl
--- /dev/null
+++ /home/jani/work/ecoswork/cvs/,,what-changed.ecos--official--2.1--patch-30--jani@iv.ro--ecos/new-files-archive/./packages/devs/serial/arm/lpc2xxx/current/include/arm_lpc2xxx_ser.inl
@@ -0,0 +1,169 @@
+//==========================================================================
+//
+// io/serial/arm/arm_lpc2xxx_ser.inl
+//
+// ARM LPC2XXX Serial I/O definitions
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, 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.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas, jlarmour
+// Date: 1999-02-04
+// Purpose: LPC2XXX Serial I/O module (interrupt driven version)
+// Description:
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <cyg/hal/hal_intr.h>
+
+//-----------------------------------------------------------------------------
+// Baud rate specification
+
+static unsigned short select_baud[] = {
+ 9999, // Unused
+ 50,
+ 75,
+ 110,
+ 134.5,
+ 150,
+ 200,
+ 300,
+ 600,
+ 1200,
+ 1800,
+ 2400,
+ 3600,
+ 4800,
+ 7200,
+ 9600,
+ 14400,
+ 19200,
+ 38400,
+ 57600,
+ 115200,
+ 230400
+};
+
+//we need dynamically generated divider values because they depend on the
+//value of pclk which in turn is changeable
+
+externC int cyg_var_baud_generator(int baud);
+#define CYG_IO_SERIAL_GENERIC_16X5X_BAUD_GENERATOR cyg_var_baud_generator
+
+#ifdef CYGPKG_IO_SERIAL_ARM_LPC2XXX_SERIAL0
+static pc_serial_info lpc2xxx_serial_info0 = {LPC_UART0,
+ CYGNUM_HAL_INTERRUPT_UART0};
+#if CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL0_BUFSIZE > 0
+static unsigned char lpc2xxx_serial_out_buf0[CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL0_BUFSIZE];
+static unsigned char lpc2xxx_serial_in_buf0[CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL0_BUFSIZE];
+
+static SERIAL_CHANNEL_USING_INTERRUPTS(lpc2xxx_serial_channel0,
+ pc_serial_funs,
+ lpc2xxx_serial_info0,
+ CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL0_BAUD),
+ CYG_SERIAL_STOP_DEFAULT,
+ CYG_SERIAL_PARITY_DEFAULT,
+ CYG_SERIAL_WORD_LENGTH_DEFAULT,
+ CYG_SERIAL_FLAGS_DEFAULT,
+ &lpc2xxx_serial_out_buf0[0], sizeof(lpc2xxx_serial_out_buf0),
+ &lpc2xxx_serial_in_buf0[0], sizeof(lpc2xxx_serial_in_buf0)
+ );
+#else
+static SERIAL_CHANNEL(lpc2xxx_serial_channel0,
+ pc_serial_funs,
+ lpc2xxx_serial_info0,
+ CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL0_BAUD),
+ CYG_SERIAL_STOP_DEFAULT,
+ CYG_SERIAL_PARITY_DEFAULT,
+ CYG_SERIAL_WORD_LENGTH_DEFAULT,
+ CYG_SERIAL_FLAGS_DEFAULT
+ );
+#endif
+
+DEVTAB_ENTRY(lpc2xxx_serial_io0,
+ CYGDAT_IO_SERIAL_ARM_LPC2XXX_SERIAL0_NAME,
+ 0, // Does not depend on a lower level interface
+ &cyg_io_serial_devio,
+ pc_serial_init,
+ pc_serial_lookup, // Serial driver may need initializing
+ &lpc2xxx_serial_channel0
+ );
+#endif // CYGPKG_IO_SERIAL_ARM_LPC2XXX_SERIAL0
+
+#ifdef CYGPKG_IO_SERIAL_ARM_LPC2XXX_SERIAL1
+static pc_serial_info lpc2xxx_serial_info1 = {LPC_UART1,
+ CYGNUM_HAL_INTERRUPT_UART1};
+#if CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_BUFSIZE > 0
+static unsigned char lpc2xxx_serial_out_buf1[CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_BUFSIZE];
+static unsigned char lpc2xxx_serial_in_buf1[CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_BUFSIZE];
+
+static SERIAL_CHANNEL_USING_INTERRUPTS(lpc2xxx_serial_channel1,
+ pc_serial_funs,
+ lpc2xxx_serial_info1,
+ CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_BAUD),
+ CYG_SERIAL_STOP_DEFAULT,
+ CYG_SERIAL_PARITY_DEFAULT,
+ CYG_SERIAL_WORD_LENGTH_DEFAULT,
+ CYG_SERIAL_FLAGS_DEFAULT,
+ &lpc2xxx_serial_out_buf1[0], sizeof(lpc2xxx_serial_out_buf1),
+ &lpc2xxx_serial_in_buf1[0], sizeof(lpc2xxx_serial_in_buf1)
+ );
+#else
+static SERIAL_CHANNEL(lpc2xxx_serial_channel1,
+ pc_serial_funs,
+ lpc2xxx_serial_info1,
+ CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_LPC2XXX_SERIAL1_BAUD),
+ CYG_SERIAL_STOP_DEFAULT,
+ CYG_SERIAL_PARITY_DEFAULT,
+ CYG_SERIAL_WORD_LENGTH_DEFAULT,
+ CYG_SERIAL_FLAGS_DEFAULT
+ );
+#endif
+
+DEVTAB_ENTRY(lpc2xxx_serial_io1,
+ CYGDAT_IO_SERIAL_ARM_LPC2XXX_SERIAL1_NAME,
+ 0, // Does not depend on a lower level interface
+ &cyg_io_serial_devio,
+ pc_serial_init,
+ pc_serial_lookup, // Serial driver may need initializing
+ &lpc2xxx_serial_channel1
+ );
+#endif // CYGPKG_IO_SERIAL_ARM_LPC2XXX_SERIAL1
+
+// EOF arm_lpc2xxx_ser.inl
--- /dev/null
+++ /home/jani/work/ecoswork/cvs/,,what-changed.ecos--official--2.1--patch-30--jani@iv.ro--ecos/new-files-archive/./packages/devs/watchdog/arm/lpc2xxx/current/ChangeLog
@@ -0,0 +1,37 @@
+2004-10-04 Jani Monoses <jani@iv.ro>
+
+ * Added watchdog driver for ARM LPC2XXX based on the AT91 code.
+
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2003 Nick Garnett <nickg@calivar.com>
+//
+// 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.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
--- /dev/null
+++ /home/jani/work/ecoswork/cvs/,,what-changed.ecos--official--2.1--patch-30--jani@iv.ro--ecos/new-files-archive/./packages/devs/watchdog/arm/lpc2xxx/current/cdl/watchdog_lpc2xxx.cdl
@@ -0,0 +1,134 @@
+# ====================================================================
+#
+# 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 Red Hat, Inc.
+## Copyright (C) 2003 Nick Garnett <nickg@calivar.com>
+##
+## 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.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-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"
+ calculated 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
--- /dev/null
+++ /home/jani/work/ecoswork/cvs/,,what-changed.ecos--official--2.1--patch-30--jani@iv.ro--ecos/new-files-archive/./packages/devs/watchdog/arm/lpc2xxx/current/src/watchdog_lpc2xxx.cxx
@@ -0,0 +1,190 @@
+//==========================================================================
+//
+// 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 Red Hat, Inc.
+// Copyright (C) 2003 Nick Garnett <nickg@calivar.com>
+//
+// 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.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-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 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>
+
+#if !defined(CYGSEM_WATCHDOG_RESETS_ON_TIMEOUT)
+#include <cyg/hal/hal_platform_ints.h>
+#include <cyg/kernel/intr.hxx>
+#endif
+
+//==========================================================================
+
+extern cyg_uint32 lpc_pclk;
+
+#define TICKS (lpc_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 (LPC_WD_MOD_WDEN | LPC_WD_MOD_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 (LPC_WD_MOD_WDEN | LPC_WD_MOD_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_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();
+
+ /* Feed magic values to reset the watchdog. */
+ HAL_WRITE_UINT32(LPC_WD + LPC_WD_FEED, 0xAA);
+ HAL_WRITE_UINT32(LPC_WD + LPC_WD_FEED, 0x55);
+ 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(LPC_WD + LPC_WD_TC, TICKS);
+ HAL_WRITE_UINT32(LPC_WD + LPC_WD_MOD, MODVAL);
+ /* Feed magic values to reset the watchdog. */
+ HAL_WRITE_UINT32(LPC_WD + LPC_WD_FEED, 0xAA);
+ HAL_WRITE_UINT32(LPC_WD + LPC_WD_FEED, 0x55);
+ CYG_REPORT_RETURN();
+}
+
+//==========================================================================
+// End of watchdog_lpc2xxx.cxx