diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c index 80f485e7f65e..6c54e1f179ad 100644 --- a/sys/arch/i386/isa/clock.c +++ b/sys/arch/i386/isa/clock.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 - * $Id: clock.c,v 1.21 1994/04/24 01:34:05 mycroft Exp $ + * $Id: clock.c,v 1.22 1994/05/03 08:23:57 mycroft Exp $ */ /* * Mach Operating System @@ -116,8 +116,8 @@ startrtclock() outb(TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT); /* Correct rounding will buy us a better precision in timekeeping */ - outb (IO_TIMER1, TIMER_DIV(hz)%256); - outb (IO_TIMER1, TIMER_DIV(hz)/256); + outb(IO_TIMER1, TIMER_DIV(hz)%256); + outb(IO_TIMER1, TIMER_DIV(hz)/256); /* Check diagnostic status */ outb (IO_RTC, RTC_DIAG); @@ -213,6 +213,41 @@ delay(n) } } +static int beeping; + +void +sysbeepstop(arg) + void *arg; +{ + + /* disable counter 2 */ + disable_intr(); + outb(PITAUX_PORT, inb(PITAUX_PORT) & ~PIT_SPKR); + enable_intr(); + beeping = 0; +} + +void +sysbeep(pitch, period) + int pitch, period; +{ + static int last_pitch, last_period; + + if (beeping) + untimeout(sysbeepstop, 0); + if (!beeping || last_pitch != pitch) { + disable_intr(); + outb(TIMER_MODE, TIMER_SEL2 | TIMER_16BIT | TIMER_SQWAVE); + outb(TIMER_CNTR2, TIMER_DIV(pitch)%256); + outb(TIMER_CNTR2, TIMER_DIV(pitch)/256); + outb(PITAUX_PORT, inb(PITAUX_PORT) | PIT_SPKR); /* enable counter 2 */ + enable_intr(); + } + last_pitch = pitch; + beeping = last_period = period; + timeout(sysbeepstop, 0, period); +} + unsigned int delaycount; /* calibrated loop variable (1 millisecond) */ #define FIRST_GUESS 0x2000 diff --git a/sys/arch/i386/isa/isa.c b/sys/arch/i386/isa/isa.c index bfcb50fb9018..85a8cebee741 100644 --- a/sys/arch/i386/isa/isa.c +++ b/sys/arch/i386/isa/isa.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: isa.c,v 1.52 1994/04/24 01:34:09 mycroft Exp $ + * $Id: isa.c,v 1.53 1994/05/03 08:23:55 mycroft Exp $ */ /* @@ -271,50 +271,3 @@ isa_configure() spl0(); } - -static int beeping; - -static void -sysbeepstop(int f) -{ - int s = splhigh(); - - /* disable counter 2 */ - disable_intr(); - outb(PITAUX_PORT, inb(PITAUX_PORT) & ~PIT_SPKR); - enable_intr(); - if (f) - timeout((timeout_t)sysbeepstop, (caddr_t)0, f); - else - beeping = 0; - - splx(s); -} - -void -sysbeep(int pitch, int period) -{ - int s = splhigh(); - static int last_pitch, last_period; - - if (beeping) { - untimeout((timeout_t)sysbeepstop, (caddr_t)(last_period/2)); - untimeout((timeout_t)sysbeepstop, (caddr_t)0); - } - if (!beeping || last_pitch != pitch) { - /* - * XXX - move timer stuff to clock.c. - */ - disable_intr(); - outb(TIMER_MODE, TIMER_SEL2|TIMER_16BIT|TIMER_SQWAVE); - outb(TIMER_CNTR2, TIMER_DIV(pitch)%256); - outb(TIMER_CNTR2, TIMER_DIV(pitch)/256); - outb(PITAUX_PORT, inb(PITAUX_PORT) | PIT_SPKR); /* enable counter 2 */ - enable_intr(); - } - last_pitch = pitch; - beeping = last_period = period; - timeout((timeout_t)sysbeepstop, (caddr_t)(period/2), period); - - splx(s); -} diff --git a/sys/dev/isa/isa.c b/sys/dev/isa/isa.c index bfcb50fb9018..85a8cebee741 100644 --- a/sys/dev/isa/isa.c +++ b/sys/dev/isa/isa.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: isa.c,v 1.52 1994/04/24 01:34:09 mycroft Exp $ + * $Id: isa.c,v 1.53 1994/05/03 08:23:55 mycroft Exp $ */ /* @@ -271,50 +271,3 @@ isa_configure() spl0(); } - -static int beeping; - -static void -sysbeepstop(int f) -{ - int s = splhigh(); - - /* disable counter 2 */ - disable_intr(); - outb(PITAUX_PORT, inb(PITAUX_PORT) & ~PIT_SPKR); - enable_intr(); - if (f) - timeout((timeout_t)sysbeepstop, (caddr_t)0, f); - else - beeping = 0; - - splx(s); -} - -void -sysbeep(int pitch, int period) -{ - int s = splhigh(); - static int last_pitch, last_period; - - if (beeping) { - untimeout((timeout_t)sysbeepstop, (caddr_t)(last_period/2)); - untimeout((timeout_t)sysbeepstop, (caddr_t)0); - } - if (!beeping || last_pitch != pitch) { - /* - * XXX - move timer stuff to clock.c. - */ - disable_intr(); - outb(TIMER_MODE, TIMER_SEL2|TIMER_16BIT|TIMER_SQWAVE); - outb(TIMER_CNTR2, TIMER_DIV(pitch)%256); - outb(TIMER_CNTR2, TIMER_DIV(pitch)/256); - outb(PITAUX_PORT, inb(PITAUX_PORT) | PIT_SPKR); /* enable counter 2 */ - enable_intr(); - } - last_pitch = pitch; - beeping = last_period = period; - timeout((timeout_t)sysbeepstop, (caddr_t)(period/2), period); - - splx(s); -}