diff options
author | Bruce Evans <bde@FreeBSD.org> | 1996-10-25 14:00:47 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 1996-10-25 14:00:47 +0000 |
commit | 9275c7cc3ea6f48897dc89223ac8103604f6d9ec (patch) | |
tree | 6f8ac205e78ddff9f7a6f34f0b8272653c44ca51 /sys | |
parent | 2d872b777dccef4b901cde6405ed9e65372413bc (diff) | |
download | src-9275c7cc3ea6f48897dc89223ac8103604f6d9ec.tar.gz src-9275c7cc3ea6f48897dc89223ac8103604f6d9ec.zip |
Notes
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/speaker/spkr.c | 35 | ||||
-rw-r--r-- | sys/i386/isa/spkr.c | 35 |
2 files changed, 14 insertions, 56 deletions
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index f05e5a1da006..232daf22248f 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.25 1996/07/20 18:48:54 joerg Exp $ + * $Id: spkr.c,v 1.26 1996/08/24 03:24:39 peter Exp $ */ #include "speaker.h" @@ -14,9 +14,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/errno.h> #include <sys/buf.h> -#include <sys/proc.h> #include <sys/uio.h> #include <sys/conf.h> #include <i386/isa/isa.h> @@ -24,8 +22,6 @@ #include <machine/clock.h> #include <machine/speaker.h> - - #ifdef DEVFS #include <sys/devfsext.h> void *devfs_token; @@ -45,38 +41,21 @@ static struct cdevsw spkr_cdevsw = /**************** MACHINE DEPENDENT PART STARTS HERE ************************* * * This section defines a function tone() which causes a tone of given - * frequency and duration from the 80x86's console speaker. + * frequency and duration from the ISA console speaker. * Another function endtone() is defined to force sound off, and there is * also a rest() entry point to do pauses. * * Audible sound is generated using the Programmable Interval Timer (PIT) and - * Programmable Peripheral Interface (PPI) attached to the 80x86's speaker. The + * Programmable Peripheral Interface (PPI) attached to the ISA speaker. The * PPI controls whether sound is passed through at all; the PIT's channel 2 is * used to generate clicks (a square wave) of whatever frequency is desired. */ /* - * PIT and PPI port addresses and control values - * - * Most of the magic is hidden in the TIMER_PREP value, which selects PIT - * channel 2, frequency LSB first, square-wave mode and binary encoding. - * The encoding is as follows: - * - * +----------+----------+---------------+-----+ - * | 1 0 | 1 1 | 0 1 1 | 0 | - * | SC1 SC0 | RW1 RW0 | M2 M1 M0 | BCD | - * +----------+----------+---------------+-----+ - * Counter Write Mode 3 Binary - * Channel 2 LSB first, (Square Wave) Encoding - * MSB second + * PPI control values. + * XXX should be in a header and used in clock.c. */ #define PPI_SPKR 0x03 /* turn these PPI bits on to pass sound */ -#define PIT_MODE 0xB6 /* set timer mode for sound generation */ - -/* - * Magic numbers for timer control. - */ -#define TIMER_CLK 1193180L /* corresponds to 18.2 MHz tick rate */ #define SPKRPRI PSOCK static char endtone, endrest; @@ -99,7 +78,7 @@ tone(thz, ticks) if (thz <= 0) return; - divisor = TIMER_CLK / thz; + divisor = timer_freq / thz; #ifdef DEBUG (void) printf("tone: thz=%d ticks=%d\n", thz, ticks); @@ -108,7 +87,7 @@ tone(thz, ticks) /* set timer to generate clicks at given frequency in Hertz */ sps = splclock(); - if (acquire_timer2(PIT_MODE)) { + if (acquire_timer2(TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT)) { /* enter list of waiting procs ??? */ splx(sps); return; diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index f05e5a1da006..232daf22248f 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/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.25 1996/07/20 18:48:54 joerg Exp $ + * $Id: spkr.c,v 1.26 1996/08/24 03:24:39 peter Exp $ */ #include "speaker.h" @@ -14,9 +14,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/errno.h> #include <sys/buf.h> -#include <sys/proc.h> #include <sys/uio.h> #include <sys/conf.h> #include <i386/isa/isa.h> @@ -24,8 +22,6 @@ #include <machine/clock.h> #include <machine/speaker.h> - - #ifdef DEVFS #include <sys/devfsext.h> void *devfs_token; @@ -45,38 +41,21 @@ static struct cdevsw spkr_cdevsw = /**************** MACHINE DEPENDENT PART STARTS HERE ************************* * * This section defines a function tone() which causes a tone of given - * frequency and duration from the 80x86's console speaker. + * frequency and duration from the ISA console speaker. * Another function endtone() is defined to force sound off, and there is * also a rest() entry point to do pauses. * * Audible sound is generated using the Programmable Interval Timer (PIT) and - * Programmable Peripheral Interface (PPI) attached to the 80x86's speaker. The + * Programmable Peripheral Interface (PPI) attached to the ISA speaker. The * PPI controls whether sound is passed through at all; the PIT's channel 2 is * used to generate clicks (a square wave) of whatever frequency is desired. */ /* - * PIT and PPI port addresses and control values - * - * Most of the magic is hidden in the TIMER_PREP value, which selects PIT - * channel 2, frequency LSB first, square-wave mode and binary encoding. - * The encoding is as follows: - * - * +----------+----------+---------------+-----+ - * | 1 0 | 1 1 | 0 1 1 | 0 | - * | SC1 SC0 | RW1 RW0 | M2 M1 M0 | BCD | - * +----------+----------+---------------+-----+ - * Counter Write Mode 3 Binary - * Channel 2 LSB first, (Square Wave) Encoding - * MSB second + * PPI control values. + * XXX should be in a header and used in clock.c. */ #define PPI_SPKR 0x03 /* turn these PPI bits on to pass sound */ -#define PIT_MODE 0xB6 /* set timer mode for sound generation */ - -/* - * Magic numbers for timer control. - */ -#define TIMER_CLK 1193180L /* corresponds to 18.2 MHz tick rate */ #define SPKRPRI PSOCK static char endtone, endrest; @@ -99,7 +78,7 @@ tone(thz, ticks) if (thz <= 0) return; - divisor = TIMER_CLK / thz; + divisor = timer_freq / thz; #ifdef DEBUG (void) printf("tone: thz=%d ticks=%d\n", thz, ticks); @@ -108,7 +87,7 @@ tone(thz, ticks) /* set timer to generate clicks at given frequency in Hertz */ sps = splclock(); - if (acquire_timer2(PIT_MODE)) { + if (acquire_timer2(TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT)) { /* enter list of waiting procs ??? */ splx(sps); return; |