summaryrefslogtreecommitdiff
path: root/sys/dev/hil
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/hil')
-rw-r--r--sys/dev/hil/hil.c25
-rw-r--r--sys/dev/hil/hilkbd.c19
-rw-r--r--sys/dev/hil/hilvar.h40
3 files changed, 44 insertions, 40 deletions
diff --git a/sys/dev/hil/hil.c b/sys/dev/hil/hil.c
index 29af438fc52..9c9d9bd647c 100644
--- a/sys/dev/hil/hil.c
+++ b/sys/dev/hil/hil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hil.c,v 1.1 2003/02/11 19:40:20 miod Exp $ */
+/* $OpenBSD: hil.c,v 1.2 2003/02/15 23:38:46 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -228,7 +228,7 @@ hil_attach_deferred(void *v)
int len;
const struct hildevice *hd;
- send_hildev_cmd(sc, id, HIL_IDENTIFY);
+ send_hildev_cmd(sc, id, HIL_IDENTIFY, NULL, NULL);
len = sc->sc_cmdbp - sc->sc_cmdbuf;
if (len == 0) {
@@ -272,7 +272,7 @@ hil_attach_deferred(void *v)
}
void
-hil_callback_register(struct hil_softc *sc, int hilid,
+hil_callback_register(struct hil_softc *sc, u_int hilid,
void (*handler)(void *, u_int, u_int8_t *), void *arg)
{
#ifdef HILDEBUG
@@ -414,7 +414,7 @@ hilconfig(struct hil_softc *sc)
* possible without blocking the clock (is this necessary?)
*/
void
-send_hil_cmd(struct hil_softc *sc, u_int8_t cmd, u_int8_t *data, u_int8_t dlen,
+send_hil_cmd(struct hil_softc *sc, u_int cmd, u_int8_t *data, u_int dlen,
u_int8_t *rdata)
{
u_int8_t status;
@@ -450,9 +450,8 @@ send_hil_cmd(struct hil_softc *sc, u_int8_t cmd, u_int8_t *data, u_int8_t dlen,
* splvm (clock only interrupts) seems to be good enough in practice.
*/
void
-send_hildev_cmd(sc, device, cmd)
- struct hil_softc *sc;
- char device, cmd;
+send_hildev_cmd(struct hil_softc *sc, u_int device, u_int cmd,
+ u_int8_t *outbuf, u_int *outlen)
{
u_int8_t status, c;
int s = splvm();
@@ -489,6 +488,14 @@ send_hildev_cmd(sc, device, cmd)
sc->sc_cmddev = 0;
+ /*
+ * Return the command response in the buffer if necessary
+ */
+ if (outbuf != NULL && outlen != NULL) {
+ *outlen = min(*outlen, sc->sc_cmdbp - sc->sc_cmdbuf);
+ bcopy(sc->sc_cmdbuf, outbuf, *outlen);
+ }
+
pollon(sc);
splx(s);
@@ -500,7 +507,7 @@ send_hildev_cmd(sc, device, cmd)
void
polloff(struct hil_softc *sc)
{
- char db;
+ u_int8_t db;
/*
* Turn off auto repeat
@@ -537,7 +544,7 @@ polloff(struct hil_softc *sc)
void
pollon(struct hil_softc *sc)
{
- char db;
+ u_int8_t db;
/*
* Turn on auto polling
diff --git a/sys/dev/hil/hilkbd.c b/sys/dev/hil/hilkbd.c
index 1bc6996e16f..3b125145e36 100644
--- a/sys/dev/hil/hilkbd.c
+++ b/sys/dev/hil/hilkbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hilkbd.c,v 1.2 2003/02/12 01:42:31 miod Exp $ */
+/* $OpenBSD: hilkbd.c,v 1.3 2003/02/15 23:38:46 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -117,17 +117,11 @@ hilkbdattach(struct device *parent, struct device *self, void *aux)
struct hilkbd_softc *sc = (void *)self;
struct hil_attach_args *ha = aux;
struct wskbddev_attach_args a;
- u_int8_t db, layoutcode;
+ u_int8_t layoutcode;
sc->sc_code = ha->ha_code;
/*
- * Put the keyboard in raw mode
- */
- db = 0;
- send_hil_cmd((struct hil_softc *)parent, HIL_WRITEKBDSADR, &db, 1, NULL);
-
- /*
* Determine the keyboard language configuration, but don't
* override a user-specified setting.
*/
@@ -190,15 +184,18 @@ hilkbd_set_leds(void *v, int leds)
if (changemask & WSKBD_LED_SCROLL)
send_hildev_cmd((struct hil_softc *)sc->sc_dev.dv_parent,
sc->sc_code,
- (leds & WSKBD_LED_SCROLL) ? HIL_PROMPT1 : HIL_ACK1);
+ (leds & WSKBD_LED_SCROLL) ? HIL_PROMPT1 : HIL_ACK1,
+ NULL, NULL);
if (changemask & WSKBD_LED_NUM)
send_hildev_cmd((struct hil_softc *)sc->sc_dev.dv_parent,
sc->sc_code,
- (leds & WSKBD_LED_NUM) ? HIL_PROMPT2 : HIL_ACK2);
+ (leds & WSKBD_LED_NUM) ? HIL_PROMPT2 : HIL_ACK2,
+ NULL, NULL);
if (changemask & WSKBD_LED_CAPS)
send_hildev_cmd((struct hil_softc *)sc->sc_dev.dv_parent,
sc->sc_code,
- (leds & WSKBD_LED_CAPS) ? HIL_PROMPT3 : HIL_ACK3);
+ (leds & WSKBD_LED_CAPS) ? HIL_PROMPT3 : HIL_ACK3,
+ NULL, NULL);
sc->sc_ledstate = leds;
}
diff --git a/sys/dev/hil/hilvar.h b/sys/dev/hil/hilvar.h
index 4611629afb5..80fc3799a18 100644
--- a/sys/dev/hil/hilvar.h
+++ b/sys/dev/hil/hilvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hilvar.h,v 1.1 2003/02/11 19:39:30 miod Exp $ */
+/* $OpenBSD: hilvar.h,v 1.2 2003/02/15 23:38:46 miod Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -71,40 +71,40 @@
#define NHILD 8 /* 7 actual + loop pseudo (dev 0) */
struct hil_cb {
- void (*cb_fn)(void *, u_int, u_char *);
+ void (*cb_fn)(void *, u_int, u_int8_t *);
void *cb_arg;
};
struct hil_softc {
- struct device sc_dev;
+ struct device sc_dev;
bus_space_handle_t sc_bsh;
- bus_space_tag_t sc_bst;
+ bus_space_tag_t sc_bst;
- u_char sc_cmddone;
- u_char sc_cmdending;
- u_char sc_actdev; /* current input device */
- u_char sc_cmddev; /* device to perform command on */
- u_char sc_pollbuf[HILBUFSIZE]; /* interrupt time input buffer */
- u_char sc_cmdbuf[HILBUFSIZE];
- u_char *sc_pollbp; /* pointer into sc_pollbuf */
- u_char *sc_cmdbp; /* pointer into sc_cmdbuf */
+ int sc_cmddone;
+ int sc_cmdending;
+ u_int sc_actdev; /* current input device */
+ u_int sc_cmddev; /* device to perform command on */
+ u_int8_t sc_pollbuf[HILBUFSIZE]; /* interrupt time input buf */
+ u_int8_t sc_cmdbuf[HILBUFSIZE];
+ u_int8_t *sc_pollbp; /* pointer into sc_pollbuf */
+ u_int8_t *sc_cmdbp; /* pointer into sc_cmdbuf */
- u_char sc_maxdev; /* number of devices on loop */
- u_char sc_kbddev; /* keyboard device id */
- struct hil_cb sc_cb[NHILD]; /* interrupt dispatcher */
+ u_int sc_maxdev; /* number of devices on loop */
+ u_int sc_kbddev; /* keyboard device id */
+ struct hil_cb sc_cb[NHILD]; /* interrupt dispatcher */
};
#ifdef _KERNEL
-void send_hil_cmd(struct hil_softc *, u_char, u_char *, u_char, u_char *);
-void send_hildev_cmd(struct hil_softc *, char, char);
+void send_hil_cmd(struct hil_softc *, u_int, u_int8_t *, u_int, u_int8_t *);
+void send_hildev_cmd(struct hil_softc *, u_int, u_int, u_int8_t *, u_int *);
void hil_set_poll(struct hil_softc *, int);
-int hil_poll_data(struct hil_softc *, u_char *, u_char *);
+int hil_poll_data(struct hil_softc *, u_int8_t *, u_int8_t *);
void hil_attach(struct hil_softc *);
void hil_attach_deferred(void *);
-void hil_callback_register(struct hil_softc *, int,
- void (*)(void *, u_int, u_char *), void *);
+void hil_callback_register(struct hil_softc *, u_int,
+ void (*)(void *, u_int, u_int8_t *), void *);
int hil_intr(void *);
int hildevprint(void *, const char *);