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