Further cleanup of sound generation in syscons:

The timer_spkr_*() functions take care of the enabling/disabling
of the speaker.

Test on the existence of timer_spkr_*() functions, rather than
architectures.
This commit is contained in:
Poul-Henning Kamp 2008-03-26 22:02:51 +00:00
parent 6ea3dc3746
commit 1d73a9dc74
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177650
2 changed files with 1 additions and 17 deletions

View File

@ -43,8 +43,6 @@ __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>
@ -272,18 +270,12 @@ sc_get_bios_values(bios_values_t *values)
int
sc_tone(int herz)
{
#if defined(__i386__) || defined(__amd64__)
#if defined(HAS_TIMER_SPKR)
if (herz) {
/* set command for counter 2, 2 byte write */
if (timer_spkr_acquire())
return EBUSY;
/* set pitch */
timer_spkr_setfreq(herz);
/* enable counter 2 output to speaker */
ppi_spkr_on();
} else {
/* disable counter 2 output to speaker */
ppi_spkr_off();
timer_spkr_release();
}
#endif

View File

@ -38,8 +38,6 @@
#include <sys/sysctl.h>
#include <machine/clock.h>
#include <machine/ppireg.h>
#include <machine/timerreg.h>
#include <pc98/pc98/pc98_machdep.h>
@ -227,16 +225,10 @@ sc_tone(int herz)
{
if (herz) {
/* enable counter 1 */
ppi_spkr_on();
/* set command for counter 1, 2 byte write */
if (timer_spkr_acquire())
return EBUSY;
/* set pitch */
timer_spkr_setfreq(herz);
} else {
/* disable counter 1 */
ppi_spkr_off();
timer_spkr_release();
}
return 0;