Changeset 56db65d in mainline for uspace/drv/bus
- Timestamp:
- 2017-10-24T11:06:32Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0206d35
- Parents:
- 894f58c
- Location:
- uspace/drv/bus/usb
- Files:
-
- 5 edited
-
ehci/ehci_bus.c (modified) (1 diff)
-
ohci/ohci_bus.c (modified) (1 diff)
-
xhci/bus.c (modified) (1 diff)
-
xhci/endpoint.c (modified) (2 diffs)
-
xhci/rh.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/ehci_bus.c
r894f58c r56db65d 114 114 115 115 116 static int ehci_register_ep(bus_t *bus_base, endpoint_t *ep )116 static int ehci_register_ep(bus_t *bus_base, endpoint_t *ep, const usb_endpoint_desc_t *desc) 117 117 { 118 118 ehci_bus_t *bus = (ehci_bus_t *) bus_base; 119 119 ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep); 120 120 121 const int err = bus->parent_ops.register_endpoint(bus_base, ep); 121 // TODO utilize desc->usb2 122 123 const int err = bus->parent_ops.register_endpoint(bus_base, ep, desc); 122 124 if (err) 123 125 return err; -
uspace/drv/bus/usb/ohci/ohci_bus.c
r894f58c r56db65d 115 115 116 116 117 static int ohci_register_ep(bus_t *bus_base, endpoint_t *ep )117 static int ohci_register_ep(bus_t *bus_base, endpoint_t *ep, const usb_endpoint_desc_t *desc) 118 118 { 119 119 ohci_bus_t *bus = (ohci_bus_t *) bus_base; 120 120 ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep); 121 121 122 const int err = bus->parent_ops.register_endpoint(bus_base, ep );122 const int err = bus->parent_ops.register_endpoint(bus_base, ep, desc); 123 123 if (err) 124 124 return err; -
uspace/drv/bus/usb/xhci/bus.c
r894f58c r56db65d 165 165 } 166 166 167 static int register_endpoint(bus_t *bus_base, endpoint_t *ep )167 static int register_endpoint(bus_t *bus_base, endpoint_t *ep, const usb_endpoint_desc_t *desc) 168 168 { 169 169 xhci_bus_t *bus = bus_to_xhci_bus(bus_base); 170 170 assert(bus); 171 171 172 usb_log_info("Endpoint(%d:%d) registered to XHCI bus.", ep->target.address, ep->target.endpoint); 172 assert(ep->device); 173 174 /* Extract USB2-related information from endpoint_desc */ 175 ep->target = (usb_target_t) {{ 176 .address = ep->device->address, 177 .endpoint = desc->endpoint_no, 178 }}; 179 ep->direction = desc->direction; 180 ep->transfer_type = desc->transfer_type; 181 ep->max_packet_size = desc->max_packet_size; 182 ep->packets = desc->packets; 173 183 174 184 xhci_device_t *xhci_dev = xhci_device_get(ep->device); 175 185 xhci_endpoint_t *xhci_ep = xhci_endpoint_get(ep); 186 187 xhci_ep->max_streams = desc->usb3.max_streams; 188 xhci_ep->max_burst = desc->usb3.max_burst; 189 // TODO add this property to usb_endpoint_desc_t and fetch it from ss companion desc 190 xhci_ep->mult = 0; 191 192 usb_log_info("Endpoint(%d:%d) registered to XHCI bus.", ep->target.address, ep->target.endpoint); 176 193 return xhci_device_add_endpoint(xhci_dev, xhci_ep); 177 194 } -
uspace/drv/bus/usb/xhci/endpoint.c
r894f58c r56db65d 275 275 assert(&dev->base == ep->base.device); 276 276 assert(dev->base.address == ep->base.target.address); 277 278 // TODO Do not fail hard on runtime conditions 277 279 assert(!dev->endpoints[ep_num]); 278 280 … … 285 287 return EOK; 286 288 } 287 288 // FIXME: Set these from usb_superspeed_endpoint_companion_descriptor_t:289 ep->max_streams = 0;290 ep->max_burst = 0;291 ep->mult = 0;292 289 293 290 /* Set up TRB ring / PSA. */ -
uspace/drv/bus/usb/xhci/rh.c
r894f58c r56db65d 90 90 } 91 91 92 /* FIXME Are these really static? Older HCs fetch it from descriptor. */ 93 /* FIXME Add USB3 options, if applicable. */ 94 static const usb_endpoint_desc_t ep0_desc = { 95 .endpoint_no = 0, 96 .direction = USB_DIRECTION_BOTH, 97 .transfer_type = USB_TRANSFER_CONTROL, 98 .max_packet_size = CTRL_PIPE_MIN_PACKET_SIZE, 99 .packets = 1, 100 }; 101 92 102 // TODO: This currently assumes the device is attached to rh directly. 93 103 // Also, we should consider moving a lot of functionailty to xhci bus … … 112 122 113 123 xhci_endpoint_t *ep0 = xhci_endpoint_get(ep0_base); 114 /* FIXME: Sync this with xhci_device_add_endpoint. */115 ep0->max_streams = 0;116 ep0->max_burst = 0;117 ep0->mult = 0;118 124 119 125 if ((err = xhci_endpoint_alloc_transfer_ds(ep0))) … … 144 150 fibril_mutex_unlock(&dev->guard); 145 151 146 // XXX: Going around bus, duplicating code147 152 ep0_base->device = dev; 148 ep0_base->target.address = dev->address; 149 ep0_base->target.endpoint = 0; 150 ep0_base->direction = USB_DIRECTION_BOTH; 151 ep0_base->transfer_type = USB_TRANSFER_CONTROL; 152 ep0_base->max_packet_size = CTRL_PIPE_MIN_PACKET_SIZE; 153 ep0_base->packets = 1; 154 ep0_base->bandwidth = CTRL_PIPE_MIN_PACKET_SIZE; 155 156 bus_register_endpoint(&rh->hc->bus.base, ep0_base); 153 154 bus_register_endpoint(&rh->hc->bus.base, ep0_base, &ep0_desc); 157 155 158 156 if (!rh->devices[dev->port - 1]) {
Note:
See TracChangeset
for help on using the changeset viewer.
