diff options
Diffstat (limited to 'ecos/packages/devs/wallclock/powerpc')
6 files changed, 444 insertions, 0 deletions
diff --git a/ecos/packages/devs/wallclock/powerpc/moab/current/ChangeLog b/ecos/packages/devs/wallclock/powerpc/moab/current/ChangeLog new file mode 100644 index 0000000..dca0aed --- /dev/null +++ b/ecos/packages/devs/wallclock/powerpc/moab/current/ChangeLog @@ -0,0 +1,29 @@ +2003-09-19 Gary Thomas <gary@mlbassoc.com> + + * include/devices_wallclock_moab.inl: + * cdl/moab_wallclock_drivers.cdl: New package - RTC support on + TAMS MOAB (PowerPC 405GPr) 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/wallclock/powerpc/moab/current/cdl/moab_wallclock_drivers.cdl b/ecos/packages/devs/wallclock/powerpc/moab/current/cdl/moab_wallclock_drivers.cdl new file mode 100644 index 0000000..337860b --- /dev/null +++ b/ecos/packages/devs/wallclock/powerpc/moab/current/cdl/moab_wallclock_drivers.cdl @@ -0,0 +1,67 @@ +# ==================================================================== +# +# moab_wallclock_drivers.cdl +# +# Wallclock drivers - support for DS1307 RTC on the TAMS MOAB +# +# ==================================================================== +## ####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): rajt +# Contributors: rajt +# Date: 2001-07-19 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVICES_WALLCLOCK_POWERPC_MOAB { + display "TAMS MOAB board RTC Driver" + description "RTC driver for TAMS MOAB." + + parent CYGPKG_IO_WALLCLOCK + active_if CYGPKG_IO_WALLCLOCK + active_if CYGPKG_HAL_POWERPC_MOAB + requires CYGPKG_DEVICES_WALLCLOCK_DALLAS_DS1307 + + include_dir cyg/io + + define_proc { + puts $::cdl_system_header "/***** MOAB RTC driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_WALLCLOCK_DALLAS_1307_INL <cyg/io/devices_wallclock_moab.inl>" + puts $::cdl_system_header "#define CYGDAT_DEVS_WALLCLOCK_MOAB_CFG <pkgconf/devices_wallclock_powerpc_moab.h>" + puts $::cdl_system_header "/***** MOAB RTC driver proc output end *****/" + } +} diff --git a/ecos/packages/devs/wallclock/powerpc/moab/current/include/devices_wallclock_moab.inl b/ecos/packages/devs/wallclock/powerpc/moab/current/include/devices_wallclock_moab.inl new file mode 100644 index 0000000..467a991 --- /dev/null +++ b/ecos/packages/devs/wallclock/powerpc/moab/current/include/devices_wallclock_moab.inl @@ -0,0 +1,122 @@ +//========================================================================== +// +// devs/wallclock/powerpc/moab/include/devs_wallclock_moab.inl +// +// TAMS MOAB RTC IO definitions +// +//========================================================================== +// ####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): rajt +// Contributors:rajt +// Date: 2001-07-19 +// Purpose: MOAB RTC definitions for using DS1307 +//####DESCRIPTIONEND#### +//========================================================================== + +#include CYGDAT_DEVS_WALLCLOCK_MOAB_CFG + +static __inline__ void +DS_GET(cyg_uint8 *regs) +{ + cyg_uint8 addr, page; + + // Read RTC + addr = 0x00; + page = 0xD1; + if (!hal_ppc405_i2c_put_bytes(page, &addr, 1)) { + diag_printf("%s - Can't select page %x\n", __FUNCTION__, page); + return; + } + if (!hal_ppc405_i2c_get_bytes(page, regs, DS_REGS_SIZE)) { + diag_printf("%s - Can't read RTC\n", __FUNCTION__); + return; + } +#if 0 + diag_printf("RTC data - read\n"); + diag_dump_buf(regs, DS_REGS_SIZE); +#endif + +#ifdef RTC_TEST + addr = 0x10; + page = 0xD1; + if (!hal_ppc405_i2c_put_bytes(page, &addr, 1)) { + diag_printf("%s - Can't select page %x\n", __FUNCTION__, page); + return; + } + if (!hal_ppc405_i2c_get_bytes(page, regs, DS_REGS_SIZE)) { + diag_printf("%s - Can't read RTC\n", __FUNCTION__); + return; + } + diag_printf("RTC data - test\n"); + diag_dump_buf(regs, DS_REGS_SIZE); +#endif +} + +static __inline__ void +DS_PUT(cyg_uint8 *regs) +{ + cyg_uint8 addr_data[DS_REGS_SIZE+1], page; + int i; + +#if 0 + diag_printf("RTC data - write\n"); + diag_dump_buf(regs, DS_REGS_SIZE); +#endif + // Update RTC in one swoop + addr_data[0] = 0x00; // Starting register address + for (i = 0; i < DS_REGS_SIZE; i++) { + addr_data[i+1] = regs[i]; + } + page = 0xD0; + if (!hal_ppc405_i2c_put_bytes(page, addr_data, DS_REGS_SIZE+1)) { + diag_printf("%s - Can't write registers\n", __FUNCTION__); + return; + } +#ifdef RTC_TEST + // Test RTC by copying the registers to some of the RAM + addr_data[0] = 0x10; // Starting register address + for (i = 0; i < DS_REGS_SIZE; i++) { + addr_data[i+1] = regs[i]; + } + page = 0xD0; + if (!hal_ppc405_i2c_put_bytes(page, addr_data, DS_REGS_SIZE+1)) { + diag_printf("%s - Can't write registers\n", __FUNCTION__); + return; + } +#endif +} + +// EOF devs_wallclock_moab.inl 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 |