1 /* $OpenBSD: intersil7170.h,v 1.1 1997/08/08 08:13:04 downsj Exp $ */ 2 /* $NetBSD: intersil7170.h,v 1.1 1997/05/02 06:15:28 jeremy Exp $ */ 3 4 /*- 5 * Copyright (c) 1996 The NetBSD Foundation, Inc. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to The NetBSD Foundation 9 * by Adam Glass. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. All advertising materials mentioning features or use of this software 20 * must display the following acknowledgement: 21 * This product includes software developed by the NetBSD 22 * Foundation, Inc. and its contributors. 23 * 4. Neither the name of The NetBSD Foundation nor the names of its 24 * contributors may be used to endorse or promote products derived 25 * from this software without specific prior written permission. 26 * 27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 * POSSIBILITY OF SUCH DAMAGE. 38 */ 39 40 #ifndef _INTERSIL7170_H 41 #define _INTERSIL7170_H 42 43 /* 44 * Driver support for the intersil7170 used in sun[34]s to provide 45 * real time clock and time-of-day support. 46 * 47 * Derived from: datasheet "ICM7170 a uP-Compatible Real-Time Clock" 48 * document #301680-005, Dec 85 49 */ 50 51 struct intersil_dt { /* from p. 7 of 10 */ 52 u_int8_t dt_csec; 53 u_int8_t dt_hour; 54 u_int8_t dt_min; 55 u_int8_t dt_sec; 56 u_int8_t dt_month; 57 u_int8_t dt_day; 58 u_int8_t dt_year; 59 u_int8_t dt_dow; 60 }; 61 62 struct intersil7170 { 63 struct intersil_dt counters; 64 struct intersil_dt clk_ram; /* should be ok as both are word aligned */ 65 u_int8_t clk_intr_reg; 66 u_int8_t clk_cmd_reg; 67 }; 68 69 /* bit assignments for command register, p. 6 of 10, write-only */ 70 #define INTERSIL_CMD_FREQ_32K 0x0 71 #define INTERSIL_CMD_FREQ_1M 0x1 72 #define INTERSIL_CMD_FREQ_2M 0x2 73 #define INTERSIL_CMD_FREQ_4M 0x3 74 75 #define INTERSIL_CMD_12HR_MODE 0x0 76 #define INTERSIL_CMD_24HR_MODE 0x4 77 78 #define INTERSIL_CMD_STOP 0x0 79 #define INTERSIL_CMD_RUN 0x8 80 81 #define INTERSIL_CMD_IDISABLE 0x0 82 #define INTERSIL_CMD_IENABLE 0x10 83 84 #define INTERSIL_CMD_TEST_MODE 0x20 85 #define INTERSIL_CMD_NORMAL_MODE 0x0 86 87 /* bit assignments for interrupt register r/w, p 7 of 10*/ 88 89 #define INTERSIL_INTER_ALARM 0x1 /* r/w */ 90 #define INTERSIL_INTER_CSECONDS 0x2 /* r/w */ 91 #define INTERSIL_INTER_DSECONDS 0x4 /* r/w */ 92 #define INTERSIL_INTER_SECONDS 0x8 /* r/w */ 93 #define INTERSIL_INTER_MINUTES 0x10 /* r/w */ 94 #define INTERSIL_INTER_HOURS 0x20 /* r/w */ 95 #define INTERSIL_INTER_DAYS 0x40 /* r/w */ 96 #define INTERSIL_INTER_PENDING 0x80 /* read-only */ 97 98 #define INTERSIL_INTER_BITS "\20\10PENDING\7DAYS\6HRS\5MIN\4SCDS\3DSEC\2CSEC\1ALARM" 99 100 #endif /* _INTERSIL7170_H */