Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hp300/dev Make the Apollo Domain keyboard actually ...



details:   https://anonhg.NetBSD.org/src/rev/709beeabdda5
branches:  trunk
changeset: 328913:709beeabdda5
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Apr 24 11:58:04 2014 +0000

description:
Make the Apollo Domain keyboard actually work.

Tested on HP9000/425e and the keyboard model A1630-82001 R2 (RX-60857-HW)
provided by Miod Vallat.  Mouse support needs more work.

diffstat:

 sys/arch/hp300/dev/dnkbd.c |  43 ++++++++++++-------------------------------
 1 files changed, 12 insertions(+), 31 deletions(-)

diffs (101 lines):

diff -r fe47be921270 -r 709beeabdda5 sys/arch/hp300/dev/dnkbd.c
--- a/sys/arch/hp300/dev/dnkbd.c        Thu Apr 24 11:56:11 2014 +0000
+++ b/sys/arch/hp300/dev/dnkbd.c        Thu Apr 24 11:58:04 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dnkbd.c,v 1.5 2011/02/18 19:15:43 tsutsui Exp $        */
+/*     $NetBSD: dnkbd.c,v 1.6 2014/04/24 11:58:04 tsutsui Exp $        */
 /*     $OpenBSD: dnkbd.c,v 1.17 2009/07/23 21:05:56 blambert Exp $     */
 
 /*
@@ -210,6 +210,8 @@
 
 typedef enum { EVENT_NONE, EVENT_KEYBOARD, EVENT_MOUSE } dnevent;
 
+#define APCIBRD(x)     (500000 / (x))
+
 static void    dnevent_kbd(struct dnkbd_softc *, int);
 static void    dnevent_kbd_internal(struct dnkbd_softc *, int);
 static void    dnevent_mouse(struct dnkbd_softc *, uint8_t *);
@@ -225,8 +227,6 @@
 static void    dnkbd_rawrepeat(void *);
 #endif
 static int     dnkbd_send(struct dnkbd_softc *, const uint8_t *, size_t);
-static int     dnsubmatch_kbd(device_t, cfdata_t, const int *, void *);
-static int     dnsubmatch_mouse(device_t, cfdata_t, const int *, void *);
 
 int
 dnkbd_match(device_t parent, cfdata_t cf, void *aux)
@@ -287,13 +287,15 @@
 {
        bus_space_tag_t bst;
        bus_space_handle_t bsh;
+       u_int divisor;
 
        bst = sc->sc_bst;
        bsh = sc->sc_bsh;
 
+       divisor = APCIBRD(rate);
        bus_space_write_1(bst, bsh, com_lctl, LCR_DLAB);
-       bus_space_write_1(bst, bsh, com_dlbl, rate & 0xff);
-       bus_space_write_1(bst, bsh, com_dlbh, (rate >> 8) & 0xff);
+       bus_space_write_1(bst, bsh, com_dlbl, divisor & 0xff);
+       bus_space_write_1(bst, bsh, com_dlbh, (divisor >> 8) & 0xff);
        bus_space_write_1(bst, bsh, com_lctl, lctl);
        bus_space_write_1(bst, bsh, com_ier, IER_ERXRDY | IER_ETXRDY);
        bus_space_write_1(bst, bsh, com_fifo,
@@ -301,6 +303,7 @@
        bus_space_write_1(bst, bsh, com_mcr, MCR_DTR | MCR_RTS);
 
        delay(100);
+       (void)bus_space_read_1(bst, bsh, com_iir);
 }
 
 void
@@ -347,43 +350,21 @@
                sc->sc_flags = SF_PLUGGED;
        }
 
-       sc->sc_wskbddev = config_found_sm_loc(sc->sc_dev, "dnkbd", NULL, &ka,
-           wskbddevprint, dnsubmatch_kbd);
+       sc->sc_wskbddev =
+           config_found_ia(sc->sc_dev, "wskbddev", &ka, wskbddevprint);
 
 #if NWSMOUSE > 0
        ma.accessops = &dnmouse_accessops;
        ma.accesscookie = sc;
 
-       sc->sc_wsmousedev = config_found_sm_loc(sc->sc_dev, "dnkbd", NULL, &ma,
-           wsmousedevprint, dnsubmatch_mouse);
+       sc->sc_wsmousedev =
+           config_found_ia(sc->sc_dev, "wsmousedev", &ma, wsmousedevprint);
 #endif
 
        SET(sc->sc_flags, SF_ATTACHED);
 }
 
 int
-dnsubmatch_kbd(device_t parent, cfdata_t cf, const int *locs, void *aux)
-{
-
-       if (strcmp(cf->cf_name, wskbd_cd.cd_name) != 0)
-               return 0;
-
-       return config_match(parent, cf, aux);
-}
-
-#if NWSMOUSE > 0
-int
-dnsubmatch_mouse(device_t parent, cfdata_t cf, const int *locs, void *aux)
-{
-
-       if (strcmp(cf->cf_name, wsmouse_cd.cd_name) != 0)
-               return 0;
-
-       return config_match(parent, cf, aux);
-}
-#endif
-
-int
 dnkbd_probe(struct dnkbd_softc *sc)
 {
        int dat, rc, flags;



Home | Main Index | Thread Index | Old Index