summaryrefslogtreecommitdiff
path: root/ecos/packages/devs/wallclock/powerpc/mpc5xx/current
diff options
context:
space:
mode:
Diffstat (limited to 'ecos/packages/devs/wallclock/powerpc/mpc5xx/current')
-rw-r--r--ecos/packages/devs/wallclock/powerpc/mpc5xx/current/ChangeLog27
-rw-r--r--ecos/packages/devs/wallclock/powerpc/mpc5xx/current/cdl/wallclock_mpc5xx.cdl100
-rw-r--r--ecos/packages/devs/wallclock/powerpc/mpc5xx/current/src/wallclock_mpc5xx.cxx99
3 files changed, 226 insertions, 0 deletions
diff --git a/ecos/packages/devs/wallclock/powerpc/mpc5xx/current/ChangeLog b/ecos/packages/devs/wallclock/powerpc/mpc5xx/current/ChangeLog
new file mode 100644
index 0000000..8d41a7c
--- /dev/null
+++ b/ecos/packages/devs/wallclock/powerpc/mpc5xx/current/ChangeLog
@@ -0,0 +1,27 @@
+2002-04-24 Bob Koninckx <bob.koninckx@mech.kuleuven.ac.be>
+
+ * New package.
+
+//===========================================================================
+// ####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/wallclock/powerpc/mpc5xx/current/cdl/wallclock_mpc5xx.cdl b/ecos/packages/devs/wallclock/powerpc/mpc5xx/current/cdl/wallclock_mpc5xx.cdl
new file mode 100644
index 0000000..f25544b
--- /dev/null
+++ b/ecos/packages/devs/wallclock/powerpc/mpc5xx/current/cdl/wallclock_mpc5xx.cdl
@@ -0,0 +1,100 @@
+# ====================================================================
+#
+# wallclock_mpc5xx.cdl
+#
+# eCos wallclock motorola MPC555-module 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): Bob Koninckx
+# Original data: nickg
+# Contributors:
+# Date: 2002-01-18
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVICES_WALLCLOCK_MPC5xx {
+ parent CYGPKG_IO_WALLCLOCK
+ active_if CYGPKG_IO_WALLCLOCK
+ display "mpc5xx RTC-module wallclock driver"
+ requires CYGPKG_HAL_POWERPC_MPC5xx
+ hardware
+ compile wallclock_mpc5xx.cxx
+ implements CYGINT_WALLCLOCK_HW_IMPLEMENTATIONS
+ active_if CYGIMP_WALLCLOCK_HARDWARE
+
+ cdl_option CYGIMP_WALLCLOCK_HARDWARE {
+ parent CYGPKG_IO_WALLCLOCK_IMPLEMENTATION
+ display "Hardware wallclock"
+ default_value 1
+ implements CYGINT_WALLCLOCK_IMPLEMENTATIONS
+ }
+
+ cdl_component CYGPKG_DEVICES_WALLCLOCK_MPC5xx_OPTIONS {
+ display "mpc5xx RTC-module wallclock 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_WALLCLOCK_MPC5xx_CFLAGS_ADD {
+ display "Additional compiler flags"
+ flavor data
+ no_define
+ default_value { "" }
+ description "
+ This option modifies the set of compiler flags for
+ building the wallclock device. These flags are used in addition
+ to the set of global flags."
+ }
+
+ cdl_option CYGPKG_DEVICES_WALLCLOCK_MPC5xx_CFLAGS_REMOVE {
+ display "Suppressed compiler flags"
+ flavor data
+ no_define
+ default_value { "" }
+ description "
+ This option modifies the set of compiler flags for
+ building the wallclock device. These flags are removed from
+ the set of global flags if present."
+ }
+
+ }
+}
diff --git a/ecos/packages/devs/wallclock/powerpc/mpc5xx/current/src/wallclock_mpc5xx.cxx b/ecos/packages/devs/wallclock/powerpc/mpc5xx/current/src/wallclock_mpc5xx.cxx
new file mode 100644
index 0000000..0c57e81
--- /dev/null
+++ b/ecos/packages/devs/wallclock/powerpc/mpc5xx/current/src/wallclock_mpc5xx.cxx
@@ -0,0 +1,99 @@
+//==========================================================================
+//
+// wallclock_mpc5xx.cxx
+//
+// mpc5xx RTC module driver.
+//
+//==========================================================================
+// ####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): Bob Koninckx
+// Contributors: Bob Koninckx
+// Date: 2002-01-18
+// Purpose: Wallclock driver for mpc5xx
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/wallclock.h> // Wallclock device config
+
+#include <cyg/hal/hal_io.h> // IO macros
+#include <cyg/infra/cyg_type.h> // Common type definitions and support
+
+#include <cyg/io/wallclock.hxx> // The WallClock API
+#include <cyg/io/wallclock/wallclock.inl> // Helpers
+
+#include <cyg/hal/hal_arch.h> // RTC register definitions
+
+#include <cyg/infra/diag.h> // For debugging
+
+//-----------------------------------------------------------------------------
+// Functions required for the hardware-driver API.
+
+// Returns the number of seconds elapsed since 1970-01-01 00:00:00.
+cyg_uint32
+Cyg_WallClock::get_hw_seconds(void)
+{
+ cyg_uint32 now;
+ HAL_READ_UINT32(CYGARC_REG_IMM_RTC, now);
+
+ return now;
+}
+
+#ifndef CYGSEM_WALLCLOCK_SET_GET_MODE
+
+void
+Cyg_WallClock::init_hw_seconds(void)
+{
+ cyg_uint32 key = 0x55ccaa33;
+ cyg_uint16 rtcsc;
+
+ // Write zero to the time register
+ // and start up the RTC
+ HAL_WRITE_UINT32(CYGARC_REG_IMM_RTCK, key);
+ HAL_WRITE_UINT32(CYGARC_REG_IMM_RTCSCK, key);
+
+ key = 0;
+ HAL_WRITE_UINT32(CYGARC_REG_IMM_RTC, key);
+ HAL_READ_UINT16(CYGARC_REG_IMM_RTCSC, rtcsc);
+ rtcsc |= 0x0001;
+ HAL_WRITE_UINT16(CYGARC_REG_IMM_RTCSC, rtcsc);
+}
+
+#endif // CYGSEM_WALLCLOCK_SET_GET_MODE
+
+//-----------------------------------------------------------------------------
+// End of wallclock_mpc5xx.cxx