Lines Matching refs:d
80 #define CX_DEBUG(d,s) ({if (d->chan->debug) {\ argument
81 printf ("%s: ", d->name); printf s;}})
82 #define CX_DEBUG2(d,s) ({if (d->chan->debug>1) {\ argument
83 printf ("%s: ", d->name); printf s;}})
196 static void cx_up (drv_t *d);
197 static void cx_start (drv_t *d);
200 static void cx_down (drv_t *d);
201 static void cx_watchdog (drv_t *d);
288 drv_t *d; in cx_timeout() local
295 d = channel[i * NCHAN + k]; in cx_timeout()
296 if (! d) in cx_timeout()
299 CX_LOCK ((bdrv_t *)d->board->sys); in cx_timeout()
300 if (d->atimeout == 1 && d->tty && d->tty->t_state & TS_BUSY) { in cx_timeout()
301 d->tty->t_state &= ~TS_BUSY; in cx_timeout()
302 if (d->tty->t_dev) { in cx_timeout()
303 d->intr_action |= CX_WRITE; in cx_timeout()
307 CX_DEBUG (d, ("cx_timeout\n")); in cx_timeout()
309 if (d->atimeout) in cx_timeout()
310 d->atimeout--; in cx_timeout()
311 CX_UNLOCK ((bdrv_t *)d->board->sys); in cx_timeout()
357 drv_t *d = b->chan[i].sys; in cx_intr() local
359 if (!d || !d->running) in cx_intr()
361 while (_IF_QLEN(&d->queue)) { in cx_intr()
362 IF_DEQUEUE (&d->queue,m); in cx_intr()
365 sppp_input (d->ifp, m); in cx_intr()
637 drv_t *d; in cx_attach() local
780 d = &bd->channel[c->num]; in cx_attach()
781 d->dmamem.size = sizeof(cx_buf_t); in cx_attach()
782 if (! cx_bus_dma_mem_alloc (unit, c->num, &d->dmamem)) in cx_attach()
784 d->board = b; in cx_attach()
785 d->chan = c; in cx_attach()
786 d->open_dev = 0; in cx_attach()
787 c->sys = d; in cx_attach()
788 channel [b->num*NCHAN + c->num] = d; in cx_attach()
789 sprintf (d->name, "cx%d.%d", b->num, c->num); in cx_attach()
799 callout_init (&d->timeout_handle, 1); in cx_attach()
801 if (ng_make_node_common (&typestruct, &d->node) != 0) { in cx_attach()
802 printf ("%s: cannot make common node\n", d->name); in cx_attach()
805 cx_bus_dma_mem_free (&d->dmamem); in cx_attach()
808 NG_NODE_SET_PRIVATE (d->node, d); in cx_attach()
809 sprintf (d->nodename, "%s%d", NG_CX_NODE_TYPE, in cx_attach()
811 if (ng_name_node (d->node, d->nodename)) { in cx_attach()
812 printf ("%s: cannot name node\n", d->nodename); in cx_attach()
813 NG_NODE_UNREF (d->node); in cx_attach()
816 cx_bus_dma_mem_free (&d->dmamem); in cx_attach()
819 d->lo_queue.ifq_maxlen = ifqmaxlen; in cx_attach()
820 d->hi_queue.ifq_maxlen = ifqmaxlen; in cx_attach()
821 mtx_init (&d->lo_queue.ifq_mtx, "cx_queue_lo", NULL, MTX_DEF); in cx_attach()
822 mtx_init (&d->hi_queue.ifq_mtx, "cx_queue_hi", NULL, MTX_DEF); in cx_attach()
824 d->ifp = if_alloc(IFT_PPP); in cx_attach()
825 if (d->ifp == NULL) { in cx_attach()
827 d->name); in cx_attach()
830 cx_bus_dma_mem_free (&d->dmamem); in cx_attach()
833 d->ifp->if_softc = d; in cx_attach()
834 if_initname (d->ifp, "cx", b->num * NCHAN + c->num); in cx_attach()
835 d->ifp->if_mtu = PP_MTU; in cx_attach()
836 d->ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST; in cx_attach()
837 d->ifp->if_ioctl = cx_sioctl; in cx_attach()
838 d->ifp->if_start = cx_ifstart; in cx_attach()
839 d->ifp->if_init = cx_initialize; in cx_attach()
840 d->queue.ifq_maxlen = 2; in cx_attach()
841 mtx_init (&d->queue.ifq_mtx, "cx_queue", NULL, MTX_DEF); in cx_attach()
842 sppp_attach (d->ifp); in cx_attach()
843 if_attach (d->ifp); in cx_attach()
844 IFP2SP(d->ifp)->pp_tlf = cx_tlf; in cx_attach()
845 IFP2SP(d->ifp)->pp_tls = cx_tls; in cx_attach()
848 bpfattach (d->ifp, DLT_PPP, 4); in cx_attach()
851 d->tty = ttyalloc (); in cx_attach()
852 d->tty->t_open = cx_topen; in cx_attach()
853 d->tty->t_close = cx_tclose; in cx_attach()
854 d->tty->t_param = cx_param; in cx_attach()
855 d->tty->t_stop = cx_stop; in cx_attach()
856 d->tty->t_modem = cx_tmodem; in cx_attach()
857 d->tty->t_oproc = cx_oproc; in cx_attach()
858 d->tty->t_sc = d; in cx_attach()
860 cx_start_chan (c, d->dmamem.virt, d->dmamem.phys); in cx_attach()
867 ttycreate(d->tty, TS_CALLOUT, "x%r%r", b->num, c->num); in cx_attach()
868 …d->devt = make_dev (&cx_cdevsw, b->num*NCHAN + c->num + 64, UID_ROOT, GID_WHEEL, 0600, "cx%d", b->… in cx_attach()
869 d->devt->si_drv1 = d; in cx_attach()
870 callout_init (&d->dcd_timeout_handle, 1); in cx_attach()
890 drv_t *d = (drv_t*) c->sys; in cx_detach() local
892 if (!d || d->chan->type == T_NONE) in cx_detach()
894 if (d->lock) { in cx_detach()
899 if (c->mode == M_ASYNC && d->tty && (d->tty->t_state & TS_ISOPEN) && in cx_detach()
900 (d->open_dev|0x2)) { in cx_detach()
905 if (d->running) { in cx_detach()
916 drv_t *d = c->sys; in cx_detach() local
918 if (!d || d->chan->type == T_NONE) in cx_detach()
921 callout_stop (&d->dcd_timeout_handle); in cx_detach()
936 drv_t *d = (drv_t*) c->sys; in cx_detach() local
938 if (!d || d->chan->type == T_NONE) in cx_detach()
941 if (d->tty) { in cx_detach()
942 ttyfree (d->tty); in cx_detach()
943 d->tty = NULL; in cx_detach()
946 callout_stop (&d->timeout_handle); in cx_detach()
948 if (d->node) { in cx_detach()
949 ng_rmnode_self (d->node); in cx_detach()
950 NG_NODE_UNREF (d->node); in cx_detach()
951 d->node = NULL; in cx_detach()
953 mtx_destroy (&d->lo_queue.ifq_mtx); in cx_detach()
954 mtx_destroy (&d->hi_queue.ifq_mtx); in cx_detach()
957 bpfdetach (d->ifp); in cx_detach()
959 sppp_detach (d->ifp); in cx_detach()
961 if_detach (d->ifp); in cx_detach()
962 if_free(d->ifp); in cx_detach()
964 IF_DRAIN (&d->queue); in cx_detach()
965 mtx_destroy (&d->queue.ifq_mtx); in cx_detach()
967 destroy_dev (d->devt); in cx_detach()
974 drv_t *d = c->sys; in cx_detach() local
976 if (!d || d->chan->type == T_NONE) in cx_detach()
979 callout_drain (&d->dcd_timeout_handle); in cx_detach()
980 callout_drain (&d->timeout_handle); in cx_detach()
986 drv_t *d = (drv_t*) c->sys; in cx_detach() local
988 if (!d || d->chan->type == T_NONE) in cx_detach()
992 cx_bus_dma_mem_free (&d->dmamem); in cx_detach()
1007 drv_t *d = ifp->if_softc; in cx_ifstart() local
1008 bdrv_t *bd = d->board->sys; in cx_ifstart()
1011 cx_start (d); in cx_ifstart()
1017 drv_t *d = SP2IFP(sp)->if_softc; in cx_tlf() local
1019 CX_DEBUG (d, ("cx_tlf\n")); in cx_tlf()
1022 if (!(IFP2SP(d->ifp)->pp_flags & PP_FR) && !(d->ifp->if_flags & PP_CISCO)) in cx_tlf()
1028 drv_t *d = SP2IFP(sp)->if_softc; in cx_tls() local
1030 CX_DEBUG (d, ("cx_tls\n")); in cx_tls()
1031 if (!(IFP2SP(d->ifp)->pp_flags & PP_FR) && !(d->ifp->if_flags & PP_CISCO)) in cx_tls()
1041 drv_t *d = softc; in cx_initialize() local
1043 CX_DEBUG (d, ("cx_initialize\n")); in cx_initialize()
1051 drv_t *d = ifp->if_softc; in cx_sioctl() local
1052 bdrv_t *bd = d->board->sys; in cx_sioctl()
1056 if (d->chan->type == T_NONE || d->chan->mode == M_ASYNC) in cx_sioctl()
1068 d->chan->debug = 0; in cx_sioctl()
1070 d->chan->debug = d->chan->debug_shadow; in cx_sioctl()
1075 default: CX_DEBUG2 (d, ("ioctl 0x%lx\n", cmd)); return 0; in cx_sioctl()
1076 case SIOCADDMULTI: CX_DEBUG2 (d, ("SIOCADDMULTI\n")); return 0; in cx_sioctl()
1077 case SIOCDELMULTI: CX_DEBUG2 (d, ("SIOCDELMULTI\n")); return 0; in cx_sioctl()
1078 case SIOCSIFFLAGS: CX_DEBUG2 (d, ("SIOCSIFFLAGS\n")); break; in cx_sioctl()
1079 case SIOCSIFADDR: CX_DEBUG2 (d, ("SIOCSIFADDR\n")); break; in cx_sioctl()
1088 cx_up (d); in cx_sioctl()
1089 cx_start (d); in cx_sioctl()
1093 cx_down (d); in cx_sioctl()
1104 static void cx_down (drv_t *d) in cx_down() argument
1107 CX_DEBUG (d, ("cx_down\n")); in cx_down()
1108 cx_set_dtr (d->chan, 0); in cx_down()
1109 cx_set_rts (d->chan, 0); in cx_down()
1110 d->running = 0; in cx_down()
1111 callout_stop (&d->timeout_handle); in cx_down()
1118 static void cx_up (drv_t *d) in cx_up() argument
1121 CX_DEBUG (d, ("cx_up\n")); in cx_up()
1122 cx_set_dtr (d->chan, 1); in cx_up()
1123 cx_set_rts (d->chan, 1); in cx_up()
1124 d->running = 1; in cx_up()
1133 static void cx_send (drv_t *d) in cx_send() argument
1138 CX_DEBUG2 (d, ("cx_send\n")); in cx_send()
1141 if (! d->running) in cx_send()
1145 if (! cx_get_dsr (d->chan) && ! cx_get_loop(d->chan)) in cx_send()
1148 if (cx_buf_free (d->chan)) { in cx_send()
1151 IF_DEQUEUE (&d->hi_queue, m); in cx_send()
1153 IF_DEQUEUE (&d->lo_queue, m); in cx_send()
1155 m = sppp_dequeue (d->ifp); in cx_send()
1160 BPF_MTAP (d->ifp, m); in cx_send()
1164 cx_send_packet (d->chan, (u_char*)mtod (m, caddr_t), in cx_send()
1169 cx_send_packet (d->chan, buf, len, 0); in cx_send()
1174 d->timeout = 10; in cx_send()
1177 d->ifp->if_drv_flags |= IFF_DRV_OACTIVE; in cx_send()
1185 static void cx_start (drv_t *d) in cx_start() argument
1188 if (d->running) { in cx_start()
1189 if (! d->chan->dtr) in cx_start()
1190 cx_set_dtr (d->chan, 1); in cx_start()
1191 if (! d->chan->rts) in cx_start()
1192 cx_set_rts (d->chan, 1); in cx_start()
1193 cx_send (d); in cx_start()
1194 callout_reset (&d->timeout_handle, hz, cx_watchdog_timer, d); in cx_start()
1204 static void cx_watchdog (drv_t *d) in cx_watchdog() argument
1207 CX_DEBUG (d, ("device timeout\n")); in cx_watchdog()
1208 if (d->running) { in cx_watchdog()
1209 cx_setup_chan (d->chan); in cx_watchdog()
1210 cx_start_chan (d->chan, 0, 0); in cx_watchdog()
1211 cx_set_dtr (d->chan, 1); in cx_watchdog()
1212 cx_set_rts (d->chan, 1); in cx_watchdog()
1213 cx_start (d); in cx_watchdog()
1219 drv_t *d = arg; in cx_watchdog_timer() local
1220 bdrv_t *bd = d->board->sys; in cx_watchdog_timer()
1223 if (d->timeout == 1) in cx_watchdog_timer()
1224 cx_watchdog (d); in cx_watchdog_timer()
1225 if (d->timeout) in cx_watchdog_timer()
1226 d->timeout--; in cx_watchdog_timer()
1227 callout_reset (&d->timeout_handle, hz, cx_watchdog_timer, d); in cx_watchdog_timer()
1236 drv_t *d = c->sys; in cx_transmit() local
1238 if (!d) in cx_transmit()
1241 if (c->mode == M_ASYNC && d->tty) { in cx_transmit()
1242 d->tty->t_state &= ~(TS_BUSY | TS_FLUSH); in cx_transmit()
1243 d->atimeout = 0; in cx_transmit()
1244 if (d->tty->t_dev) { in cx_transmit()
1245 d->intr_action |= CX_WRITE; in cx_transmit()
1251 d->timeout = 0; in cx_transmit()
1253 if_inc_counter(d->ifp, IFCOUNTER_OPACKETS, 1); in cx_transmit()
1254 d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; in cx_transmit()
1256 cx_start (d); in cx_transmit()
1264 drv_t *d = c->sys; in cx_receive() local
1271 if (!d) in cx_receive()
1274 if (c->mode == M_ASYNC && d->tty) { in cx_receive()
1275 if (d->tty->t_state & TS_ISOPEN) { in cx_receive()
1276 async_q *q = &d->aqueue; in cx_receive()
1293 d->intr_action |= CX_READ; in cx_receive()
1299 if (! d->running) in cx_receive()
1304 CX_DEBUG (d, ("no memory for packet\n")); in cx_receive()
1306 if_inc_counter(d->ifp, IFCOUNTER_IQDROPS, 1); in cx_receive()
1314 NG_SEND_DATA_ONLY (error, d->hook, m); in cx_receive()
1316 if_inc_counter(d->ifp, IFCOUNTER_IPACKETS, 1); in cx_receive()
1317 m->m_pkthdr.rcvif = d->ifp; in cx_receive()
1320 BPF_MTAP(d->ifp, m); in cx_receive()
1321 IF_ENQUEUE (&d->queue, m); in cx_receive()
1337 drv_t *d = c->sys; in cx_error() local
1340 if (!d) in cx_error()
1343 q = &(d->aqueue); in cx_error()
1347 CX_DEBUG (d, ("frame error\n")); in cx_error()
1348 if (c->mode == M_ASYNC && d->tty && (d->tty->t_state & TS_ISOPEN) in cx_error()
1350 && (!CONDITION((&d->tty->t_termios), (d->tty)) in cx_error()
1351 || !(d->tty->t_iflag & (IGNPAR | PARMRK)))) { in cx_error()
1353 d->intr_action |= CX_READ; in cx_error()
1359 if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); in cx_error()
1363 CX_DEBUG (d, ("crc error\n")); in cx_error()
1364 if (c->mode == M_ASYNC && d->tty && (d->tty->t_state & TS_ISOPEN) in cx_error()
1366 && (!CONDITION((&d->tty->t_termios), (d->tty)) in cx_error()
1367 || !(d->tty->t_iflag & INPCK) in cx_error()
1368 || !(d->tty->t_iflag & (IGNPAR | PARMRK)))) { in cx_error()
1370 d->intr_action |= CX_READ; in cx_error()
1376 if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); in cx_error()
1380 CX_DEBUG (d, ("overrun error\n")); in cx_error()
1382 if (c->mode == M_ASYNC && d->tty && (d->tty->t_state & TS_ISOPEN) in cx_error()
1384 && (!CONDITION((&d->tty->t_termios), (d->tty)))) { in cx_error()
1386 d->intr_action |= CX_READ; in cx_error()
1393 if_inc_counter(d->ifp, IFCOUNTER_COLLISIONS, 1); in cx_error()
1394 if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); in cx_error()
1399 CX_DEBUG (d, ("overflow error\n")); in cx_error()
1402 if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); in cx_error()
1406 CX_DEBUG (d, ("underrun error\n")); in cx_error()
1408 d->timeout = 0; in cx_error()
1410 if_inc_counter(d->ifp, IFCOUNTER_OERRORS, 1); in cx_error()
1411 d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; in cx_error()
1413 cx_start (d); in cx_error()
1417 CX_DEBUG (d, ("break error\n")); in cx_error()
1418 if (c->mode == M_ASYNC && d->tty && (d->tty->t_state & TS_ISOPEN) in cx_error()
1420 && (!CONDITION((&d->tty->t_termios), (d->tty)) in cx_error()
1421 || !(d->tty->t_iflag & (IGNBRK | BRKINT | PARMRK)))) { in cx_error()
1423 d->intr_action |= CX_READ; in cx_error()
1429 if_inc_counter(d->ifp, IFCOUNTER_IERRORS, 1); in cx_error()
1433 CX_DEBUG (d, ("error #%d\n", data)); in cx_error()
1440 drv_t *d; in cx_topen() local
1442 d = tp->t_sc; in cx_topen()
1443 CX_DEBUG2 (d, ("cx_open (serial)\n")); in cx_topen()
1445 bd = d->board->sys; in cx_topen()
1447 if (d->chan->mode != M_ASYNC) in cx_topen()
1450 d->open_dev |= 0x2; in cx_topen()
1452 cx_start_chan (d->chan, 0, 0); in cx_topen()
1453 cx_set_dtr (d->chan, 1); in cx_topen()
1454 cx_set_rts (d->chan, 1); in cx_topen()
1455 d->cd = cx_get_cd (d->chan); in cx_topen()
1458 CX_DEBUG2 (d, ("cx_open done\n")); in cx_topen()
1465 drv_t *d; in cx_tclose() local
1468 d = tp->t_sc; in cx_tclose()
1469 CX_DEBUG2 (d, ("cx_close\n")); in cx_tclose()
1470 bd = d->board->sys; in cx_tclose()
1474 cx_enable_receive (d->chan, 0); in cx_tclose()
1476 d->open_dev &= ~0x2; in cx_tclose()
1481 drv_t *d; in cx_tmodem() local
1484 d = tp->t_sc; in cx_tmodem()
1485 bd = d->board->sys; in cx_tmodem()
1489 if (cx_get_dsr (d->chan)) sigon |= SER_DSR; in cx_tmodem()
1490 if (cx_get_cd (d->chan)) sigon |= SER_DCD; in cx_tmodem()
1491 if (cx_get_cts (d->chan)) sigon |= SER_CTS; in cx_tmodem()
1492 if (d->chan->dtr) sigon |= SER_DTR; in cx_tmodem()
1493 if (d->chan->rts) sigon |= SER_RTS; in cx_tmodem()
1499 cx_set_dtr (d->chan, 1); in cx_tmodem()
1501 cx_set_dtr (d->chan, 0); in cx_tmodem()
1503 cx_set_rts (d->chan, 1); in cx_tmodem()
1505 cx_set_rts (d->chan, 0); in cx_tmodem()
1514 drv_t *d; in cx_open() local
1516 d = dev->si_drv1; in cx_open()
1517 unit = d->chan->num; in cx_open()
1519 CX_DEBUG2 (d, ("cx_open unit=%d, flag=0x%x, mode=0x%x\n", in cx_open()
1522 d->open_dev |= 0x1; in cx_open()
1524 CX_DEBUG2 (d, ("cx_open done\n")); in cx_open()
1531 drv_t *d; in cx_close() local
1533 d = dev->si_drv1; in cx_close()
1534 CX_DEBUG2 (d, ("cx_close\n")); in cx_close()
1535 d->open_dev &= ~0x1; in cx_close()
1539 static int cx_modem_status (drv_t *d) in cx_modem_status() argument
1541 bdrv_t *bd = d->board->sys; in cx_modem_status()
1545 if ((d->chan->mode == M_ASYNC && d->tty && (d->tty->t_state & TS_ISOPEN) && in cx_modem_status()
1546 (d->open_dev|0x2)) || (d->chan->mode != M_ASYNC && d->running)) in cx_modem_status()
1549 if (cx_get_dsr (d->chan)) status |= TIOCM_DSR; in cx_modem_status()
1550 if (cx_get_cd (d->chan)) status |= TIOCM_CD; in cx_modem_status()
1551 if (cx_get_cts (d->chan)) status |= TIOCM_CTS; in cx_modem_status()
1552 if (d->chan->dtr) status |= TIOCM_DTR; in cx_modem_status()
1553 if (d->chan->rts) status |= TIOCM_RTS; in cx_modem_status()
1561 drv_t *d; in cx_ioctl() local
1568 d = dev->si_drv1; in cx_ioctl()
1569 c = d->chan; in cx_ioctl()
1571 bd = d->board->sys; in cx_ioctl()
1575 CX_DEBUG2 (d, ("ioctl: getregistered\n")); in cx_ioctl()
1584 CX_DEBUG2 (d, ("ioctl: getport\n")); in cx_ioctl()
1596 CX_DEBUG2 (d, ("ioctl: setproto\n")); in cx_ioctl()
1611 CX_DEBUG2 (d, ("ioctl: getproto\n")); in cx_ioctl()
1615 (IFP2SP(d->ifp)->pp_flags & PP_FR) ? "fr" : in cx_ioctl()
1616 (d->ifp->if_flags & PP_CISCO) ? "cisco" : "ppp"); in cx_ioctl()
1622 CX_DEBUG2 (d, ("ioctl: setproto\n")); in cx_ioctl()
1629 if (d->ifp->if_drv_flags & IFF_DRV_RUNNING) in cx_ioctl()
1632 IFP2SP(d->ifp)->pp_flags &= ~(PP_FR); in cx_ioctl()
1633 IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE; in cx_ioctl()
1634 d->ifp->if_flags |= PP_CISCO; in cx_ioctl()
1636 d->ifp->if_flags &= ~(PP_CISCO); in cx_ioctl()
1637 IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE; in cx_ioctl()
1639 IFP2SP(d->ifp)->pp_flags &= ~(PP_FR | PP_KEEPALIVE); in cx_ioctl()
1640 d->ifp->if_flags &= ~(PP_CISCO); in cx_ioctl()
1646 CX_DEBUG2 (d, ("ioctl: getkeepalive\n")); in cx_ioctl()
1647 if ((IFP2SP(d->ifp)->pp_flags & PP_FR) || in cx_ioctl()
1648 (d->ifp->if_flags & PP_CISCO) || in cx_ioctl()
1653 *(int*)data = (IFP2SP(d->ifp)->pp_flags & PP_KEEPALIVE) ? 1 : 0; in cx_ioctl()
1659 CX_DEBUG2 (d, ("ioctl: setkeepalive\n")); in cx_ioctl()
1664 if ((IFP2SP(d->ifp)->pp_flags & PP_FR) || in cx_ioctl()
1665 (d->ifp->if_flags & PP_CISCO)) in cx_ioctl()
1670 IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE; in cx_ioctl()
1672 IFP2SP(d->ifp)->pp_flags &= ~PP_KEEPALIVE; in cx_ioctl()
1679 CX_DEBUG2 (d, ("ioctl: getmode\n")); in cx_ioctl()
1689 CX_DEBUG2 (d, ("ioctl: setmode\n")); in cx_ioctl()
1696 if (d->lock) in cx_ioctl()
1699 if (c->mode == M_ASYNC && d->tty && (d->tty->t_state & TS_ISOPEN) && in cx_ioctl()
1700 (d->open_dev|0x2)) in cx_ioctl()
1704 if (c->mode != M_ASYNC && d->running && in cx_ioctl()
1715 if (d->ifp->if_flags & IFF_DEBUG) in cx_ioctl()
1726 CX_DEBUG2 (d, ("ioctl: getestat\n")); in cx_ioctl()
1744 CX_DEBUG2 (d, ("ioctl: clrstat\n")); in cx_ioctl()
1765 CX_DEBUG2 (d, ("ioctl: getbaud\n")); in cx_ioctl()
1776 CX_DEBUG2 (d, ("ioctl: setbaud\n")); in cx_ioctl()
1791 CX_DEBUG2 (d, ("ioctl: getloop\n")); in cx_ioctl()
1802 CX_DEBUG2 (d, ("ioctl: setloop\n")); in cx_ioctl()
1817 CX_DEBUG2 (d, ("ioctl: getdpll\n")); in cx_ioctl()
1828 CX_DEBUG2 (d, ("ioctl: setdpll\n")); in cx_ioctl()
1843 CX_DEBUG2 (d, ("ioctl: getnrzi\n")); in cx_ioctl()
1854 CX_DEBUG2 (d, ("ioctl: setnrzi\n")); in cx_ioctl()
1869 CX_DEBUG2 (d, ("ioctl: getdebug\n")); in cx_ioctl()
1878 CX_DEBUG2 (d, ("ioctl: setdebug\n")); in cx_ioctl()
1895 if (d->ifp->if_flags & IFF_DEBUG) in cx_ioctl()
1908 CX_DEBUG2 (d, ("ioctl: tiocsdtr\n")); in cx_ioctl()
1917 CX_DEBUG2 (d, ("ioctl: tioccdtr\n")); in cx_ioctl()
1926 CX_DEBUG2 (d, ("ioctl: tiocmset\n")); in cx_ioctl()
1936 CX_DEBUG2 (d, ("ioctl: tiocmbis\n")); in cx_ioctl()
1946 CX_DEBUG2 (d, ("ioctl: tiocmbic\n")); in cx_ioctl()
1956 CX_DEBUG2 (d, ("ioctl: tiocmget\n")); in cx_ioctl()
1957 *(int*)data = cx_modem_status (d); in cx_ioctl()
1962 CX_DEBUG2 (d, ("ioctl: 0x%lx\n", cmd)); in cx_ioctl()
1968 drv_t *d; in cx_softintr() local
1975 d = channel [i]; in cx_softintr()
1976 if (!d || !d->chan || d->chan->type == T_NONE in cx_softintr()
1977 || d->chan->mode != M_ASYNC || !d->tty in cx_softintr()
1978 || !d->tty->t_dev) in cx_softintr()
1980 bd = d->board->sys; in cx_softintr()
1983 if (d->intr_action & CX_READ) { in cx_softintr()
1984 q = &(d->aqueue); in cx_softintr()
1985 if (d->tty->t_state & TS_CAN_BYPASS_L_RINT) { in cx_softintr()
1987 if (d->tty->t_rawq.c_cc + k > in cx_softintr()
1988 d->tty->t_ihiwat in cx_softintr()
1989 && (d->tty->t_cflag & CRTS_IFLOW in cx_softintr()
1990 || d->tty->t_iflag & IXOFF) in cx_softintr()
1991 && !(d->tty->t_state & TS_TBLOCK)) in cx_softintr()
1992 ttyblock(d->tty); in cx_softintr()
1993 d->tty->t_rawcc += k; in cx_softintr()
1999 putc (ic, &d->tty->t_rawq); in cx_softintr()
2003 ttwakeup(d->tty); in cx_softintr()
2004 if (d->tty->t_state & TS_TTSTOP in cx_softintr()
2005 && (d->tty->t_iflag & IXANY in cx_softintr()
2006 || d->tty->t_cc[VSTART] == in cx_softintr()
2007 d->tty->t_cc[VSTOP])) { in cx_softintr()
2008 d->tty->t_state &= ~TS_TTSTOP; in cx_softintr()
2009 d->tty->t_lflag &= ~FLUSHO; in cx_softintr()
2010 d->intr_action |= CX_WRITE; in cx_softintr()
2017 ttyld_rint (d->tty, ic); in cx_softintr()
2022 d->intr_action &= ~CX_READ; in cx_softintr()
2029 if (d->intr_action & CX_WRITE) { in cx_softintr()
2030 if (d->tty->t_line) in cx_softintr()
2031 ttyld_start (d->tty); in cx_softintr()
2033 cx_oproc (d->tty); in cx_softintr()
2034 d->intr_action &= ~CX_WRITE; in cx_softintr()
2049 drv_t *d; in cx_oproc() local
2055 d = tp->t_sc; in cx_oproc()
2056 bd = d->board->sys; in cx_oproc()
2058 CX_DEBUG2 (d, ("cx_oproc\n")); in cx_oproc()
2063 if (tp->t_cflag & CRTSCTS && (tp->t_state & TS_TBLOCK) && d->chan->rts) in cx_oproc()
2064 cx_set_rts (d->chan, 0); in cx_oproc()
2065 else if (tp->t_cflag & CRTSCTS && ! (tp->t_state & TS_TBLOCK) && ! d->chan->rts) in cx_oproc()
2066 cx_set_rts (d->chan, 1); in cx_oproc()
2070 cx_enable_transmit (d->chan, 1); in cx_oproc()
2073 if (! cx_buf_free (d->chan)) { in cx_oproc()
2086 cx_xflow_ctl (d->chan, 0); in cx_oproc()
2091 cx_xflow_ctl (d->chan, 1); in cx_oproc()
2104 cx_send_packet (d->chan, buf, len, 0); in cx_oproc()
2106 d->atimeout = 10; in cx_oproc()
2107 CX_DEBUG2 (d, ("out %d bytes\n", len)); in cx_oproc()
2117 drv_t *d; in cx_param() local
2121 d = tp->t_sc; in cx_param()
2122 bd = d->board->sys; in cx_param()
2128 cx_set_dtr (d->chan, 0); in cx_param()
2131 CX_DEBUG2 (d, ("cx_param (hangup)\n")); in cx_param()
2134 CX_DEBUG2 (d, ("cx_param\n")); in cx_param()
2165 if (! d->chan->dtr) in cx_param()
2166 cx_set_dtr (d->chan, 1); in cx_param()
2169 cx_set_async_param (d->chan, t->c_ospeed, bits, parity, (t->c_cflag & CSTOPB), in cx_param()
2183 drv_t *d; in cx_stop() local
2187 d = tp->t_sc; in cx_stop()
2188 bd = d->board->sys; in cx_stop()
2194 CX_DEBUG2 (d, ("cx_stop\n")); in cx_stop()
2195 cx_transmitter_ctl (d->chan, 0); in cx_stop()
2206 drv_t *d = arg; in cx_carrier() local
2207 bdrv_t *bd = d->board->sys; in cx_carrier()
2208 cx_chan_t *c = d->chan; in cx_carrier()
2214 if (d->cd != cd) { in cx_carrier()
2216 CX_DEBUG (d, ("carrier on\n")); in cx_carrier()
2217 d->cd = 1; in cx_carrier()
2220 if (d->tty) in cx_carrier()
2221 ttyld_modem(d->tty, 1); in cx_carrier()
2223 CX_DEBUG (d, ("carrier loss\n")); in cx_carrier()
2224 d->cd = 0; in cx_carrier()
2227 if (d->tty) in cx_carrier()
2228 ttyld_modem(d->tty, 0); in cx_carrier()
2241 drv_t *d = c->sys; in cx_modem() local
2243 if (!d || c->mode != M_ASYNC) in cx_modem()
2248 callout_reset (&d->dcd_timeout_handle, hz/2, cx_carrier, d); in cx_modem()
2254 drv_t *d = NG_NODE_PRIVATE (node); in ng_cx_constructor() local
2255 CX_DEBUG (d, ("Constructor\n")); in ng_cx_constructor()
2262 drv_t *d = NG_NODE_PRIVATE (node); in ng_cx_newhook() local
2263 bdrv_t *bd = d->board->sys; in ng_cx_newhook()
2265 if (d->chan->mode == M_ASYNC) in ng_cx_newhook()
2271 d->debug_hook = hook; in ng_cx_newhook()
2279 NG_HOOK_SET_PRIVATE (hook, d); in ng_cx_newhook()
2280 d->hook = hook; in ng_cx_newhook()
2283 cx_up (d); in ng_cx_newhook()
2320 drv_t *d = c->sys; in print_chan() local
2324 if (d->chan->debug) in print_chan()
2325 length += sprintf (s + length, " debug=%d", d->chan->debug); in print_chan()
2343 drv_t *d = NG_NODE_PRIVATE (node); in ng_cx_rcvmsg() local
2348 if (!d) in ng_cx_rcvmsg()
2351 CX_DEBUG (d, ("Rcvmsg\n")); in ng_cx_rcvmsg()
2381 l += print_chan (s + l, d->chan); in ng_cx_rcvmsg()
2382 l += print_stats (s + l, d->chan, 1); in ng_cx_rcvmsg()
2383 l += print_modems (s + l, d->chan, 1); in ng_cx_rcvmsg()
2397 drv_t *d = NG_NODE_PRIVATE (NG_HOOK_NODE(hook)); in ng_cx_rcvdata() local
2406 if (! NG_HOOK_PRIVATE (hook) || ! d) { in ng_cx_rcvdata()
2411 bd = d->board->sys; in ng_cx_rcvdata()
2415 q = &d->hi_queue; in ng_cx_rcvdata()
2417 q = &d->lo_queue; in ng_cx_rcvdata()
2431 cx_start (d); in ng_cx_rcvdata()
2439 drv_t *d = NG_NODE_PRIVATE (node); in ng_cx_rmnode() local
2442 CX_DEBUG (d, ("Rmnode\n")); in ng_cx_rmnode()
2443 if (d && d->running) { in ng_cx_rmnode()
2445 bd = d->board->sys; in ng_cx_rmnode()
2447 cx_down (d); in ng_cx_rmnode()
2463 drv_t *d = NG_NODE_PRIVATE (NG_HOOK_NODE (hook)); in ng_cx_connect() local
2465 callout_reset (&d->timeout_handle, hz, cx_watchdog_timer, d); in ng_cx_connect()
2471 drv_t *d = NG_NODE_PRIVATE (NG_HOOK_NODE (hook)); in ng_cx_disconnect() local
2472 bdrv_t *bd = d->board->sys; in ng_cx_disconnect()
2478 cx_down (d); in ng_cx_disconnect()
2482 if (!callout_drain (&d->timeout_handle)) in ng_cx_disconnect()
2483 callout_stop (&d->timeout_handle); in ng_cx_disconnect()