nvram.h revision 1.3 1 1.3 cgd /* $NetBSD: nvram.h,v 1.3 1994/10/27 04:18:03 cgd Exp $ */
2 1.3 cgd
3 1.1 mycroft /*-
4 1.1 mycroft * Copyright (c) 1990 The Regents of the University of California.
5 1.1 mycroft * All rights reserved.
6 1.1 mycroft *
7 1.1 mycroft * This code is derived from software contributed to Berkeley by
8 1.1 mycroft * William Jolitz.
9 1.1 mycroft *
10 1.1 mycroft * Redistribution and use in source and binary forms, with or without
11 1.1 mycroft * modification, are permitted provided that the following conditions
12 1.1 mycroft * are met:
13 1.1 mycroft * 1. Redistributions of source code must retain the above copyright
14 1.1 mycroft * notice, this list of conditions and the following disclaimer.
15 1.1 mycroft * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 mycroft * notice, this list of conditions and the following disclaimer in the
17 1.1 mycroft * documentation and/or other materials provided with the distribution.
18 1.1 mycroft * 3. All advertising materials mentioning features or use of this software
19 1.1 mycroft * must display the following acknowledgement:
20 1.1 mycroft * This product includes software developed by the University of
21 1.1 mycroft * California, Berkeley and its contributors.
22 1.1 mycroft * 4. Neither the name of the University nor the names of its contributors
23 1.1 mycroft * may be used to endorse or promote products derived from this software
24 1.1 mycroft * without specific prior written permission.
25 1.1 mycroft *
26 1.1 mycroft * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 1.1 mycroft * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 1.1 mycroft * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 1.1 mycroft * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 1.1 mycroft * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 1.1 mycroft * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 1.1 mycroft * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 1.1 mycroft * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 1.1 mycroft * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 1.1 mycroft * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 1.1 mycroft * SUCH DAMAGE.
37 1.1 mycroft *
38 1.3 cgd * @(#)rtc.h 7.1 (Berkeley) 5/12/91
39 1.1 mycroft */
40 1.1 mycroft /*
41 1.1 mycroft * Mach Operating System
42 1.1 mycroft * Copyright (c) 1991,1990,1989 Carnegie Mellon University
43 1.1 mycroft * All Rights Reserved.
44 1.1 mycroft *
45 1.1 mycroft * Permission to use, copy, modify and distribute this software and its
46 1.1 mycroft * documentation is hereby granted, provided that both the copyright
47 1.1 mycroft * notice and this permission notice appear in all copies of the
48 1.1 mycroft * software, derivative works or modified versions, and any portions
49 1.1 mycroft * thereof, and that both notices appear in supporting documentation.
50 1.1 mycroft *
51 1.1 mycroft * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
52 1.1 mycroft * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
53 1.1 mycroft * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
54 1.1 mycroft *
55 1.1 mycroft * Carnegie Mellon requests users of this software to return to
56 1.1 mycroft *
57 1.1 mycroft * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
58 1.1 mycroft * School of Computer Science
59 1.1 mycroft * Carnegie Mellon University
60 1.1 mycroft * Pittsburgh PA 15213-3890
61 1.1 mycroft *
62 1.1 mycroft * any improvements or extensions that they make and grant Carnegie Mellon
63 1.1 mycroft * the rights to redistribute these changes.
64 1.1 mycroft */
65 1.1 mycroft /*
66 1.1 mycroft Copyright 1988, 1989 by Intel Corporation, Santa Clara, California.
67 1.1 mycroft
68 1.1 mycroft All Rights Reserved
69 1.1 mycroft
70 1.1 mycroft Permission to use, copy, modify, and distribute this software and
71 1.1 mycroft its documentation for any purpose and without fee is hereby
72 1.1 mycroft granted, provided that the above copyright notice appears in all
73 1.1 mycroft copies and that both the copyright notice and this permission notice
74 1.1 mycroft appear in supporting documentation, and that the name of Intel
75 1.1 mycroft not be used in advertising or publicity pertaining to distribution
76 1.1 mycroft of the software without specific, written prior permission.
77 1.1 mycroft
78 1.1 mycroft INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
79 1.1 mycroft INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
80 1.1 mycroft IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
81 1.1 mycroft CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
82 1.1 mycroft LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
83 1.1 mycroft NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
84 1.1 mycroft WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
85 1.1 mycroft */
86 1.1 mycroft
87 1.1 mycroft /*
88 1.1 mycroft * RTC/CMOS Register locations
89 1.1 mycroft */
90 1.1 mycroft
91 1.1 mycroft /*
92 1.1 mycroft * Register A definitions
93 1.1 mycroft */
94 1.1 mycroft #define CLOCK_RATE 0x0a /* register A address */
95 1.1 mycroft #define CLOCK_RATE_UIP 0x80 /* Update in progress bit */
96 1.1 mycroft #define CLOCK_RATE_DIV0 0x00 /* Time base of 4.194304 MHz */
97 1.1 mycroft #define CLOCK_RATE_DIV1 0x10 /* Time base of 1.048576 MHz */
98 1.1 mycroft #define CLOCK_RATE_DIV2 0x20 /* Time base of 32.768 KHz */
99 1.1 mycroft #define CLOCK_RATE_6 0x06 /* interrupt rate of 976.562 */
100 1.1 mycroft
101 1.1 mycroft /*
102 1.1 mycroft * Register B definitions
103 1.1 mycroft */
104 1.1 mycroft #define CLOCK_MODE 0x0b /* register B address */
105 1.1 mycroft #define CLOCK_MODE_SET 0x80 /* stop updates for time set */
106 1.1 mycroft #define CLOCK_MODE_PIE 0x40 /* Periodic interrupt enable */
107 1.1 mycroft #define CLOCK_MODE_AIE 0x20 /* Alarm interrupt enable */
108 1.1 mycroft #define CLOCK_MODE_UIE 0x10 /* Update ended interrupt enable */
109 1.1 mycroft #define CLOCK_MODE_SQWE 0x08 /* Square wave enable */
110 1.1 mycroft #define CLOCK_MODE_DM 0x04 /* Date mode, 1 = binary, 0 = BCD */
111 1.1 mycroft #define CLOCK_MODE_HM 0x02 /* hour mode, 1 = 24 hour, 0 = 12 hour */
112 1.1 mycroft #define CLOCK_MODE_DSE 0x01 /* Daylight savings enable */
113 1.1 mycroft
114 1.1 mycroft /*
115 1.1 mycroft * Register C definitions
116 1.1 mycroft */
117 1.1 mycroft #define CLOCK_INTR 0x0c /* register C address */
118 1.1 mycroft #define CLOCK_INTR_IRQF 0x80 /* IRQ flag */
119 1.1 mycroft #define CLOCK_INTR_PF 0x40 /* PF flag bit */
120 1.1 mycroft #define CLOCK_INTR_AF 0x20 /* AF flag bit */
121 1.1 mycroft #define CLOCK_INTR_UF 0x10 /* UF flag bit */
122 1.1 mycroft
123 1.1 mycroft /*
124 1.1 mycroft * Register D definitions
125 1.1 mycroft */
126 1.1 mycroft #define NVRAM_VALID 0x0d /* register D address */
127 1.1 mycroft #define NVRAM_VALID_VRT 0x80 /* Valid RAM and time bit */
128 1.1 mycroft
129 1.2 mycroft #define CLOCK_NREG 0x0a /* number of RTC registers */
130 1.1 mycroft
131 1.1 mycroft /*
132 1.1 mycroft * These are generic CMOS locations, but we call then RTC anyway...
133 1.1 mycroft */
134 1.1 mycroft #define NVRAM_DIAG 0x0e /* status register E - bios diagnostic */
135 1.1 mycroft #define NVRAM_DIAG_BITS "\020\010clock_battery\007ROM_cksum\006config_unit"\
136 1.1 mycroft "\005memory_size\004fixed_disk\003invalid_time"
137 1.1 mycroft
138 1.1 mycroft #define NVRAM_RESET 0x0f /* status register F - reset code byte */
139 1.1 mycroft #define NVRAM_RESET_RST 0x00 /* normal reset */
140 1.1 mycroft #define NVRAM_RESET_LOAD 0x04 /* load system */
141 1.1 mycroft
142 1.1 mycroft #define NVRAM_DISKETTE 0x10 /* diskette drive type in upper/lower nibble */
143 1.1 mycroft #define NVRAM_DISKETTE_NONE 0x00 /* none present */
144 1.1 mycroft #define NVRAM_DISKETTE_360K 0x10 /* 360K */
145 1.1 mycroft #define NVRAM_DISKETTE_12M 0x20 /* 1.2M */
146 1.1 mycroft #define NVRAM_DISKETTE_720K 0x30 /* 720K */
147 1.1 mycroft #define NVRAM_DISKETTE_144M 0x40 /* 1.44M */
148 1.1 mycroft
149 1.1 mycroft #define NVRAM_BASEMEM_LO 0x15 /* low byte of basemem size */
150 1.1 mycroft #define NVRAM_BASEMEM_HI 0x16 /* high byte of basemem size */
151 1.1 mycroft #define NVRAM_EXTMEM_LO 0x17 /* low byte of extended mem size */
152 1.1 mycroft #define NVRAM_EXTMEM_HI 0x18 /* low byte of extended mem size */
153 1.1 mycroft
154 1.1 mycroft #define CLOCK_CENTURY 0x32 /* current century - please increment in Dec99 */
155 1.1 mycroft
156 1.2 mycroft #define CLOCK_NPORTS 16
157 1.2 mycroft
158 1.2 mycroft
159 1.2 mycroft u_char nvram __P((u_char pos));
160