From 8d6e7120d54ee34d9117704584e7eb8df27a6b24 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 29 Jul 1998 00:01:56 +0000 Subject: New files. --- c/src/libchip/rtc/README.icm7170 | 52 ++++++++++++++++++++++++++++++++++ c/src/libchip/rtc/README.m48t08 | 48 +++++++++++++++++++++++++++++++ c/src/libchip/rtc/STATUS | 37 ++++++++++++++++++++++++ c/src/libchip/rtc/icm7170_reg.c | 61 ++++++++++++++++++++++++++++++++++++++++ c/src/libchip/rtc/icm7170_reg2.c | 24 ++++++++++++++++ c/src/libchip/rtc/icm7170_reg4.c | 24 ++++++++++++++++ c/src/libchip/rtc/icm7170_reg8.c | 24 ++++++++++++++++ c/src/libchip/rtc/m48t08_reg.c | 61 ++++++++++++++++++++++++++++++++++++++++ c/src/libchip/rtc/m48t08_reg2.c | 24 ++++++++++++++++ c/src/libchip/rtc/m48t08_reg4.c | 24 ++++++++++++++++ c/src/libchip/rtc/m48t08_reg8.c | 24 ++++++++++++++++ 11 files changed, 403 insertions(+) create mode 100644 c/src/libchip/rtc/README.icm7170 create mode 100644 c/src/libchip/rtc/README.m48t08 create mode 100644 c/src/libchip/rtc/STATUS create mode 100644 c/src/libchip/rtc/icm7170_reg.c create mode 100644 c/src/libchip/rtc/icm7170_reg2.c create mode 100644 c/src/libchip/rtc/icm7170_reg4.c create mode 100644 c/src/libchip/rtc/icm7170_reg8.c create mode 100644 c/src/libchip/rtc/m48t08_reg.c create mode 100644 c/src/libchip/rtc/m48t08_reg2.c create mode 100644 c/src/libchip/rtc/m48t08_reg4.c create mode 100644 c/src/libchip/rtc/m48t08_reg8.c (limited to 'c/src/libchip') diff --git a/c/src/libchip/rtc/README.icm7170 b/c/src/libchip/rtc/README.icm7170 new file mode 100644 index 0000000000..de2199339d --- /dev/null +++ b/c/src/libchip/rtc/README.icm7170 @@ -0,0 +1,52 @@ +# +# $Id$ +# + + +Configuration Table Use +======================= + +sDeviceName + + The name of this device. + +deviceType + + This field must be RTC_ICM7170. + +pDeviceFns + + The device interface control table. This must be icm7170_fns. + +deviceProbe + + This is the address of the routine which probes to see if the device + is present. + +pDeviceParams + + This field specifies the clock frequency. It may be one of the + following: + ICM7170_AT_32_KHZ + ICM7170_AT_1_MHZ + ICM7170_AT_2_MHZ + ICM7170_AT_4_MHZ + +ulCtrlPort1 + + This field is the base address of the RTC area of the chip. + +ulCtrlPort2 + + This field is ignored. + +ulDataPort + + This field is ignored. + + +getRegister +setRegister + + These follow standard conventions. + diff --git a/c/src/libchip/rtc/README.m48t08 b/c/src/libchip/rtc/README.m48t08 new file mode 100644 index 0000000000..d792d7957e --- /dev/null +++ b/c/src/libchip/rtc/README.m48t08 @@ -0,0 +1,48 @@ +# +# $Id$ +# + + +Configuration Table Use +======================= + +sDeviceName + + The name of this device. + +deviceType + + This field must be RTC_M48T08. + +pDeviceFns + + The device interface control table. This must be m48t08_fns. + +deviceProbe + + This is the address of the routine which probes to see if the device + is present. + +pDeviceParams + + This is ignored and should be NULL. + +ulCtrlPort1 + + This field is the base address of the RTC area of the chip. The + NVRAM portion of the chip is ignored. + +ulCtrlPort2 + + This field is ignored. + +ulDataPort + + This field is ignored. + + +getRegister +setRegister + + These follow standard conventions. + diff --git a/c/src/libchip/rtc/STATUS b/c/src/libchip/rtc/STATUS new file mode 100644 index 0000000000..9d08b4f58e --- /dev/null +++ b/c/src/libchip/rtc/STATUS @@ -0,0 +1,37 @@ +# +# $Id$ +# + +General +======= + ++ It would be nice to utilize the interrupt capabilities of some + RTC parts. This could be used to trigger checking the software + clock against the hardware clock. + ++ The periodic capability of most RTCs is not suitable for use + as a general purpose flexible clock tick source. For example, + many RTCs generate only a handful of periods with 100 Hz being the + most frequent. + ++ The tick field is not set on get. Anything smaller than a second + is ignored on set and get operations. + ++ Day of week is ignored since RTEMS does not set it internally. + ++ There is no attempt in RTEMS to know about time zones. + +Harris ICM7170 +============== + ++ Untested. + ++ Interrupt capabilities are ignored. + +Mostek 48T08 +============ + ++ Untested. + ++ NVRAM is ignored. + diff --git a/c/src/libchip/rtc/icm7170_reg.c b/c/src/libchip/rtc/icm7170_reg.c new file mode 100644 index 0000000000..bdf7bfb31d --- /dev/null +++ b/c/src/libchip/rtc/icm7170_reg.c @@ -0,0 +1,61 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the icm7170 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are only byte-aligned (no address gaps) + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#ifndef _ICM7170_MULTIPLIER +#define _ICM7170_MULTIPLIER 1 +#define _ICM7170_NAME(_X) _X +#define _ICM7170_TYPE unsigned8 +#endif + +#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \ + (_ICM7170_TYPE *)((_base) + ((_reg) * _ICM7170_MULTIPLIER )) + +/* + * ICM7170 Get Register Routine + */ + +unsigned8 _ICM7170_NAME(icm7170_get_register)( + unsigned32 ulCtrlPort, + unsigned8 ucRegNum +) +{ + _ICM7170_TYPE *port; + + port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); + + return *port; +} + +/* + * ICM7170 Set Register Routine + */ + +void _ICM7170_NAME(icm7170_set_register)( + unsigned32 ulCtrlPort, + unsigned8 ucRegNum, + unsigned8 ucData +) +{ + _ICM7170_TYPE *port; + + port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); + + *port = ucData; +} diff --git a/c/src/libchip/rtc/icm7170_reg2.c b/c/src/libchip/rtc/icm7170_reg2.c new file mode 100644 index 0000000000..bab92697bf --- /dev/null +++ b/c/src/libchip/rtc/icm7170_reg2.c @@ -0,0 +1,24 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the icm7170 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 16-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _ICM7170_MULTIPLIER 2 +#define _ICM7170_NAME(_X) _X##_2 +#define _ICM7170_TYPE unsigned8 + +#include "icm7170_reg.c" + diff --git a/c/src/libchip/rtc/icm7170_reg4.c b/c/src/libchip/rtc/icm7170_reg4.c new file mode 100644 index 0000000000..896e0cbc0b --- /dev/null +++ b/c/src/libchip/rtc/icm7170_reg4.c @@ -0,0 +1,24 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the icm7170 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 32-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _ICM7170_MULTIPLIER 4 +#define _ICM7170_NAME(_X) _X##_4 +#define _ICM7170_TYPE unsigned8 + +#include "icm7170_reg.c" + diff --git a/c/src/libchip/rtc/icm7170_reg8.c b/c/src/libchip/rtc/icm7170_reg8.c new file mode 100644 index 0000000000..d2ed2844ac --- /dev/null +++ b/c/src/libchip/rtc/icm7170_reg8.c @@ -0,0 +1,24 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the icm7170 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 64-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _ICM7170_MULTIPLIER 8 +#define _ICM7170_NAME(_X) _X##_8 +#define _ICM7170_TYPE unsigned8 + +#include "icm7170_reg.c" + diff --git a/c/src/libchip/rtc/m48t08_reg.c b/c/src/libchip/rtc/m48t08_reg.c new file mode 100644 index 0000000000..649a176a48 --- /dev/null +++ b/c/src/libchip/rtc/m48t08_reg.c @@ -0,0 +1,61 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the m48t08 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are only byte-aligned (no address gaps) + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#ifndef _M48T08_MULTIPLIER +#define _M48T08_MULTIPLIER 1 +#define _M48T08_NAME(_X) _X +#define _M48T08_TYPE unsigned8 +#endif + +#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \ + (_M48T08_TYPE *)((_base) + ((_reg) * _M48T08_MULTIPLIER )) + +/* + * M48T08 Get Register Routine + */ + +unsigned8 _M48T08_NAME(m48t08_get_register)( + unsigned32 ulCtrlPort, + unsigned8 ucRegNum +) +{ + _M48T08_TYPE *port; + + port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); + + return *port; +} + +/* + * M48T08 Set Register Routine + */ + +void _M48T08_NAME(m48t08_set_register)( + unsigned32 ulCtrlPort, + unsigned8 ucRegNum, + unsigned8 ucData +) +{ + _M48T08_TYPE *port; + + port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); + + *port = ucData; +} diff --git a/c/src/libchip/rtc/m48t08_reg2.c b/c/src/libchip/rtc/m48t08_reg2.c new file mode 100644 index 0000000000..a6f294a3f7 --- /dev/null +++ b/c/src/libchip/rtc/m48t08_reg2.c @@ -0,0 +1,24 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the m48t08 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 16-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _M48T08_MULTIPLIER 2 +#define _M48T08_NAME(_X) _X##_2 +#define _M48T08_TYPE unsigned8 + +#include "m48t08_reg.c" + diff --git a/c/src/libchip/rtc/m48t08_reg4.c b/c/src/libchip/rtc/m48t08_reg4.c new file mode 100644 index 0000000000..a84b988a34 --- /dev/null +++ b/c/src/libchip/rtc/m48t08_reg4.c @@ -0,0 +1,24 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the m48t08 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 32-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _M48T08_MULTIPLIER 4 +#define _M48T08_NAME(_X) _X##_4 +#define _M48T08_TYPE unsigned8 + +#include "m48t08_reg.c" + diff --git a/c/src/libchip/rtc/m48t08_reg8.c b/c/src/libchip/rtc/m48t08_reg8.c new file mode 100644 index 0000000000..dcc2a9b39b --- /dev/null +++ b/c/src/libchip/rtc/m48t08_reg8.c @@ -0,0 +1,24 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the m48t08 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 64-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _M48T08_MULTIPLIER 8 +#define _M48T08_NAME(_X) _X##_8 +#define _M48T08_TYPE unsigned8 + +#include "m48t08_reg.c" + -- cgit v1.2.3