1*02cdf4d2Sdsl /* $NetBSD: rtc.h,v 1.2 2009/03/14 14:45:55 dsl Exp $ */ 2c1f753f9Sreinoud 3c1f753f9Sreinoud /* 4c1f753f9Sreinoud * Copyright (c) 1994 Mark Brinicombe. 5c1f753f9Sreinoud * Copyright (c) 1994 Brini. 6c1f753f9Sreinoud * All rights reserved. 7c1f753f9Sreinoud * 8c1f753f9Sreinoud * This code is derived from software written for Brini by Mark Brinicombe 9c1f753f9Sreinoud * 10c1f753f9Sreinoud * Redistribution and use in source and binary forms, with or without 11c1f753f9Sreinoud * modification, are permitted provided that the following conditions 12c1f753f9Sreinoud * are met: 13c1f753f9Sreinoud * 1. Redistributions of source code must retain the above copyright 14c1f753f9Sreinoud * notice, this list of conditions and the following disclaimer. 15c1f753f9Sreinoud * 2. Redistributions in binary form must reproduce the above copyright 16c1f753f9Sreinoud * notice, this list of conditions and the following disclaimer in the 17c1f753f9Sreinoud * documentation and/or other materials provided with the distribution. 18c1f753f9Sreinoud * 3. All advertising materials mentioning features or use of this software 19c1f753f9Sreinoud * must display the following acknowledgement: 20c1f753f9Sreinoud * This product includes software developed by Brini. 21c1f753f9Sreinoud * 4. The name of the company nor the name of the author may be used to 22c1f753f9Sreinoud * endorse or promote products derived from this software without specific 23c1f753f9Sreinoud * prior written permission. 24c1f753f9Sreinoud * 25c1f753f9Sreinoud * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED 26c1f753f9Sreinoud * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 27c1f753f9Sreinoud * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28c1f753f9Sreinoud * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 29c1f753f9Sreinoud * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30c1f753f9Sreinoud * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31c1f753f9Sreinoud * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32c1f753f9Sreinoud * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33c1f753f9Sreinoud * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34c1f753f9Sreinoud * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35c1f753f9Sreinoud * SUCH DAMAGE. 36c1f753f9Sreinoud * 37c1f753f9Sreinoud * RiscBSD kernel project 38c1f753f9Sreinoud * 39c1f753f9Sreinoud * rtc.h 40c1f753f9Sreinoud * 41c1f753f9Sreinoud * Header file for RTC / CMOS stuff 42c1f753f9Sreinoud * 43c1f753f9Sreinoud * Created : 13/10/94 44c1f753f9Sreinoud * Updated : 15/07/2000 45c1f753f9Sreinoud * 46c1f753f9Sreinoud * Based of kate/display/iiccontrol.c 47c1f753f9Sreinoud */ 48c1f753f9Sreinoud 49c1f753f9Sreinoud /* 50c1f753f9Sreinoud * IIC addresses for RTC chip 51c1f753f9Sreinoud * Two PCF8583 chips are supported on the IIC bus 52c1f753f9Sreinoud */ 53c1f753f9Sreinoud 54c1f753f9Sreinoud #define IIC_PCF8583_MASK 0xfc 55c1f753f9Sreinoud #define IIC_PCF8583_ADDR 0xa0 56c1f753f9Sreinoud 57c1f753f9Sreinoud #define RTC_Write (IIC_PCF8583_ADDR | IIC_WRITE) 58c1f753f9Sreinoud #define RTC_Read (IIC_PCF8583_ADDR | IIC_READ) 59c1f753f9Sreinoud 60c1f753f9Sreinoud typedef struct { 61c1f753f9Sreinoud u_char rtc_micro; 62c1f753f9Sreinoud u_char rtc_centi; 63c1f753f9Sreinoud u_char rtc_sec; 64c1f753f9Sreinoud u_char rtc_min; 65c1f753f9Sreinoud u_char rtc_hour; 66c1f753f9Sreinoud u_char rtc_day; 67c1f753f9Sreinoud u_char rtc_mon; 68c1f753f9Sreinoud u_char rtc_year; 69c1f753f9Sreinoud u_char rtc_cen; 70c1f753f9Sreinoud } rtc_t; 71c1f753f9Sreinoud 72c1f753f9Sreinoud #define RTC_ADDR_CHECKSUM 0x3f 73c1f753f9Sreinoud #define RTC_ADDR_BOOTOPTS 0x90 74c1f753f9Sreinoud #define RTC_ADDR_REBOOTCNT 0x91 75c1f753f9Sreinoud #define RTC_ADDR_YEAR 0xc0 76c1f753f9Sreinoud #define RTC_ADDR_CENT 0xc1 77c1f753f9Sreinoud 78c1f753f9Sreinoud #ifdef _KERNEL 79*02cdf4d2Sdsl int cmos_read(int); 80*02cdf4d2Sdsl int cmos_write(int, int); 81c1f753f9Sreinoud #endif /* _KERNEL */ 82c1f753f9Sreinoud 83c1f753f9Sreinoud /* End of rtc.h */ 84