xref: /netbsd-src/sys/arch/vax/include/clock.h (revision 6a6027692662ba623e7bf5274322989a7b5d1440)
1*6a602769Sragge /*	$NetBSD: clock.h,v 1.10 2017/05/22 17:12:11 ragge Exp $ */
27ac59ffeSragge /*
37ac59ffeSragge  * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
47ac59ffeSragge  * All rights reserved.
57ac59ffeSragge  *
67ac59ffeSragge  * Redistribution and use in source and binary forms, with or without
77ac59ffeSragge  * modification, are permitted provided that the following conditions
87ac59ffeSragge  * are met:
97ac59ffeSragge  * 1. Redistributions of source code must retain the above copyright
107ac59ffeSragge  *    notice, this list of conditions and the following disclaimer.
117ac59ffeSragge  * 2. Redistributions in binary form must reproduce the above copyright
127ac59ffeSragge  *    notice, this list of conditions and the following disclaimer in the
137ac59ffeSragge  *    documentation and/or other materials provided with the distribution.
147ac59ffeSragge  *
157ac59ffeSragge  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
167ac59ffeSragge  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
177ac59ffeSragge  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
187ac59ffeSragge  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
197ac59ffeSragge  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
207ac59ffeSragge  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
217ac59ffeSragge  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
227ac59ffeSragge  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
237ac59ffeSragge  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
247ac59ffeSragge  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
257ac59ffeSragge  */
2627176f37Smatt #ifndef _VAX_CLOCK_H_
2727176f37Smatt #define	_VAX_CLOCK_H_
2827176f37Smatt 
2927176f37Smatt #include <dev/clock_subr.h>
307ac59ffeSragge 
317ac59ffeSragge /*
327ac59ffeSragge  * Time constants. These are unlikely to change.
337ac59ffeSragge  */
347ac59ffeSragge #define TODRBASE	(1 << 28) /* Rumours says it comes from VMS */
357ac59ffeSragge 
36e3a104cbSragge #define	SEC_OFF		0
37e3a104cbSragge #define	MIN_OFF		2
38e3a104cbSragge #define	HR_OFF		4
39e3a104cbSragge #define	WDAY_OFF	6
40e3a104cbSragge #define	DAY_OFF		7
41e3a104cbSragge #define	MON_OFF		8
42e3a104cbSragge #define	YR_OFF		9
43e3a104cbSragge #define	CSRA_OFF	10
44e3a104cbSragge #define	CSRB_OFF	11
45e3a104cbSragge #define	CSRD_OFF	13
46e3a104cbSragge 
47e3a104cbSragge #define	CSRA_UIP	0200
48e3a104cbSragge #define	CSRB_SET	0200
49e3a104cbSragge #define	CSRB_24		0002
50e3a104cbSragge #define	CSRB_DM		0004
51e3a104cbSragge #define	CSRD_VRT	0200
52e3a104cbSragge 
5356f0f92bSragge /* Var's used when dealing with clock chip */
54fe8a330bSragge extern	volatile short *clk_page;
5556f0f92bSragge extern	int clk_adrshift, clk_tweak;
5656f0f92bSragge 
577ac59ffeSragge /* Prototypes */
58471e528bStsutsui int generic_gettime(struct timeval *);
59471e528bStsutsui void generic_settime(struct timeval *);
60471e528bStsutsui int chip_gettime(struct timeval *);
61471e528bStsutsui void chip_settime(struct timeval *);
62550bb5fbSragge int yeartonum(int);
63550bb5fbSragge int numtoyear(int);
6427176f37Smatt 
6527176f37Smatt #endif /* _VAX_CLOCK_H_ */
66