Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic When receiving an rx interrupt on a closed or unc...
details: https://anonhg.NetBSD.org/src/rev/62300a74d50f
branches: trunk
changeset: 494585:62300a74d50f
user: sommerfeld <sommerfeld%NetBSD.org@localhost>
date: Sat Jul 08 18:36:02 2000 +0000
description:
When receiving an rx interrupt on a closed or unconfigured port, read
the data out of the board anyway so it won't re-interrupt anyway.
Fix tested by C Kane <ckane%best.com@localhost>
diffstat:
sys/dev/ic/cy.c | 38 +++++++++++++++++++++++++-------------
1 files changed, 25 insertions(+), 13 deletions(-)
diffs (83 lines):
diff -r bab44c5a86e3 -r 62300a74d50f sys/dev/ic/cy.c
--- a/sys/dev/ic/cy.c Sat Jul 08 18:24:28 2000 +0000
+++ b/sys/dev/ic/cy.c Sat Jul 08 18:36:02 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cy.c,v 1.14 2000/07/06 01:47:37 thorpej Exp $ */
+/* $NetBSD: cy.c,v 1.15 2000/07/08 18:36:02 sommerfeld Exp $ */
/*
* cy.c
@@ -1099,10 +1099,6 @@
cy->cy_rx_int_count++;
#endif
- if (cy->cy_tty == NULL ||
- !ISSET(cy->cy_tty->t_state, TS_ISOPEN))
- goto end_rx_serv;
-
buf_p = cy->cy_ibuf_wr_ptr;
if (ISSET(serv_type, CD1400_RIVR_EXCEPTION)) {
@@ -1111,6 +1107,10 @@
recv_data = cd_read_reg(sc, cy->cy_chip,
CD1400_RDSR);
+ if (cy->cy_tty == NULL ||
+ !ISSET(cy->cy_tty->t_state, TS_ISOPEN))
+ goto end_rx_serv;
+
#ifdef CY_DEBUG
printf("%s port %d recv exception, line_stat 0x%x, char 0x%x\n",
sc->sc_dev.dv_xname, cy->cy_port_num, line_stat, recv_data);
@@ -1133,6 +1133,16 @@
} else {/* no exception, received data OK */
n_chars = cd_read_reg(sc, cy->cy_chip,
CD1400_RDCR);
+
+ /* If no tty or not open, discard data */
+ if (cy->cy_tty == NULL ||
+ !ISSET(cy->cy_tty->t_state, TS_ISOPEN)) {
+ while (n_chars--)
+ cd_read_reg(sc, cy->cy_chip,
+ CD1400_RDSR);
+ goto end_rx_serv;
+ }
+
#ifdef CY_DEBUG
printf("%s port %d receive ok %d chars\n",
sc->sc_dev.dv_xname, cy->cy_port_num, n_chars);
@@ -1159,24 +1169,26 @@
/* RTS handshaking for incoming data */
if (ISSET(cy->cy_tty->t_cflag, CRTSCTS)) {
- int bf;
+ int bf, msvr;
bf = buf_p - cy->cy_ibuf_rd_ptr;
if (bf < 0)
bf += CY_IBUF_SIZE;
- if (bf > (CY_IBUF_SIZE / 2)) { /* turn RTS off */
- if (cy->cy_clock == CY_CLOCK_60) {
- cd_write_reg(sc, cy->cy_chip, CD1400_MSVR2, 0);
- } else {
- cd_write_reg(sc, cy->cy_chip, CD1400_MSVR1, 0);
- }
+ if (bf > (CY_IBUF_SIZE / 2)) {
+ /* turn RTS off */
+ if (cy->cy_clock == CY_CLOCK_60)
+ msvr = CD1400_MSVR2;
+ else
+ msvr = CD1400_MSVR1;
+ cd_write_reg(sc, cy->cy_chip, msvr, 0);
}
}
end_rx_serv:
/* terminate service context */
- cd_write_reg(sc, cy->cy_chip, CD1400_RIR, save_rir & 0x3f);
+ cd_write_reg(sc, cy->cy_chip, CD1400_RIR,
+ save_rir & 0x3f);
cd_write_reg(sc, cy->cy_chip, CD1400_CAR, save_car);
int_serviced = 1;
} /* if (rx_service...) */
Home |
Main Index |
Thread Index |
Old Index