From a183d34f04482a618d0fb955db92ffba90ee516e Mon Sep 17 00:00:00 2001 From: thorpej Date: Mon, 6 Mar 2000 21:36:05 +0000 Subject: - Implement cnbell() -- ring the console bell. The cn_bell entrypoint is optional. - Add cn_bell to statically allocated consdevs as appropriate. --- sys/dev/cons.c | 12 +++++++++++- sys/dev/cons.h | 12 ++++++++++-- sys/dev/ic/com.c | 5 +++-- 3 files changed, 24 insertions(+), 5 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/cons.c b/sys/dev/cons.c index 853442f4125..cf09fd4b9f1 100644 --- a/sys/dev/cons.c +++ b/sys/dev/cons.c @@ -1,4 +1,4 @@ -/* $NetBSD: cons.c,v 1.33 1999/08/04 14:40:54 leo Exp $ */ +/* $NetBSD: cons.c,v 1.34 2000/03/06 21:36:12 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -275,3 +275,13 @@ nullcnpollc(dev, on) { } + +void +cnbell(pitch, period, volume) + u_int pitch, period, volume; +{ + + if (cn_tab == NULL || cn_tab->cn_bell == NULL) + return; + (*cn_tab->cn_bell)(cn_tab->cn_dev, pitch, period, volume); +} diff --git a/sys/dev/cons.h b/sys/dev/cons.h index ecb452147d5..d264fd25803 100644 --- a/sys/dev/cons.h +++ b/sys/dev/cons.h @@ -1,4 +1,4 @@ -/* $NetBSD: cons.h,v 1.16 1999/12/08 01:20:12 simonb Exp $ */ +/* $NetBSD: cons.h,v 1.17 2000/03/06 21:36:12 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -56,6 +56,8 @@ struct consdev { __P((dev_t, int)); void (*cn_pollc) /* turn on and off polling */ __P((dev_t, int)); + void (*cn_bell) /* ring bell */ + __P((dev_t, u_int, u_int, u_int)); dev_t cn_dev; /* major/minor of device */ int cn_pri; /* pecking order; the higher the better */ }; @@ -84,6 +86,7 @@ int cnpoll __P((dev_t, int, struct proc *)); int cngetc __P((void)); void cnputc __P((int)); void cnpollc __P((int)); +void cnbell __P((u_int, u_int, u_int)); void cnrint __P((void)); void nullcnpollc __P((dev_t, int)); @@ -93,15 +96,20 @@ void nullcnpollc __P((dev_t, int)); #define dev_type_cngetc(n) int n __P((dev_t)) #define dev_type_cnputc(n) void n __P((dev_t, int)) #define dev_type_cnpollc(n) void n __P((dev_t, int)) +#define dev_type_cnbell(n) void n __P((dev_t, u_int, u_int, u_int)); #define cons_decl(n) \ dev_decl(n,cnprobe); dev_decl(n,cninit); dev_decl(n,cngetc); \ - dev_decl(n,cnputc); dev_decl(n,cnpollc) + dev_decl(n,cnputc); dev_decl(n,cnpollc); dev_decl(n,cnbell); #define cons_init(n) { \ dev_init(1,n,cnprobe), dev_init(1,n,cninit), dev_init(1,n,cngetc), \ dev_init(1,n,cnputc), dev_init(1,n,cnpollc) } +#define cons_init_bell(n) { \ + dev_init(1,n,cnprobe), dev_init(1,n,cninit), dev_init(1,n,cngetc), \ + dev_init(1,n,cnputc), dev_init(1,n,cnpollc), dev_init(1,n,cnbell) } + #endif #endif /* _SYS_DEV_CONS_H_ */ diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index d9abc8721c1..be6e5842360 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.168 2000/02/07 02:17:18 jonathan Exp $ */ +/* $NetBSD: com.c,v 1.169 2000/03/06 21:36:12 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -2235,7 +2235,8 @@ comcnattach(iot, iobase, rate, frequency, cflag) { int res; static struct consdev comcons = { - NULL, NULL, comcngetc, comcnputc, comcnpollc, NODEV, CN_NORMAL + NULL, NULL, comcngetc, comcnputc, comcnpollc, NULL, + NODEV, CN_NORMAL }; res = cominit(iot, iobase, rate, frequency, cflag, &comconsioh); -- cgit