summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev/kbd.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-11 05:35:37 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-11 05:35:37 +0000
commite511a52691ddb2290f5d3c9ca6e9f0fc3b320289 (patch)
treef68510b774a71e2a0879cb013e3abd7a15665abc /sys/arch/sparc/dev/kbd.c
parentfc98d7c9a0046f274410f903f952ef6224f68e10 (diff)
netbsd port, now we merge our changes back in
Diffstat (limited to 'sys/arch/sparc/dev/kbd.c')
-rw-r--r--sys/arch/sparc/dev/kbd.c99
1 files changed, 62 insertions, 37 deletions
diff --git a/sys/arch/sparc/dev/kbd.c b/sys/arch/sparc/dev/kbd.c
index 194da8fdd6e..f65228f0848 100644
--- a/sys/arch/sparc/dev/kbd.c
+++ b/sys/arch/sparc/dev/kbd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kbd.c,v 1.19 1995/07/06 05:35:34 pk Exp $ */
+/* $NetBSD: kbd.c,v 1.23 1996/04/01 17:34:34 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -51,7 +51,6 @@
*/
#include <sys/param.h>
-#include <sys/conf.h>
#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/kernel.h>
@@ -59,8 +58,11 @@
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/tty.h>
+#include <sys/signalvar.h>
+#include <sys/conf.h>
#include <machine/autoconf.h>
+#include <machine/conf.h>
#include <machine/vuid_event.h>
#include <sparc/dev/event_var.h>
@@ -217,19 +219,10 @@ struct kbd_softc {
} kbd_softc;
/* Prototypes */
-void kbd_ascii(struct tty *);
-void kbd_serial(struct tty *, void (*)(), void (*)());
-static void kbd_getid(void *);
-void kbd_reset(struct kbd_state *);
-static int kbd_translate(int, struct kbd_state *);
-void kbd_rint(int);
-int kbdopen(dev_t, int, int, struct proc *);
-int kbdclose(dev_t, int, int, struct proc *);
-int kbdread(dev_t, struct uio *, int);
-int kbdwrite(dev_t, struct uio *, int);
-int kbdioctl(dev_t, u_long, caddr_t, int, struct proc *);
-int kbdselect(dev_t, int, struct proc *);
-int kbd_docmd(int, int);
+void kbd_reset __P((struct kbd_state *));
+static int kbd_translate __P((int, struct kbd_state *));
+void kbdattach __P((int));
+void kbd_repeat __P((void *arg));
/* set in kbdattach() */
int kbd_repeat_start;
@@ -240,7 +233,8 @@ int kbd_repeat_step;
* This happens before kbd_serial.
*/
void
-kbd_ascii(struct tty *tp)
+kbd_ascii(tp)
+ struct tty *tp;
{
kbd_softc.k_cons = tp;
@@ -251,7 +245,10 @@ kbd_ascii(struct tty *tp)
* We pick up the initial keyboard click state here as well.
*/
void
-kbd_serial(struct tty *tp, void (*iopen)(), void (*iclose)())
+kbd_serial(tp, iopen, iclose)
+ struct tty *tp;
+ void (*iopen) __P((struct tty *));
+ void (*iclose) __P((struct tty *));
{
register struct kbd_softc *k;
register char *cp;
@@ -261,13 +258,11 @@ kbd_serial(struct tty *tp, void (*iopen)(), void (*iclose)())
k->k_open = iopen;
k->k_close = iclose;
-#if defined(SUN4C) || defined(SUN4M)
- if (cputyp != CPU_SUN4) {
+ if (!CPU_ISSUN4) {
cp = getpropstring(optionsnode, "keyboard-click?");
if (cp && strcmp(cp, "true") == 0)
k->k_state.kbd_click = 1;
}
-#endif /* SUN4C || SUN4M */
}
/*
@@ -276,7 +271,8 @@ kbd_serial(struct tty *tp, void (*iopen)(), void (*iclose)())
* send a RESET, so that we can find out what kind of keyboard it is.
*/
void
-kbdattach(int nkbd)
+kbdattach(kbd)
+ int kbd;
{
register struct kbd_softc *k;
register struct tty *tp;
@@ -295,7 +291,8 @@ kbdattach(int nkbd)
}
void
-kbd_reset(register struct kbd_state *ks)
+kbd_reset(ks)
+ register struct kbd_state *ks;
{
/*
* On first identification, wake up anyone waiting for type
@@ -328,7 +325,6 @@ kbd_reset(register struct kbd_state *ks)
break;
default:
printf("Unknown keyboard type %d\n", ks->kbd_id);
- break;
}
ks->kbd_leds = 0;
@@ -338,7 +334,9 @@ kbd_reset(register struct kbd_state *ks)
* Turn keyboard up/down codes into ASCII.
*/
static int
-kbd_translate(register int c, register struct kbd_state *ks)
+kbd_translate(c, ks)
+ register int c;
+ register struct kbd_state *ks;
{
register int down;
@@ -401,7 +399,8 @@ kbd_translate(register int c, register struct kbd_state *ks)
void
-kbd_repeat(void *arg)
+kbd_repeat(arg)
+ void *arg;
{
struct kbd_softc *k = (struct kbd_softc *)arg;
int s = spltty();
@@ -414,7 +413,8 @@ kbd_repeat(void *arg)
}
void
-kbd_rint(register int c)
+kbd_rint(c)
+ register int c;
{
register struct kbd_softc *k = &kbd_softc;
register struct firm_event *fe;
@@ -512,7 +512,11 @@ kbd_rint(register int c)
}
int
-kbdopen(dev_t dev, int flags, int mode, struct proc *p)
+kbdopen(dev, flags, mode, p)
+ dev_t dev;
+ int flags;
+ int mode;
+ struct proc *p;
{
int s, error;
struct tty *tp;
@@ -548,7 +552,11 @@ kbdopen(dev_t dev, int flags, int mode, struct proc *p)
}
int
-kbdclose(dev_t dev, int flags, int mode, struct proc *p)
+kbdclose(dev, flags, mode, p)
+ dev_t dev;
+ int flags;
+ int mode;
+ struct proc *p;
{
/*
@@ -564,7 +572,10 @@ kbdclose(dev_t dev, int flags, int mode, struct proc *p)
}
int
-kbdread(dev_t dev, struct uio *uio, int flags)
+kbdread(dev, uio, flags)
+ dev_t dev;
+ struct uio *uio;
+ int flags;
{
return (ev_read(&kbd_softc.k_events, uio, flags));
@@ -572,14 +583,22 @@ kbdread(dev_t dev, struct uio *uio, int flags)
/* this routine should not exist, but is convenient to write here for now */
int
-kbdwrite(dev_t dev, struct uio *uio, int flags)
+kbdwrite(dev, uio, flags)
+ dev_t dev;
+ struct uio *uio;
+ int flags;
{
return (EOPNOTSUPP);
}
int
-kbdioctl(dev_t dev, u_long cmd, register caddr_t data, int flag, struct proc *p)
+kbdioctl(dev, cmd, data, flag, p)
+ dev_t dev;
+ u_long cmd;
+ register caddr_t data;
+ int flag;
+ struct proc *p;
{
register struct kbd_softc *k = &kbd_softc;
register struct kiockey *kmp;
@@ -602,10 +621,11 @@ kbdioctl(dev_t dev, u_long cmd, register caddr_t data, int flag, struct proc *p)
case KIOCGETKEY:
if (((struct okiockey *)data)->kio_station == 118) {
/*
- * This is X11 asking if a type 3 keyboard is
- * really a type 3 keyboard. Say yes.
+ * This is X11 asking (in an inappropriate fashion)
+ * if a type 3 keyboard is really a type 3 keyboard.
+ * Say yes (inappropriately).
*/
- ((struct okiockey *)data)->kio_entry = (u_char) HOLE;
+ ((struct okiockey *)data)->kio_entry = (u_char)HOLE;
return (0);
}
break;
@@ -680,7 +700,6 @@ kbdioctl(dev_t dev, u_long cmd, register caddr_t data, int flag, struct proc *p)
int s;
char leds = *(char *)data;
struct tty *tp = kbd_softc.k_kbd;
-
s = spltty();
if (tp->t_outq.c_cc > 120)
(void) tsleep((caddr_t)&lbolt, TTIPRI,
@@ -699,6 +718,7 @@ kbdioctl(dev_t dev, u_long cmd, register caddr_t data, int flag, struct proc *p)
*(char *)data = k->k_state.kbd_leds;
return (0);
+
case FIONBIO: /* we will remove this someday (soon???) */
return (0);
@@ -722,7 +742,10 @@ kbdioctl(dev_t dev, u_long cmd, register caddr_t data, int flag, struct proc *p)
}
int
-kbdselect(dev_t dev, int rw, struct proc *p)
+kbdselect(dev, rw, p)
+ dev_t dev;
+ int rw;
+ struct proc *p;
{
return (ev_select(&kbd_softc.k_events, rw, p));
@@ -734,7 +757,9 @@ kbdselect(dev_t dev, int rw, struct proc *p)
* is flooding. (The keyboard runs at 1200 baud, or 120 cps.)
*/
int
-kbd_docmd(int cmd, int isuser)
+kbd_docmd(cmd, isuser)
+ int cmd;
+ int isuser;
{
register struct tty *tp = kbd_softc.k_kbd;
register struct kbd_softc *k = &kbd_softc;