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