digi.c (130057) | digi.c (130077) |
---|---|
1/*- 2 * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> 3 * based on work by Slawa Olhovchenkov 4 * John Prince <johnp@knight-trosoft.com> 5 * Eric Hernes 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org> 3 * based on work by Slawa Olhovchenkov 4 * John Prince <johnp@knight-trosoft.com> 5 * Eric Hernes 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/sys/dev/digi/digi.c 130057 2004-06-04 08:02:37Z phk $ | 29 * $FreeBSD: head/sys/dev/digi/digi.c 130077 2004-06-04 16:02:56Z phk $ |
30 */ 31 32/*- 33 * TODO: 34 * Figure out what the con bios stuff is supposed to do 35 * Test with *LOTS* more cards - I only have a PCI8r and an ISA Xem. 36 */ 37 --- 789 unchanged lines hidden (view full) --- 827 "port %d: cxpparam error = %d\n", pnum, error)); 828 goto out; 829 } 830 ttsetwater(tp); 831 832 /* handle fake and initial DCD for callout devices */ 833 834 if (bc->mstat & port->cd || mynor & CALLOUT_MASK) | 30 */ 31 32/*- 33 * TODO: 34 * Figure out what the con bios stuff is supposed to do 35 * Test with *LOTS* more cards - I only have a PCI8r and an ISA Xem. 36 */ 37 --- 789 unchanged lines hidden (view full) --- 827 "port %d: cxpparam error = %d\n", pnum, error)); 828 goto out; 829 } 830 ttsetwater(tp); 831 832 /* handle fake and initial DCD for callout devices */ 833 834 if (bc->mstat & port->cd || mynor & CALLOUT_MASK) |
835 linesw[tp->t_line].l_modem(tp, 1); | 835 ttyld_modem(tp, 1); |
836 } 837 838 /* Wait for DCD if necessary */ 839 if (!(tp->t_state & TS_CARR_ON) && !(mynor & CALLOUT_MASK) && 840 !(tp->t_cflag & CLOCAL) && !(flag & O_NONBLOCK)) { 841 port->wopeners++; 842 error = tsleep(TSA_CARR_ON(tp), TTIPRI | PCATCH, "digidcd", 0); 843 port->wopeners--; 844 if (error != 0) { 845 DLOG(DIGIDB_OPEN, (sc->dev, 846 "port %d: tsleep(digidcd) error = %d\n", 847 pnum, error)); 848 goto out; 849 } 850 goto open_top; 851 } | 836 } 837 838 /* Wait for DCD if necessary */ 839 if (!(tp->t_state & TS_CARR_ON) && !(mynor & CALLOUT_MASK) && 840 !(tp->t_cflag & CLOCAL) && !(flag & O_NONBLOCK)) { 841 port->wopeners++; 842 error = tsleep(TSA_CARR_ON(tp), TTIPRI | PCATCH, "digidcd", 0); 843 port->wopeners--; 844 if (error != 0) { 845 DLOG(DIGIDB_OPEN, (sc->dev, 846 "port %d: tsleep(digidcd) error = %d\n", 847 pnum, error)); 848 goto out; 849 } 850 goto open_top; 851 } |
852 error = linesw[tp->t_line].l_open(dev, tp); | 852 error = ttyld_open(tp, dev); |
853 DLOG(DIGIDB_OPEN, (sc->dev, "port %d: l_open error = %d\n", 854 pnum, error)); 855 856 digi_disc_optim(tp, &tp->t_termios, port); 857 858 if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK) 859 port->active_out = TRUE; 860 --- 34 unchanged lines hidden (view full) --- 895 } 896 897 port = sc->ports + pnum; 898 tp = port->tp; 899 900 DLOG(DIGIDB_CLOSE, (sc->dev, "port %d: closing\n", pnum)); 901 902 s = spltty(); | 853 DLOG(DIGIDB_OPEN, (sc->dev, "port %d: l_open error = %d\n", 854 pnum, error)); 855 856 digi_disc_optim(tp, &tp->t_termios, port); 857 858 if (tp->t_state & TS_ISOPEN && mynor & CALLOUT_MASK) 859 port->active_out = TRUE; 860 --- 34 unchanged lines hidden (view full) --- 895 } 896 897 port = sc->ports + pnum; 898 tp = port->tp; 899 900 DLOG(DIGIDB_CLOSE, (sc->dev, "port %d: closing\n", pnum)); 901 902 s = spltty(); |
903 linesw[tp->t_line].l_close(tp, flag); | 903 ttyld_close(tp, flag); |
904 digi_disc_optim(tp, &tp->t_termios, port); 905 digihardclose(port); 906 ttyclose(tp); 907 if (--sc->opencnt == 0) 908 splx(s); 909 return (0); 910} 911 --- 53 unchanged lines hidden (view full) --- 965 966 unit = MINOR_TO_UNIT(mynor); 967 pnum = MINOR_TO_PORT(mynor); 968 969 sc = (struct digi_softc *)devclass_get_softc(digi_devclass, unit); 970 KASSERT(sc, ("digi%d: softc not allocated in digiclose\n", unit)); 971 tp = &sc->ttys[pnum]; 972 | 904 digi_disc_optim(tp, &tp->t_termios, port); 905 digihardclose(port); 906 ttyclose(tp); 907 if (--sc->opencnt == 0) 908 splx(s); 909 return (0); 910} 911 --- 53 unchanged lines hidden (view full) --- 965 966 unit = MINOR_TO_UNIT(mynor); 967 pnum = MINOR_TO_PORT(mynor); 968 969 sc = (struct digi_softc *)devclass_get_softc(digi_devclass, unit); 970 KASSERT(sc, ("digi%d: softc not allocated in digiclose\n", unit)); 971 tp = &sc->ttys[pnum]; 972 |
973 error = linesw[tp->t_line].l_read(tp, uio, flag); | 973 error = ttyld_read(tp, uio, flag); |
974 DLOG(DIGIDB_READ, (sc->dev, "port %d: read() returns %d\n", 975 pnum, error)); 976 977 return (error); 978} 979 980static int 981digiwrite(dev_t dev, struct uio *uio, int flag) --- 9 unchanged lines hidden (view full) --- 991 992 unit = MINOR_TO_UNIT(mynor); 993 pnum = MINOR_TO_PORT(mynor); 994 995 sc = (struct digi_softc *)devclass_get_softc(digi_devclass, unit); 996 KASSERT(sc, ("digi%d: softc not allocated in digiclose\n", unit)); 997 tp = &sc->ttys[pnum]; 998 | 974 DLOG(DIGIDB_READ, (sc->dev, "port %d: read() returns %d\n", 975 pnum, error)); 976 977 return (error); 978} 979 980static int 981digiwrite(dev_t dev, struct uio *uio, int flag) --- 9 unchanged lines hidden (view full) --- 991 992 unit = MINOR_TO_UNIT(mynor); 993 pnum = MINOR_TO_PORT(mynor); 994 995 sc = (struct digi_softc *)devclass_get_softc(digi_devclass, unit); 996 KASSERT(sc, ("digi%d: softc not allocated in digiclose\n", unit)); 997 tp = &sc->ttys[pnum]; 998 |
999 error = linesw[tp->t_line].l_write(tp, uio, flag); | 999 error = ttyld_write(tp, uio, flag); |
1000 DLOG(DIGIDB_WRITE, (sc->dev, "port %d: write() returns %d\n", 1001 pnum, error)); 1002 1003 return (error); 1004} 1005 1006/* 1007 * Load module "digi_<mod>.ko" and look for a symbol called digi_mod_<mod>. --- 638 unchanged lines hidden (view full) --- 1646 sc->setwin(sc, 0); 1647 wakeup(TSA_CARR_ON(tp)); 1648 } 1649 1650 if (event.mstat & sc->csigs->ri) { 1651 DLOG(DIGIDB_RI, (sc->dev, "port %d: RING\n", 1652 event.pnum)); 1653 if (port->send_ring) { | 1000 DLOG(DIGIDB_WRITE, (sc->dev, "port %d: write() returns %d\n", 1001 pnum, error)); 1002 1003 return (error); 1004} 1005 1006/* 1007 * Load module "digi_<mod>.ko" and look for a symbol called digi_mod_<mod>. --- 638 unchanged lines hidden (view full) --- 1646 sc->setwin(sc, 0); 1647 wakeup(TSA_CARR_ON(tp)); 1648 } 1649 1650 if (event.mstat & sc->csigs->ri) { 1651 DLOG(DIGIDB_RI, (sc->dev, "port %d: RING\n", 1652 event.pnum)); 1653 if (port->send_ring) { |
1654 linesw[tp->t_line].l_rint('R', tp); 1655 linesw[tp->t_line].l_rint('I', tp); 1656 linesw[tp->t_line].l_rint('N', tp); 1657 linesw[tp->t_line].l_rint('G', tp); 1658 linesw[tp->t_line].l_rint('\r', tp); 1659 linesw[tp->t_line].l_rint('\n', tp); | 1654 ttyld_rint(tp, 'R'); 1655 ttyld_rint(tp, 'I'); 1656 ttyld_rint(tp, 'N'); 1657 ttyld_rint(tp, 'G'); 1658 ttyld_rint(tp, '\r'); 1659 ttyld_rint(tp, '\n'); |
1660 } 1661 } 1662 } 1663 if (event.event & BREAK_IND) { 1664 DLOG(DIGIDB_MODEM, (sc->dev, "port %d: BREAK_IND\n", 1665 event.pnum)); | 1660 } 1661 } 1662 } 1663 if (event.event & BREAK_IND) { 1664 DLOG(DIGIDB_MODEM, (sc->dev, "port %d: BREAK_IND\n", 1665 event.pnum)); |
1666 linesw[tp->t_line].l_rint(TTY_BI, tp); | 1666 ttyld_rint(tp, TTY_BI); |
1667 } 1668 if (event.event & (LOWTX_IND | EMPTYTX_IND)) { 1669 DLOG(DIGIDB_IRQ, (sc->dev, "port %d:%s%s\n", 1670 event.pnum, 1671 event.event & LOWTX_IND ? " LOWTX" : "", 1672 event.event & EMPTYTX_IND ? " EMPTYTX" : "")); | 1667 } 1668 if (event.event & (LOWTX_IND | EMPTYTX_IND)) { 1669 DLOG(DIGIDB_IRQ, (sc->dev, "port %d:%s%s\n", 1670 event.pnum, 1671 event.event & LOWTX_IND ? " LOWTX" : "", 1672 event.event & EMPTYTX_IND ? " EMPTYTX" : "")); |
1673 (*linesw[tp->t_line].l_start)(tp); | 1673 ttyld_start(tp); |
1674 } 1675 } 1676 sc->gdata->eout = etail; 1677eoi: 1678 if (sc->window != 0) 1679 sc->towin(sc, 0); 1680 if (window != 0) 1681 sc->towin(sc, window); --- 265 unchanged lines hidden --- | 1674 } 1675 } 1676 sc->gdata->eout = etail; 1677eoi: 1678 if (sc->window != 0) 1679 sc->towin(sc, 0); 1680 if (window != 0) 1681 sc->towin(sc, window); --- 265 unchanged lines hidden --- |