diff --git a/sys/amd64/amd64/tsc.c b/sys/amd64/amd64/tsc.c index b7624423d42d..3e25aa5e7782 100644 --- a/sys/amd64/amd64/tsc.c +++ b/sys/amd64/amd64/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.17 1994/09/14 23:09:06 ache Exp $ + * $Id: clock.c,v 1.18 1994/09/18 20:39:42 wollman Exp $ */ /* @@ -44,13 +44,17 @@ #include #include #include -#include #include #include #include #include #include -#include + +/* + * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we + * can use a simple formula for leap years. + */ +#define LEAPYEAR(y) ((u_int)(y) % 4 == 0) /* X-tals being what they are, it's nice to be able to fudge this one... */ /* Note, the name changed here from XTALSPEED to TIMER_FREQ rgrimes 4/26/93 */ @@ -58,9 +62,8 @@ #define TIMER_FREQ 1193182 /* XXX - should be in isa.h */ #endif #define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x)) -#define LEAPYEAR(y) (!((y)%4) && ((y)%100) || !((y)%400)) -static int beeping; +static int beeping; int timer0_divisor = TIMER_DIV(100); /* XXX should be hz */ u_int timer0_prescale; int adjkerntz = 0; /* offset from CMOS clock */ @@ -258,7 +261,7 @@ calibrate_cyclecounter(void) void DELAY(int n) { - int counter_limit, prev_tick, tick, ticks_left, sec, usec; + int prev_tick, tick, ticks_left, sec, usec; #ifdef DELAYDEBUG int getit_calls = 1; @@ -314,7 +317,8 @@ DELAY(int n) static void -sysbeepstop() +sysbeepstop(chan) + void *chan; { outb(IO_PPI, inb(IO_PPI)&0xFC); /* disable counter2 output to speaker */ release_timer2(); @@ -335,7 +339,7 @@ sysbeep(int pitch, int period) if (!beeping) { outb(IO_PPI, inb(IO_PPI) | 3); /* enable counter2 output to speaker */ beeping = period; - timeout(sysbeepstop, 0, period); + timeout(sysbeepstop, (void *)NULL, period); } return 0; } @@ -489,16 +493,6 @@ enablertclock() outb(IO_RTC+1, RTCSB_PINTR | RTCSB_24HR); } - -/* - * Delay for some number of milliseconds. - */ -void -spinwait(int millisecs) -{ - DELAY(1000 * millisecs); -} - void cpu_initclocks() { diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index b7624423d42d..3e25aa5e7782 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.17 1994/09/14 23:09:06 ache Exp $ + * $Id: clock.c,v 1.18 1994/09/18 20:39:42 wollman Exp $ */ /* @@ -44,13 +44,17 @@ #include #include #include -#include #include #include #include #include #include -#include + +/* + * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we + * can use a simple formula for leap years. + */ +#define LEAPYEAR(y) ((u_int)(y) % 4 == 0) /* X-tals being what they are, it's nice to be able to fudge this one... */ /* Note, the name changed here from XTALSPEED to TIMER_FREQ rgrimes 4/26/93 */ @@ -58,9 +62,8 @@ #define TIMER_FREQ 1193182 /* XXX - should be in isa.h */ #endif #define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x)) -#define LEAPYEAR(y) (!((y)%4) && ((y)%100) || !((y)%400)) -static int beeping; +static int beeping; int timer0_divisor = TIMER_DIV(100); /* XXX should be hz */ u_int timer0_prescale; int adjkerntz = 0; /* offset from CMOS clock */ @@ -258,7 +261,7 @@ calibrate_cyclecounter(void) void DELAY(int n) { - int counter_limit, prev_tick, tick, ticks_left, sec, usec; + int prev_tick, tick, ticks_left, sec, usec; #ifdef DELAYDEBUG int getit_calls = 1; @@ -314,7 +317,8 @@ DELAY(int n) static void -sysbeepstop() +sysbeepstop(chan) + void *chan; { outb(IO_PPI, inb(IO_PPI)&0xFC); /* disable counter2 output to speaker */ release_timer2(); @@ -335,7 +339,7 @@ sysbeep(int pitch, int period) if (!beeping) { outb(IO_PPI, inb(IO_PPI) | 3); /* enable counter2 output to speaker */ beeping = period; - timeout(sysbeepstop, 0, period); + timeout(sysbeepstop, (void *)NULL, period); } return 0; } @@ -489,16 +493,6 @@ enablertclock() outb(IO_RTC+1, RTCSB_PINTR | RTCSB_24HR); } - -/* - * Delay for some number of milliseconds. - */ -void -spinwait(int millisecs) -{ - DELAY(1000 * millisecs); -} - void cpu_initclocks() { diff --git a/sys/amd64/isa/icu.h b/sys/amd64/isa/icu.h index 22c9066564e3..8bafaf366c40 100644 --- a/sys/amd64/isa/icu.h +++ b/sys/amd64/isa/icu.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)icu.h 5.6 (Berkeley) 5/9/91 - * $Id: icu.h,v 1.3 1994/04/02 07:00:40 davidg Exp $ + * $Id: icu.h,v 1.4 1994/09/16 13:33:38 davidg Exp $ */ /* @@ -42,8 +42,8 @@ * W. Jolitz 8/89 */ -#ifndef __ICU__ -#define __ICU__ +#ifndef _I386_ISA_ICU_H_ +#define _I386_ISA_ICU_H_ #ifndef LOCORE @@ -52,17 +52,17 @@ */ extern unsigned imen; /* interrupt mask enable */ -#define INTREN(s) {imen &= ~(s); SET_ICUS()} -#define INTRDIS(s) {imen |= (s); SET_ICUS()} +#define INTREN(s) (imen &= ~(s), SET_ICUS()) +#define INTRDIS(s) (imen |= (s), SET_ICUS()) #define INTRMASK(msk,s) (msk |= (s)) #if 0 -#define SET_ICUS() {outb(IO_ICU1 + 1, imen); outb(IU_ICU2 + 1, imen >> 8);} +#define SET_ICUS() (outb(IO_ICU1 + 1, imen), outb(IU_ICU2 + 1, imen >> 8)) #else /* * XXX - IO_ICU* are defined in isa.h, not icu.h, and nothing much bothers to * include isa.h, while too many things include icu.h. */ -#define SET_ICUS() {outb(0x21, imen); outb(0xa1, imen >> 8);} +#define SET_ICUS() (outb(0x21, imen), outb(0xa1, imen >> 8)) #endif #endif @@ -94,4 +94,4 @@ extern unsigned imen; /* interrupt mask enable */ #define ICU_OFFSET 32 /* 0-31 are processor exceptions */ #define ICU_LEN 16 /* 32-47 are ISA interrupts */ -#endif __ICU__ +#endif /* !_I386_ISA_ICU_H_ */ diff --git a/sys/i386/i386/tsc.c b/sys/i386/i386/tsc.c index b7624423d42d..3e25aa5e7782 100644 --- a/sys/i386/i386/tsc.c +++ b/sys/i386/i386/tsc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.17 1994/09/14 23:09:06 ache Exp $ + * $Id: clock.c,v 1.18 1994/09/18 20:39:42 wollman Exp $ */ /* @@ -44,13 +44,17 @@ #include #include #include -#include #include #include #include #include #include -#include + +/* + * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we + * can use a simple formula for leap years. + */ +#define LEAPYEAR(y) ((u_int)(y) % 4 == 0) /* X-tals being what they are, it's nice to be able to fudge this one... */ /* Note, the name changed here from XTALSPEED to TIMER_FREQ rgrimes 4/26/93 */ @@ -58,9 +62,8 @@ #define TIMER_FREQ 1193182 /* XXX - should be in isa.h */ #endif #define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x)) -#define LEAPYEAR(y) (!((y)%4) && ((y)%100) || !((y)%400)) -static int beeping; +static int beeping; int timer0_divisor = TIMER_DIV(100); /* XXX should be hz */ u_int timer0_prescale; int adjkerntz = 0; /* offset from CMOS clock */ @@ -258,7 +261,7 @@ calibrate_cyclecounter(void) void DELAY(int n) { - int counter_limit, prev_tick, tick, ticks_left, sec, usec; + int prev_tick, tick, ticks_left, sec, usec; #ifdef DELAYDEBUG int getit_calls = 1; @@ -314,7 +317,8 @@ DELAY(int n) static void -sysbeepstop() +sysbeepstop(chan) + void *chan; { outb(IO_PPI, inb(IO_PPI)&0xFC); /* disable counter2 output to speaker */ release_timer2(); @@ -335,7 +339,7 @@ sysbeep(int pitch, int period) if (!beeping) { outb(IO_PPI, inb(IO_PPI) | 3); /* enable counter2 output to speaker */ beeping = period; - timeout(sysbeepstop, 0, period); + timeout(sysbeepstop, (void *)NULL, period); } return 0; } @@ -489,16 +493,6 @@ enablertclock() outb(IO_RTC+1, RTCSB_PINTR | RTCSB_24HR); } - -/* - * Delay for some number of milliseconds. - */ -void -spinwait(int millisecs) -{ - DELAY(1000 * millisecs); -} - void cpu_initclocks() { diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index b7624423d42d..3e25aa5e7782 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.17 1994/09/14 23:09:06 ache Exp $ + * $Id: clock.c,v 1.18 1994/09/18 20:39:42 wollman Exp $ */ /* @@ -44,13 +44,17 @@ #include #include #include -#include #include #include #include #include #include -#include + +/* + * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we + * can use a simple formula for leap years. + */ +#define LEAPYEAR(y) ((u_int)(y) % 4 == 0) /* X-tals being what they are, it's nice to be able to fudge this one... */ /* Note, the name changed here from XTALSPEED to TIMER_FREQ rgrimes 4/26/93 */ @@ -58,9 +62,8 @@ #define TIMER_FREQ 1193182 /* XXX - should be in isa.h */ #endif #define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x)) -#define LEAPYEAR(y) (!((y)%4) && ((y)%100) || !((y)%400)) -static int beeping; +static int beeping; int timer0_divisor = TIMER_DIV(100); /* XXX should be hz */ u_int timer0_prescale; int adjkerntz = 0; /* offset from CMOS clock */ @@ -258,7 +261,7 @@ calibrate_cyclecounter(void) void DELAY(int n) { - int counter_limit, prev_tick, tick, ticks_left, sec, usec; + int prev_tick, tick, ticks_left, sec, usec; #ifdef DELAYDEBUG int getit_calls = 1; @@ -314,7 +317,8 @@ DELAY(int n) static void -sysbeepstop() +sysbeepstop(chan) + void *chan; { outb(IO_PPI, inb(IO_PPI)&0xFC); /* disable counter2 output to speaker */ release_timer2(); @@ -335,7 +339,7 @@ sysbeep(int pitch, int period) if (!beeping) { outb(IO_PPI, inb(IO_PPI) | 3); /* enable counter2 output to speaker */ beeping = period; - timeout(sysbeepstop, 0, period); + timeout(sysbeepstop, (void *)NULL, period); } return 0; } @@ -489,16 +493,6 @@ enablertclock() outb(IO_RTC+1, RTCSB_PINTR | RTCSB_24HR); } - -/* - * Delay for some number of milliseconds. - */ -void -spinwait(int millisecs) -{ - DELAY(1000 * millisecs); -} - void cpu_initclocks() { diff --git a/sys/i386/isa/icu.h b/sys/i386/isa/icu.h index 22c9066564e3..8bafaf366c40 100644 --- a/sys/i386/isa/icu.h +++ b/sys/i386/isa/icu.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)icu.h 5.6 (Berkeley) 5/9/91 - * $Id: icu.h,v 1.3 1994/04/02 07:00:40 davidg Exp $ + * $Id: icu.h,v 1.4 1994/09/16 13:33:38 davidg Exp $ */ /* @@ -42,8 +42,8 @@ * W. Jolitz 8/89 */ -#ifndef __ICU__ -#define __ICU__ +#ifndef _I386_ISA_ICU_H_ +#define _I386_ISA_ICU_H_ #ifndef LOCORE @@ -52,17 +52,17 @@ */ extern unsigned imen; /* interrupt mask enable */ -#define INTREN(s) {imen &= ~(s); SET_ICUS()} -#define INTRDIS(s) {imen |= (s); SET_ICUS()} +#define INTREN(s) (imen &= ~(s), SET_ICUS()) +#define INTRDIS(s) (imen |= (s), SET_ICUS()) #define INTRMASK(msk,s) (msk |= (s)) #if 0 -#define SET_ICUS() {outb(IO_ICU1 + 1, imen); outb(IU_ICU2 + 1, imen >> 8);} +#define SET_ICUS() (outb(IO_ICU1 + 1, imen), outb(IU_ICU2 + 1, imen >> 8)) #else /* * XXX - IO_ICU* are defined in isa.h, not icu.h, and nothing much bothers to * include isa.h, while too many things include icu.h. */ -#define SET_ICUS() {outb(0x21, imen); outb(0xa1, imen >> 8);} +#define SET_ICUS() (outb(0x21, imen), outb(0xa1, imen >> 8)) #endif #endif @@ -94,4 +94,4 @@ extern unsigned imen; /* interrupt mask enable */ #define ICU_OFFSET 32 /* 0-31 are processor exceptions */ #define ICU_LEN 16 /* 32-47 are ISA interrupts */ -#endif __ICU__ +#endif /* !_I386_ISA_ICU_H_ */ diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c index b7624423d42d..3e25aa5e7782 100644 --- a/sys/isa/atrtc.c +++ b/sys/isa/atrtc.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.17 1994/09/14 23:09:06 ache Exp $ + * $Id: clock.c,v 1.18 1994/09/18 20:39:42 wollman Exp $ */ /* @@ -44,13 +44,17 @@ #include #include #include -#include #include #include #include #include #include -#include + +/* + * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we + * can use a simple formula for leap years. + */ +#define LEAPYEAR(y) ((u_int)(y) % 4 == 0) /* X-tals being what they are, it's nice to be able to fudge this one... */ /* Note, the name changed here from XTALSPEED to TIMER_FREQ rgrimes 4/26/93 */ @@ -58,9 +62,8 @@ #define TIMER_FREQ 1193182 /* XXX - should be in isa.h */ #endif #define TIMER_DIV(x) ((TIMER_FREQ+(x)/2)/(x)) -#define LEAPYEAR(y) (!((y)%4) && ((y)%100) || !((y)%400)) -static int beeping; +static int beeping; int timer0_divisor = TIMER_DIV(100); /* XXX should be hz */ u_int timer0_prescale; int adjkerntz = 0; /* offset from CMOS clock */ @@ -258,7 +261,7 @@ calibrate_cyclecounter(void) void DELAY(int n) { - int counter_limit, prev_tick, tick, ticks_left, sec, usec; + int prev_tick, tick, ticks_left, sec, usec; #ifdef DELAYDEBUG int getit_calls = 1; @@ -314,7 +317,8 @@ DELAY(int n) static void -sysbeepstop() +sysbeepstop(chan) + void *chan; { outb(IO_PPI, inb(IO_PPI)&0xFC); /* disable counter2 output to speaker */ release_timer2(); @@ -335,7 +339,7 @@ sysbeep(int pitch, int period) if (!beeping) { outb(IO_PPI, inb(IO_PPI) | 3); /* enable counter2 output to speaker */ beeping = period; - timeout(sysbeepstop, 0, period); + timeout(sysbeepstop, (void *)NULL, period); } return 0; } @@ -489,16 +493,6 @@ enablertclock() outb(IO_RTC+1, RTCSB_PINTR | RTCSB_24HR); } - -/* - * Delay for some number of milliseconds. - */ -void -spinwait(int millisecs) -{ - DELAY(1000 * millisecs); -} - void cpu_initclocks() {