xref: /netbsd-src/sys/arch/amiga/dev/rtc.h (revision 41e877e7066c60eba1892ef73727b391b965ef64)
1*41e877e7Srkujawa /*	$NetBSD: rtc.h,v 1.10 2012/11/14 13:36:02 rkujawa Exp $	*/
2ec77f0b3Scgd 
315d4cf6bSchopps /*
415d4cf6bSchopps  * Copyright (c) 1994 Christian E. Hopps
515d4cf6bSchopps  * All rights reserved.
615d4cf6bSchopps  *
715d4cf6bSchopps  * Redistribution and use in source and binary forms, with or without
815d4cf6bSchopps  * modification, are permitted provided that the following conditions
915d4cf6bSchopps  * are met:
1015d4cf6bSchopps  * 1. Redistributions of source code must retain the above copyright
1115d4cf6bSchopps  *    notice, this list of conditions and the following disclaimer.
1215d4cf6bSchopps  * 2. Redistributions in binary form must reproduce the above copyright
1315d4cf6bSchopps  *    notice, this list of conditions and the following disclaimer in the
1415d4cf6bSchopps  *    documentation and/or other materials provided with the distribution.
1515d4cf6bSchopps  * 3. All advertising materials mentioning features or use of this software
1615d4cf6bSchopps  *    must display the following acknowledgement:
1715d4cf6bSchopps  *      This product includes software developed by Christian E. Hopps.
1815d4cf6bSchopps  * 4. The name of the author may not be used to endorse or promote products
1915d4cf6bSchopps  *    derived from this software without specific prior written permission
2015d4cf6bSchopps  *
2115d4cf6bSchopps  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2215d4cf6bSchopps  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2315d4cf6bSchopps  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2415d4cf6bSchopps  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2515d4cf6bSchopps  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2615d4cf6bSchopps  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2715d4cf6bSchopps  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2815d4cf6bSchopps  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2915d4cf6bSchopps  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3015d4cf6bSchopps  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3115d4cf6bSchopps  *
3215d4cf6bSchopps  * information on A3000 clock from Holger Emden.
3315d4cf6bSchopps  */
3415d4cf6bSchopps #ifndef _RTCVAR_H_
3515d4cf6bSchopps #define _RTCVAR_H_
3615d4cf6bSchopps 
37fc3de9d8Sis /* this is a hook set by a clock driver for the configured realtime clock,
38fc3de9d8Sis    returning plain current unix-time */
39fc3de9d8Sis 
40109792dcSmatt extern int (*ugettod)(struct timeval *);
41109792dcSmatt extern int (*usettod)(struct timeval *);
42fc3de9d8Sis 
4315d4cf6bSchopps struct rtclock3000 {
4415d4cf6bSchopps 	u_int  :28, second2:4;	/* 0x03  lower digit */
4515d4cf6bSchopps 	u_int  :28, second1:4;	/* 0x07  upper digit */
4615d4cf6bSchopps 	u_int  :28, minute2:4;	/* 0x0b  lower digit */
4715d4cf6bSchopps 	u_int  :28, minute1:4;	/* 0x0f  upper digit */
4815d4cf6bSchopps 	u_int  :28, hour2:4;	/* 0x13  lower digit */
4915d4cf6bSchopps 	u_int  :28, hour1:4;	/* 0x17  upper digit */
5015d4cf6bSchopps 	u_int  :28, weekday:4;	/* 0x1b */
5115d4cf6bSchopps 	u_int  :28, day2:4;	/* 0x1f  lower digit */
5215d4cf6bSchopps 	u_int  :28, day1:4;	/* 0x23  upper digit */
5315d4cf6bSchopps 	u_int  :28, month2:4;	/* 0x27  lower digit */
5415d4cf6bSchopps 	u_int  :28, month1:4;	/* 0x2b  upper digit */
5515d4cf6bSchopps 	u_int  :28, year2:4;	/* 0x2f  lower digit */
5615d4cf6bSchopps 	u_int  :28, year1:4;	/* 0x33  upper digit */
5715d4cf6bSchopps 	u_int  :28, control1:4;	/* 0x37  control-byte 1 */
5815d4cf6bSchopps 	u_int  :28, control2:4;	/* 0x3b  control-byte 2 */
5915d4cf6bSchopps 	u_int  :28, control3:4;	/* 0x3f  control-byte 3 */
6015d4cf6bSchopps };
6115d4cf6bSchopps 
6215d4cf6bSchopps #define A3CONTROL1_HOLD_CLOCK	0
6315d4cf6bSchopps #define A3CONTROL1_FREE_CLOCK	9
6415d4cf6bSchopps 
652e3d1cc0Sis /* mode1 registers used by us */
662e3d1cc0Sis #define leapyear year2
672e3d1cc0Sis 
6815d4cf6bSchopps #define A3BBC_SET_REG 	0xe0
6915d4cf6bSchopps #define A3BBC_WRITE_REG	0xc2
7015d4cf6bSchopps #define A3BBC_READ_REG	0xc3
7115d4cf6bSchopps #define A3NUM_BBC_REGS	12
7215d4cf6bSchopps 
73b2361aa1Sveego /*
74b2361aa1Sveego  * Our clock starts at 1/1/1970, but counts the years from 1900.
75b2361aa1Sveego  */
7615d4cf6bSchopps #define	STARTOFTIME	1970
77b2361aa1Sveego #define	CLOCK_BASE_YEAR	1900
7815d4cf6bSchopps 
7915d4cf6bSchopps #endif /* _RTCVAR_H_ */
80