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>
This commit is contained in:
parent
6f0015c48f
commit
dcf6e7b09e
@ -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
|
* cy.c
|
||||||
@ -1099,10 +1099,6 @@ cy_intr(arg)
|
|||||||
cy->cy_rx_int_count++;
|
cy->cy_rx_int_count++;
|
||||||
#endif
|
#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;
|
buf_p = cy->cy_ibuf_wr_ptr;
|
||||||
|
|
||||||
if (ISSET(serv_type, CD1400_RIVR_EXCEPTION)) {
|
if (ISSET(serv_type, CD1400_RIVR_EXCEPTION)) {
|
||||||
@ -1111,6 +1107,10 @@ cy_intr(arg)
|
|||||||
recv_data = cd_read_reg(sc, cy->cy_chip,
|
recv_data = cd_read_reg(sc, cy->cy_chip,
|
||||||
CD1400_RDSR);
|
CD1400_RDSR);
|
||||||
|
|
||||||
|
if (cy->cy_tty == NULL ||
|
||||||
|
!ISSET(cy->cy_tty->t_state, TS_ISOPEN))
|
||||||
|
goto end_rx_serv;
|
||||||
|
|
||||||
#ifdef CY_DEBUG
|
#ifdef CY_DEBUG
|
||||||
printf("%s port %d recv exception, line_stat 0x%x, char 0x%x\n",
|
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);
|
sc->sc_dev.dv_xname, cy->cy_port_num, line_stat, recv_data);
|
||||||
@ -1133,6 +1133,16 @@ cy_intr(arg)
|
|||||||
} else {/* no exception, received data OK */
|
} else {/* no exception, received data OK */
|
||||||
n_chars = cd_read_reg(sc, cy->cy_chip,
|
n_chars = cd_read_reg(sc, cy->cy_chip,
|
||||||
CD1400_RDCR);
|
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
|
#ifdef CY_DEBUG
|
||||||
printf("%s port %d receive ok %d chars\n",
|
printf("%s port %d receive ok %d chars\n",
|
||||||
sc->sc_dev.dv_xname, cy->cy_port_num, n_chars);
|
sc->sc_dev.dv_xname, cy->cy_port_num, n_chars);
|
||||||
@ -1159,24 +1169,26 @@ cy_intr(arg)
|
|||||||
|
|
||||||
/* RTS handshaking for incoming data */
|
/* RTS handshaking for incoming data */
|
||||||
if (ISSET(cy->cy_tty->t_cflag, CRTSCTS)) {
|
if (ISSET(cy->cy_tty->t_cflag, CRTSCTS)) {
|
||||||
int bf;
|
int bf, msvr;
|
||||||
|
|
||||||
bf = buf_p - cy->cy_ibuf_rd_ptr;
|
bf = buf_p - cy->cy_ibuf_rd_ptr;
|
||||||
if (bf < 0)
|
if (bf < 0)
|
||||||
bf += CY_IBUF_SIZE;
|
bf += CY_IBUF_SIZE;
|
||||||
|
|
||||||
if (bf > (CY_IBUF_SIZE / 2)) { /* turn RTS off */
|
if (bf > (CY_IBUF_SIZE / 2)) {
|
||||||
if (cy->cy_clock == CY_CLOCK_60) {
|
/* turn RTS off */
|
||||||
cd_write_reg(sc, cy->cy_chip, CD1400_MSVR2, 0);
|
if (cy->cy_clock == CY_CLOCK_60)
|
||||||
} else {
|
msvr = CD1400_MSVR2;
|
||||||
cd_write_reg(sc, cy->cy_chip, CD1400_MSVR1, 0);
|
else
|
||||||
}
|
msvr = CD1400_MSVR1;
|
||||||
|
cd_write_reg(sc, cy->cy_chip, msvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end_rx_serv:
|
end_rx_serv:
|
||||||
/* terminate service context */
|
/* 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);
|
cd_write_reg(sc, cy->cy_chip, CD1400_CAR, save_car);
|
||||||
int_serviced = 1;
|
int_serviced = 1;
|
||||||
} /* if (rx_service...) */
|
} /* if (rx_service...) */
|
||||||
|
Loading…
Reference in New Issue
Block a user