todmostek.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1997-1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _TODMOSTEK_H
#define _TODMOSTEK_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
extern caddr_t v_eeprom_addr;
extern caddr_t v_timecheck_addr;
#define V_TOD_OFFSET 0x1FF0
/*
* Definitions for the Mostek 48T59 clock chip. We use this chip as
* our TOD clock. Clock interrupts are generated by a separate timer
* circuit.
*/
#ifndef _ASM
struct mostek48T59 {
};
#endif /* _ASM */
/*
* Bit masks for various operations and register limits.
*/
#define CLK_CTRL_WRITE 0x80
#define CLK_CTRL_READ 0x40
#define CLK_CTRL_SIGN 0x20
#define CLK_STOP 0x80
#define CLK_KICK 0x80
#define CLK_FREQT 0x40
#define CLK_MONTH_MASK 0x1f
#define CLK_DAY_MASK 0x3f
#define CLK_WEEKDAY_MASK 0x07
#define CLK_HOUR_MASK 0x3f
#define CLK_MIN_MASK 0x7f
#define CLK_SEC_MASK 0x7f
#define CLK_ALARM_ENABLE 0xa0
/*
* If the passed in time is non-zero, enable the watchdog and set the scale
* to seconds
*/
#define CLK_WATCHDOG_ENABLE 0x80
#define CLK_WATCHDOG_1SEC 0x02
#define CLK_WATCHDOG_TMASK 0x1f
#define CLK_WATCHDOG_BITS(n) (((n) & CLK_WATCHDOG_TMASK) ? \
((((n) & CLK_WATCHDOG_TMASK) << 2) | \
CLK_WATCHDOG_ENABLE | CLK_WATCHDOG_1SEC) : 0)
#ifdef __cplusplus
}
#endif
#endif /* !_TODMOSTEK_H */