static int uhci_broadcast_packet(UHCIState *s, USBPacket *p)

{

    UHCIPort *port;

    USBDevice *dev;

    int i, ret;



#ifdef DEBUG_PACKET

    {

        const char *pidstr;

        switch(p->pid) {

        case USB_TOKEN_SETUP: pidstr = "SETUP"; break;

        case USB_TOKEN_IN: pidstr = "IN"; break;

        case USB_TOKEN_OUT: pidstr = "OUT"; break;

        default: pidstr = "?"; break;

        }

        printf("frame %d: pid=%s addr=0x%02x ep=%d len=%d\n",

               s->frnum, pidstr, p->devaddr, p->devep, p->len);

        if (p->pid != USB_TOKEN_IN) {

            printf("     data_out=");

            for(i = 0; i < p->len; i++) {

                printf(" %02x", p->data[i]);

            }

            printf("\n");

        }

    }

#endif

    for(i = 0; i < NB_PORTS; i++) {

        port = &s->ports[i];

        dev = port->port.dev;

        if (dev && (port->ctrl & UHCI_PORT_EN)) {

            ret = dev->handle_packet(dev, p);

            if (ret != USB_RET_NODEV) {

#ifdef DEBUG_PACKET

                if (ret == USB_RET_ASYNC) {

                    printf("usb-uhci: Async packet\n");

                } else {

                    printf("     ret=%d ", ret);

                    if (p->pid == USB_TOKEN_IN && ret > 0) {

                        printf("data_in=");

                        for(i = 0; i < ret; i++) {

                            printf(" %02x", p->data[i]);

                        }

                    }

                    printf("\n");

                }

#endif

                return ret;

            }

        }

    }

    return USB_RET_NODEV;

}

static int uhci_broadcast_packet(UHCIState *s, USBPacket *p)

{

    UHCIPort *port;

    USBDevice *dev;

    int i, ret;



#ifdef DEBUG_PACKET

    {

        const char *pidstr;

        switch(p->pid) {

        case USB_TOKEN_SETUP: pidstr = "SETUP"; break;

        case USB_TOKEN_IN: pidstr = "IN"; break;

        case USB_TOKEN_OUT: pidstr = "OUT"; break;

        default: pidstr = "?"; break;

        }

        printf("frame %d: pid=%s addr=0x%02x ep=%d len=%d\n",

               s->frnum, pidstr, p->devaddr, p->devep, p->len);

        if (p->pid != USB_TOKEN_IN) {

            printf("     data_out=");

            for(i = 0; i < p->len; i++) {

                printf(" %02x", p->data[i]);

            }

            printf("\n");

        }

    }

#endif

    for(i = 0; i < NB_PORTS; i++) {

        port = &s->ports[i];

        dev = port->port.dev;

        if (dev && (port->ctrl & UHCI_PORT_EN)) {

            ret = dev->handle_packet(dev, p);

            if (ret != USB_RET_NODEV) {

#ifdef DEBUG_PACKET

                if (ret == USB_RET_ASYNC) {

                    printf("usb-uhci: Async packet\n");

                } else {

                    printf("     ret=%d ", ret);

                    if (p->pid == USB_TOKEN_IN && ret > 0) {

                        printf("data_in=");

                        for(i = 0; i < ret; i++) {

                            printf(" %02x", p->data[i]);

                        }

                    }

                    printf("\n");

                }

#endif

                return ret;

            }

        }

    }

    return USB_RET_NODEV;

}

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

{

    UHCIPort *port;

    USBDevice *dev;

    int VAR_2, VAR_3;



#ifdef DEBUG_PACKET

    {

        const char *pidstr;

        switch(VAR_1->pid) {

        case USB_TOKEN_SETUP: pidstr = "SETUP"; break;

        case USB_TOKEN_IN: pidstr = "IN"; break;

        case USB_TOKEN_OUT: pidstr = "OUT"; break;

        default: pidstr = "?"; break;

        }

        printf("frame %d: pid=%VAR_0 addr=0x%02x ep=%d len=%d\n",

               VAR_0->frnum, pidstr, VAR_1->devaddr, VAR_1->devep, VAR_1->len);

        if (VAR_1->pid != USB_TOKEN_IN) {

            printf("     data_out=");

            for(VAR_2 = 0; VAR_2 < VAR_1->len; VAR_2++) {

                printf(" %02x", VAR_1->data[VAR_2]);

            }

            printf("\n");

        }

    }

#endif

    for(VAR_2 = 0; VAR_2 < NB_PORTS; VAR_2++) {

        port = &VAR_0->ports[VAR_2];

        dev = port->port.dev;

        if (dev && (port->ctrl & UHCI_PORT_EN)) {

            VAR_3 = dev->handle_packet(dev, VAR_1);

            if (VAR_3 != USB_RET_NODEV) {

#ifdef DEBUG_PACKET

                if (VAR_3 == USB_RET_ASYNC) {

                    printf("usb-uhci: Async packet\n");

                } else {

                    printf("     VAR_3=%d ", VAR_3);

                    if (VAR_1->pid == USB_TOKEN_IN && VAR_3 > 0) {

                        printf("data_in=");

                        for(VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) {

                            printf(" %02x", VAR_1->data[VAR_2]);

                        }

                    }

                    printf("\n");

                }

#endif

                return VAR_3;

            }

        }

    }

    return USB_RET_NODEV;

}

static int FUNC_0(UHCIState *VAR_0, USBPacket *VAR_1)
{ UHCIPort *port; USBDevice *dev; int VAR_2, VAR_3; #ifdef DEBUG_PACKET
{ const char *pidstr; switch(VAR_1->pid) { case USB_TOKEN_SETUP: pidstr = "SETUP"; break; case USB_TOKEN_IN: pidstr = "IN"; break; case USB_TOKEN_OUT: pidstr = "OUT"; break; default: pidstr = "?"; break; } printf("frame %d: pid=%VAR_0 addr=0x%02x ep=%d len=%d\n",
VAR_0->frnum, pidstr, VAR_1->devaddr, VAR_1->devep, VAR_1->len); if (VAR_1->pid != USB_TOKEN_IN) { printf("     data_out="); for(VAR_2 = 0; VAR_2 < VAR_1->len; VAR_2++) { printf(" %02x", VAR_1->data[VAR_2]); } printf("\n"); } } #endif
for(VAR_2 = 0; VAR_2 < NB_PORTS; VAR_2++) { port = &VAR_0->ports[VAR_2]; dev = port->port.dev; if (dev && (port->ctrl & UHCI_PORT_EN)) { VAR_3 = dev->handle_packet(dev, VAR_1); if (VAR_3 != USB_RET_NODEV) { #ifdef DEBUG_PACKET
if (VAR_3 == USB_RET_ASYNC) { printf("usb-uhci: Async packet\n"); } else { printf("     VAR_3=%d ", VAR_3); if (VAR_1->pid == USB_TOKEN_IN && VAR_3 > 0) { printf("data_in="); for(VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) { printf(" %02x", VAR_1->data[VAR_2]); } } printf("\n"); } #endif
return VAR_3; } } } return USB_RET_NODEV; }