Use audiobell for system beeps on acorn32 when vidcaudio(4) is compiled in.

Remove the vestigal sysbeep device and replace it with the same kind of
mechanism that pckbd(4) uses to find the bell, which is just as ugly, but
more standard.  Adapt beep(4) to the new world (though I'm not sure it
deserves to live).
This commit is contained in:
bjh21 2004-01-17 21:49:24 +00:00
parent e095fd5eda
commit 13d0914a93
11 changed files with 66 additions and 134 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.31 2003/10/18 08:30:12 lukem Exp $
# $NetBSD: GENERIC,v 1.32 2004/01/17 21:49:24 bjh21 Exp $
#
# GENERIC --- NetBSD/acorn32 complete configuration
#
@ -22,7 +22,7 @@ include "arch/acorn32/conf/std.acorn32"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "GENERIC-$Revision: 1.31 $"
#ident "GENERIC-$Revision: 1.32 $"
# estimated number of users
maxusers 32
@ -260,9 +260,6 @@ beep0 at vidc?
vidcaudio0 at vidc?
audio* at vidcaudio0
# System beep
sysbeep0 at vidc?
# Podule bus device
podulebus0 at root

View File

@ -1,4 +1,4 @@
# $NetBSD: LOWMEM_WSCONS,v 1.19 2003/10/18 08:30:12 lukem Exp $
# $NetBSD: LOWMEM_WSCONS,v 1.20 2004/01/17 21:49:24 bjh21 Exp $
#
# LOWMEM_WSCONS -- RiscPC config with wscons for SMALL machines
#
@ -236,9 +236,6 @@ beep0 at vidc?
vidcaudio0 at vidc?
audio* at vidcaudio0
# System beep
sysbeep0 at vidc?
# Podule bus device
#podulebus0 at root

View File

@ -1,4 +1,4 @@
# $NetBSD: NC,v 1.19 2003/10/18 08:30:12 lukem Exp $
# $NetBSD: NC,v 1.20 2004/01/17 21:49:24 bjh21 Exp $
#
# NC - with vidcconsole
#
@ -206,9 +206,6 @@ beep0 at vidc?
vidcaudio0 at vidc?
audio* at vidcaudio0
# System beep
sysbeep0 at vidc?
# Podule bus device
podulebus0 at root

View File

@ -1,4 +1,4 @@
# $NetBSD: NC_WSCONS,v 1.22 2003/10/18 08:30:12 lukem Exp $
# $NetBSD: NC_WSCONS,v 1.23 2004/01/17 21:49:24 bjh21 Exp $
#
# NC - with wscons
#
@ -233,9 +233,6 @@ beep0 at vidc?
vidcaudio0 at vidc?
audio* at vidcaudio0
# System beep
sysbeep0 at vidc?
# Podule bus device
podulebus0 at root

View File

@ -1,4 +1,4 @@
# $NetBSD: RPC_WSCONS,v 1.21 2003/10/18 08:30:12 lukem Exp $
# $NetBSD: RPC_WSCONS,v 1.22 2004/01/17 21:49:24 bjh21 Exp $
#
# RPC_WSCONS -- Full RiscPC config with wscons
#
@ -22,7 +22,7 @@ include "arch/acorn32/conf/std.acorn32"
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "GENERIC-$Revision: 1.21 $"
#ident "GENERIC-$Revision: 1.22 $"
# estimated number of users
maxusers 32
@ -254,9 +254,6 @@ beep0 at vidc?
vidcaudio0 at vidc?
audio* at vidcaudio0
# System beep
sysbeep0 at vidc?
# Podule bus device
podulebus0 at root

View File

@ -1,4 +1,4 @@
/* $NetBSD: beep.c,v 1.20 2004/01/17 21:25:25 bjh21 Exp $ */
/* $NetBSD: beep.c,v 1.21 2004/01/17 21:49:24 bjh21 Exp $ */
/*
* Copyright (c) 1995 Mark Brinicombe
@ -42,7 +42,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: beep.c,v 1.20 2004/01/17 21:25:25 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: beep.c,v 1.21 2004/01/17 21:49:24 bjh21 Exp $");
#include <sys/systm.h>
#include <sys/conf.h>
@ -64,9 +64,11 @@ __KERNEL_RCSID(0, "$NetBSD: beep.c,v 1.20 2004/01/17 21:25:25 bjh21 Exp $");
#include <arm/iomd/waveform.h>
#include <arm/iomd/iomdreg.h>
#include <arm/iomd/iomdvar.h>
#include <arm/iomd/rpckbdvar.h>
#include "beep.h"
#include "locators.h"
#include "rpckbd.h"
struct beep_softc {
struct device sc_device;
@ -86,6 +88,8 @@ void beepattach (struct device *, struct device *, void *);
int beepintr (void *arg);
void beepdma (struct beep_softc *sc, int buf);
static void beep_bell(void *, u_int, u_int, u_int, int);
static int sdma_channel;
CFATTACH_DECL(beep, sizeof(struct beep_softc),
@ -189,6 +193,9 @@ beepattach(struct device *parent, struct device *self, void *aux)
WriteWord(vidc_base, VIDC_SIR5 | SIR_CENTRE);
WriteWord(vidc_base, VIDC_SIR6 | SIR_CENTRE);
WriteWord(vidc_base, VIDC_SIR7 | SIR_CENTRE);
#if NRPCKBD > 0
rpckbd_hookup_bell(beep_bell, NULL);
#endif
}
@ -236,6 +243,13 @@ beepclose(dev_t dev, int flag, int mode, struct proc *p)
return 0;
}
static void
beep_bell(void *arg, u_int pitch, u_int period, u_int volume, int poll)
{
if (!poll)
beep_generate();
}
void
beep_generate(void)

View File

@ -1,4 +1,4 @@
# $NetBSD: files.iomd,v 1.6 2004/01/03 14:46:17 chris Exp $
# $NetBSD: files.iomd,v 1.7 2004/01/17 21:49:24 bjh21 Exp $
#
# IOMD-specific configuration data
#
@ -63,11 +63,7 @@ device beep
attach beep at vidc
file arch/arm/iomd/beep.c beep needs-flag
device sysbeep
attach sysbeep at vidc with sysbeep_vidc
file arch/arm/iomd/sysbeep_vidc.c sysbeep_vidc
device vidcaudio: audiobus, mulaw, aurateconv
device vidcaudio: audiobus, mulaw, aurateconv, audiobell
attach vidcaudio at vidc
file arch/arm/iomd/vidcaudio.c vidcaudio needs-flag

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpckbd.c,v 1.9 2004/01/17 21:16:13 bjh21 Exp $ */
/* $NetBSD: rpckbd.c,v 1.10 2004/01/17 21:49:24 bjh21 Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rpckbd.c,v 1.9 2004/01/17 21:16:13 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: rpckbd.c,v 1.10 2004/01/17 21:49:24 bjh21 Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -160,6 +160,14 @@ static void kbd_flush_input(struct rpckbd_softc *);
static int rpckbd_decode(struct rpckbd_softc *, int, u_int *, int *);
static int rpckbd_led_encode(int);
static int rpckbd_led_decode(int);
/*
* Hackish support for a bell on the PC Keyboard; when a suitable feeper
* is found, it attaches itself into the pckbd driver here.
*/
static void (*rpckbd_bell_fn)(void *, u_int, u_int, u_int, int);
static void *rpckbd_bell_fn_arg;
static void rpckbd_bell(int, int, int);
@ -175,7 +183,7 @@ rpckbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
switch (cmd) {
case WSKBDIO_GTYPE:
*(int *)data = WSKBD_TYPE_RISCP;
*(int *)data = WSKBD_TYPE_RISCPC;
return 0;
case WSKBDIO_SETLEDS:
/* same as rpckbd_set_leds */
@ -450,18 +458,29 @@ void
rpckbd_cnbell(void *v, u_int pitch, u_int period, u_int volume)
{
/* dunno yet */
if (rpckbd_bell_fn != NULL)
(*rpckbd_bell_fn)(rpckbd_bell_fn_arg, pitch, period,
volume, TRUE);
}
void
rpckbd_hookup_bell(void (*fn)(void *, u_int, u_int, u_int, int), void *arg)
{
if (rpckbd_bell_fn == NULL) {
rpckbd_bell_fn = fn;
rpckbd_bell_fn_arg = arg;
}
}
void
rpckbd_bell(int pitch, int period, int volume)
{
/* dunno yet */
#if NBEEP > 0
sysbeep(pitch, period);
#endif
if (rpckbd_bell_fn != NULL)
(*rpckbd_bell_fn)(rpckbd_bell_fn_arg, pitch, period,
volume, FALSE);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpckbdvar.h,v 1.1 2001/10/05 22:27:42 reinoud Exp $ */
/* $NetBSD: rpckbdvar.h,v 1.2 2004/01/17 21:49:24 bjh21 Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -77,6 +77,8 @@ extern int rpckbd_reset __P((struct rpckbd_softc *sc));
extern int rpckbd_intr __P((void *arg));
extern int rpckbd_init __P((struct device *self, int isconsole, vaddr_t, vaddr_t));
extern int rpckbd_cnattach __P((struct device *self));
extern void rpckbd_hookup_bell __P((void (*fn)(void *, u_int, u_int, u_int, int),
void *));
/* End of rpckbdvar.h */

View File

@ -1,84 +0,0 @@
/* $NetBSD: sysbeep_vidc.c,v 1.8 2004/01/01 19:12:13 bjh21 Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Mark Brinicombe of Causality Limited.
*
* 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 the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 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.
*/
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: sysbeep_vidc.c,v 1.8 2004/01/01 19:12:13 bjh21 Exp $");
#include <sys/systm.h>
#include <sys/device.h>
#include <arch/arm/iomd/beepvar.h>
#include <arch/arm/iomd/vidcaudiovar.h>
#include "beep.h"
#include "vidcaudio.h"
/* Prototypes */
int sysbeep_vidc_match(struct device *, struct cfdata *, void *);
void sysbeep_vidc_attach(struct device *, struct device *, void *);
void sysbeep(int, int);
/* device attach structure */
CFATTACH_DECL(sysbeep_vidc, sizeof(struct device),
sysbeep_vidc_match, sysbeep_vidc_attach, NULL, NULL);
int
sysbeep_vidc_match(struct device *parent, struct cfdata *match, void *aux)
{
return (1); /* XXX */
}
void
sysbeep_vidc_attach(struct device *parent, struct device *self, void *aux)
{
printf("\n");
}
void
sysbeep(int pitch, int period)
{
#if NVIDCAUDIO > 0
vidcaudio_beep_generate();
#elif NBEEP > 0
beep_generate();
#endif /* NVIDCAUDIO */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: vidcaudio.c,v 1.33 2004/01/10 22:33:24 bjh21 Exp $ */
/* $NetBSD: vidcaudio.c,v 1.34 2004/01/17 21:49:24 bjh21 Exp $ */
/*
* Copyright (c) 1995 Melvin Tang-Richardson
@ -65,7 +65,7 @@
#include <sys/param.h> /* proc.h */
__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.33 2004/01/10 22:33:24 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.34 2004/01/17 21:49:24 bjh21 Exp $");
#include <sys/audioio.h>
#include <sys/conf.h> /* autoconfig functions */
@ -78,6 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.33 2004/01/10 22:33:24 bjh21 Exp $")
#include <uvm/uvm_extern.h>
#include <dev/audio_if.h>
#include <dev/audiobellvar.h>
#include <dev/mulaw.h>
#include <machine/intr.h>
@ -87,10 +88,13 @@ __KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.33 2004/01/10 22:33:24 bjh21 Exp $")
#include <arm/iomd/vidcaudiovar.h>
#include <arm/iomd/iomdreg.h>
#include <arm/iomd/iomdvar.h>
#include <arm/iomd/rpckbdvar.h>
#include <arm/iomd/vidc.h>
#include <arm/mainbus/mainbus.h>
#include <arm/iomd/waveform.h>
#include "rpckbd.h"
extern int *vidc_base;
#ifdef VIDCAUDIO_DEBUG
@ -183,14 +187,6 @@ static struct audio_hw_if vidcaudio_hw_if = {
NULL,
};
void
vidcaudio_beep_generate(void)
{
}
static int
vidcaudio_probe(struct device *parent, struct cfdata *cf, void *aux)
{
@ -215,6 +211,7 @@ static void
vidcaudio_attach(struct device *parent, struct device *self, void *aux)
{
struct vidcaudio_softc *sc = (void *)self;
struct device *beepdev;
switch (IOMD_ID) {
#ifndef EB7500ATX
@ -252,7 +249,10 @@ vidcaudio_attach(struct device *parent, struct device *self, void *aux)
disable_irq(sc->sc_dma_intr);
audio_attach_mi(&vidcaudio_hw_if, sc, self);
beepdev = audio_attach_mi(&vidcaudio_hw_if, sc, self);
#if NRPCKBD > 0
rpckbd_hookup_bell(audiobell, beepdev);
#endif
}
static int