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