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_dev_z8530.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_dev_z8530.c')
-rw-r--r-- | sys/dev/uart/uart_dev_z8530.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/dev/uart/uart_dev_z8530.c b/sys/dev/uart/uart_dev_z8530.c index 04ebc69..8509718 100644 --- a/sys/dev/uart/uart_dev_z8530.c +++ b/sys/dev/uart/uart_dev_z8530.c @@ -192,7 +192,7 @@ static int z8530_probe(struct uart_bas *bas); static void z8530_init(struct uart_bas *bas, int, int, int, int); static void z8530_term(struct uart_bas *bas); static void z8530_putc(struct uart_bas *bas, int); -static int z8530_poll(struct uart_bas *bas); +static int z8530_rxready(struct uart_bas *bas); static int z8530_getc(struct uart_bas *bas, struct mtx *); struct uart_ops uart_z8530_ops = { @@ -200,7 +200,7 @@ struct uart_ops uart_z8530_ops = { .init = z8530_init, .term = z8530_term, .putc = z8530_putc, - .poll = z8530_poll, + .rxready = z8530_rxready, .getc = z8530_getc, }; @@ -235,12 +235,10 @@ z8530_putc(struct uart_bas *bas, int c) } static int -z8530_poll(struct uart_bas *bas) +z8530_rxready(struct uart_bas *bas) { - if (!(uart_getreg(bas, REG_CTRL) & BES_RXA)) - return (-1); - return (uart_getreg(bas, REG_DATA)); + return ((uart_getreg(bas, REG_CTRL) & BES_RXA) != 0 ? 1 : 0); } static int |