summaryrefslogtreecommitdiff
path: root/sys/dev/speaker
diff options
context:
space:
mode:
authorYoshihiro Takahashi <nyan@FreeBSD.org>2005-05-14 09:10:02 +0000
committerYoshihiro Takahashi <nyan@FreeBSD.org>2005-05-14 09:10:02 +0000
commit24072ca35b756417b697443a11c2a96eccf05649 (patch)
treed6652ab4639c3a5c5eb85fbf3822f9f54a92d8b1 /sys/dev/speaker
parentbc3729b63f6b4405d965e987c9bcbb94c660c883 (diff)
downloadsrc-test2-24072ca35b756417b697443a11c2a96eccf05649.tar.gz
src-test2-24072ca35b756417b697443a11c2a96eccf05649.zip
Notes
Diffstat (limited to 'sys/dev/speaker')
-rw-r--r--sys/dev/speaker/spkr.c42
1 files changed, 7 insertions, 35 deletions
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
index 321b2cbd7357..d265e7c4f0a9 100644
--- a/sys/dev/speaker/spkr.c
+++ b/sys/dev/speaker/spkr.c
@@ -19,14 +19,10 @@ __FBSDID("$FreeBSD$");
#include <sys/ctype.h>
#include <sys/malloc.h>
#include <isa/isavar.h>
-#ifdef PC98
-#include <pc98/cbus/cbus.h>
-#else
-#include <i386/isa/isa.h>
-#endif
-#include <i386/isa/timerreg.h>
#include <machine/clock.h>
#include <machine/speaker.h>
+#include <machine/ppireg.h>
+#include <machine/timerreg.h>
static d_open_t spkropen;
static d_close_t spkrclose;
@@ -58,34 +54,10 @@ static MALLOC_DEFINE(M_SPKR, "spkr", "Speaker buffer");
* used to generate clicks (a square wave) of whatever frequency is desired.
*/
-/*
- * XXX PPI control values should be in a header and used in clock.c.
- */
#ifdef PC98
#define SPKR_DESC "PC98 speaker"
-#define PPI_SPKR 0x08 /* turn these PPI bits on to pass sound */
-#define PIT_COUNT 0x3fdb /* PIT count address */
-
-#define SPEAKER_ON outb(IO_PPI, inb(IO_PPI) & ~PPI_SPKR)
-#define SPEAKER_OFF outb(IO_PPI, inb(IO_PPI) | PPI_SPKR)
-#define TIMER_ACQUIRE acquire_timer1(TIMER_SEL1 | TIMER_SQWAVE | TIMER_16BIT)
-#define TIMER_RELEASE release_timer1()
-#define SPEAKER_WRITE(val) { \
- outb(PIT_COUNT, (val & 0xff)); \
- outb(PIT_COUNT, (val >> 8)); \
- }
#else
#define SPKR_DESC "PC speaker"
-#define PPI_SPKR 0x03 /* turn these PPI bits on to pass sound */
-
-#define SPEAKER_ON outb(IO_PPI, inb(IO_PPI) | PPI_SPKR)
-#define SPEAKER_OFF outb(IO_PPI, inb(IO_PPI) & ~PPI_SPKR)
-#define TIMER_ACQUIRE acquire_timer2(TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT)
-#define TIMER_RELEASE release_timer2()
-#define SPEAKER_WRITE(val) { \
- outb(TIMER_CNTR2, (val & 0xff)); \
- outb(TIMER_CNTR2, (val >> 8)); \
- }
#endif
#define SPKRPRI PSOCK
@@ -117,18 +89,18 @@ tone(thz, ticks)
/* set timer to generate clicks at given frequency in Hertz */
sps = splclock();
- if (TIMER_ACQUIRE) {
+ if (timer_spkr_acquire()) {
/* enter list of waiting procs ??? */
splx(sps);
return;
}
splx(sps);
disable_intr();
- SPEAKER_WRITE(divisor);
+ spkr_set_pitch(divisor);
enable_intr();
/* turn the speaker on */
- SPEAKER_ON;
+ ppi_spkr_on();
/*
* Set timeout to endtone function, then give up the timeslice.
@@ -137,9 +109,9 @@ tone(thz, ticks)
*/
if (ticks > 0)
tsleep(&endtone, SPKRPRI | PCATCH, "spkrtn", ticks);
- SPEAKER_OFF;
+ ppi_spkr_off();
sps = splclock();
- TIMER_RELEASE;
+ timer_spkr_release();
splx(sps);
}