summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2005-05-14 09:10:02 +0000
committernyan <nyan@FreeBSD.org>2005-05-14 09:10:02 +0000
commit99f1b222339d6eee1c65e04ad1def3c866f155b0 (patch)
treed6652ab4639c3a5c5eb85fbf3822f9f54a92d8b1 /sys/isa
parentcb84f02ba844fdbece84784ccefc57126f36d66f (diff)
downloadFreeBSD-src-99f1b222339d6eee1c65e04ad1def3c866f155b0.zip
FreeBSD-src-99f1b222339d6eee1c65e04ad1def3c866f155b0.tar.gz
- Move timerreg.h to <arch>/include and split i8253 specific defines into
i8253reg.h, and add some defines to control a speaker. - Move PPI related defines from i386/isa/spkr.c into ppireg.h and use them. - Move IO_{PPI,TIMER} defines into ppireg.h and timerreg.h respectively. - Use isa/isareg.h rather than <arch>/isa/isa.h. Tested on: i386, pc98
Diffstat (limited to 'sys/isa')
-rw-r--r--sys/isa/atrtc.c16
-rw-r--r--sys/isa/isareg.h3
-rw-r--r--sys/isa/syscons_isa.c19
3 files changed, 15 insertions, 23 deletions
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
index eb8f282..5350c79 100644
--- a/sys/isa/atrtc.c
+++ b/sys/isa/atrtc.c
@@ -77,13 +77,14 @@ __FBSDID("$FreeBSD$");
#include <machine/apicvar.h>
#endif
#include <machine/specialreg.h>
+#include <machine/ppireg.h>
+#include <machine/timerreg.h>
-#include <i386/isa/isa.h>
#include <isa/rtc.h>
#ifdef DEV_ISA
+#include <isa/isareg.h>
#include <isa/isavar.h>
#endif
-#include <i386/isa/timerreg.h>
#ifdef DEV_MCA
#include <i386/bios/mca_machdep.h>
@@ -379,8 +380,8 @@ DELAY(int n)
static void
sysbeepstop(void *chan)
{
- outb(IO_PPI, inb(IO_PPI)&0xFC); /* disable counter2 output to speaker */
- release_timer2();
+ ppi_spkr_off(); /* disable counter2 output to speaker */
+ timer_spkr_release();
beeping = 0;
}
@@ -389,19 +390,18 @@ sysbeep(int pitch, int period)
{
int x = splclock();
- if (acquire_timer2(TIMER_SQWAVE|TIMER_16BIT))
+ if (timer_spkr_acquire())
if (!beeping) {
/* Something else owns it. */
splx(x);
return (-1); /* XXX Should be EBUSY, but nobody cares anyway. */
}
mtx_lock_spin(&clock_lock);
- outb(TIMER_CNTR2, pitch);
- outb(TIMER_CNTR2, (pitch>>8));
+ spkr_set_pitch(pitch);
mtx_unlock_spin(&clock_lock);
if (!beeping) {
/* enable counter2 output to speaker */
- outb(IO_PPI, inb(IO_PPI) | 3);
+ ppi_spkr_on();
beeping = period;
timeout(sysbeepstop, (void *)NULL, period);
}
diff --git a/sys/isa/isareg.h b/sys/isa/isareg.h
index 05f21bfb..8be7443 100644
--- a/sys/isa/isareg.h
+++ b/sys/isa/isareg.h
@@ -56,10 +56,7 @@
#define IO_DMA1 0x000 /* 8237A DMA Controller #1 */
#define IO_ICU1 0x020 /* 8259A Interrupt Controller #1 */
#define IO_PMP1 0x026 /* 82347 Power Management Peripheral */
-#define IO_TIMER1 0x040 /* 8253 Timer #1 */
-#define IO_TIMER2 0x048 /* 8253 Timer #2 */
#define IO_KBD 0x060 /* 8042 Keyboard */
-#define IO_PPI 0x061 /* Programmable Peripheral Interface */
#define IO_RTC 0x070 /* RTC */
#define IO_NMI IO_RTC /* NMI Control */
#define IO_DMAPG 0x080 /* DMA Page Registers */
diff --git a/sys/isa/syscons_isa.c b/sys/isa/syscons_isa.c
index d271d09..3f750ef 100644
--- a/sys/isa/syscons_isa.c
+++ b/sys/isa/syscons_isa.c
@@ -43,14 +43,14 @@ __FBSDID("$FreeBSD$");
#include <machine/clock.h>
#include <machine/md_var.h>
+#include <machine/ppireg.h>
+#include <machine/timerreg.h>
#include <machine/pc/bios.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_param.h>
-#include <i386/isa/timerreg.h>
-
#define BIOS_CLKED (1 << 6)
#define BIOS_NLKED (1 << 5)
#define BIOS_SLKED (1 << 4)
@@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$");
#include <dev/syscons/syscons.h>
-#include <isa/isareg.h>
#include <isa/isavar.h>
static devclass_t sc_devclass;
@@ -256,22 +255,18 @@ int
sc_tone(int herz)
{
#if defined(__i386__) || defined(__amd64__)
- int pitch;
-
if (herz) {
/* set command for counter 2, 2 byte write */
- if (acquire_timer2(TIMER_16BIT | TIMER_SQWAVE))
+ if (timer_spkr_acquire())
return EBUSY;
/* set pitch */
- pitch = timer_freq/herz;
- outb(TIMER_CNTR2, pitch);
- outb(TIMER_CNTR2, pitch >> 8);
+ spkr_set_pitch(timer_freq / herz);
/* enable counter 2 output to speaker */
- outb(IO_PPI, inb(IO_PPI) | 3);
+ ppi_spkr_on();
} else {
/* disable counter 2 output to speaker */
- outb(IO_PPI, inb(IO_PPI) & 0xFC);
- release_timer2();
+ ppi_spkr_off();
+ timer_spkr_release();
}
#endif
OpenPOWER on IntegriCloud