Support for Sun Keyboard/Mouse line disciplines.

This commit is contained in:
eeh 2000-09-21 23:40:47 +00:00
parent 9220a0cf6b
commit c28a7b93c0
5 changed files with 59 additions and 13 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.sun,v 1.3 2000/08/23 13:41:15 pk Exp $
# $NetBSD: files.sun,v 1.4 2000/09/21 23:40:47 eeh Exp $
#
# Configuration file for devices found on Sun machines.
#
@ -33,3 +33,11 @@ file dev/sun/cgthree.c cgthree needs-flag
device cgsix: bt_dac, fb, rasops8, pfour
file dev/sun/cgsix.c cgsix needs-flag
#device sunkbd
#file dev/sun/sunkbd.c sunkbd needs-flag
#file dev/sun/kbd.c sunkbd
#device sunms
#file dev/sun/sunms.c sunms needs-flag
#file dev/sun/ms.c sunms

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbd.c,v 1.26 2000/03/24 11:46:47 hannken Exp $ */
/* $NetBSD: kbd.c,v 1.27 2000/09/21 23:40:47 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -50,6 +50,8 @@
* passes them up to the appropriate reader.
*/
#include "opt_ddb.h"
/*
* This is the "slave" driver that will be attached to
* the "zsc" driver for a Sun keyboard.
@ -68,6 +70,7 @@
#include <sys/syslog.h>
#include <sys/select.h>
#include <sys/poll.h>
#include <sys/file.h>
#include <dev/ic/z8530reg.h>
#include <machine/z8530var.h>
@ -135,7 +138,7 @@ kbdopen(dev, flags, mode, p)
return (error);
}
ev_init(&k->k_events);
k->k_evmode = 1; /* XXX: OK? */
k->k_evmode = 0; /* XXX: OK? */
if (k->k_repeating) {
k->k_repeating = 0;
@ -724,7 +727,7 @@ kbd_input_raw(k, c)
* If /dev/kbd is not connected in event mode,
* translate and send upstream (to console).
*/
if (!k->k_evmode && k->k_isconsole) {
if (!k->k_evmode) {
/* Any input stops auto-repeat (i.e. key release). */
if (k->k_repeating) {
@ -829,6 +832,10 @@ kbd_iopen(k)
if (k->k_isopen)
return (0);
/* Open internal device */
if (k->k_deviopen)
(*k->k_deviopen)((struct device *)k, FREAD|FWRITE);
s = spltty();
/* Reset the keyboard and find out its type. */
@ -962,7 +969,7 @@ kbd_drain_tx(k)
error = 0;
while (k->k_txflags & K_TXBUSY) {
while (k->k_txflags & K_TXBUSY && !error) {
k->k_txflags |= K_TXWANT;
error = tsleep((caddr_t)&k->k_txflags,
PZERO | PCATCH, "kbdout", 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: kbdvar.h,v 1.6 2000/05/19 05:26:18 eeh Exp $ */
/* $NetBSD: kbdvar.h,v 1.7 2000/09/21 23:40:47 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -83,11 +83,21 @@ struct kbd_softc {
/* Stuff our parent setup */
union {
struct zs_chanstate *ku_zcs;
struct zs_chanstate *ku_cs;
struct ucom_softc *ku_usc;
} k_cs_u;
#define k_cs k_cs_u.ku_zcs
#define k_usc k_cs_u.ku_usc
void *ku_priv;
} k_u;
#define k_cs k_u.ku_cs
#define k_usc k_u.ku_usc
#define k_priv k_u.ku_priv
/*
* The deviopen and deviclose routines are provided
* by the lower level driver and used as a back door
* when opening and closing the internal device.
*/
int (*k_deviopen) __P((struct device *, int));
int (*k_deviclose) __P((struct device *, int));
void (*k_write_data) __P((struct kbd_softc *, int));
/* Flags to communicate with kbd_softint() */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ms.c,v 1.18 2000/03/30 12:45:42 augustss Exp $ */
/* $NetBSD: ms.c,v 1.19 2000/09/21 23:40:47 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -106,6 +106,13 @@ msopen(dev, flags, mode, p)
/* This is an exclusive open device. */
if (ms->ms_events.ev_io)
return (EBUSY);
if (ms->ms_deviopen) {
int err;
err = (*ms->ms_deviopen)(ms, flags);
if (err)
return (err);
}
ms->ms_events.ev_io = p;
ev_init(&ms->ms_events); /* may cause sleep */
@ -126,6 +133,12 @@ msclose(dev, flags, mode, p)
ev_fini(&ms->ms_events);
ms->ms_events.ev_io = NULL;
if (ms->ms_deviclose) {
int err;
err = (*ms->ms_deviclose)(ms, flags);
if (err)
return (err);
}
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: msvar.h,v 1.1 1999/05/14 07:07:16 mrg Exp $ */
/* $NetBSD: msvar.h,v 1.2 2000/09/21 23:40:47 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -81,6 +81,14 @@ struct ms_softc {
struct device ms_dev; /* required first: base device */
struct zs_chanstate *ms_cs;
/*
* The deviopen and deviclose routines are provided
* by the lower level driver and used as a back door
* when opening and closing the internal device.
*/
int (*ms_deviopen) __P((struct device *, int));
int (*ms_deviclose) __P((struct device *, int));
/* Flags to communicate with ms_softintr() */
volatile int ms_intr_flags;
#define INTR_RX_OVERRUN 1