xref: /csrg-svn/sys/vax/include/clock.h (revision 2633)
1*2633Swnj /*	clock.h	4.5	81/02/23	*/
251Sbill 
351Sbill /*
451Sbill  * VAX clock registers
551Sbill  */
651Sbill 
7*2633Swnj #define	ICCS_RUN	0x00000001
8*2633Swnj #define	ICCS_TRANS	0x00000010
9*2633Swnj #define	ICCS_SS		0x00000020
10*2633Swnj #define	ICCS_IE		0x00000040
11*2633Swnj #define	ICCS_INT	0x00000080
1251Sbill #define	ICCS_ERR	0x80000000
1351Sbill 
14880Sbill #define	SECDAY		((unsigned)(24*60*60))		/* seconds per day */
15880Sbill #define	SECYR		((unsigned)(365*SECDAY))	/* per common year */
16880Sbill /*
17880Sbill  * TODRZERO is the what the TODR should contain when the ``year'' begins.
18880Sbill  * The TODR should always contain a number between 0 and SECYR+SECDAY.
19880Sbill  */
20880Sbill #define	TODRZERO	((unsigned)(1<<28))
2151Sbill 
22880Sbill #define	YRREF		1970
232307Swnj #define	LEAPYEAR(year)	((year)%4==0)	/* good till time becomes negative */
24880Sbill 
25880Sbill /*
26880Sbill  * Start a 60 HZ clock.
27880Sbill  */
28880Sbill #define	clkstart() {\
29880Sbill 	mtpr(NICR, -16667);	/* 16.667 milli-seconds */\
30880Sbill 	mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_TRANS+ICCS_INT+ICCS_ERR);\
31880Sbill }
32880Sbill #define	clkreld()	mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_INT+ICCS_ERR)
33880Sbill 
34880Sbill #define	clkwrap()	(((unsigned)mfpr(TODR) - TODRZERO)/100 > SECYR+SECDAY)
352447Swnj 
362447Swnj /*
372447Swnj  * Software clock is software interrupt level 8
382447Swnj  */
392447Swnj #define	setsoftclock()	mtpr(SIRR, 0x8)
40