Changeset 51c1d500 in mainline for uspace/drv/bus/usb/xhci/device.c
- Timestamp:
- 2018-01-20T17:16:33Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6271a34
- Parents:
- abb5d08
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/device.c
rabb5d08 r51c1d500 52 52 #include "bus.h" 53 53 #include "endpoint.h" 54 #include "hw_struct/context.h" 54 55 55 56 #include "device.h" … … 86 87 dev->base.endpoints[0] = ep0_base; 87 88 88 xhci_endpoint_t *ep0 = xhci_endpoint_get(ep0_base);89 90 89 /* Address device */ 91 if ((err = hc_address_device(dev , ep0)))90 if ((err = hc_address_device(dev))) 92 91 goto err_added; 93 92 … … 127 126 ep0->base.max_transfer_size = max_packet_size * ep0->base.packets_per_uframe; 128 127 129 xhci_ep_ctx_t ep_ctx; 130 xhci_setup_endpoint_context(ep0, &ep_ctx); 131 132 if ((err = hc_update_endpoint(dev, 0, &ep_ctx))) 128 if ((err = hc_update_endpoint(ep0))) 133 129 return err; 134 130 … … 306 302 } 307 303 304 /** 305 * Fill a slot context that is part of an Input Context with appropriate 306 * values. 307 * 308 * @param ctx Slot context, zeroed out. 309 */ 310 void xhci_setup_slot_context(xhci_device_t *dev, xhci_slot_ctx_t *ctx) 311 { 312 /* Initialize slot_ctx according to section 4.3.3 point 3. */ 313 XHCI_SLOT_ROOT_HUB_PORT_SET(*ctx, dev->rh_port); 314 XHCI_SLOT_ROUTE_STRING_SET(*ctx, dev->route_str); 315 XHCI_SLOT_SPEED_SET(*ctx, hc_speed_to_psiv(dev->base.speed)); 316 317 /* 318 * Note: This function is used even before this flag can be set, to 319 * issue the address device command. It is OK, because these 320 * flags are not required to be valid for that command. 321 */ 322 if (dev->is_hub) { 323 XHCI_SLOT_HUB_SET(*ctx, 1); 324 XHCI_SLOT_NUM_PORTS_SET(*ctx, dev->num_ports); 325 XHCI_SLOT_TT_THINK_TIME_SET(*ctx, dev->tt_think_time); 326 XHCI_SLOT_MTT_SET(*ctx, 0); // MTT not supported yet 327 } 328 329 /* Setup Transaction Translation. TODO: Test this with HS hub. */ 330 if (dev->base.tt.dev != NULL) { 331 xhci_device_t *hub = xhci_device_get(dev->base.tt.dev); 332 XHCI_SLOT_TT_HUB_SLOT_ID_SET(*ctx, hub->slot_id); 333 XHCI_SLOT_TT_HUB_PORT_SET(*ctx, dev->base.tt.port); 334 } 335 336 // As we always allocate space for whole input context, we can set this to maximum 337 XHCI_SLOT_CTX_ENTRIES_SET(*ctx, 31); 338 } 339 308 340 309 341 /**
Note:
See TracChangeset
for help on using the changeset viewer.