| 63 |
typedef struct UHCIPort { |
typedef struct UHCIPort { |
| 64 |
USBPort port; |
USBPort port; |
| 65 |
uint16_t ctrl; |
uint16_t ctrl; |
|
USBDevice *dev; /* connected device */ |
|
| 66 |
} UHCIPort; |
} UHCIPort; |
| 67 |
|
|
| 68 |
typedef struct UHCIState { |
typedef struct UHCIState { |
| 127 |
for(i = 0; i < NB_PORTS; i++) { |
for(i = 0; i < NB_PORTS; i++) { |
| 128 |
port = &s->ports[i]; |
port = &s->ports[i]; |
| 129 |
port->ctrl = 0x0080; |
port->ctrl = 0x0080; |
| 130 |
if (port->dev) |
if (port->port.dev) |
| 131 |
uhci_attach(&port->port, port->dev); |
uhci_attach(&port->port, port->port.dev); |
| 132 |
} |
} |
| 133 |
} |
} |
| 134 |
|
|
| 182 |
/* send reset on the USB bus */ |
/* send reset on the USB bus */ |
| 183 |
for(i = 0; i < NB_PORTS; i++) { |
for(i = 0; i < NB_PORTS; i++) { |
| 184 |
port = &s->ports[i]; |
port = &s->ports[i]; |
| 185 |
dev = port->dev; |
dev = port->port.dev; |
| 186 |
if (dev) { |
if (dev) { |
| 187 |
dev->handle_packet(dev, |
dev->handle_packet(dev, |
| 188 |
USB_MSG_RESET, 0, 0, NULL, 0); |
USB_MSG_RESET, 0, 0, NULL, 0); |
| 223 |
if (n >= NB_PORTS) |
if (n >= NB_PORTS) |
| 224 |
return; |
return; |
| 225 |
port = &s->ports[n]; |
port = &s->ports[n]; |
| 226 |
dev = port->dev; |
dev = port->port.dev; |
| 227 |
if (dev) { |
if (dev) { |
| 228 |
/* port reset */ |
/* port reset */ |
| 229 |
if ( (val & UHCI_PORT_RESET) && |
if ( (val & UHCI_PORT_RESET) && |
| 319 |
UHCIPort *port = &s->ports[port1->index]; |
UHCIPort *port = &s->ports[port1->index]; |
| 320 |
|
|
| 321 |
if (dev) { |
if (dev) { |
| 322 |
if (port->dev) { |
if (port->port.dev) { |
| 323 |
usb_attach(port1, NULL); |
usb_attach(port1, NULL); |
| 324 |
} |
} |
| 325 |
/* set connect status */ |
/* set connect status */ |
| 331 |
port->ctrl |= UHCI_PORT_LSDA; |
port->ctrl |= UHCI_PORT_LSDA; |
| 332 |
else |
else |
| 333 |
port->ctrl &= ~UHCI_PORT_LSDA; |
port->ctrl &= ~UHCI_PORT_LSDA; |
| 334 |
port->dev = dev; |
port->port.dev = dev; |
| 335 |
/* send the attach message */ |
/* send the attach message */ |
| 336 |
dev->handle_packet(dev, |
dev->handle_packet(dev, |
| 337 |
USB_MSG_ATTACH, 0, 0, NULL, 0); |
USB_MSG_ATTACH, 0, 0, NULL, 0); |
| 345 |
port->ctrl &= ~UHCI_PORT_EN; |
port->ctrl &= ~UHCI_PORT_EN; |
| 346 |
port->ctrl |= UHCI_PORT_ENC; |
port->ctrl |= UHCI_PORT_ENC; |
| 347 |
} |
} |
| 348 |
dev = port->dev; |
dev = port->port.dev; |
| 349 |
if (dev) { |
if (dev) { |
| 350 |
/* send the detach message */ |
/* send the detach message */ |
| 351 |
dev->handle_packet(dev, |
dev->handle_packet(dev, |
| 352 |
USB_MSG_DETACH, 0, 0, NULL, 0); |
USB_MSG_DETACH, 0, 0, NULL, 0); |
| 353 |
} |
} |
| 354 |
port->dev = NULL; |
port->port.dev = NULL; |
| 355 |
} |
} |
| 356 |
} |
} |
| 357 |
|
|
| 385 |
#endif |
#endif |
| 386 |
for(i = 0; i < NB_PORTS; i++) { |
for(i = 0; i < NB_PORTS; i++) { |
| 387 |
port = &s->ports[i]; |
port = &s->ports[i]; |
| 388 |
dev = port->dev; |
dev = port->port.dev; |
| 389 |
if (dev && (port->ctrl & UHCI_PORT_EN)) { |
if (dev && (port->ctrl & UHCI_PORT_EN)) { |
| 390 |
ret = dev->handle_packet(dev, pid, |
ret = dev->handle_packet(dev, pid, |
| 391 |
devaddr, devep, |
devaddr, devep, |