Date: Thu, 16 Oct 2008 07:00:21 GMT From: Ed Schouten <ed@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 151441 for review Message-ID: <200810160700.m9G70LGV082114@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=151441 Change 151441 by ed@ed_dull on 2008/10/16 06:59:38 Revert the ucom(4) changes. It seems the USB folks are already taking care of ucom(4) again. Affected files ... .. //depot/projects/mpsafetty/sys/dev/usb/ucom.c#8 integrate Differences ... ==== //depot/projects/mpsafetty/sys/dev/usb/ucom.c#8 (text+ko) ==== @@ -128,7 +128,6 @@ static tsw_open_t ucomtty_open; static tsw_close_t ucomtty_close; static tsw_outwakeup_t ucomtty_outwakeup; -static tsw_inwakeup_t ucomtty_inwakeup; static tsw_ioctl_t ucomtty_ioctl; static tsw_param_t ucomtty_param; static tsw_modem_t ucomtty_modem; @@ -139,7 +138,6 @@ .tsw_open = ucomtty_open, .tsw_close = ucomtty_close, .tsw_outwakeup = ucomtty_outwakeup, - .tsw_inwakeup = ucomtty_inwakeup, .tsw_ioctl = ucomtty_ioctl, .tsw_param = ucomtty_param, .tsw_modem = ucomtty_modem, @@ -499,6 +497,10 @@ return (error); } +#if 0 + ttsetwater(tp); +#endif + if (t->c_cflag & CRTS_IFLOW) { sc->sc_state |= UCS_RTS_IFLOW; } else if (sc->sc_state & UCS_RTS_IFLOW) { @@ -506,6 +508,10 @@ (void)ucomtty_modem(tp, SER_RTS, 0); } +#if 0 + ttyldoptim(tp); +#endif + uerr = ucomstartread(sc); if (uerr != USBD_NORMAL_COMPLETION) return (EIO); @@ -545,6 +551,24 @@ if (sc->sc_oxfer == NULL) return; + /* XXX: hardware flow control. We should use inwakeup here. */ +#if 0 + if (tp->t_state & TS_TBLOCK) { + if (ISSET(sc->sc_mcr, SER_RTS) && + ISSET(sc->sc_state, UCS_RTS_IFLOW)) { + DPRINTF(("ucomtty_outwakeup: clear RTS\n")); + (void)ucomtty_modem(tp, 0, SER_RTS); + } + } else { + if (!ISSET(sc->sc_mcr, SER_RTS) && + tp->t_rawq.c_cc <= tp->t_ilowat && + ISSET(sc->sc_state, UCS_RTS_IFLOW)) { + DPRINTF(("ucomtty_outwakeup: set RTS\n")); + (void)ucomtty_modem(tp, SER_RTS, 0); + } + } +#endif + if (sc->sc_state & UCS_TXBUSY) return; @@ -574,22 +598,35 @@ } } +#if 0 static void -ucomtty_inwakeup(struct tty *tp) +ucomstop(struct tty *tp, int flag) { struct ucom_softc *sc = tty_softc(tp); + int s; - DPRINTF(("ucomtty_inwakeup: sc = %p\n", sc)); + DPRINTF(("ucomstop: %d\n", flag)); - if (sc->sc_dying) - return; + if ((flag & FREAD) && (sc->sc_state & UCS_RXSTOP) == 0) { + DPRINTF(("ucomstop: read\n")); + ucomstopread(sc); + ucomstartread(sc); + } - if (!ISSET(sc->sc_mcr, SER_RTS) && - ISSET(sc->sc_state, UCS_RTS_IFLOW)) { - DPRINTF(("ucomtty_outwakeup: set RTS\n")); - (void)ucomtty_modem(tp, SER_RTS, 0); + if (flag & FWRITE) { + DPRINTF(("ucomstop: write\n")); + if (ISSET(tp->t_state, TS_BUSY)) { + /* XXX do what? */ + if (!ISSET(tp->t_state, TS_TTSTOP)) + SET(tp->t_state, TS_FLUSH); + } } + + ucomtty_outwakeup(tp); + + DPRINTF(("ucomstop: done\n")); } +#endif static void ucomwritecb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status) @@ -627,6 +664,13 @@ cc, sc->sc_obufactive); sc->sc_state &= ~UCS_TXBUSY; +#if 0 + CLR(tp->t_state, TS_BUSY); + if (ISSET(tp->t_state, TS_FLUSH)) + CLR(tp->t_state, TS_FLUSH); + else + ndflush(&tp->t_outq, cc); +#endif ucomtty_outwakeup(tp); } @@ -701,11 +745,9 @@ while (cc > 0) { DPRINTFN(7, ("ucomreadcb: char = 0x%02x\n", *cp)); if (ttydisc_rint(tp, *cp, 0) == -1) { - if (ISSET(sc->sc_mcr, SER_RTS) && - ISSET(sc->sc_state, UCS_RTS_IFLOW)) { - DPRINTF(("ucomtty_outwakeup: clear RTS\n")); - (void)ucomtty_modem(tp, 0, SER_RTS); - } + /* XXX what should we do? */ + printf("%s: lost %d chars\n", + device_get_nameunit(sc->sc_dev), cc); break; } cc--; @@ -719,6 +761,12 @@ printf("%s: read start failed\n", device_get_nameunit(sc->sc_dev)); /* XXX what should we dow now? */ } + +#if 0 + if ((sc->sc_state & UCS_RTS_IFLOW) && !ISSET(sc->sc_mcr, SER_RTS) + && !(tp->t_state & TS_TBLOCK)) + ucomtty_modem(tp, SER_RTS, 0); +#endif } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810160700.m9G70LGV082114>