summaryrefslogtreecommitdiffstats
path: root/sys/pccard/pccard_beep.c
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1997-10-26 06:06:54 +0000
committernate <nate@FreeBSD.org>1997-10-26 06:06:54 +0000
commit0689fa1ceb9804e257bcefc12b99b194cb4179b8 (patch)
tree4384a35cd8a781e9c59adee7383aa54109afe948 /sys/pccard/pccard_beep.c
parente38809b8d94147c1e06ed088d9966d24d85d45a3 (diff)
downloadFreeBSD-src-0689fa1ceb9804e257bcefc12b99b194cb4179b8.zip
FreeBSD-src-0689fa1ceb9804e257bcefc12b99b194cb4179b8.tar.gz
- 'Beep' support now happens in it's own separate file, so you can mess
around with different noises for the different events and not have it affect other files. Inspired by: PAO
Diffstat (limited to 'sys/pccard/pccard_beep.c')
-rw-r--r--sys/pccard/pccard_beep.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/sys/pccard/pccard_beep.c b/sys/pccard/pccard_beep.c
new file mode 100644
index 0000000..63c6098
--- /dev/null
+++ b/sys/pccard/pccard_beep.c
@@ -0,0 +1,70 @@
+/*-
+ * pccard noise interface.
+ * Nate Williams, October 1997.
+ * This file is in the public domain.
+ */
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+
+#include <machine/clock.h>
+
+#include <pccard/driver.h>
+
+#define PCCARD_BEEP_PITCH0 1600
+#define PCCARD_BEEP_DURATION0 20
+#define PCCARD_BEEP_PITCH1 1200
+#define PCCARD_BEEP_DURATION1 40
+#define PCCARD_BEEP_PITCH2 3200
+#define PCCARD_BEEP_DURATION2 40
+
+static struct callout_handle beeptimeout_ch
+ = CALLOUT_HANDLE_INITIALIZER(&beeptimeout_ch);
+
+static enum beepstate allow_beep = BEEP_OFF;
+
+/*
+ * timeout function to keep lots of noise from
+ * happening with insertion/removals.
+ */
+static void enable_beep(void *dummy)
+{
+ /* Should never be needed */
+ untimeout(enable_beep, (void *)NULL, beeptimeout_ch);
+
+ allow_beep = 1;
+}
+
+void pccard_insert_beep(void)
+{
+ if (allow_beep == BEEP_ON) {
+ sysbeep(PCCARD_BEEP_PITCH0, PCCARD_BEEP_DURATION0);
+ allow_beep = 0;
+ beeptimeout_ch = timeout(enable_beep, (void *)NULL, hz / 5);
+ }
+}
+
+void pccard_remove_beep(void)
+{
+ if (allow_beep == BEEP_ON) {
+ sysbeep(PCCARD_BEEP_PITCH0, PCCARD_BEEP_DURATION0);
+ allow_beep = 0;
+ beeptimeout_ch = timeout(enable_beep, (void *)NULL, hz / 5);
+ }
+}
+
+void pccard_success_beep(void)
+{
+ sysbeep(PCCARD_BEEP_PITCH1, PCCARD_BEEP_DURATION1);
+}
+
+void pccard_failure_beep(void)
+{
+ sysbeep(PCCARD_BEEP_PITCH2, PCCARD_BEEP_DURATION2);
+}
+
+void pccard_beep_select(enum beepstate state)
+{
+ allow_beep = state;
+}
OpenPOWER on IntegriCloud