static int usb_bt_handle_data(USBDevice *dev, USBPacket *p)

{

    struct USBBtState *s = (struct USBBtState *) dev->opaque;

    int ret = 0;



    if (!s->config)

        goto fail;



    switch (p->pid) {

    case USB_TOKEN_IN:

        switch (p->devep & 0xf) {

        case USB_EVT_EP:

            ret = usb_bt_fifo_dequeue(&s->evt, p);

            break;



        case USB_ACL_EP:

            ret = usb_bt_fifo_dequeue(&s->acl, p);

            break;



        case USB_SCO_EP:

            ret = usb_bt_fifo_dequeue(&s->sco, p);

            break;



        default:

            goto fail;

        }

        break;



    case USB_TOKEN_OUT:

        switch (p->devep & 0xf) {

        case USB_ACL_EP:

            usb_bt_fifo_out_enqueue(s, &s->outacl, s->hci->acl_send,

                            usb_bt_hci_acl_complete, p);

            break;



        case USB_SCO_EP:

            usb_bt_fifo_out_enqueue(s, &s->outsco, s->hci->sco_send,

                            usb_bt_hci_sco_complete, p);

            break;



        default:

            goto fail;

        }

        break;



    default:

    fail:

        ret = USB_RET_STALL;

        break;

    }



    return ret;

}

static int usb_bt_handle_data(USBDevice *dev, USBPacket *p)

{

    struct USBBtState *s = (struct USBBtState *) dev->opaque;

    int ret = 0;



    if (!s->config)

        goto fail;



    switch (p->pid) {

    case USB_TOKEN_IN:

        switch (p->devep & 0xf) {

        case USB_EVT_EP:

            ret = usb_bt_fifo_dequeue(&s->evt, p);

            break;



        case USB_ACL_EP:

            ret = usb_bt_fifo_dequeue(&s->acl, p);

            break;



        case USB_SCO_EP:

            ret = usb_bt_fifo_dequeue(&s->sco, p);

            break;



        default:

            goto fail;

        }

        break;



    case USB_TOKEN_OUT:

        switch (p->devep & 0xf) {

        case USB_ACL_EP:

            usb_bt_fifo_out_enqueue(s, &s->outacl, s->hci->acl_send,

                            usb_bt_hci_acl_complete, p);

            break;



        case USB_SCO_EP:

            usb_bt_fifo_out_enqueue(s, &s->outsco, s->hci->sco_send,

                            usb_bt_hci_sco_complete, p);

            break;



        default:

            goto fail;

        }

        break;



    default:

    fail:

        ret = USB_RET_STALL;

        break;

    }



    return ret;

}

static int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)

{

    struct USBBtState *VAR_2 = (struct USBBtState *) VAR_0->opaque;

    int VAR_3 = 0;



    if (!VAR_2->config)

        goto fail;



    switch (VAR_1->pid) {

    case USB_TOKEN_IN:

        switch (VAR_1->devep & 0xf) {

        case USB_EVT_EP:

            VAR_3 = usb_bt_fifo_dequeue(&VAR_2->evt, VAR_1);

            break;



        case USB_ACL_EP:

            VAR_3 = usb_bt_fifo_dequeue(&VAR_2->acl, VAR_1);

            break;



        case USB_SCO_EP:

            VAR_3 = usb_bt_fifo_dequeue(&VAR_2->sco, VAR_1);

            break;



        default:

            goto fail;

        }

        break;



    case USB_TOKEN_OUT:

        switch (VAR_1->devep & 0xf) {

        case USB_ACL_EP:

            usb_bt_fifo_out_enqueue(VAR_2, &VAR_2->outacl, VAR_2->hci->acl_send,

                            usb_bt_hci_acl_complete, VAR_1);

            break;



        case USB_SCO_EP:

            usb_bt_fifo_out_enqueue(VAR_2, &VAR_2->outsco, VAR_2->hci->sco_send,

                            usb_bt_hci_sco_complete, VAR_1);

            break;



        default:

            goto fail;

        }

        break;



    default:

    fail:

        VAR_3 = USB_RET_STALL;

        break;

    }



    return VAR_3;

}

static int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)
{ struct USBBtState *VAR_2 = (struct USBBtState *) VAR_0->opaque; int VAR_3 = 0; if (!VAR_2->config)
goto fail; switch (VAR_1->pid) { case USB_TOKEN_IN:
switch (VAR_1->devep & 0xf) { case USB_EVT_EP:
VAR_3 = usb_bt_fifo_dequeue(&VAR_2->evt, VAR_1); break; case USB_ACL_EP:
VAR_3 = usb_bt_fifo_dequeue(&VAR_2->acl, VAR_1); break; case USB_SCO_EP:
VAR_3 = usb_bt_fifo_dequeue(&VAR_2->sco, VAR_1); break; default:
goto fail; } break; case USB_TOKEN_OUT:
switch (VAR_1->devep & 0xf) { case USB_ACL_EP:
usb_bt_fifo_out_enqueue(VAR_2, &VAR_2->outacl, VAR_2->hci->acl_send,
usb_bt_hci_acl_complete, VAR_1); break; case USB_SCO_EP:
usb_bt_fifo_out_enqueue(VAR_2, &VAR_2->outsco, VAR_2->hci->sco_send,
usb_bt_hci_sco_complete, VAR_1); break; default:
goto fail; } break; default:
fail:
VAR_3 = USB_RET_STALL; break; } return VAR_3; }