diff options
author | marius <marius@FreeBSD.org> | 2007-01-18 22:01:19 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2007-01-18 22:01:19 +0000 |
commit | 545a381d5f5917c12078fc06b779fab7711c053e (patch) | |
tree | 9d40efb79e6c86a1071e9763b706b391d9e9c487 /sys/dev/uart/uart_kbd_sun.c | |
parent | 6f6da4e54a1b02d5dd2237063607a3b22d39e819 (diff) | |
download | FreeBSD-src-545a381d5f5917c12078fc06b779fab7711c053e.zip FreeBSD-src-545a381d5f5917c12078fc06b779fab7711c053e.tar.gz |
- Add a uart_rxready() and corresponding device-specific implementations
that can be used to check whether receive data is ready, i.e. whether
the subsequent call of uart_poll() should return a char, and unlike
uart_poll() doesn't actually receive data.
- Remove the device-specific implementations of uart_poll() and implement
uart_poll() in terms of uart_getc() and the newly added uart_rxready()
in order to minimize code duplication.
- In sunkbd(4) take advantage of uart_rxready() and use it to implement
the polled mode part of sunkbd_check() so we don't need to buffer a
potentially read char in the softc.
- Fix some mis-indentation in sunkbd_read_char().
Discussed with: marcel
Diffstat (limited to 'sys/dev/uart/uart_kbd_sun.c')
-rw-r--r-- | sys/dev/uart/uart_kbd_sun.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/sys/dev/uart/uart_kbd_sun.c b/sys/dev/uart/uart_kbd_sun.c index 201761d..7395f9d 100644 --- a/sys/dev/uart/uart_kbd_sun.c +++ b/sys/dev/uart/uart_kbd_sun.c @@ -72,8 +72,6 @@ struct sunkbd_softc { struct uart_softc *sc_uart; struct uart_devinfo *sc_sysdev; - int sc_checked_key; - struct callout sc_repeat_callout; int sc_repeat_key; @@ -403,7 +401,7 @@ sunkbd_check(keyboard_t *kbd) return (TRUE); if (sc->sc_polling != 0 && sc->sc_sysdev != NULL && - (sc->sc_checked_key = uart_poll(sc->sc_sysdev)) != -1) + uart_rxready(sc->sc_sysdev)) return (TRUE); return (FALSE); @@ -441,12 +439,6 @@ sunkbd_read_char(keyboard_t *kbd, int wait) goto process_code; } - if (sc->sc_checked_key != -1) { - suncode = sc->sc_checked_key; - sc->sc_checked_key = -1; - goto process_code; - } - for (;;) { next_code: if (!(sc->sc_flags & KPCOMPOSE) && (sc->sc_composed_char > 0)) { @@ -472,7 +464,6 @@ sunkbd_read_char(keyboard_t *kbd, int wait) case SKBD_RSP_IDLE: break; default: - process_code: ++kbd->kb_count; key = SKBD_KEY_CHAR(suncode); @@ -565,10 +556,12 @@ sunkbd_read_char(keyboard_t *kbd, int wait) if (key == 0x13) { /* left alt (KP compose key) */ #endif if (release != 0) { - if (sc->sc_flags & KPCOMPOSE) { - sc->sc_flags &= ~KPCOMPOSE; - if (sc->sc_composed_char > UCHAR_MAX) - sc->sc_composed_char = 0; + if (sc->sc_flags & KPCOMPOSE) { + sc->sc_flags &= ~KPCOMPOSE; + if (sc->sc_composed_char > + UCHAR_MAX) + sc->sc_composed_char = + 0; } } else { if (!(sc->sc_flags & KPCOMPOSE)) { @@ -768,7 +761,6 @@ sunkbd_clear_state(keyboard_t *kbd) struct sunkbd_softc *sc; sc = (struct sunkbd_softc *)kbd; - sc->sc_checked_key = -1; sc->sc_repeat_key = -1; sc->sc_accents = 0; sc->sc_composed_char = 0; |