Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys New device wsbell - allows for a console beep for non pc...
details: https://anonhg.NetBSD.org/src/rev/458ffe210ad4
branches: trunk
changeset: 354304:458ffe210ad4
user: nat <nat%NetBSD.org@localhost>
date: Sun Jun 11 03:55:56 2017 +0000
description:
New device wsbell - allows for a console beep for non pckbds (usb etc).
Works for platforms without pcppi - can work with spkr at audio and spkr
at pcppi.
To use add the following to your kernel config:
wsbell* at spkr? console?
Ok pgoyette@.
diffstat:
sys/conf/files | 7 +-
sys/dev/pckbport/pckbd.c | 6 +-
sys/dev/spkr.c | 16 +-
sys/dev/spkrvar.h | 3 +-
sys/dev/wscons/files.wscons | 6 +-
sys/dev/wscons/wsbell.c | 463 ++++++++++++++++++++++++++++++++++++++++++
sys/dev/wscons/wsbellmux.c | 79 +++++++
sys/dev/wscons/wsbellmuxvar.h | 31 ++
sys/dev/wscons/wsbellvar.h | 61 +++++
sys/dev/wscons/wsconsio.h | 3 +-
sys/dev/wscons/wsmux.c | 7 +-
sys/dev/wscons/wsmuxvar.h | 3 +-
12 files changed, 672 insertions(+), 13 deletions(-)
diffs (truncated from 875 to 300 lines):
diff -r 673d16ddc089 -r 458ffe210ad4 sys/conf/files
--- a/sys/conf/files Sun Jun 11 03:38:12 2017 +0000
+++ b/sys/conf/files Sun Jun 11 03:55:56 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.1175 2017/06/08 21:00:43 jmcneill Exp $
+# $NetBSD: files,v 1.1176 2017/06/11 03:55:56 nat Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20150846
@@ -344,8 +344,8 @@
define firmload
# speaker devices, attaches to audio or pcppi drivers
-device spkr
-file dev/spkr.c spkr
+device spkr: wsbelldev
+file dev/spkr.c spkr needs-flag
include "dev/files.audio"
@@ -1185,6 +1185,7 @@
define wsemuldisplaydev {[console = -1], [kbdmux = 1]}
define wskbddev {[console = -1], [mux = 1]}
define wsmousedev {[mux = 0]}
+define wsbelldev {[console = -1], [mux = 1]}
define vcons
# attribute to pull in raster support
#
diff -r 673d16ddc089 -r 458ffe210ad4 sys/dev/pckbport/pckbd.c
--- a/sys/dev/pckbport/pckbd.c Sun Jun 11 03:38:12 2017 +0000
+++ b/sys/dev/pckbport/pckbd.c Sun Jun 11 03:55:56 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbd.c,v 1.32 2015/07/16 15:01:04 prlw1 Exp $ */
+/* $NetBSD: pckbd.c,v 1.33 2017/06/11 03:55:56 nat Exp $ */
/*-
* Copyright (c) 1998, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbd.c,v 1.32 2015/07/16 15:01:04 prlw1 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbd.c,v 1.33 2017/06/11 03:55:56 nat Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1010,6 +1010,7 @@
case WSKBDIO_GETLEDS:
*(int *)data = pckbd_led_decode(sc->sc_ledstate);
return 0;
+#if 0
case WSKBDIO_COMPLEXBELL:
#define d ((struct wskbd_bell_data *)data)
/*
@@ -1019,6 +1020,7 @@
pckbd_bell(d->pitch, d->period, d->volume, 0);
#undef d
return 0;
+#endif
#ifdef WSDISPLAY_COMPAT_RAWKBD
case WSKBDIO_SETMODE:
sc->rawkbd = (*(int *)data == WSKBD_RAW);
diff -r 673d16ddc089 -r 458ffe210ad4 sys/dev/spkr.c
--- a/sys/dev/spkr.c Sun Jun 11 03:38:12 2017 +0000
+++ b/sys/dev/spkr.c Sun Jun 11 03:55:56 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spkr.c,v 1.8 2017/06/11 03:33:48 nat Exp $ */
+/* $NetBSD: spkr.c,v 1.9 2017/06/11 03:55:56 nat Exp $ */
/*
* Copyright (c) 1990 Eric S. Raymond (esr%snark.thyrsus.com@localhost)
@@ -43,7 +43,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.8 2017/06/11 03:33:48 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.9 2017/06/11 03:55:56 nat Exp $");
+
+#include "wsmux.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -61,6 +63,9 @@
#include <dev/spkrio.h>
#include <dev/spkrvar.h>
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsbellvar.h>
+#include <dev/wscons/wsbellmuxvar.h>
dev_type_open(spkropen);
dev_type_close(spkrclose);
@@ -365,6 +370,13 @@
sc->sc_tone = tone;
sc->sc_rest = rest;
sc->sc_inbuf = NULL;
+
+#if (NWSMUX > 0)
+ struct wsbelldev_attach_args a;
+
+ a.accesscookie = sc;
+ sc->sc_wsbelldev = config_found(self, &a, wsbelldevprint);
+#endif
}
int
diff -r 673d16ddc089 -r 458ffe210ad4 sys/dev/spkrvar.h
--- a/sys/dev/spkrvar.h Sun Jun 11 03:38:12 2017 +0000
+++ b/sys/dev/spkrvar.h Sun Jun 11 03:55:56 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spkrvar.h,v 1.7 2017/06/11 03:33:48 nat Exp $ */
+/* $NetBSD: spkrvar.h,v 1.8 2017/06/11 03:55:56 nat Exp $ */
#ifndef _SYS_DEV_SPKRVAR_H
#define _SYS_DEV_SPKRVAR_H
@@ -7,6 +7,7 @@
struct spkr_softc {
device_t sc_dev;
+ device_t sc_wsbelldev;
int sc_octave; /* currently selected octave */
int sc_whole; /* whole-note time at current tempo, in ticks */
int sc_value; /* whole divisor for note time, quarter note = 1 */
diff -r 673d16ddc089 -r 458ffe210ad4 sys/dev/wscons/files.wscons
--- a/sys/dev/wscons/files.wscons Sun Jun 11 03:38:12 2017 +0000
+++ b/sys/dev/wscons/files.wscons Sun Jun 11 03:55:56 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.wscons,v 1.50 2017/05/19 19:22:33 macallan Exp $
+# $NetBSD: files.wscons,v 1.51 2017/06/11 03:55:56 nat Exp $
#
# "Workstation Console" glue; attaches frame buffer to emulator & keyboard,
@@ -43,6 +43,8 @@
attach wskbd at wskbddev
device wsmouse
attach wsmouse at wsmousedev
+device wsbell
+attach wsbell at wsbelldev
file dev/wscons/wsdisplay.c wsdisplay needs-flag
file dev/wscons/wsdisplay_compat_usl.c wsdisplay & wsdisplay_compat_usl
@@ -58,6 +60,7 @@
file dev/wscons/wskbd.c wskbd needs-flag
file dev/wscons/wskbdutil.c wskbd needs-flag
file dev/wscons/wsmouse.c wsmouse needs-flag
+file dev/wscons/wsbell.c wsbell needs-flag
# rcons bit-depth options
include "dev/rcons/files.rcons"
@@ -67,6 +70,7 @@
defpseudo wsmux
file dev/wscons/wsmux.c wsmux needs-flag
+file dev/wscons/wsbellmux.c wsmux needs-flag
define tpcalib
file dev/wscons/tpcalib.c tpcalib
diff -r 673d16ddc089 -r 458ffe210ad4 sys/dev/wscons/wsbell.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/wscons/wsbell.c Sun Jun 11 03:55:56 2017 +0000
@@ -0,0 +1,463 @@
+/* $NetBSD: wsbell.c,v 1.1 2017/06/11 03:55:56 nat Exp $ */
+
+/*-
+ * Copyright (c) 2017 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
+ * All rights reserved.
+ *
+ * Copyright (c) 2006 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Julio M. Merino Vidal.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou
+ * for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
+ *
+ * All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Lawrence Berkeley Laboratory.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ms.c 8.1 (Berkeley) 6/11/93
+ */
+
+/*
+ * Keyboard Bell driver.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.1 2017/06/11 03:55:56 nat Exp $");
+
+#include "wsdisplay.h"
+#include "wsmux.h"
+
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/ioctl.h>
+#include <sys/poll.h>
+#include <sys/fcntl.h>
+#include <sys/kernel.h>
+#include <sys/condvar.h>
+#include <sys/mutex.h>
+#include <sys/kthread.h>
+#include <sys/proc.h>
+#include <sys/syslog.h>
+#include <sys/systm.h>
+#include <sys/tty.h>
+#include <sys/signalvar.h>
+#include <sys/device.h>
+#include <sys/vnode.h>
+#include <sys/callout.h>
+#include <sys/malloc.h>
+
+#include <dev/wscons/wsconsio.h>
+#include <dev/wscons/wsbellvar.h>
+#include <dev/wscons/wsbellmuxvar.h>
+#include <dev/wscons/wsbelldata.h>
+
+#include <dev/spkrio.h>
Home |
Main Index |
Thread Index |
Old Index