Revision 9159f679
b/hw/usb-uhci.c | ||
---|---|---|
57 | 57 |
#define TD_CTRL_NAK (1 << 19) |
58 | 58 |
#define TD_CTRL_TIMEOUT (1 << 18) |
59 | 59 |
|
60 |
#define UHCI_PORT_SUSPEND (1 << 12) |
|
60 | 61 |
#define UHCI_PORT_RESET (1 << 9) |
61 | 62 |
#define UHCI_PORT_LSDA (1 << 8) |
63 |
#define UHCI_PORT_RD (1 << 6) |
|
62 | 64 |
#define UHCI_PORT_ENC (1 << 3) |
63 | 65 |
#define UHCI_PORT_EN (1 << 2) |
64 | 66 |
#define UHCI_PORT_CSC (1 << 1) |
65 | 67 |
#define UHCI_PORT_CCS (1 << 0) |
66 | 68 |
|
69 |
#define UHCI_PORT_READ_ONLY (0x1bb) |
|
70 |
#define UHCI_PORT_WRITE_CLEAR (UHCI_PORT_CSC | UHCI_PORT_ENC) |
|
71 |
|
|
67 | 72 |
#define FRAME_TIMER_FREQ 1000 |
68 | 73 |
|
69 | 74 |
#define FRAME_MAX_LOOPS 100 |
... | ... | |
497 | 502 |
usb_send_msg(dev, USB_MSG_RESET); |
498 | 503 |
} |
499 | 504 |
} |
500 |
port->ctrl = (port->ctrl & 0x01fb) | (val & ~0x01fb); |
|
505 |
port->ctrl &= UHCI_PORT_READ_ONLY; |
|
506 |
port->ctrl |= (val & ~UHCI_PORT_READ_ONLY); |
|
501 | 507 |
/* some bits are reset when a '1' is written to them */ |
502 |
port->ctrl &= ~(val & 0x000a);
|
|
508 |
port->ctrl &= ~(val & UHCI_PORT_WRITE_CLEAR);
|
|
503 | 509 |
} |
504 | 510 |
break; |
505 | 511 |
} |
... | ... | |
629 | 635 |
uhci_resume(s); |
630 | 636 |
} |
631 | 637 |
|
638 |
static void uhci_wakeup(USBDevice *dev) |
|
639 |
{ |
|
640 |
USBBus *bus = usb_bus_from_device(dev); |
|
641 |
UHCIState *s = container_of(bus, UHCIState, bus); |
|
642 |
UHCIPort *port = s->ports + dev->port->index; |
|
643 |
|
|
644 |
if (port->ctrl & UHCI_PORT_SUSPEND && !(port->ctrl & UHCI_PORT_RD)) { |
|
645 |
port->ctrl |= UHCI_PORT_RD; |
|
646 |
uhci_resume(s); |
|
647 |
} |
|
648 |
} |
|
649 |
|
|
632 | 650 |
static int uhci_broadcast_packet(UHCIState *s, USBPacket *p) |
633 | 651 |
{ |
634 | 652 |
int i, ret; |
... | ... | |
1094 | 1112 |
static USBPortOps uhci_port_ops = { |
1095 | 1113 |
.attach = uhci_attach, |
1096 | 1114 |
.detach = uhci_detach, |
1115 |
.wakeup = uhci_wakeup, |
|
1097 | 1116 |
}; |
1098 | 1117 |
|
1099 | 1118 |
static int usb_uhci_common_initfn(UHCIState *s) |
Also available in: Unified diff