17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*2df1fe9cSrandyf * Common Development and Distribution License (the "License"). 6*2df1fe9cSrandyf * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21*2df1fe9cSrandyf 227c478bd9Sstevel@tonic-gate /* 23*2df1fe9cSrandyf * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ 307c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifndef _SYS_RTC_H 337c478bd9Sstevel@tonic-gate #define _SYS_RTC_H 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 367c478bd9Sstevel@tonic-gate extern "C" { 377c478bd9Sstevel@tonic-gate #endif 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* 417c478bd9Sstevel@tonic-gate * Definitions for Real Time Clock driver (Motorola MC146818 chip). 427c478bd9Sstevel@tonic-gate */ 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate /* 457c478bd9Sstevel@tonic-gate * MP NOTE: 467c478bd9Sstevel@tonic-gate * cmos_lck must be locked when addressing CMOS via 477c478bd9Sstevel@tonic-gate * RTC_ADDR and RTC_DATA i/o addresses 487c478bd9Sstevel@tonic-gate */ 497c478bd9Sstevel@tonic-gate #define RTC_ADDR 0x70 /* I/O port address of for register select */ 507c478bd9Sstevel@tonic-gate #define RTC_DATA 0x71 /* I/O port address for data read/write */ 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate /* 537c478bd9Sstevel@tonic-gate * Register A definitions 547c478bd9Sstevel@tonic-gate */ 557c478bd9Sstevel@tonic-gate #define RTC_A 0x0a /* register A address */ 567c478bd9Sstevel@tonic-gate #define RTC_UIP 0x80 /* Update in progress bit */ 577c478bd9Sstevel@tonic-gate #define RTC_DIV0 0x00 /* Time base of 4.194304 MHz */ 587c478bd9Sstevel@tonic-gate #define RTC_DIV1 0x10 /* Time base of 1.048576 MHz */ 597c478bd9Sstevel@tonic-gate #define RTC_DIV2 0x20 /* Time base of 32.768 KHz */ 607c478bd9Sstevel@tonic-gate #define RTC_RATE6 0x06 /* interrupt rate of 976.562 */ 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate /* 637c478bd9Sstevel@tonic-gate * Register B definitions 647c478bd9Sstevel@tonic-gate */ 657c478bd9Sstevel@tonic-gate #define RTC_B 0x0b /* register B address */ 667c478bd9Sstevel@tonic-gate #define RTC_SET 0x80 /* stop updates for time set */ 677c478bd9Sstevel@tonic-gate #define RTC_PIE 0x40 /* Periodic interrupt enable */ 687c478bd9Sstevel@tonic-gate #define RTC_AIE 0x20 /* Alarm interrupt enable */ 697c478bd9Sstevel@tonic-gate #define RTC_UIE 0x10 /* Update ended interrupt enable */ 707c478bd9Sstevel@tonic-gate #define RTC_SQWE 0x08 /* Square wave enable */ 717c478bd9Sstevel@tonic-gate #define RTC_DM 0x04 /* Date mode, 1 = binary, 0 = BCD */ 727c478bd9Sstevel@tonic-gate #define RTC_HM 0x02 /* hour mode, 1 = 24 hour, 0 = 12 hour */ 737c478bd9Sstevel@tonic-gate #define RTC_DSE 0x01 /* Daylight savings enable */ 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate /* 767c478bd9Sstevel@tonic-gate * Register C definitions 777c478bd9Sstevel@tonic-gate */ 787c478bd9Sstevel@tonic-gate #define RTC_C 0x0c /* register C address */ 797c478bd9Sstevel@tonic-gate #define RTC_IRQF 0x80 /* IRQ flag */ 807c478bd9Sstevel@tonic-gate #define RTC_PF 0x40 /* PF flag bit */ 817c478bd9Sstevel@tonic-gate #define RTC_AF 0x20 /* AF flag bit */ 827c478bd9Sstevel@tonic-gate #define RTC_UF 0x10 /* UF flag bit */ 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate /* 857c478bd9Sstevel@tonic-gate * Register D definitions 867c478bd9Sstevel@tonic-gate */ 877c478bd9Sstevel@tonic-gate #define RTC_D 0x0d /* register D address */ 887c478bd9Sstevel@tonic-gate #define RTC_VRT 0x80 /* Valid RAM and time bit */ 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate #define RTC_NREG 0x0e /* number of RTC registers */ 91*2df1fe9cSrandyf #define RTC_NREGP 0x0c /* number of RTC registers to set time */ 927c478bd9Sstevel@tonic-gate #define RTC_CENTURY 0x32 /* not included in RTC_NREG(P) */ 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate /* 957c478bd9Sstevel@tonic-gate * Ioctl definitions for accessing RTC. 967c478bd9Sstevel@tonic-gate */ 977c478bd9Sstevel@tonic-gate #define RTCIOC ('R' << 8) 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate #define RTCRTIME (RTCIOC | 0x01) /* Read time from RTC */ 1007c478bd9Sstevel@tonic-gate #define RTCSTIME (RTCIOC | 0x02) /* Set time into RTC */ 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate struct rtc_t { /* registers 0x0 to 0xD, 0x32 */ 1037c478bd9Sstevel@tonic-gate unsigned char rtc_sec; 1047c478bd9Sstevel@tonic-gate unsigned char rtc_asec; 1057c478bd9Sstevel@tonic-gate unsigned char rtc_min; 1067c478bd9Sstevel@tonic-gate unsigned char rtc_amin; 1077c478bd9Sstevel@tonic-gate unsigned char rtc_hr; 1087c478bd9Sstevel@tonic-gate unsigned char rtc_ahr; 1097c478bd9Sstevel@tonic-gate unsigned char rtc_dow; 1107c478bd9Sstevel@tonic-gate unsigned char rtc_dom; 1117c478bd9Sstevel@tonic-gate unsigned char rtc_mon; 1127c478bd9Sstevel@tonic-gate unsigned char rtc_yr; 1137c478bd9Sstevel@tonic-gate unsigned char rtc_statusa; 1147c478bd9Sstevel@tonic-gate unsigned char rtc_statusb; 1157c478bd9Sstevel@tonic-gate unsigned char rtc_statusc; 1167c478bd9Sstevel@tonic-gate unsigned char rtc_statusd; 1177c478bd9Sstevel@tonic-gate unsigned char rtc_century; /* register 0x32 */ 118*2df1fe9cSrandyf unsigned char rtc_adom; /* ACPI-provided day alarm */ 119*2df1fe9cSrandyf unsigned char rtc_amon; /* ACPI-provided mon alarm */ 1207c478bd9Sstevel@tonic-gate }; 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1237c478bd9Sstevel@tonic-gate } 1247c478bd9Sstevel@tonic-gate #endif 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate #endif /* _SYS_RTC_H */ 127