BSD 4_1_snap development
[unix-history] / sys / h / clock.h
CommitLineData
6bafdb92
C
1/* clock.h 4.5 81/02/23 */
2
3/*
4 * VAX clock registers
5 */
6
7#define ICCS_RUN 0x00000001
8#define ICCS_TRANS 0x00000010
9#define ICCS_SS 0x00000020
10#define ICCS_IE 0x00000040
11#define ICCS_INT 0x00000080
12#define ICCS_ERR 0x80000000
13
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) /* good till time becomes negative */
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)
33
34#define clkwrap() (((unsigned)mfpr(TODR) - TODRZERO)/100 > SECYR+SECDAY)
35
36/*
37 * Software clock is software interrupt level 8
38 */
39#define setsoftclock() mtpr(SIRR, 0x8)