• Home
  • Raw
  • Download

Lines Matching refs:sc

73 extern int ucom_modem(struct ucom_softc *sc, int sigon, int sigoff);
122 static void ucom_close(struct ucom_softc *sc);
171 ucom_attach(struct ucom_super_softc *ssc, struct ucom_softc *sc, in ucom_attach() argument
180 if ((sc == NULL) || in ucom_attach()
213 sc[subunit].sc_subunit = subunit; in ucom_attach()
214 sc[subunit].sc_super = ssc; in ucom_attach()
215 sc[subunit].sc_mtx = umtx; in ucom_attach()
216 sc[subunit].sc_parent = parent; in ucom_attach()
217 sc[subunit].sc_callback = callback; in ucom_attach()
219 error = ucom_attach_tty(ssc, &sc[subunit]); in ucom_attach()
221 ucom_detach(ssc, &sc[0]); in ucom_attach()
228 sc[subunit].sc_flag = UCOM_FLAG_ATTACHED; in ucom_attach()
243 ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc) in ucom_detach() argument
252 if (sc[subunit].sc_flag & UCOM_FLAG_ATTACHED) { in ucom_detach()
253 ucom_detach_tty(ssc, &sc[subunit]); in ucom_detach()
256 sc[subunit].sc_flag &= ~UCOM_FLAG_ATTACHED; in ucom_detach()
306 ucom_attach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc) in ucom_attach_tty() argument
310 ret = snprintf_s(sc->sc_name, TTY_NAME_LEN, TTY_NAME_LEN - 1, "/dev/ttyUSB%d", sc->sc_subunit); in ucom_attach_tty()
315 (void)register_driver(sc->sc_name, &tty_usb_fops, 0666, sc); in ucom_attach_tty()
317 ssc->sc_unit, sc->sc_subunit); in ucom_attach_tty()
320 ucom_cons_softc = sc; in ucom_attach_tty()
334 ucom_detach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc) in ucom_detach_tty() argument
338 UCOM_MTX_LOCK(sc); in ucom_detach_tty()
339 sc->sc_flag |= UCOM_FLAG_GONE; in ucom_detach_tty()
340 sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_LL_READY); in ucom_detach_tty()
341 ucom_close(sc); /* close, if any */ in ucom_detach_tty()
342 UCOM_MTX_UNLOCK(sc); in ucom_detach_tty()
344 (void)unregister_driver(sc->sc_name); in ucom_detach_tty()
346 UCOM_MTX_LOCK(sc); in ucom_detach_tty()
350 if (sc->sc_callback->ucom_stop_read) in ucom_detach_tty()
351 (sc->sc_callback->ucom_stop_read) (sc); in ucom_detach_tty()
352 if (sc->sc_callback->ucom_stop_write) in ucom_detach_tty()
353 (sc->sc_callback->ucom_stop_write) (sc); in ucom_detach_tty()
354 UCOM_MTX_UNLOCK(sc); in ucom_detach_tty()
382 ucom_queue_command(struct ucom_softc *sc, in ucom_queue_command() argument
386 struct ucom_super_softc *ssc = sc->sc_super; in ucom_queue_command()
389 UCOM_MTX_ASSERT(sc, MA_OWNED); in ucom_queue_command()
405 task->sc = sc; in ucom_queue_command()
425 sc->sc_last_start_xfer = &task->hdr; in ucom_queue_command()
429 ucom_shutdown(struct ucom_softc *sc) in ucom_shutdown() argument
439 ucom_cfg_is_gone(struct ucom_softc *sc) in ucom_cfg_is_gone() argument
441 struct ucom_super_softc *ssc = sc->sc_super; in ucom_cfg_is_gone()
451 struct ucom_softc *sc = task->sc; in ucom_cfg_start_transfers() local
453 if (!(sc->sc_flag & UCOM_FLAG_LL_READY)) { in ucom_cfg_start_transfers()
456 if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { in ucom_cfg_start_transfers()
461 if (_task == sc->sc_last_start_xfer) in ucom_cfg_start_transfers()
462 sc->sc_flag |= UCOM_FLAG_GP_DATA; in ucom_cfg_start_transfers()
464 if (sc->sc_callback->ucom_start_read) { in ucom_cfg_start_transfers()
465 (sc->sc_callback->ucom_start_read) (sc); in ucom_cfg_start_transfers()
467 if (sc->sc_callback->ucom_start_write) { in ucom_cfg_start_transfers()
468 (sc->sc_callback->ucom_start_write) (sc); in ucom_cfg_start_transfers()
473 ucom_start_transfers(struct ucom_softc *sc) in ucom_start_transfers() argument
475 if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { in ucom_start_transfers()
482 if (sc->sc_callback->ucom_start_read) { in ucom_start_transfers()
483 (sc->sc_callback->ucom_start_read) (sc); in ucom_start_transfers()
485 if (sc->sc_callback->ucom_start_write) { in ucom_start_transfers()
486 (sc->sc_callback->ucom_start_write) (sc); in ucom_start_transfers()
495 struct ucom_softc *sc = task->sc; in ucom_cfg_open() local
499 if (sc->sc_flag & UCOM_FLAG_LL_READY) { in ucom_cfg_open()
503 sc->sc_flag |= UCOM_FLAG_LL_READY; in ucom_cfg_open()
505 if (sc->sc_callback->ucom_cfg_open) { in ucom_cfg_open()
506 (sc->sc_callback->ucom_cfg_open) (sc); in ucom_cfg_open()
509 usb_pause_mtx(sc->sc_mtx, hz / 10); in ucom_cfg_open()
515 ucom_open(struct ucom_softc *sc) in ucom_open() argument
519 UCOM_MTX_ASSERT(sc, MA_OWNED); in ucom_open()
521 if (sc->sc_flag & UCOM_FLAG_GONE) { in ucom_open()
524 if (sc->sc_flag & UCOM_FLAG_HL_READY) { in ucom_open()
528 DPRINTF("sc = %p\n", sc); in ucom_open()
530 if (sc->sc_callback->ucom_pre_open) { in ucom_open()
535 error = (sc->sc_callback->ucom_pre_open) (sc); in ucom_open()
541 sc->sc_flag |= UCOM_FLAG_HL_READY; in ucom_open()
544 sc->sc_flag &= ~UCOM_FLAG_GP_DATA; in ucom_open()
546 sc->sc_lsr = 0; in ucom_open()
547 sc->sc_msr = 0; in ucom_open()
548 sc->sc_mcr = 0; in ucom_open()
551 sc->sc_pls_curr = 0; in ucom_open()
552 sc->sc_pls_set = 0; in ucom_open()
553 sc->sc_pls_clr = 0; in ucom_open()
556 sc->sc_jitterbuf_in = 0; in ucom_open()
557 sc->sc_jitterbuf_out = 0; in ucom_open()
559 ucom_queue_command(sc, ucom_cfg_open, NULL, in ucom_open()
560 &sc->sc_open_task[0].hdr, in ucom_open()
561 &sc->sc_open_task[1].hdr); in ucom_open()
564 ucom_queue_command(sc, ucom_cfg_start_transfers, NULL, in ucom_open()
565 &sc->sc_start_task[0].hdr, in ucom_open()
566 &sc->sc_start_task[1].hdr); in ucom_open()
568 (void)ucom_modem(sc, SER_DTR | SER_RTS, 0); in ucom_open()
570 ucom_ring(sc, 0); in ucom_open()
572 ucom_break(sc, 0); in ucom_open()
582 struct ucom_softc *sc = task->sc; in ucom_cfg_close() local
586 if (sc->sc_flag & UCOM_FLAG_LL_READY) { in ucom_cfg_close()
587 sc->sc_flag &= ~UCOM_FLAG_LL_READY; in ucom_cfg_close()
588 if (sc->sc_callback->ucom_cfg_close) in ucom_cfg_close()
589 (sc->sc_callback->ucom_cfg_close) (sc); in ucom_cfg_close()
596 ucom_close(struct ucom_softc *sc) in ucom_close() argument
598 UCOM_MTX_ASSERT(sc, MA_OWNED); in ucom_close()
600 if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { in ucom_close()
601 DPRINTF("tp=%p already closed\n", sc); in ucom_close()
604 ucom_shutdown(sc); in ucom_close()
606 ucom_queue_command(sc, ucom_cfg_close, NULL, in ucom_close()
607 &sc->sc_close_task[0].hdr, in ucom_close()
608 &sc->sc_close_task[1].hdr); in ucom_close()
610 sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_RTS_IFLOW); in ucom_close()
612 if (sc->sc_callback->ucom_stop_read) { in ucom_close()
613 (sc->sc_callback->ucom_stop_read) (sc); in ucom_close()
625 ucom_modem(struct ucom_softc *sc, int sigon, int sigoff) in ucom_modem() argument
629 UCOM_MTX_ASSERT(sc, MA_OWNED); in ucom_modem()
631 if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { in ucom_modem()
635 if (sc->sc_mcr & SER_DTR) { in ucom_modem()
638 if (sc->sc_mcr & SER_RTS) { in ucom_modem()
641 if (sc->sc_msr & SER_CTS) { in ucom_modem()
644 if (sc->sc_msr & SER_DCD) { in ucom_modem()
647 if (sc->sc_msr & SER_DSR) { in ucom_modem()
650 if (sc->sc_msr & SER_RI) { in ucom_modem()
656 sc->sc_mcr |= SER_DTR; in ucom_modem()
659 sc->sc_mcr &= ~SER_DTR; in ucom_modem()
662 sc->sc_mcr |= SER_RTS; in ucom_modem()
665 sc->sc_mcr &= ~SER_RTS; in ucom_modem()
667 onoff = (sc->sc_mcr & SER_DTR) ? 1 : 0; in ucom_modem()
668 ucom_dtr(sc, onoff); in ucom_modem()
670 onoff = (sc->sc_mcr & SER_RTS) ? 1 : 0; in ucom_modem()
671 ucom_rts(sc, onoff); in ucom_modem()
681 struct ucom_softc *sc = task->sc; in ucom_cfg_line_state() local
688 if (!(sc->sc_flag & UCOM_FLAG_LL_READY)) { in ucom_cfg_line_state()
694 if (sc->sc_callback->ucom_cfg_set_dtr) in ucom_cfg_line_state()
696 if (sc->sc_callback->ucom_cfg_set_rts) in ucom_cfg_line_state()
698 if (sc->sc_callback->ucom_cfg_set_break) in ucom_cfg_line_state()
700 if (sc->sc_callback->ucom_cfg_set_ring) in ucom_cfg_line_state()
704 notch_bits = (sc->sc_pls_set & sc->sc_pls_clr) & mask; in ucom_cfg_line_state()
705 any_bits = (sc->sc_pls_set | sc->sc_pls_clr) & mask; in ucom_cfg_line_state()
706 prev_value = sc->sc_pls_curr ^ notch_bits; in ucom_cfg_line_state()
707 last_value = sc->sc_pls_curr; in ucom_cfg_line_state()
710 sc->sc_pls_curr = 0; in ucom_cfg_line_state()
711 sc->sc_pls_set = 0; in ucom_cfg_line_state()
712 sc->sc_pls_clr = 0; in ucom_cfg_line_state()
716 sc->sc_callback->ucom_cfg_set_dtr(sc, in ucom_cfg_line_state()
719 sc->sc_callback->ucom_cfg_set_rts(sc, in ucom_cfg_line_state()
722 sc->sc_callback->ucom_cfg_set_break(sc, in ucom_cfg_line_state()
725 sc->sc_callback->ucom_cfg_set_ring(sc, in ucom_cfg_line_state()
730 sc->sc_callback->ucom_cfg_set_dtr(sc, in ucom_cfg_line_state()
733 sc->sc_callback->ucom_cfg_set_rts(sc, in ucom_cfg_line_state()
736 sc->sc_callback->ucom_cfg_set_break(sc, in ucom_cfg_line_state()
739 sc->sc_callback->ucom_cfg_set_ring(sc, in ucom_cfg_line_state()
744 ucom_line_state(struct ucom_softc *sc, in ucom_line_state() argument
747 UCOM_MTX_ASSERT(sc, MA_OWNED); in ucom_line_state()
749 if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { in ucom_line_state()
756 sc->sc_pls_curr |= set_bits; in ucom_line_state()
757 sc->sc_pls_curr &= ~clear_bits; in ucom_line_state()
758 sc->sc_pls_set |= set_bits; in ucom_line_state()
759 sc->sc_pls_clr |= clear_bits; in ucom_line_state()
762 ucom_queue_command(sc, ucom_cfg_line_state, NULL, in ucom_line_state()
763 &sc->sc_line_state_task[0].hdr, in ucom_line_state()
764 &sc->sc_line_state_task[1].hdr); in ucom_line_state()
768 ucom_ring(struct ucom_softc *sc, uint8_t onoff) in ucom_ring() argument
773 ucom_line_state(sc, UCOM_LS_RING, 0); in ucom_ring()
775 ucom_line_state(sc, 0, UCOM_LS_RING); in ucom_ring()
779 ucom_break(struct ucom_softc *sc, uint8_t onoff) in ucom_break() argument
784 ucom_line_state(sc, UCOM_LS_BREAK, 0); in ucom_break()
786 ucom_line_state(sc, 0, UCOM_LS_BREAK); in ucom_break()
790 ucom_dtr(struct ucom_softc *sc, uint8_t onoff) in ucom_dtr() argument
795 ucom_line_state(sc, UCOM_LS_DTR, 0); in ucom_dtr()
797 ucom_line_state(sc, 0, UCOM_LS_DTR); in ucom_dtr()
801 ucom_rts(struct ucom_softc *sc, uint8_t onoff) in ucom_rts() argument
806 ucom_line_state(sc, UCOM_LS_RTS, 0); in ucom_rts()
808 ucom_line_state(sc, 0, UCOM_LS_RTS); in ucom_rts()
816 struct ucom_softc *sc = task->sc; in ucom_cfg_status_change() local
822 UCOM_MTX_ASSERT(sc, MA_OWNED); in ucom_cfg_status_change()
824 if (!(sc->sc_flag & UCOM_FLAG_LL_READY)) { in ucom_cfg_status_change()
827 if (sc->sc_callback->ucom_cfg_get_status == NULL) { in ucom_cfg_status_change()
835 (sc->sc_callback->ucom_cfg_get_status) (sc, &new_lsr, &new_msr); in ucom_cfg_status_change()
837 if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { in ucom_cfg_status_change()
841 onoff = ((sc->sc_msr ^ new_msr) & SER_DCD); in ucom_cfg_status_change()
842 lsr_delta = (sc->sc_lsr ^ new_lsr); in ucom_cfg_status_change()
844 sc->sc_msr = new_msr; in ucom_cfg_status_change()
845 sc->sc_lsr = new_lsr; in ucom_cfg_status_change()
848 onoff = (sc->sc_msr & SER_DCD) ? 1 : 0; in ucom_cfg_status_change()
852 if ((lsr_delta & ULSR_BI) && (sc->sc_lsr & ULSR_BI)) { in ucom_cfg_status_change()
856 if ((lsr_delta & ULSR_FE) && (sc->sc_lsr & ULSR_FE)) { in ucom_cfg_status_change()
860 if ((lsr_delta & ULSR_PE) && (sc->sc_lsr & ULSR_PE)) { in ucom_cfg_status_change()
866 ucom_status_change(struct ucom_softc *sc) in ucom_status_change() argument
868 UCOM_MTX_ASSERT(sc, MA_OWNED); in ucom_status_change()
870 if (sc->sc_flag & UCOM_FLAG_CONSOLE) in ucom_status_change()
873 if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { in ucom_status_change()
878 ucom_queue_command(sc, ucom_cfg_status_change, NULL, in ucom_status_change()
879 &sc->sc_status_task[0].hdr, in ucom_status_change()
880 &sc->sc_status_task[1].hdr); in ucom_status_change()
884 ucom_outwakeup(struct ucom_softc *sc) in ucom_outwakeup() argument
886 UCOM_MTX_ASSERT(sc, MA_OWNED); in ucom_outwakeup()
888 DPRINTF("sc = %p\n", sc); in ucom_outwakeup()
890 ucom_start_transfers(sc); in ucom_outwakeup()
901 ucom_get_data(struct ucom_softc *sc, struct usb_page_cache *pc, in ucom_get_data() argument
905 UCOM_MTX_ASSERT(sc, MA_OWNED); in ucom_get_data()
936 ucom_put_data(struct ucom_softc *sc, struct usb_page_cache *pc, in ucom_put_data() argument
940 UCOM_MTX_ASSERT(sc, MA_OWNED); in ucom_put_data()
1022 tx_data_copy_in(struct ucom_softc *sc, const void *tx_data, unsigned int len) in tx_data_copy_in() argument
1027 UCOM_MTX_LOCK(sc); in tx_data_copy_in()
1045 UCOM_MTX_UNLOCK(sc); in tx_data_copy_in()
1052 UCOM_MTX_UNLOCK(sc); in tx_data_copy_in()
1060 UCOM_MTX_UNLOCK(sc); in tx_data_copy_in()
1070 UCOM_MTX_UNLOCK(sc); in tx_data_copy_in()
1351 struct ucom_softc *sc = (struct ucom_softc *)drvData->priv; in tty_usb_open() local
1354 UCOM_MTX_LOCK(sc); in tty_usb_open()
1356 UCOM_MTX_UNLOCK(sc); in tty_usb_open()
1360 ret = -ucom_open(sc); in tty_usb_open()
1361 UCOM_MTX_UNLOCK(sc); in tty_usb_open()
1370 struct ucom_softc *sc = (struct ucom_softc *)drvData->priv; in tty_usb_close() local
1372 UCOM_MTX_LOCK(sc); in tty_usb_close()
1374 ucom_close(sc); in tty_usb_close()
1375 UCOM_MTX_UNLOCK(sc); in tty_usb_close()
1384 struct ucom_softc *sc = (struct ucom_softc *)drvData->priv; in tty_usb_read() local
1387 UCOM_MTX_LOCK(sc); in tty_usb_read()
1404 UCOM_MTX_UNLOCK(sc); in tty_usb_read()
1411 UCOM_MTX_UNLOCK(sc); in tty_usb_read()
1419 UCOM_MTX_UNLOCK(sc); in tty_usb_read()
1433 ucom_outwakeup(sc); in tty_usb_read()
1435 UCOM_MTX_UNLOCK(sc); in tty_usb_read()
1443 struct ucom_softc *sc = (struct ucom_softc *)drvData->priv; in tty_usb_write() local
1445 tx_data_copy_in(sc, (void *)buffer, buflen); in tty_usb_write()
1446 ucom_outwakeup(sc); in tty_usb_write()