diff options
Diffstat (limited to 'c/src/lib/libchip/rtc')
-rw-r--r-- | c/src/lib/libchip/rtc/Makefile.in | 74 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/README.ds1643 | 7 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/README.icm7170 | 52 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/README.m48t08 | 48 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/README.m48t18 | 5 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/STATUS | 37 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/icm7170.c | 176 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/icm7170.h | 100 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/icm7170_reg.c | 61 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/icm7170_reg2.c | 24 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/icm7170_reg4.c | 24 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/icm7170_reg8.c | 24 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/m48t08.c | 165 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/m48t08.h | 90 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/m48t08_reg.c | 61 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/m48t08_reg2.c | 24 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/m48t08_reg4.c | 24 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/m48t08_reg8.c | 24 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/rtc.h | 81 | ||||
-rw-r--r-- | c/src/lib/libchip/rtc/rtcprobe.c | 24 |
20 files changed, 0 insertions, 1125 deletions
diff --git a/c/src/lib/libchip/rtc/Makefile.in b/c/src/lib/libchip/rtc/Makefile.in deleted file mode 100644 index 8039ef32d6..0000000000 --- a/c/src/lib/libchip/rtc/Makefile.in +++ /dev/null @@ -1,74 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -top_builddir = .. -subdir = rtc - -RTEMS_ROOT = @RTEMS_ROOT@ -PROJECT_ROOT = @PROJECT_ROOT@ - -VPATH = @srcdir@ - -LIBNAME = librtcio.a -LIB = ${ARCH}/${LIBNAME} - -C_PIECES = rtcprobe icm7170 icm7170_reg icm7170_reg2 icm7170_reg4 \ - icm7170_reg8 m48t08 m48t08_reg m48t08_reg2 m48t08_reg4 m48t08_reg8 - -C_FILES = $(C_PIECES:%=%.c) -C_O_FILES = $(C_PIECES:%=${ARCH}/%.o) - -INSTALLED_H_FILES = $(srcdir)/rtc.h $(srcdir)/icm7170.h $(srcdir)/m48t08.h - -SRCS = $(C_FILES) $(H_FILES) $(SYS_H_FILES) $(RTEMS_H_FILES) \ - $(PRIVATE_H_FILES) -OBJS = $(C_O_FILES) - -include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg -include $(RTEMS_ROOT)/make/lib.cfg - -INSTALL_CHANGE = @INSTALL_CHANGE@ -mkinstalldirs = $(SHELL) $(top_srcdir)/@RTEMS_TOPdir@/mkinstalldirs - -INSTALLDIRS = $(PROJECT_INCLUDE)/libchip - -$(INSTALLDIRS): - @$(mkinstalldirs) $(INSTALLDIRS) - -# -# Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += $(LIBC_DEFINES) - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += $(LIB) -CLOBBER_ADDITIONS += - -all: ${ARCH} preinstall $(LIB) - $(INSTALL_VARIANT) -m 644 ${LIB} $(PROJECT_RELEASE)/lib - -$(LIB): $(SRCS) ${OBJS} - $(make-library) - -# Install the library, appending _g or _p as appropriate. -# for include files, just use $(INSTALL_CHANGE) -preinstall: - @$(mkinstalldirs) $(PROJECT_INCLUDE)/libchip - @$(INSTALL_CHANGE) -m 644 $(INSTALLED_H_FILES) $(PROJECT_INCLUDE)/libchip - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status diff --git a/c/src/lib/libchip/rtc/README.ds1643 b/c/src/lib/libchip/rtc/README.ds1643 deleted file mode 100644 index 4fab5b62c6..0000000000 --- a/c/src/lib/libchip/rtc/README.ds1643 +++ /dev/null @@ -1,7 +0,0 @@ -# -# $Id$ -# - -The Mostek M48T08 is compatible with the Dallas Semiconductor DS1643. Please -use that driver. - diff --git a/c/src/lib/libchip/rtc/README.icm7170 b/c/src/lib/libchip/rtc/README.icm7170 deleted file mode 100644 index de2199339d..0000000000 --- a/c/src/lib/libchip/rtc/README.icm7170 +++ /dev/null @@ -1,52 +0,0 @@ -# -# $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/lib/libchip/rtc/README.m48t08 b/c/src/lib/libchip/rtc/README.m48t08 deleted file mode 100644 index d792d7957e..0000000000 --- a/c/src/lib/libchip/rtc/README.m48t08 +++ /dev/null @@ -1,48 +0,0 @@ -# -# $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/lib/libchip/rtc/README.m48t18 b/c/src/lib/libchip/rtc/README.m48t18 deleted file mode 100644 index 85fe918f23..0000000000 --- a/c/src/lib/libchip/rtc/README.m48t18 +++ /dev/null @@ -1,5 +0,0 @@ -# -# $Id$ -# - -This is supported by the m48t08 driver. diff --git a/c/src/lib/libchip/rtc/STATUS b/c/src/lib/libchip/rtc/STATUS deleted file mode 100644 index e95a924ae9..0000000000 --- a/c/src/lib/libchip/rtc/STATUS +++ /dev/null @@ -1,37 +0,0 @@ -# -# $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 -============== - -+ Tested on a DMV177. - -+ Interrupt capabilities are ignored. - -Mostek 48T08 -============ - -+ Untested. - -+ NVRAM is ignored. - diff --git a/c/src/lib/libchip/rtc/icm7170.c b/c/src/lib/libchip/rtc/icm7170.c deleted file mode 100644 index f3cf513d2e..0000000000 --- a/c/src/lib/libchip/rtc/icm7170.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file interfaces with the real-time clock found in - * a Harris ICM7170 - * - * Year 2K Notes: - * - * This chip only uses a two digit field to store the year. This - * code uses the RTEMS Epoch as a pivot year. This lets us map the - * two digit year field as follows: - * - * + two digit years 0-87 are mapped to 2000-2087. - * + two digit years 88-99 are mapped to 1988-1999. - * - * This is less than the time span supported by RTEMS. - * - * COPYRIGHT (c) 1989-1998. - * 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 <rtems.h> -#include <libchip/rtc.h> -#include <libchip/icm7170.h> - -/* - * Control register bits - */ - -/* XXX */ - -/* - * icm7170_initialize - */ - -void icm7170_initialize( - int minor -) -{ - unsigned32 icm7170; - setRegister_f setReg; - unsigned32 clock; - - icm7170 = RTC_Table[ minor ].ulCtrlPort1; - setReg = RTC_Table[ minor ].setRegister; - - /* - * Initialize the RTC with the proper clock frequency - */ - - clock = (unsigned32) RTC_Table[ minor ].pDeviceParams; - (*setReg)( icm7170, ICM7170_CONTROL, 0x0c | clock ); -} - -/* - * icm7170_get_time - */ - -int icm7170_get_time( - int minor, - rtems_time_of_day *time -) -{ - unsigned32 icm7170; - getRegister_f getReg; - setRegister_f setReg; - unsigned32 year; - - icm7170 = RTC_Table[ minor ].ulCtrlPort1; - getReg = RTC_Table[ minor ].getRegister; - setReg = RTC_Table[ minor ].setRegister; - - /* - * Put the RTC into read mode - */ - - (void) (*getReg)( icm7170, ICM7170_COUNTER_HUNDREDTHS ); - - /* - * Now get the time - */ - - - year = (*getReg)( icm7170, ICM7170_YEAR ); - if ( year < 88 ) - year += 2000; - else - year += 1900; - - time->year = year; - time->month = (*getReg)( icm7170, ICM7170_MONTH ); - time->day = (*getReg)( icm7170, ICM7170_DATE ); - time->hour = (*getReg)( icm7170, ICM7170_HOUR ); - time->minute = (*getReg)( icm7170, ICM7170_MINUTE ); - time->second = (*getReg)( icm7170, ICM7170_SECOND ); - - time->ticks = 0; - - /* - * Put the RTC back into normal mode. - */ - - (void) (*getReg)( icm7170, ICM7170_COUNTER_HUNDREDTHS ); - - return 0; -} - -/* - * icm7170_set_time - */ - -int icm7170_set_time( - int minor, - rtems_time_of_day *time -) -{ - unsigned32 icm7170; - getRegister_f getReg; - setRegister_f setReg; - unsigned32 year; - unsigned32 clock; - - icm7170 = RTC_Table[ minor ].ulCtrlPort1; - getReg = RTC_Table[ minor ].getRegister; - setReg = RTC_Table[ minor ].setRegister; - clock = (unsigned32) RTC_Table[ minor ].pDeviceParams; - - year = time->year; - - if ( year >= 2088 ) - rtems_fatal_error_occurred( RTEMS_INVALID_NUMBER ); - - if ( year >= 2000 ) - year -= 2000; - else - year -= 1900; - - (*setReg)( icm7170, ICM7170_CONTROL, 0x04 | clock ); - - (*setReg)( icm7170, ICM7170_YEAR, year ); - (*setReg)( icm7170, ICM7170_MONTH, time->month ); - (*setReg)( icm7170, ICM7170_DATE, time->day ); - (*setReg)( icm7170, ICM7170_HOUR, time->hour ); - (*setReg)( icm7170, ICM7170_MINUTE, time->minute ); - (*setReg)( icm7170, ICM7170_SECOND, time->second ); - - /* - * This is not really right. - */ - - (*setReg)( icm7170, ICM7170_DAY_OF_WEEK, 1 ); - - /* - * Put the RTC back into normal mode. - */ - - (*setReg)( icm7170, ICM7170_CONTROL, 0x0c | clock ); - - return 0; -} - -/* - * Driver function table - */ - -rtc_fns icm7170_fns = { - icm7170_initialize, - icm7170_get_time, - icm7170_set_time -}; - diff --git a/c/src/lib/libchip/rtc/icm7170.h b/c/src/lib/libchip/rtc/icm7170.h deleted file mode 100644 index 5bf9fd065c..0000000000 --- a/c/src/lib/libchip/rtc/icm7170.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This file contains the definitions for the following real-time clocks: - * - * + Harris Semiconduction ICM7170 - * - * COPYRIGHT (c) 1989-1998. - * 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$ - */ - -#ifndef __LIBCHIP_ICM7170_h -#define __LIBCHIP_ICM7170_h - -/* - * Register indices - */ - -#define ICM7170_CONTROL 0x11 - - -#define ICM7170_COUNTER_HUNDREDTHS 0x00 -#define ICM7170_HOUR 0x01 -#define ICM7170_MINUTE 0x02 -#define ICM7170_SECOND 0x03 -#define ICM7170_MONTH 0x04 -#define ICM7170_DATE 0x05 -#define ICM7170_YEAR 0x06 -#define ICM7170_DAY_OF_WEEK 0x07 - -/* - * Configuration information in the parameters field - */ - -#define ICM7170_AT_32_KHZ 0x00 -#define ICM7170_AT_1_MHZ 0x01 -#define ICM7170_AT_2_MHZ 0x02 -#define ICM7170_AT_4_MHZ 0x03 - -/* - * Driver function table - */ - -extern rtc_fns icm7170_fns; - -/* - * Default register access routines - */ - -unsigned32 icm7170_get_register( /* registers are at 1 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void icm7170_set_register( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 icm7170_get_register_2( /* registers are at 2 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void icm7170_set_register_2( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 icm7170_get_register_4( /* registers are at 4 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void icm7170_set_register_4( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 icm7170_get_register_8( /* registers are at 8 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void icm7170_set_register_8( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -#endif -/* end of include file */ diff --git a/c/src/lib/libchip/rtc/icm7170_reg.c b/c/src/lib/libchip/rtc/icm7170_reg.c deleted file mode 100644 index b6961824b6..0000000000 --- a/c/src/lib/libchip/rtc/icm7170_reg.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 <rtems.h> - -#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 - */ - -unsigned32 _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, - unsigned32 ucData -) -{ - _ICM7170_TYPE *port; - - port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); - - *port = ucData; -} diff --git a/c/src/lib/libchip/rtc/icm7170_reg2.c b/c/src/lib/libchip/rtc/icm7170_reg2.c deleted file mode 100644 index bab92697bf..0000000000 --- a/c/src/lib/libchip/rtc/icm7170_reg2.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/lib/libchip/rtc/icm7170_reg4.c b/c/src/lib/libchip/rtc/icm7170_reg4.c deleted file mode 100644 index 896e0cbc0b..0000000000 --- a/c/src/lib/libchip/rtc/icm7170_reg4.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/lib/libchip/rtc/icm7170_reg8.c b/c/src/lib/libchip/rtc/icm7170_reg8.c deleted file mode 100644 index d2ed2844ac..0000000000 --- a/c/src/lib/libchip/rtc/icm7170_reg8.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/lib/libchip/rtc/m48t08.c b/c/src/lib/libchip/rtc/m48t08.c deleted file mode 100644 index b3d0dcb0de..0000000000 --- a/c/src/lib/libchip/rtc/m48t08.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * This file interfaces with the real-time clock found in - * a Mostek M48T08 or M48T18 or compatibles. - * - * Year 2K Notes: - * - * This chip only uses a two digit field to store the year. This - * code uses the RTEMS Epoch as a pivot year. This lets us map the - * two digit year field as follows: - * - * + two digit years 0-87 are mapped to 2000-2087. - * + two digit years 88-99 are mapped to 1988-1999. - * - * This is less than the time span supported by RTEMS. - * - * COPYRIGHT (c) 1989-1998. - * 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 <rtems.h> -#include <libchip/rtc.h> -#include <libchip/m48t08.h> - -/* - * Control register bits - */ - -#define M48T08_CONTROL_WRITE 0x80 -#define M48T08_CONTROL_READ 0x40 -#define M48T08_CONTROL_SIGN 0x20 - -/* - * m48t08_initialize - */ - -void m48t08_initialize( - int minor -) -{ -} - -/* - * m48t08_get_time - */ - -#define From_BCD( _x ) ((((_x) >> 4) * 10) + ((_x) & 0x0F)) -#define To_BCD( _x ) ((((_x) / 10) << 4) + ((_x) % 10)) - -int m48t08_get_time( - int minor, - rtems_time_of_day *time -) -{ - unsigned32 m48t08; - getRegister_f getReg; - setRegister_f setReg; - unsigned8 controlReg; - unsigned32 value1; - unsigned32 value2; - - m48t08 = RTC_Table[ minor ].ulCtrlPort1; - getReg = RTC_Table[ minor ].getRegister; - setReg = RTC_Table[ minor ].setRegister; - - /* - * Put the RTC into read mode - */ - - controlReg = (*getReg)( m48t08, M48T08_CONTROL ); - (*setReg)( m48t08, M48T08_CONTROL, controlReg | M48T08_CONTROL_READ ); - - value1 = (*getReg)( m48t08, M48T08_YEAR ); - value2 = From_BCD( value1 ); - if ( value2 < 88 ) - time->year = 2000 + value2; - else - time->year = 1900 + value2; - - value1 = (*getReg)( m48t08, M48T08_MONTH ); - time->month = From_BCD( value1 ); - - value1 = (*getReg)( m48t08, M48T08_DATE ); - time->day = From_BCD( value1 ); - - value1 = (*getReg)( m48t08, M48T08_HOUR ); - time->hour = From_BCD( value1 ); - - value1 = (*getReg)( m48t08, M48T08_MINUTE ); - time->minute = From_BCD( value1 ); - - value1 = (*getReg)( m48t08, M48T08_SECOND ); - time->second = From_BCD( value1 ); - - time->ticks = 0; - - /* - * Put the RTC back into normal mode. - */ - - (*setReg)( m48t08, M48T08_CONTROL, controlReg ); - - return 0; -} - -/* - * m48t08_set_time - */ - -int m48t08_set_time( - int minor, - rtems_time_of_day *time -) -{ - unsigned32 m48t08; - getRegister_f getReg; - setRegister_f setReg; - unsigned8 controlReg; - - m48t08 = RTC_Table[ minor ].ulCtrlPort1; - getReg = RTC_Table[ minor ].getRegister; - setReg = RTC_Table[ minor ].setRegister; - - /* - * Put the RTC into read mode - */ - - controlReg = (*getReg)( m48t08, M48T08_CONTROL ); - (*setReg)( m48t08, M48T08_CONTROL, controlReg | M48T08_CONTROL_WRITE ); - - if ( time->year >= 2088 ) - rtems_fatal_error_occurred( RTEMS_INVALID_NUMBER ); - - (*setReg)( m48t08, M48T08_YEAR, To_BCD(time->year % 100) ); - (*setReg)( m48t08, M48T08_MONTH, To_BCD(time->month) ); - (*setReg)( m48t08, M48T08_DATE, To_BCD(time->day) ); - (*setReg)( m48t08, M48T08_HOUR, To_BCD(time->hour) ); - (*setReg)( m48t08, M48T08_MINUTE, To_BCD(time->minute) ); - (*setReg)( m48t08, M48T08_SECOND, To_BCD(time->second) ); - - /* - * Put the RTC back into normal mode. - */ - - (*setReg)( m48t08, M48T08_CONTROL, controlReg ); - - return 0; -} - -/* - * Driver function table - */ - -rtc_fns m48t08_fns = { - m48t08_initialize, - m48t08_get_time, - m48t08_set_time -}; - diff --git a/c/src/lib/libchip/rtc/m48t08.h b/c/src/lib/libchip/rtc/m48t08.h deleted file mode 100644 index 7d27215e1e..0000000000 --- a/c/src/lib/libchip/rtc/m48t08.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This file contains the definitions for the following real-time clocks: - * - * + Mostek M48T08 - * + Mostek M48T18 - * + Dallas Semiconductor DS1643 - * - * COPYRIGHT (c) 1989-1998. - * 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$ - */ - -#ifndef __LIBCHIP_M48T08_h -#define __LIBCHIP_M48T08_h - -/* - * Register indices - */ - -#define M48T08_CONTROL 0 -#define M48T08_SECOND 1 -#define M48T08_MINUTE 2 -#define M48T08_HOUR 3 -#define M48T08_DAY_OF_WEEK 4 -#define M48T08_DATE 5 -#define M48T08_MONTH 6 -#define M48T08_YEAR 7 - -/* - * Driver function table - */ - -extern rtc_fns m48t08_fns; - -/* - * Default register access routines - */ - -unsigned32 m48t08_get_register( /* registers are at 1 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void m48t08_set_register( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 m48t08_get_register_2( /* registers are at 2 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void m48t08_set_register_2( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 m48t08_get_register_4( /* registers are at 4 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void m48t08_set_register_4( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 m48t08_get_register_8( /* registers are at 8 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void m48t08_set_register_8( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -#endif -/* end of include file */ diff --git a/c/src/lib/libchip/rtc/m48t08_reg.c b/c/src/lib/libchip/rtc/m48t08_reg.c deleted file mode 100644 index abb37c628c..0000000000 --- a/c/src/lib/libchip/rtc/m48t08_reg.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 <rtems.h> - -#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 - */ - -unsigned32 _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, - unsigned32 ucData -) -{ - _M48T08_TYPE *port; - - port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); - - *port = ucData; -} diff --git a/c/src/lib/libchip/rtc/m48t08_reg2.c b/c/src/lib/libchip/rtc/m48t08_reg2.c deleted file mode 100644 index a6f294a3f7..0000000000 --- a/c/src/lib/libchip/rtc/m48t08_reg2.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/lib/libchip/rtc/m48t08_reg4.c b/c/src/lib/libchip/rtc/m48t08_reg4.c deleted file mode 100644 index a84b988a34..0000000000 --- a/c/src/lib/libchip/rtc/m48t08_reg4.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/lib/libchip/rtc/m48t08_reg8.c b/c/src/lib/libchip/rtc/m48t08_reg8.c deleted file mode 100644 index dcc2a9b39b..0000000000 --- a/c/src/lib/libchip/rtc/m48t08_reg8.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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" - diff --git a/c/src/lib/libchip/rtc/rtc.h b/c/src/lib/libchip/rtc/rtc.h deleted file mode 100644 index 94b42e3f34..0000000000 --- a/c/src/lib/libchip/rtc/rtc.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file contains the Real-Time Clock definitions. - * - * COPYRIGHT (c) 1989-1998. - * 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$ - */ - -#ifndef __LIBCHIP_RTC_h -#define __LIBCHIP_RTC_h - -/* - * Types for get and set register routines - */ - -typedef unsigned32 (*getRegister_f)(unsigned32 port, unsigned8 register); -typedef void (*setRegister_f)( - unsigned32 port, unsigned8 reg, unsigned32 value); - -typedef struct _rtc_fns { - void (*deviceInitialize)(int minor); - int (*deviceGetTime)(int minor, rtems_time_of_day *time); - int (*deviceSetTime)(int minor, rtems_time_of_day *time); -} rtc_fns; - -typedef enum { - RTC_M48T08, /* SGS-Thomsom M48T08 or M48T18 */ - RTC_ICM7170, /* Harris ICM-7170 */ - RTC_CUSTOM /* BSP specific driver */ -} rtc_devs; - -/* - * Each field is interpreted thus: - * - * sDeviceName This is the name of the device. - * - * deviceType This indicates the chip type. - * - * pDeviceFns This is a pointer to the set of driver routines to use. - * - * pDeviceParams This contains either device specific data or a pointer to a - * device specific information table. - * - * ulCtrlPort1 This is the primary control port number for the device. - * - * ulCtrlPort2 This is the secondary control port number. - * - * ulDataPort This is the port number for the data port of the device - * - * getRegister This is the routine used to read register values. - * - * setRegister This is the routine used to write register values. - */ - -typedef struct _rtc_tbl { - char *sDeviceName; - rtc_devs deviceType; - rtc_fns *pDeviceFns; - boolean (*deviceProbe)(int minor); - void *pDeviceParams; - unsigned32 ulCtrlPort1; - unsigned32 ulDataPort; - getRegister_f getRegister; - setRegister_f setRegister; -} rtc_tbl; - -extern rtc_tbl RTC_Table[]; -extern unsigned long RTC_Count; - - -boolean rtc_probe( int minor ); - -#endif -/* end of include file */ diff --git a/c/src/lib/libchip/rtc/rtcprobe.c b/c/src/lib/libchip/rtc/rtcprobe.c deleted file mode 100644 index 6aaad89486..0000000000 --- a/c/src/lib/libchip/rtc/rtcprobe.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file contains the default Real-Time Clock probe routine. - * - * COPYRIGHT (c) 1989-1998. - * 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 <rtems.h> -#include <libchip/rtc.h> - - -boolean rtc_probe( - int minor -) -{ - return TRUE; -} |