static void usb_ohci_init(OHCIState *ohci, DeviceState *dev,

                          int num_ports, dma_addr_t localmem_base,

                          char *masterbus, uint32_t firstport,

                          AddressSpace *as, Error **errp)

{

    Error *err = NULL;

    int i;



    ohci->as = as;



    if (usb_frame_time == 0) {

#ifdef OHCI_TIME_WARP

        usb_frame_time = get_ticks_per_sec();

        usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000);

#else

        usb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000);

        if (get_ticks_per_sec() >= USB_HZ) {

            usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ);

        } else {

            usb_bit_time = 1;

        }

#endif

        trace_usb_ohci_init_time(usb_frame_time, usb_bit_time);

    }



    ohci->num_ports = num_ports;

    if (masterbus) {

        USBPort *ports[OHCI_MAX_PORTS];

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

            ports[i] = &ohci->rhport[i].port;

        }

        usb_register_companion(masterbus, ports, num_ports,

                               firstport, ohci, &ohci_port_ops,

                               USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL,

                               &err);

        if (err) {

            error_propagate(errp, err);

            return;

        }

    } else {

        usb_bus_new(&ohci->bus, sizeof(ohci->bus), &ohci_bus_ops, dev);

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

            usb_register_port(&ohci->bus, &ohci->rhport[i].port,

                              ohci, i, &ohci_port_ops,

                              USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);

        }

    }



    memory_region_init_io(&ohci->mem, OBJECT(dev), &ohci_mem_ops,

                          ohci, "ohci", 256);

    ohci->localmem_base = localmem_base;



    ohci->name = object_get_typename(OBJECT(dev));

    usb_packet_init(&ohci->usb_packet);



    ohci->async_td = 0;

    qemu_register_reset(ohci_reset, ohci);

}

static void usb_ohci_init(OHCIState *ohci, DeviceState *dev,

                          int num_ports, dma_addr_t localmem_base,

                          char *masterbus, uint32_t firstport,

                          AddressSpace *as, Error **errp)

{

    Error *err = NULL;

    int i;



    ohci->as = as;



    if (usb_frame_time == 0) {

#ifdef OHCI_TIME_WARP

        usb_frame_time = get_ticks_per_sec();

        usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000);

#else

        usb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000);

        if (get_ticks_per_sec() >= USB_HZ) {

            usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ);

        } else {

            usb_bit_time = 1;

        }

#endif

        trace_usb_ohci_init_time(usb_frame_time, usb_bit_time);

    }



    ohci->num_ports = num_ports;

    if (masterbus) {

        USBPort *ports[OHCI_MAX_PORTS];

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

            ports[i] = &ohci->rhport[i].port;

        }

        usb_register_companion(masterbus, ports, num_ports,

                               firstport, ohci, &ohci_port_ops,

                               USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL,

                               &err);

        if (err) {

            error_propagate(errp, err);

            return;

        }

    } else {

        usb_bus_new(&ohci->bus, sizeof(ohci->bus), &ohci_bus_ops, dev);

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

            usb_register_port(&ohci->bus, &ohci->rhport[i].port,

                              ohci, i, &ohci_port_ops,

                              USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);

        }

    }



    memory_region_init_io(&ohci->mem, OBJECT(dev), &ohci_mem_ops,

                          ohci, "ohci", 256);

    ohci->localmem_base = localmem_base;



    ohci->name = object_get_typename(OBJECT(dev));

    usb_packet_init(&ohci->usb_packet);



    ohci->async_td = 0;

    qemu_register_reset(ohci_reset, ohci);

}

    qemu_register_reset(ohci_reset, ohci);
static void FUNC_0(OHCIState *VAR_0, DeviceState *VAR_1,

                          int VAR_2, dma_addr_t VAR_3,

                          char *VAR_4, uint32_t VAR_5,

                          AddressSpace *VAR_6, Error **VAR_7)

{

    Error *err = NULL;

    int VAR_8;



    VAR_0->VAR_6 = VAR_6;



    if (usb_frame_time == 0) {

#ifdef OHCI_TIME_WARP

        usb_frame_time = get_ticks_per_sec();

        usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000);

#else

        usb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000);

        if (get_ticks_per_sec() >= USB_HZ) {

            usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ);

        } else {

            usb_bit_time = 1;

        }

#endif

        trace_usb_ohci_init_time(usb_frame_time, usb_bit_time);

    }



    VAR_0->VAR_2 = VAR_2;

    if (VAR_4) {

        USBPort *ports[OHCI_MAX_PORTS];

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

            ports[VAR_8] = &VAR_0->rhport[VAR_8].port;

        }

        usb_register_companion(VAR_4, ports, VAR_2,

                               VAR_5, VAR_0, &ohci_port_ops,

                               USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL,

                               &err);

        if (err) {

            error_propagate(VAR_7, err);

            return;

        }

    } else {

        usb_bus_new(&VAR_0->bus, sizeof(VAR_0->bus), &ohci_bus_ops, VAR_1);

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

            usb_register_port(&VAR_0->bus, &VAR_0->rhport[VAR_8].port,

                              VAR_0, VAR_8, &ohci_port_ops,

                              USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);

        }

    }



    memory_region_init_io(&VAR_0->mem, OBJECT(VAR_1), &ohci_mem_ops,

                          VAR_0, "VAR_0", 256);

    VAR_0->VAR_3 = VAR_3;



    VAR_0->name = object_get_typename(OBJECT(VAR_1));

    usb_packet_init(&VAR_0->usb_packet);



    VAR_0->async_td = 0;

    qemu_register_reset(ohci_reset, VAR_0);

}

static void FUNC_0(OHCIState *VAR_0, DeviceState *VAR_1,
int VAR_2, dma_addr_t VAR_3,
char *VAR_4, uint32_t VAR_5,
AddressSpace *VAR_6, Error **VAR_7)
{ Error *err = NULL; int VAR_8; VAR_0->VAR_6 = VAR_6; if (usb_frame_time == 0) { #ifdef OHCI_TIME_WARP
usb_frame_time = get_ticks_per_sec(); usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000); #else
usb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000); if (get_ticks_per_sec() >= USB_HZ) { usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ); } else { usb_bit_time = 1; } #endif
trace_usb_ohci_init_time(usb_frame_time, usb_bit_time); } VAR_0->VAR_2 = VAR_2; if (VAR_4) { USBPort *ports[OHCI_MAX_PORTS]; for(VAR_8 = 0; VAR_8 < VAR_2; VAR_8++) { ports[VAR_8] = &VAR_0->rhport[VAR_8].port; } usb_register_companion(VAR_4, ports, VAR_2,
VAR_5, VAR_0, &ohci_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL,
&err); if (err) { error_propagate(VAR_7, err); return; } } else { usb_bus_new(&VAR_0->bus, sizeof(VAR_0->bus), &ohci_bus_ops, VAR_1); for (VAR_8 = 0; VAR_8 < VAR_2; VAR_8++) { usb_register_port(&VAR_0->bus, &VAR_0->rhport[VAR_8].port,
VAR_0, VAR_8, &ohci_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL); } } memory_region_init_io(&VAR_0->mem, OBJECT(VAR_1), &ohci_mem_ops,
VAR_0, "VAR_0", 256); VAR_0->VAR_3 = VAR_3; VAR_0->name = object_get_typename(OBJECT(VAR_1)); usb_packet_init(&VAR_0->usb_packet); VAR_0->async_td = 0; qemu_register_reset(ohci_reset, VAR_0); }