added pty driver
[unix-history] / usr / src / sys / vax / include / clock.h
index df55c63..aa28a8f 100644 (file)
@@ -1,4 +1,4 @@
-/*     clock.h 3.2     %G%     */
+/*     clock.h 4.1     %G%     */
 
 /*
  * VAX clock registers
 
 /*
  * VAX clock registers
 #define        ICCS_INT        0x80
 #define        ICCS_ERR        0x80000000
        
 #define        ICCS_INT        0x80
 #define        ICCS_ERR        0x80000000
        
-/* THIS IS RIDICULOUS */
-#define        YRCURR  1980            /* current year */
+#define        SECDAY          ((unsigned)(24*60*60))          /* seconds per day */
+#define        SECYR           ((unsigned)(365*SECDAY))        /* per common year */
+/*
+ * TODRZERO is the what the TODR should contain when the ``year'' begins.
+ * The TODR should always contain a number between 0 and SECYR+SECDAY.
+ */
+#define        TODRZERO        ((unsigned)(1<<28))
+
+#define        YRREF           1970
+#define        LEAPYEAR(year)  ((year)%4==0 && year != 2000)   /* good till 2100 */
+
+/*
+ * Start a 60 HZ clock.
+ */
+#define        clkstart() {\
+       mtpr(NICR, -16667);     /* 16.667 milli-seconds */\
+       mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_TRANS+ICCS_INT+ICCS_ERR);\
+}
+#define        clkreld()       mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_INT+ICCS_ERR)
 
 
-#define        YRREF   1970            /* reference year for time */
-#define        SECHR   (60*60)         /* seconds/hr */
-#define        SECDAY  (24*SECHR)      /* seconds/day */
-#define        SECYR   (365*SECDAY)    /* seconds/common year */
+#define        clkwrap()       (((unsigned)mfpr(TODR) - TODRZERO)/100 > SECYR+SECDAY)