summaryrefslogtreecommitdiffstats
path: root/sys/dev/speaker
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>1994-04-21 14:21:50 +0000
committersos <sos@FreeBSD.org>1994-04-21 14:21:50 +0000
commit133b947de1908142c5f1c4e1d5b876c203a6d3ea (patch)
treea83c7e9093e9113ee0d22352b85a436467109a76 /sys/dev/speaker
parent879ba563bd436207fee1fece54cad08f142aef55 (diff)
downloadFreeBSD-src-133b947de1908142c5f1c4e1d5b876c203a6d3ea.zip
FreeBSD-src-133b947de1908142c5f1c4e1d5b876c203a6d3ea.tar.gz
Change timer usage to use new functions in clock.c
Diffstat (limited to 'sys/dev/speaker')
-rw-r--r--sys/dev/speaker/spkr.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
index 76efbb2..d273f31 100644
--- a/sys/dev/speaker/spkr.c
+++ b/sys/dev/speaker/spkr.c
@@ -4,7 +4,7 @@
* v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993
* modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>
*
- * $Id: spkr.c,v 1.6 1993/11/29 19:26:32 ache Exp $
+ * $Id: spkr.c,v 1.7 1994/01/25 23:04:27 ache Exp $
*/
#include "speaker.h"
@@ -17,7 +17,8 @@
#include "errno.h"
#include "buf.h"
#include "uio.h"
-
+#include "i386/isa/isa.h"
+#include "i386/isa/timerreg.h"
#include "machine/speaker.h"
/**************** MACHINE DEPENDENT PART STARTS HERE *************************
@@ -48,10 +49,7 @@
* Channel 2 LSB first, (Square Wave) Encoding
* MSB second
*/
-#define PPI 0x61 /* port of Programmable Peripheral Interface */
#define PPI_SPKR 0x03 /* turn these PPI bits on to pass sound */
-#define PIT_CTRL 0x43 /* PIT control address */
-#define PIT_COUNT 0x42 /* PIT count address */
#define PIT_MODE 0xB6 /* set timer mode for sound generation */
/*
@@ -75,13 +73,17 @@ unsigned int thz, ticks;
/* set timer to generate clicks at given frequency in Hertz */
sps = spltty();
- outb(PIT_CTRL, PIT_MODE); /* prepare timer */
- outb(PIT_COUNT, (divisor & 0xff)); /* send lo byte */
- outb(PIT_COUNT, (divisor >> 8)); /* send hi byte */
+
+ if (acquire_timer2(PIT_MODE)) {
+ /* enter list of waiting procs ??? */
+ return;
+ }
+ outb(TIMER_CNTR2, (divisor & 0xff)); /* send lo byte */
+ outb(TIMER_CNTR2, (divisor >> 8)); /* send hi byte */
splx(sps);
/* turn the speaker on */
- outb(PPI, inb(PPI) | PPI_SPKR);
+ outb(IO_PPI, inb(IO_PPI) | PPI_SPKR);
/*
* Set timeout to endtone function, then give up the timeslice.
@@ -89,7 +91,8 @@ unsigned int thz, ticks;
* emitted.
*/
(void) tsleep((caddr_t)&endtone, SPKRPRI | PCATCH, "spkrtn", ticks);
- outb(PPI, inb(PPI) & ~PPI_SPKR);
+ outb(IO_PPI, inb(IO_PPI) & ~PPI_SPKR);
+ release_timer2();
}
static void rest(ticks)
OpenPOWER on IntegriCloud