FreeBSD/sys/dev/usb/net/uhso.c
/*
 * Interrupt callback for the multiplexed serial port. Indicates
 * which serial port has data waiting.
 */
Interrupt callback for the multiplexed serial port. Indicates
which serial port has data waiting.
Interrupt callback for the multiplexed serial port . Indicates which serial port has data waiting .
static void
uhso_mux_intr_callback(struct usb_xfer *xfer, usb_error_t error)
{
	struct usb_page_cache *pc;
	struct usb_page_search res;
	struct uhso_softc *sc = usbd_xfer_softc(xfer);
	unsigned int i, mux;
	UHSO_DPRINTF(3, "status %d\n", USB_GET_STATE(xfer));
	switch (USB_GET_STATE(xfer)) {
	case USB_ST_TRANSFERRED:
		pc = usbd_xfer_get_frame(xfer, 0);
		usbd_get_page(pc, 0, &res);
		i = *((unsigned char *)res.buffer);
		mux = 0;
		while (i >>= 1) {
			mux++;
		}
		UHSO_DPRINTF(3, "mux port %d (%d)\n", mux, i);
		if (mux > UHSO_MPORT_TYPE_NOMAX)
			break;
		usbd_xfer_set_priv(
		    sc->sc_tty[mux].ht_xfer[UHSO_CTRL_READ],
		    &sc->sc_tty[mux]);
		usbd_transfer_start(sc->sc_tty[mux].ht_xfer[UHSO_CTRL_READ]);
		break;
	case USB_ST_SETUP:
tr_setup:
		usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer));
		usbd_transfer_submit(xfer);
		break;
	default:
		UHSO_DPRINTF(0, "error: %s\n", usbd_errstr(error));
		if (error == USB_ERR_CANCELLED)
			break;
		usbd_xfer_set_stall(xfer);
		goto tr_setup;
	}
}
static void uhso_mux_intr_callback ( struct usb_xfer * xfer , usb_error_t error ) { struct usb_page_cache * pc ; struct usb_page_search res ; struct uhso_softc * sc = usbd_xfer_softc ( xfer ) ; unsigned int i , mux ; UHSO_DPRINTF ( 3 , " \n " , USB_GET_STATE ( xfer ) ) ; switch ( USB_GET_STATE ( xfer ) ) { case USB_ST_TRANSFERRED : pc = usbd_xfer_get_frame ( xfer , 0 ) ; usbd_get_page ( pc , 0 , & res ) ; i = * ( ( unsigned char * ) res . buffer ) ; mux = 0 ; while ( i >>= 1 ) { mux ++ ; } UHSO_DPRINTF ( 3 , " \n " , mux , i ) ; if ( mux > UHSO_MPORT_TYPE_NOMAX ) break ; usbd_xfer_set_priv ( sc -> sc_tty [ mux ] . ht_xfer [ UHSO_CTRL_READ ] , & sc -> sc_tty [ mux ] ) ; usbd_transfer_start ( sc -> sc_tty [ mux ] . ht_xfer [ UHSO_CTRL_READ ] ) ; break ; case USB_ST_SETUP : tr_setup : usbd_xfer_set_frame_len ( xfer , 0 , usbd_xfer_max_len ( xfer ) ) ; usbd_transfer_submit ( xfer ) ; break ; default : UHSO_DPRINTF ( 0 , " \n " , usbd_errstr ( error ) ) ; if ( error == USB_ERR_CANCELLED ) break ; usbd_xfer_set_stall ( xfer ) ; goto tr_setup ; } }
Interrupt callback for the multiplexed serial port.
Interrupt callback for the multiplexed serial port .
/*
		 * The multiplexed port number can be found at the first byte.
		 * It contains a bit mask, we transform this in to an integer.
		 */ /* Issue a read for this serial port */