10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*5295Srandyf * Common Development and Distribution License (the "License"). 6*5295Srandyf * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 21*5295Srandyf 220Sstevel@tonic-gate /* 23*5295Srandyf * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ 300Sstevel@tonic-gate /* All Rights Reserved */ 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifndef _SYS_RTC_H 330Sstevel@tonic-gate #define _SYS_RTC_H 340Sstevel@tonic-gate 350Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 360Sstevel@tonic-gate 370Sstevel@tonic-gate #ifdef __cplusplus 380Sstevel@tonic-gate extern "C" { 390Sstevel@tonic-gate #endif 400Sstevel@tonic-gate 410Sstevel@tonic-gate 420Sstevel@tonic-gate /* 430Sstevel@tonic-gate * Definitions for Real Time Clock driver (Motorola MC146818 chip). 440Sstevel@tonic-gate */ 450Sstevel@tonic-gate 460Sstevel@tonic-gate /* 470Sstevel@tonic-gate * MP NOTE: 480Sstevel@tonic-gate * cmos_lck must be locked when addressing CMOS via 490Sstevel@tonic-gate * RTC_ADDR and RTC_DATA i/o addresses 500Sstevel@tonic-gate */ 510Sstevel@tonic-gate #define RTC_ADDR 0x70 /* I/O port address of for register select */ 520Sstevel@tonic-gate #define RTC_DATA 0x71 /* I/O port address for data read/write */ 530Sstevel@tonic-gate 540Sstevel@tonic-gate /* 550Sstevel@tonic-gate * Register A definitions 560Sstevel@tonic-gate */ 570Sstevel@tonic-gate #define RTC_A 0x0a /* register A address */ 580Sstevel@tonic-gate #define RTC_UIP 0x80 /* Update in progress bit */ 590Sstevel@tonic-gate #define RTC_DIV0 0x00 /* Time base of 4.194304 MHz */ 600Sstevel@tonic-gate #define RTC_DIV1 0x10 /* Time base of 1.048576 MHz */ 610Sstevel@tonic-gate #define RTC_DIV2 0x20 /* Time base of 32.768 KHz */ 620Sstevel@tonic-gate #define RTC_RATE6 0x06 /* interrupt rate of 976.562 */ 630Sstevel@tonic-gate 640Sstevel@tonic-gate /* 650Sstevel@tonic-gate * Register B definitions 660Sstevel@tonic-gate */ 670Sstevel@tonic-gate #define RTC_B 0x0b /* register B address */ 680Sstevel@tonic-gate #define RTC_SET 0x80 /* stop updates for time set */ 690Sstevel@tonic-gate #define RTC_PIE 0x40 /* Periodic interrupt enable */ 700Sstevel@tonic-gate #define RTC_AIE 0x20 /* Alarm interrupt enable */ 710Sstevel@tonic-gate #define RTC_UIE 0x10 /* Update ended interrupt enable */ 720Sstevel@tonic-gate #define RTC_SQWE 0x08 /* Square wave enable */ 730Sstevel@tonic-gate #define RTC_DM 0x04 /* Date mode, 1 = binary, 0 = BCD */ 740Sstevel@tonic-gate #define RTC_HM 0x02 /* hour mode, 1 = 24 hour, 0 = 12 hour */ 750Sstevel@tonic-gate #define RTC_DSE 0x01 /* Daylight savings enable */ 760Sstevel@tonic-gate 770Sstevel@tonic-gate /* 780Sstevel@tonic-gate * Register C definitions 790Sstevel@tonic-gate */ 800Sstevel@tonic-gate #define RTC_C 0x0c /* register C address */ 810Sstevel@tonic-gate #define RTC_IRQF 0x80 /* IRQ flag */ 820Sstevel@tonic-gate #define RTC_PF 0x40 /* PF flag bit */ 830Sstevel@tonic-gate #define RTC_AF 0x20 /* AF flag bit */ 840Sstevel@tonic-gate #define RTC_UF 0x10 /* UF flag bit */ 850Sstevel@tonic-gate 860Sstevel@tonic-gate /* 870Sstevel@tonic-gate * Register D definitions 880Sstevel@tonic-gate */ 890Sstevel@tonic-gate #define RTC_D 0x0d /* register D address */ 900Sstevel@tonic-gate #define RTC_VRT 0x80 /* Valid RAM and time bit */ 910Sstevel@tonic-gate 920Sstevel@tonic-gate #define RTC_NREG 0x0e /* number of RTC registers */ 93*5295Srandyf #define RTC_NREGP 0x0c /* number of RTC registers to set time */ 940Sstevel@tonic-gate #define RTC_CENTURY 0x32 /* not included in RTC_NREG(P) */ 950Sstevel@tonic-gate 960Sstevel@tonic-gate /* 970Sstevel@tonic-gate * Ioctl definitions for accessing RTC. 980Sstevel@tonic-gate */ 990Sstevel@tonic-gate #define RTCIOC ('R' << 8) 1000Sstevel@tonic-gate 1010Sstevel@tonic-gate #define RTCRTIME (RTCIOC | 0x01) /* Read time from RTC */ 1020Sstevel@tonic-gate #define RTCSTIME (RTCIOC | 0x02) /* Set time into RTC */ 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate struct rtc_t { /* registers 0x0 to 0xD, 0x32 */ 1050Sstevel@tonic-gate unsigned char rtc_sec; 1060Sstevel@tonic-gate unsigned char rtc_asec; 1070Sstevel@tonic-gate unsigned char rtc_min; 1080Sstevel@tonic-gate unsigned char rtc_amin; 1090Sstevel@tonic-gate unsigned char rtc_hr; 1100Sstevel@tonic-gate unsigned char rtc_ahr; 1110Sstevel@tonic-gate unsigned char rtc_dow; 1120Sstevel@tonic-gate unsigned char rtc_dom; 1130Sstevel@tonic-gate unsigned char rtc_mon; 1140Sstevel@tonic-gate unsigned char rtc_yr; 1150Sstevel@tonic-gate unsigned char rtc_statusa; 1160Sstevel@tonic-gate unsigned char rtc_statusb; 1170Sstevel@tonic-gate unsigned char rtc_statusc; 1180Sstevel@tonic-gate unsigned char rtc_statusd; 1190Sstevel@tonic-gate unsigned char rtc_century; /* register 0x32 */ 120*5295Srandyf unsigned char rtc_adom; /* ACPI-provided day alarm */ 121*5295Srandyf unsigned char rtc_amon; /* ACPI-provided mon alarm */ 1220Sstevel@tonic-gate }; 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate #ifdef __cplusplus 1250Sstevel@tonic-gate } 1260Sstevel@tonic-gate #endif 1270Sstevel@tonic-gate 1280Sstevel@tonic-gate #endif /* _SYS_RTC_H */ 129