}
int
-xhci_send_control(struct usb_pipe *p, int dir, const void *cmd, int cmdsize
- , void *data, int datalen)
+xhci_send_pipe(struct usb_pipe *p, int dir, const void *cmd, int cmdsize
+ , void *data, int datalen)
{
if (!CONFIG_USB_XHCI)
return -1;
- const struct usb_ctrlrequest *req = cmd;
struct xhci_pipe *pipe = container_of(p, struct xhci_pipe, pipe);
struct usb_xhci_s *xhci = container_of(
pipe->pipe.cntl, struct usb_xhci_s, usb);
- if (req->bRequest == USB_REQ_SET_ADDRESS)
- // Set address command sent during xhci_alloc_pipe.
- return 0;
-
- xhci_xfer_setup(pipe, req, dir, datalen);
- if (datalen)
- xhci_xfer_data(pipe, dir, data, datalen);
- xhci_xfer_status(pipe, dir, datalen);
+ if (cmd) {
+ const struct usb_ctrlrequest *req = cmd;
+ if (req->bRequest == USB_REQ_SET_ADDRESS)
+ // Set address command sent during xhci_alloc_pipe.
+ return 0;
- int cc = xhci_event_wait(xhci, &pipe->reqs, usb_xfer_time(p, datalen));
- if (cc != CC_SUCCESS) {
- dprintf(1, "%s: control xfer failed (cc %d)\n", __func__, cc);
- return -1;
+ xhci_xfer_setup(pipe, req, dir, datalen);
+ if (datalen)
+ xhci_xfer_data(pipe, dir, data, datalen);
+ xhci_xfer_status(pipe, dir, datalen);
+ } else {
+ xhci_xfer_normal(pipe, data, datalen);
}
- return 0;
-}
-
-int
-xhci_send_bulk(struct usb_pipe *p, int dir, void *data, int datalen)
-{
- if (!CONFIG_USB_XHCI)
- return -1;
-
- struct xhci_pipe *pipe = container_of(p, struct xhci_pipe, pipe);
- struct usb_xhci_s *xhci = container_of(
- pipe->pipe.cntl, struct usb_xhci_s, usb);
-
- xhci_xfer_normal(pipe, data, datalen);
int cc = xhci_event_wait(xhci, &pipe->reqs, usb_xfer_time(p, datalen));
if (cc != CC_SUCCESS) {
- dprintf(1, "%s: bulk xfer failed (cc %d)\n", __func__, cc);
+ dprintf(1, "%s: xfer failed (cc %d)\n", __func__, cc);
return -1;
}
+
return 0;
}
struct usb_pipe *xhci_realloc_pipe(struct usbdevice_s *usbdev
, struct usb_pipe *upipe
, struct usb_endpoint_descriptor *epdesc);
-int xhci_send_control(struct usb_pipe *p, int dir, const void *cmd, int cmdsize
- , void *data, int datasize);
-int xhci_send_bulk(struct usb_pipe *p, int dir, void *data, int datasize);
+int xhci_send_pipe(struct usb_pipe *p, int dir, const void *cmd, int cmdsize
+ , void *data, int datasize);
int xhci_poll_intr(struct usb_pipe *p, void *data);
// --------------------------------------------------------------
case USB_TYPE_EHCI:
return ehci_send_pipe(pipe, dir, cmd, cmdsize, data, datasize);
case USB_TYPE_XHCI:
- return xhci_send_control(pipe, dir, cmd, cmdsize, data, datasize);
+ return xhci_send_pipe(pipe, dir, cmd, cmdsize, data, datasize);
}
}
case USB_TYPE_XHCI:
if (MODESEGMENT)
return -1;
- return xhci_send_bulk(pipe_fl, dir, data, datasize);
+ return xhci_send_pipe(pipe_fl, dir, NULL, 0, data, datasize);
}
}