add cpu_set_init_frame to initialize init's syscall frame
[unix-history] / usr / src / sys / vax / include / clock.h
CommitLineData
80992c50
KB
1/*-
2 * Copyright (c) 1982, 1986 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.proprietary.c%
da7c5cc6 6 *
80992c50 7 * @(#)clock.h 7.3 (Berkeley) %G%
da7c5cc6 8 */
dc9546ae
BJ
9
10/*
11 * VAX clock registers
12 */
13
dd259ba3
BJ
14#define ICCS_RUN 0x00000001
15#define ICCS_TRANS 0x00000010
16#define ICCS_SS 0x00000020
17#define ICCS_IE 0x00000040
18#define ICCS_INT 0x00000080
dc9546ae
BJ
19#define ICCS_ERR 0x80000000
20
93359143
BJ
21#define SECDAY ((unsigned)(24*60*60)) /* seconds per day */
22#define SECYR ((unsigned)(365*SECDAY)) /* per common year */
23/*
24 * TODRZERO is the what the TODR should contain when the ``year'' begins.
25 * The TODR should always contain a number between 0 and SECYR+SECDAY.
26 */
27#define TODRZERO ((unsigned)(1<<28))
28
29#define YRREF 1970
768f552e 30#define LEAPYEAR(year) ((year)%4==0) /* good till time becomes negative */
93359143
BJ
31
32/*
d21d4302 33 * Has the time-of-day clock wrapped around?
93359143 34 */
93359143 35#define clkwrap() (((unsigned)mfpr(TODR) - TODRZERO)/100 > SECYR+SECDAY)
546011e3
BJ
36
37/*
17e0f483
BJ
38 * Software clock is software interrupt level 8,
39 * implemented as mtpr(SIRR, 0x8) in asm.sed.
546011e3 40 */
9a0de372
MK
41
42#ifndef LOCORE
43/*
44 * 8200s and 630s have a clock chip like those found in digital alarm
45 * clocks and watches. Converting this to and from system times is
46 * painful, so we do it in only one place. The routine chiptotime()
47 * converts a chiptime to the right value for time.tv_sec, and
48 * timetochip converts time.tv_sec back.
49 */
50struct chiptime {
51 int sec;
52 int min;
53 int hour;
54 int day;
55 int mon;
56 int year;
57};
58
59/*
60 * Clock read routine return values.
61 */
62#define CLKREAD_OK 0 /* success, time.tv_sec set */
63#define CLKREAD_WARN 1 /* clock appears wrong but time set anyway */
64#define CLKREAD_BAD 2 /* clock is bad, no time available */
65#endif