This commit is contained in:
scottr 1996-03-12 19:18:49 +00:00
parent d99c63563c
commit 89f7d665d5
1 changed files with 65 additions and 62 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.25 1996/03/12 04:34:46 scottr Exp $ */ /* $NetBSD: clock.c,v 1.26 1996/03/12 19:18:49 scottr Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -113,11 +113,12 @@ static int month_days[12] = {
* We use VIA1 timer 1. * We use VIA1 timer 1.
*/ */
void void
startrtclock(void) startrtclock()
{ {
/* BARF MF startrt clock is called twice in init_main, configure, /*
the reason why is doced in configure */ * BARF MF startrt clock is called twice in init_main, configure,
* the reason why is doced in configure
*/
/* be certain clock interrupts are off */ /* be certain clock interrupts are off */
via_reg(VIA1, vIER) = V1IF_T1; via_reg(VIA1, vIER) = V1IF_T1;
@ -134,7 +135,7 @@ startrtclock(void)
} }
void void
enablertclock(void) enablertclock()
{ {
/* clear then enable clock interrupt. */ /* clear then enable clock interrupt. */
via_reg(VIA1, vIFR) |= V1IF_T1; via_reg(VIA1, vIFR) |= V1IF_T1;
@ -142,18 +143,19 @@ enablertclock(void)
} }
void void
cpu_initclocks(void) cpu_initclocks()
{ {
enablertclock(); enablertclock();
} }
void void
setstatclockrate(int rateinhz) setstatclockrate()
int rateinhz;
{ {
} }
void void
disablertclock(void) disablertclock()
{ {
/* disable clock interrupt */ /* disable clock interrupt */
via_reg(VIA1, vIER) = V1IF_T1; via_reg(VIA1, vIER) = V1IF_T1;
@ -204,7 +206,7 @@ char profon = 0; /* Is profiling clock on? */
#define PRF_KERNEL 0x80 #define PRF_KERNEL 0x80
void void
initprofclock(void) initprofclock()
{ {
/* profile interval must be even divisor of system clock interval */ /* profile interval must be even divisor of system clock interval */
if (profint > CLK_INTERVAL) if (profint > CLK_INTERVAL)
@ -221,7 +223,7 @@ initprofclock(void)
} }
void void
startprofclock(void) startprofclock()
{ {
via_reg(VIA2, vT1L) = (profint - 1) & 0xff; via_reg(VIA2, vT1L) = (profint - 1) & 0xff;
via_reg(VIA2, vT1LH) = (profint - 1) >> 8; via_reg(VIA2, vT1LH) = (profint - 1) >> 8;
@ -231,7 +233,7 @@ startprofclock(void)
} }
void void
stopprofclock(void) stopprofclock()
{ {
via_reg(VIA2, vT1L) = 0; via_reg(VIA2, vT1L) = 0;
via_reg(VIA2, vT1LH) = 0; via_reg(VIA2, vT1LH) = 0;
@ -247,7 +249,8 @@ stopprofclock(void)
* Assumes it is called with clock interrupts blocked. * Assumes it is called with clock interrupts blocked.
*/ */
void void
profclock(clockframe * pclk) profclock(pclk)
clockframe *pclk;
{ {
/* /*
* Came from user mode. * Came from user mode.
@ -287,12 +290,13 @@ profclock(clockframe * pclk)
* GMT bias adjustment is done elsewhere. * GMT bias adjustment is done elsewhere.
*/ */
static u_long static u_long
ugmt_2_pramt(u_long t) ugmt_2_pramt(t)
u_long t;
{ {
/* don't know how to open a file properly. */ /* don't know how to open a file properly. */
/* assume compiled timezone is correct. */ /* assume compiled timezone is correct. */
return (t = t + DIFF19041970 - 60*tz.tz_minuteswest); return (t = t + DIFF19041970 - 60 * tz.tz_minuteswest);
} }
/* /*
@ -300,9 +304,10 @@ ugmt_2_pramt(u_long t)
* GMT bias adjustment is done elsewhere. * GMT bias adjustment is done elsewhere.
*/ */
static u_long static u_long
pramt_2_ugmt(u_long t) pramt_2_ugmt(t)
u_long t;
{ {
return (t = t - DIFF19041970 + 60*tz.tz_minuteswest); return (t = t - DIFF19041970 + 60 * tz.tz_minuteswest);
} }
/* /*
@ -328,7 +333,8 @@ int mac68k_trust_pram = 1;
* and sanity checking. * and sanity checking.
*/ */
void void
inittodr(time_t base) inittodr(base)
time_t base;
{ {
u_long timbuf; u_long timbuf;
u_long pramtime; u_long pramtime;
@ -386,7 +392,7 @@ inittodr(time_t base)
* changed system time. * changed system time.
*/ */
void void
resettodr(void) resettodr()
{ {
if (mac68k_trust_pram) if (mac68k_trust_pram)
/* /*
@ -401,7 +407,6 @@ resettodr(void)
"to the pram on this system.\n"); "to the pram on this system.\n");
#endif #endif
} }
/* /*
* The Macintosh timers decrement once every 1.2766 microseconds. * The Macintosh timers decrement once every 1.2766 microseconds.
* MGFH2, p. 180 * MGFH2, p. 180
@ -434,8 +439,7 @@ delay(usec)
else else
cycles = ((usec > 0 ? usec : 1) * delay_factor) >> 7; cycles = ((usec > 0 ? usec : 1) * delay_factor) >> 7;
while ((cycles-- > 0) && delay_flag) while ((cycles-- > 0) && delay_flag);
;
} }
/* /*
@ -453,8 +457,7 @@ dummy_delay(usec)
else else
cycles = ((usec > 0 ? usec : 1) * delay_factor) >> 7; cycles = ((usec > 0 ? usec : 1) * delay_factor) >> 7;
while ((cycles-- > 0) && delay_flag) while ((cycles-- > 0) && delay_flag);
;
return ((delay_factor >> 7) - cycles); return ((delay_factor >> 7) - cycles);
} }