Commit | Line | Data |
---|---|---|
4e0c95d7 | 1 | /* clock.h 4.1 %G% */ |
dc9546ae BJ |
2 | |
3 | /* | |
4 | * VAX clock registers | |
5 | */ | |
6 | ||
7 | #define ICCS_RUN 0x1 | |
8 | #define ICCS_TRANS 0x10 | |
9 | #define ICCS_SS 0x20 | |
10 | #define ICCS_IE 0x40 | |
11 | #define ICCS_INT 0x80 | |
12 | #define ICCS_ERR 0x80000000 | |
13 | ||
93359143 BJ |
14 | #define SECDAY ((unsigned)(24*60*60)) /* seconds per day */ |
15 | #define SECYR ((unsigned)(365*SECDAY)) /* per common year */ | |
16 | /* | |
17 | * TODRZERO is the what the TODR should contain when the ``year'' begins. | |
18 | * The TODR should always contain a number between 0 and SECYR+SECDAY. | |
19 | */ | |
20 | #define TODRZERO ((unsigned)(1<<28)) | |
21 | ||
22 | #define YRREF 1970 | |
23 | #define LEAPYEAR(year) ((year)%4==0 && year != 2000) /* good till 2100 */ | |
24 | ||
25 | /* | |
26 | * Start a 60 HZ clock. | |
27 | */ | |
28 | #define clkstart() {\ | |
29 | mtpr(NICR, -16667); /* 16.667 milli-seconds */\ | |
30 | mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_TRANS+ICCS_INT+ICCS_ERR);\ | |
31 | } | |
32 | #define clkreld() mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_INT+ICCS_ERR) | |
dc9546ae | 33 | |
93359143 | 34 | #define clkwrap() (((unsigned)mfpr(TODR) - TODRZERO)/100 > SECYR+SECDAY) |