diff options
| author | Raphael Poss <knz@thaumogen.net> | 2025-12-10 19:53:21 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2026-04-24 16:23:06 +0000 |
| commit | 03a515e9890b0c6844457254e26dc34333b85127 (patch) | |
| tree | f33c786754939588fa0435b47d1487de1b68e595 /sys/dev | |
| parent | 70ae0c4524d2c5d0aae3339e95f6bd4f3c480b6e (diff) | |
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/speaker/spkr.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index c698a4820434..2cdbbd43ff6e 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -71,23 +71,29 @@ tone(unsigned int thz, unsigned int centisecs) (void) printf("tone: thz=%d centisecs=%d\n", thz, centisecs); #endif /* DEBUG */ - /* set timer to generate clicks at given frequency in Hertz */ + /* + * Acquire the i8254 clock, configure it to drive the speaker + * signal, and turn on the speaker. + */ if (timer_spkr_acquire()) { - /* enter list of waiting procs ??? */ return; } disable_intr(); + /* Configure the speaker with the tone frequency. */ timer_spkr_setfreq(thz); enable_intr(); /* - * Set timeout to endtone function, then give up the timeslice. - * This is so other processes can execute while the tone is being + * Make the current thread sleep while the tone is being * emitted. */ timo = centisecs * hz / 100; if (timo > 0) tsleep(&endtone, SPKRPRI | PCATCH, "spkrtn", timo); + + /* + * Turn off the speaker and release the i8254 clock. + */ timer_spkr_release(); } |
