Changeset 766043c in mainline
- Timestamp:
- 2017-10-21T23:18:09Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2b61945
- Parents:
- 5fd9c30
- Location:
- uspace/drv/bus/usb/xhci
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified uspace/drv/bus/usb/xhci/rh.c ¶
r5fd9c30 r766043c 68 68 rh->hc = hc; 69 69 rh->max_ports = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PORTS); 70 rh->devices = (xhci_device_t **) malloc(rh->max_ports * sizeof(xhci_device_t *)); 70 71 hc->rh.hc_device = device; 72 73 memset(rh->devices, 0, rh->max_ports * sizeof(xhci_device_t *)); 71 74 72 75 return device_init(&hc->rh.device); … … 175 178 xhci_dev->hc = hc; 176 179 177 // TODO: Save anything else? 180 if (!rh->devices[dev->port - 1]) { 181 /* Only save the device if it's the first one connected to this port. */ 182 rh->devices[dev->port - 1] = xhci_dev; 183 } 178 184 179 185 return EOK; … … 280 286 static int handle_disconnected_device(xhci_rh_t *rh, uint8_t port_id) 281 287 { 282 // TODO: Find XHCI device by the port. 288 /* Find XHCI device by the port. */ 289 xhci_device_t *dev = rh->devices[port_id - 1]; 290 if (!dev) { 291 /* Must be extraneous call */ 292 return EOK; 293 } 294 295 usb_log_info("Device at port %u has been disconnected.", port_id); 296 283 297 // TODO: Destroy DDF function using _gone. 284 298 // TODO: Remove device endpoints on the bus. … … 437 451 /* TODO: Implement me! */ 438 452 usb_log_debug2("Called xhci_rh_fini()."); 453 454 free(rh->devices); 455 439 456 return EOK; 440 457 } -
TabularUnified uspace/drv/bus/usb/xhci/rh.h ¶
r5fd9c30 r766043c 55 55 typedef struct hcd_roothub hcd_roothub_t; 56 56 typedef struct xhci_bus xhci_bus_t; 57 typedef struct xhci_device xhci_device_t; 57 58 58 59 /* XHCI root hub instance */ … … 75 76 /* Number of hub ports. */ 76 77 uint8_t max_ports; 78 79 /* Device pointers connected to RH ports or NULL. (size is `max_ports`) */ 80 xhci_device_t **devices; 77 81 } xhci_rh_t; 78 82
Note:
See TracChangeset
for help on using the changeset viewer.