Пример #1
0
struct MUSBState *musb_init(qemu_irq *irqs)
{
    MUSBState *s = qemu_mallocz(sizeof(*s));
    int i;

    s->irqs = irqs;

    s->faddr = 0x00;
    s->power = MGC_M_POWER_HSENAB;
    s->tx_intr = 0x0000;
    s->rx_intr = 0x0000;
    s->tx_mask = 0xffff;
    s->rx_mask = 0xffff;
    s->intr = 0x00;
    s->mask = 0x06;
    s->idx = 0;

    /* TODO: _DW */
    s->ep[0].config = MGC_M_CONFIGDATA_SOFTCONE | MGC_M_CONFIGDATA_DYNFIFO;
    for (i = 0; i < 16; i ++) {
        s->ep[i].fifosize = 64;
        s->ep[i].maxp[0] = 0x40;
        s->ep[i].maxp[1] = 0x40;
        s->ep[i].musb = s;
        s->ep[i].epnum = i;
    }

    usb_bus_new(&s->bus, NULL /* FIXME */);
    usb_register_port(&s->bus, &s->port, s, 0, &musb_port_ops,
                      USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
    usb_port_location(&s->port, NULL, 1);

    return s;
}
Пример #2
0
struct MUSBState {
    qemu_irq *irqs;
    USBBus bus;
    USBPort port;

    int idx;
    uint8_t devctl;
    uint8_t power;
    uint8_t faddr;

    uint8_t intr;
    uint8_t mask;
    uint16_t tx_intr;
    uint16_t tx_mask;
    uint16_t rx_intr;
    uint16_t rx_mask;

    int setup_len;
    int session;

    uint8_t buf[0x8000];

        /* Duplicating the world since 2008!...  probably we should have 32
         * logical, single endpoints instead.  */
    MUSBEndPoint ep[16];
} *musb_init(qemu_irq *irqs)
{
    MUSBState *s = qemu_mallocz(sizeof(*s));
    int i;

    s->irqs = irqs;

    s->faddr = 0x00;
    s->power = MGC_M_POWER_HSENAB;
    s->tx_intr = 0x0000;
    s->rx_intr = 0x0000;
    s->tx_mask = 0xffff;
    s->rx_mask = 0xffff;
    s->intr = 0x00;
    s->mask = 0x06;
    s->idx = 0;

    /* TODO: _DW */
    s->ep[0].config = MGC_M_CONFIGDATA_SOFTCONE | MGC_M_CONFIGDATA_DYNFIFO;
    for (i = 0; i < 16; i ++) {
        s->ep[i].fifosize = 64;
        s->ep[i].maxp[0] = 0x40;
        s->ep[i].maxp[1] = 0x40;
        s->ep[i].musb = s;
        s->ep[i].epnum = i;
    }

    usb_bus_new(&s->bus, NULL /* FIXME */);
    usb_register_port(&s->bus, &s->port, s, 0, &musb_port_ops,
                      USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
    usb_port_location(&s->port, NULL, 1);

    return s;
}
Пример #3
0
struct MUSBState *musb_init(DeviceState *parent_device, int gpio_base)
{
    MUSBState *s = g_malloc0(sizeof(*s));
    int i;

    for (i = 0; i < musb_irq_max; i++) {
        s->irqs[i] = qdev_get_gpio_in(parent_device, gpio_base + i);
    }

    musb_reset(s);

    usb_bus_new(&s->bus, sizeof(s->bus), &musb_bus_ops, parent_device);
    usb_register_port(&s->bus, &s->port, s, 0, &musb_port_ops,
                      USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);

    return s;
}