1/* $NetBSD: ucom.c,v 1.40 2001/11/13 06:24:54 lukem Exp $ */ 2 3/*- 4 * Copyright (c) 2001-2003, 2005, 2008 5 * Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 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 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/usb/serial/usb_serial.c 192820 2009-05-26 17:06:36Z thompsa $"); |
32 33/*- 34 * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. 35 * All rights reserved. 36 * 37 * This code is derived from software contributed to The NetBSD Foundation 38 * by Lennart Augustsson (lennart@augustsson.net) at 39 * Carlstedt Research & Technology. --- 544 unchanged lines hidden (view full) --- 584{ 585 struct usb2_com_cfg_task *task = 586 (struct usb2_com_cfg_task *)_task; 587 struct usb2_com_softc *sc = task->sc; 588 589 DPRINTF("\n"); 590 591 if (sc->sc_flag & UCOM_FLAG_LL_READY) { |
592 sc->sc_flag &= ~UCOM_FLAG_LL_READY; 593 if (sc->sc_callback->usb2_com_cfg_close) |
594 (sc->sc_callback->usb2_com_cfg_close) (sc); |
595 } else { 596 /* already closed */ 597 } 598} 599 600static void 601usb2_com_close(struct tty *tp) 602{ --- 8 unchanged lines hidden (view full) --- 611 return; 612 } 613 usb2_com_shutdown(sc); 614 615 usb2_com_queue_command(sc, usb2_com_cfg_close, NULL, 616 &sc->sc_close_task[0].hdr, 617 &sc->sc_close_task[1].hdr); 618 |
619 sc->sc_flag &= ~(UCOM_FLAG_HL_READY | UCOM_FLAG_RTS_IFLOW); |
620 621 if (sc->sc_callback->usb2_com_stop_read) { 622 (sc->sc_callback->usb2_com_stop_read) (sc); 623 } |
624} 625 626static int 627usb2_com_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) 628{ 629 struct usb2_com_softc *sc = tty_softc(tp); 630 int error; 631 --- 359 unchanged lines hidden (view full) --- 991 mtx_assert(sc->sc_mtx, MA_OWNED); 992 993 DPRINTF("sc = %p\n", sc); 994 995 if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { 996 /* The higher layer is not ready */ 997 return; 998 } |
999 usb2_com_start_transfers(sc); 1000} 1001 1002/*------------------------------------------------------------------------* 1003 * usb2_com_get_data 1004 * 1005 * Return values: 1006 * 0: No data is available. --- 5 unchanged lines hidden (view full) --- 1012{ 1013 struct usb2_page_search res; 1014 struct tty *tp = sc->sc_tty; 1015 uint32_t cnt; 1016 uint32_t offset_orig; 1017 1018 mtx_assert(sc->sc_mtx, MA_OWNED); 1019 |
1020 if (tty_gone(tp) || 1021 !(sc->sc_flag & UCOM_FLAG_GP_DATA)) { |
1022 actlen[0] = 0; 1023 return (0); /* multiport device polling */ 1024 } 1025 offset_orig = offset; 1026 1027 while (len != 0) { 1028 1029 usb2_get_page(pc, offset, &res); --- 29 unchanged lines hidden (view full) --- 1059{ 1060 struct usb2_page_search res; 1061 struct tty *tp = sc->sc_tty; 1062 char *buf; 1063 uint32_t cnt; 1064 1065 mtx_assert(sc->sc_mtx, MA_OWNED); 1066 |
1067 if (tty_gone(tp)) |
1068 return; /* multiport device polling */ |
1069 |
1070 if (len == 0) 1071 return; /* no data */ 1072 1073 /* set a flag to prevent recursation ? */ 1074 1075 while (len > 0) { 1076 1077 usb2_get_page(pc, offset, &res); --- 45 unchanged lines hidden --- |