static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext *epctx)

{

    uint64_t mfindex;



    DPRINTF("xhci_submit(slotid=%d,epid=%d)\n", xfer->slotid, xfer->epid);



    xfer->in_xfer = epctx->type>>2;



    switch(epctx->type) {

    case ET_INTR_OUT:

    case ET_INTR_IN:

        xfer->pkts = 0;

        xfer->iso_xfer = false;

        xfer->timed_xfer = true;

        mfindex = xhci_mfindex_get(xhci);

        xhci_calc_intr_kick(xhci, xfer, epctx, mfindex);

        xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex);

        if (xfer->running_retry) {

            return -1;

        }

        break;

    case ET_BULK_OUT:

    case ET_BULK_IN:

        xfer->pkts = 0;

        xfer->iso_xfer = false;

        xfer->timed_xfer = false;

        break;

    case ET_ISO_OUT:

    case ET_ISO_IN:

        xfer->pkts = 1;

        xfer->iso_xfer = true;

        xfer->timed_xfer = true;

        mfindex = xhci_mfindex_get(xhci);

        xhci_calc_iso_kick(xhci, xfer, epctx, mfindex);

        xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex);

        if (xfer->running_retry) {

            return -1;

        }

        break;

    default:

        trace_usb_xhci_unimplemented("endpoint type", epctx->type);

        return -1;

    }



    if (xhci_setup_packet(xfer) < 0) {

        return -1;

    }

    usb_handle_packet(xfer->packet.ep->dev, &xfer->packet);



    xhci_try_complete_packet(xfer);

    if (!xfer->running_async && !xfer->running_retry) {

        xhci_kick_epctx(xfer->epctx, xfer->streamid);

    }

    return 0;

}

static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext *epctx)

{

    uint64_t mfindex;



    DPRINTF("xhci_submit(slotid=%d,epid=%d)\n", xfer->slotid, xfer->epid);



    xfer->in_xfer = epctx->type>>2;



    switch(epctx->type) {

    case ET_INTR_OUT:

    case ET_INTR_IN:

        xfer->pkts = 0;

        xfer->iso_xfer = false;

        xfer->timed_xfer = true;

        mfindex = xhci_mfindex_get(xhci);

        xhci_calc_intr_kick(xhci, xfer, epctx, mfindex);

        xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex);

        if (xfer->running_retry) {

            return -1;

        }

        break;

    case ET_BULK_OUT:

    case ET_BULK_IN:

        xfer->pkts = 0;

        xfer->iso_xfer = false;

        xfer->timed_xfer = false;

        break;

    case ET_ISO_OUT:

    case ET_ISO_IN:

        xfer->pkts = 1;

        xfer->iso_xfer = true;

        xfer->timed_xfer = true;

        mfindex = xhci_mfindex_get(xhci);

        xhci_calc_iso_kick(xhci, xfer, epctx, mfindex);

        xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex);

        if (xfer->running_retry) {

            return -1;

        }

        break;

    default:

        trace_usb_xhci_unimplemented("endpoint type", epctx->type);

        return -1;

    }



    if (xhci_setup_packet(xfer) < 0) {

        return -1;

    }

    usb_handle_packet(xfer->packet.ep->dev, &xfer->packet);



    xhci_try_complete_packet(xfer);

    if (!xfer->running_async && !xfer->running_retry) {

        xhci_kick_epctx(xfer->epctx, xfer->streamid);

    }

    return 0;

}

static int FUNC_0(XHCIState *VAR_0, XHCITransfer *VAR_1, XHCIEPContext *VAR_2)

{

    uint64_t mfindex;



    DPRINTF("FUNC_0(slotid=%d,epid=%d)\n", VAR_1->slotid, VAR_1->epid);



    VAR_1->in_xfer = VAR_2->type>>2;



    switch(VAR_2->type) {

    case ET_INTR_OUT:

    case ET_INTR_IN:

        VAR_1->pkts = 0;

        VAR_1->iso_xfer = false;

        VAR_1->timed_xfer = true;

        mfindex = xhci_mfindex_get(VAR_0);

        xhci_calc_intr_kick(VAR_0, VAR_1, VAR_2, mfindex);

        xhci_check_intr_iso_kick(VAR_0, VAR_1, VAR_2, mfindex);

        if (VAR_1->running_retry) {

            return -1;

        }

        break;

    case ET_BULK_OUT:

    case ET_BULK_IN:

        VAR_1->pkts = 0;

        VAR_1->iso_xfer = false;

        VAR_1->timed_xfer = false;

        break;

    case ET_ISO_OUT:

    case ET_ISO_IN:

        VAR_1->pkts = 1;

        VAR_1->iso_xfer = true;

        VAR_1->timed_xfer = true;

        mfindex = xhci_mfindex_get(VAR_0);

        xhci_calc_iso_kick(VAR_0, VAR_1, VAR_2, mfindex);

        xhci_check_intr_iso_kick(VAR_0, VAR_1, VAR_2, mfindex);

        if (VAR_1->running_retry) {

            return -1;

        }

        break;

    default:

        trace_usb_xhci_unimplemented("endpoint type", VAR_2->type);

        return -1;

    }



    if (xhci_setup_packet(VAR_1) < 0) {

        return -1;

    }

    usb_handle_packet(VAR_1->packet.ep->dev, &VAR_1->packet);



    xhci_try_complete_packet(VAR_1);

    if (!VAR_1->running_async && !VAR_1->running_retry) {

        xhci_kick_epctx(VAR_1->VAR_2, VAR_1->streamid);

    }

    return 0;

}

static int FUNC_0(XHCIState *VAR_0, XHCITransfer *VAR_1, XHCIEPContext *VAR_2)
{ uint64_t mfindex; DPRINTF("FUNC_0(slotid=%d,epid=%d)\n", VAR_1->slotid, VAR_1->epid); VAR_1->in_xfer = VAR_2->type>>2; switch(VAR_2->type) { case ET_INTR_OUT:
case ET_INTR_IN:
VAR_1->pkts = 0; VAR_1->iso_xfer = false; VAR_1->timed_xfer = true; mfindex = xhci_mfindex_get(VAR_0); xhci_calc_intr_kick(VAR_0, VAR_1, VAR_2, mfindex); xhci_check_intr_iso_kick(VAR_0, VAR_1, VAR_2, mfindex); if (VAR_1->running_retry) { return -1; } break; case ET_BULK_OUT:
case ET_BULK_IN:
VAR_1->pkts = 0; VAR_1->iso_xfer = false; VAR_1->timed_xfer = false; break; case ET_ISO_OUT:
case ET_ISO_IN:
VAR_1->pkts = 1; VAR_1->iso_xfer = true; VAR_1->timed_xfer = true; mfindex = xhci_mfindex_get(VAR_0); xhci_calc_iso_kick(VAR_0, VAR_1, VAR_2, mfindex); xhci_check_intr_iso_kick(VAR_0, VAR_1, VAR_2, mfindex); if (VAR_1->running_retry) { return -1; } break; default:
trace_usb_xhci_unimplemented("endpoint type", VAR_2->type); return -1; } if (xhci_setup_packet(VAR_1) < 0) { return -1; } usb_handle_packet(VAR_1->packet.ep->dev, &VAR_1->packet); xhci_try_complete_packet(VAR_1); if (!VAR_1->running_async && !VAR_1->running_retry) { xhci_kick_epctx(VAR_1->VAR_2, VAR_1->streamid); } return 0; }