xref: /csrg-svn/sys/vax/include/clock.h (revision 880)
1*880Sbill /*	clock.h	3.3	09/16/80	*/
251Sbill 
351Sbill /*
451Sbill  * VAX clock registers
551Sbill  */
651Sbill 
751Sbill #define	ICCS_RUN	0x1
851Sbill #define	ICCS_TRANS	0x10
951Sbill #define	ICCS_SS		0x20
1051Sbill #define	ICCS_IE		0x40
1151Sbill #define	ICCS_INT	0x80
1251Sbill #define	ICCS_ERR	0x80000000
1351Sbill 
14*880Sbill #define	SECDAY		((unsigned)(24*60*60))		/* seconds per day */
15*880Sbill #define	SECYR		((unsigned)(365*SECDAY))	/* per common year */
16*880Sbill /*
17*880Sbill  * TODRZERO is the what the TODR should contain when the ``year'' begins.
18*880Sbill  * The TODR should always contain a number between 0 and SECYR+SECDAY.
19*880Sbill  */
20*880Sbill #define	TODRZERO	((unsigned)(1<<28))
2151Sbill 
22*880Sbill #define	YRREF		1970
23*880Sbill #define	LEAPYEAR(year)	((year)%4==0 && year != 2000)	/* good till 2100 */
24*880Sbill 
25*880Sbill /*
26*880Sbill  * Start a 60 HZ clock.
27*880Sbill  */
28*880Sbill #define	clkstart() {\
29*880Sbill 	mtpr(NICR, -16667);	/* 16.667 milli-seconds */\
30*880Sbill 	mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_TRANS+ICCS_INT+ICCS_ERR);\
31*880Sbill }
32*880Sbill #define	clkreld()	mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_INT+ICCS_ERR)
33*880Sbill 
34*880Sbill #define	clkwrap()	(((unsigned)mfpr(TODR) - TODRZERO)/100 > SECYR+SECDAY)
35