[ USB_SUPERSPEED ] = 4,
};
-static const int speed_to_ctlsize[] = {
- [ USB_FULLSPEED ] = 8,
- [ USB_LOWSPEED ] = 8,
- [ USB_HIGHSPEED ] = 64,
- [ USB_SUPERSPEED ] = 256,
-};
-
static const int eptype_to_xhci_in[] = {
[ USB_ENDPOINT_XFER_CONTROL] = 4,
[ USB_ENDPOINT_XFER_ISOC ] = 5,
struct xhci_epctx *ep = (void*)&in[2 << xhci->context64];
ep->ctx[0] |= (3 << 16); // interval: 1ms
ep->ctx[1] |= (4 << 3); // control pipe
- ep->ctx[1] |= (speed_to_ctlsize[usbdev->speed] << 16);
+ ep->ctx[1] |= (pipe->pipe.maxpacket << 16);
ep->deq_low = (u32)&pipe->reqs.ring[0];
ep->deq_low |= 1; // dcs
ep->deq_high = 0;
- ep->length = 8;
+ ep->length = pipe->pipe.maxpacket;
int cc = xhci_cmd_address_device(xhci, slotid, in);
free(in);
* Initialization and enumeration
****************************************************************/
+static const int speed_to_ctlsize[] = {
+ [ USB_FULLSPEED ] = 8,
+ [ USB_LOWSPEED ] = 8,
+ [ USB_HIGHSPEED ] = 64,
+ [ USB_SUPERSPEED ] = 512,
+};
+
// Assign an address to a device in the default state on the given
// controller.
static int
// Create a pipe for the default address.
struct usb_endpoint_descriptor epdesc = {
- .wMaxPacketSize = 8,
+ .wMaxPacketSize = speed_to_ctlsize[usbdev->speed],
.bmAttributes = USB_ENDPOINT_XFER_CONTROL,
};
usbdev->defpipe = usb_alloc_pipe(usbdev, &epdesc);