Annotation of xinu/sys/clkinit.c, revision 1.1.1.1

1.1       root        1: /* clkinit.c - clkinit */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <sleep.h>
                      6: #include <procreg.h>
                      7: 
                      8: /* real-time clock variables and sleeping process queue pointers       */
                      9: 
                     10: #ifdef RTCLOCK
                     11: int    clmutex;                /* mutual exclusion for time-of-day     */
                     12: long   clktime;                /* current time in seconds since 1/1/70 */
                     13: int    tickctr;                /* counts 10ths of a second 10-0        */
                     14: int     defclk;                        /* non-zero, then deferring clock count */
                     15: int     clkdiff;               /* deferred clock ticks                 */
                     16: int     slnempty;              /* FALSE if the sleep queue is empty    */
                     17: short   *sltop;                        /* address of key part of top entry in  */
                     18:                                /* the sleep queue if slnonempty==TRUE  */
                     19: int     clockq;                        /* head of queue of sleeping processes  */
                     20: int    preempt;                /* preemption counter.  Current process */
                     21:                                /* is preempted when it reaches zero;   */
                     22:                                /* set in resched; counts in ticks      */
                     23: int    clkruns = TRUE;         /* set TRUE iff clock exists            */
                     24: #else
                     25: int    clkruns = FALSE;        /* no clock configured; be sure sleep   */
                     26: #endif                         /*   doesn't wait forever               */
                     27: #if defined(UVAX)
                     28: int    count10;                /* counts 100ths of a second 10-0       */
                     29: #endif
                     30: 
                     31: /*
                     32:  *------------------------------------------------------------------------
                     33:  * clkinit - initialize the clock and sleep queue (called at startup)
                     34:  *------------------------------------------------------------------------
                     35:  */
                     36: clkinit()
                     37: {
                     38:        *CVECTOR = (int) clkint;        /* call clkint on interrupt     */
                     39:        clmutex = screate(1);           /* semaphore for tod clock      */
                     40:        clktime = 0L;                   /* initially a low number       */
                     41:        preempt = QUANTUM;              /* initial time quantum         */
                     42:        slnempty = FALSE;               /* initially, no process asleep */
                     43:        clkdiff = 0;                    /* zero deferred ticks          */
                     44:        defclk = 0;                     /* clock is not deferred        */
                     45:        clockq = newqueue();            /* allocate clock queue in q    */
                     46:        tickctr = 10;                   /* 10ths of a second counter    */
                     47: #if defined(UVAX)
                     48:        count10 = 10;                   /* 100ths of a sec. counter     */
                     49:        mtpr(STRTUCLK, ICCS);           /* start real-time clock        */
                     50: #else
                     51:        mtpr(-CLKINTVL, NICR);          /* set interval to 0.1 sec      */
                     52:        mtpr(STRTCLK, ICCS);            /* start interval timer,        */
                     53:                                        /* enable clock to interrupt    */
                     54: #endif
                     55: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.