|
|
1.1 root 1: #include <conf.h>
2: #include <kernel.h>
3: #include <sleep.h>
1.1.1.2 ! root 4: #ifdef ATT7300
! 5: #include <intvectors_7300.h>
! 6: #include <mcr7300.h>
1.1 root 7: #else
1.1.1.2 ! root 8: #include <intvectors_mecb.h>
! 9: #include <clock.h>
1.1 root 10: #endif
11:
1.1.1.2 ! root 12: extern clkint(),spurint();
! 13: extern count6,preempt ;
! 14: #ifdef ATT7300
! 15: /* ATT7300 misc. control reg. is write-only, so keep copy of its normal
! 16: value in memory--currently only used for clock tick acknowledge */
! 17: unsigned short soft_mcr7300 = 0;
! 18: unsigned short *tstat ; /* global pointer to timer tstat, used in clkint.s */
! 19: #else
! 20: unsigned char *tstat ; /* global pointer to timer tstat, used in clkint.s */
! 21: #endif
1.1 root 22: /*
1.1.1.2 ! root 23: *------------------------------------------------------------------
1.1 root 24: * clkinit - initialize the clock and sleep queue (called at startup)
1.1.1.2 ! root 25: *------------------------------------------------------------------
1.1 root 26: */
27: clkinit()
28: {
1.1.1.2 ! root 29: int len;
! 30: int clockqtail; /* need place to put it, but never used */
! 31:
! 32: CLOCKVEC = clkint; /* set up interrupt vector */
! 33: setclkr(); /* set global flag clock on */
! 34: preempt = QUANTUM; /* initial time quantum */
! 35: count6 = 6; /* 60ths of a sec. counter */
! 36: slnempty = FALSE; /* initially, no process asleep */
! 37: clkdiff = 0; /* zero deferred ticks */
! 38: defclk = 0; /* clock is not deferred */
! 39: newqueue(&clockq,&clockqtail);/* allocate clock queue in q */
! 40:
! 41: #ifdef ATT7300
! 42: tstat = MCR7300; /* pointer to MCR for clkint.s */
! 43: soft_mcr7300 |= CLRCLKINT; /* bit was low from sys reset, make hi */
! 44: kprintf("starting clock...\n");
! 45: *MCR7300 = soft_mcr7300; /* put new val in hardware MCR */
1.1 root 46: #else
1.1.1.2 ! root 47: /* Added for MECB: set up timer of 68230 as line clock-- */
! 48: /* specify clock int location to clock device, as int vect slot#-- */
! 49: SPURVEC = spurint; /* and handle spurious ints too */
! 50: TIMER->tivr = (char)(((int)CLOCKVECADDRESS)>>2); /* i.e div by 4 */
! 51: /* specify downcount to be loaded at each zero detect-- */
! 52: /* 3 byte register at odd-addressed bytes, 1 downcount=8usec */
! 53: TIMER->cpr_high = 0;
! 54: TIMER->cpr_med = 8; /* approx 16 msecs apart (8*256*8=16K usec) */
! 55: TIMER->cpr_low = 0; /* --i.e, approx 1/60 sec, like PDP11 clock */
! 56: kprintf("starting clock...\n");
! 57: TIMER->tcsr = (CLOCKIE|LOADFROMCPR|PRESCALE32|CLOCKON); /* start timer */
! 58: tstat = &TIMER->tstat; /* set up the global address of timer tstat */
! 59: TIMER->tstat = 1; /* reset counter (otherwise wait to roll over, ~2min) */
1.1 root 60: #endif
61: }
1.1.1.2 ! root 62:
! 63: spurintc()
! 64: {
! 65: kprintf("Received a spurious interrupt\n");
! 66: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.