aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-11-03 21:55:32 +0000
committerWarner Losh <imp@FreeBSD.org>2021-11-03 22:03:51 +0000
commit072d5b98c4318e20248a6fbea4a5ca7c96992cac (patch)
tree9e77c1a90a9947a8527f260f98a79e7c93ea101f /sys/dev
parent6b67753488cb506f05694c5f6d2e74cf53497c54 (diff)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/mlx/mlx.c6
-rw-r--r--sys/dev/syscons/syscons.c7
-rw-r--r--sys/dev/vt/vt_core.c8
3 files changed, 13 insertions, 8 deletions
diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c
index bafd0902e09a..f5b023eafc9c 100644
--- a/sys/dev/mlx/mlx.c
+++ b/sys/dev/mlx/mlx.c
@@ -1083,7 +1083,7 @@ mlx_periodic(void *data)
mlx_pause_action(sc); /* pause is running */
sc->mlx_pause.mp_when = 0;
- sysbeep(500, hz);
+ sysbeep(500, SBT_1S);
/*
* Bus pause still running?
@@ -1095,9 +1095,9 @@ mlx_periodic(void *data)
if (time_second >= sc->mlx_pause.mp_howlong) {
mlx_pause_action(sc);
sc->mlx_pause.mp_which = 0; /* pause is complete */
- sysbeep(500, hz);
+ sysbeep(500, SBT_1S);
} else {
- sysbeep((time_second % 5) * 100 + 500, hz/8);
+ sysbeep((time_second % 5) * 100 + 500, SBT_1S / 8);
}
/*
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 6a389604d3ab..6c349668410d 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -4258,6 +4258,11 @@ sc_respond(scr_stat *scp, const u_char *p, int count, int wakeup)
}
}
+/*
+ * pitch is the divisor for 1.193182MHz PIT clock. By dividing 1193172 / pitch,
+ * we convert it back to Hz.
+ * duration is in ticks of 1/hz.
+ */
void
sc_bell(scr_stat *scp, int pitch, int duration)
{
@@ -4277,7 +4282,7 @@ sc_bell(scr_stat *scp, int pitch, int duration)
} else if (duration != 0 && pitch != 0) {
if (scp != scp->sc->cur_scp)
pitch *= 2;
- sysbeep(1193182 / pitch, duration);
+ sysbeep(1193182 / pitch, SBT_1S * duration / hz);
}
}
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 075b23597f68..567cdd2890d5 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -118,8 +118,8 @@ const struct terminal_class vt_termclass = {
#define VT_TIMERFREQ 25
/* Bell pitch/duration. */
-#define VT_BELLDURATION ((5 * hz + 99) / 100)
-#define VT_BELLPITCH 800
+#define VT_BELLDURATION (SBT_1S / 20)
+#define VT_BELLPITCH (1193182 / 800) /* Approx 1491Hz */
#define VT_UNIT(vw) ((vw)->vw_device->vd_unit * VT_MAXWINDOWS + \
(vw)->vw_number)
@@ -1100,7 +1100,7 @@ vtterm_bell(struct terminal *tm)
if (vd->vd_flags & VDF_QUIET_BELL)
return;
- sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION);
+ sysbeep(VT_BELLPITCH, VT_BELLDURATION);
}
static void
@@ -1116,7 +1116,7 @@ vtterm_beep(struct terminal *tm, u_int param)
return;
}
- period = ((param >> 16) & 0xffff) * hz / 1000;
+ period = ((param >> 16) & 0xffff) * SBT_1MS;
freq = 1193182 / (param & 0xffff);
sysbeep(freq, period);