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