diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2014-12-31 02:11:36 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2015-01-07 10:13:46 -0500 |
commit | da64e86cba8b7e09e33a0123e026d51eda970000 (patch) | |
tree | aa01605b3f60292ae8d4ddf62a107af47e049298 | |
parent | b33e31d17b42eaaccbf3a3b4a6f6e0ef49152ae2 (diff) | |
download | seabios-da64e86cba8b7e09e33a0123e026d51eda970000.zip seabios-da64e86cba8b7e09e33a0123e026d51eda970000.tar.gz seabios-da64e86cba8b7e09e33a0123e026d51eda970000.tar.bz2 |
usb: Use usb_send_pipe() now that all drivers have x_send_pipe()
Now that all drivers have unified control and bulk transmit functions,
unify the driver calling code in usb.c as well.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/hw/usb.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/src/hw/usb.c b/src/hw/usb.c index a262a98..773057e 100644 --- a/src/hw/usb.c +++ b/src/hw/usb.c @@ -46,40 +46,23 @@ usb_realloc_pipe(struct usbdevice_s *usbdev, struct usb_pipe *pipe // Send a message on a control pipe using the default control descriptor. static int -usb_send_control(struct usb_pipe *pipe, int dir, const void *cmd, int cmdsize - , void *data, int datasize) -{ - ASSERT32FLAT(); - switch (pipe->type) { - default: - case USB_TYPE_UHCI: - return uhci_send_pipe(pipe, dir, cmd, cmdsize, data, datasize); - case USB_TYPE_OHCI: - return ohci_send_pipe(pipe, dir, cmd, cmdsize, data, datasize); - case USB_TYPE_EHCI: - return ehci_send_pipe(pipe, dir, cmd, cmdsize, data, datasize); - case USB_TYPE_XHCI: - return xhci_send_pipe(pipe, dir, cmd, cmdsize, data, datasize); - } -} - -int -usb_send_bulk(struct usb_pipe *pipe_fl, int dir, void *data, int datasize) +usb_send_pipe(struct usb_pipe *pipe_fl, int dir, const void *cmd, int cmdsize + , void *data, int datasize) { switch (GET_LOWFLAT(pipe_fl->type)) { default: case USB_TYPE_UHCI: - return uhci_send_pipe(pipe_fl, dir, NULL, 0, data, datasize); + return uhci_send_pipe(pipe_fl, dir, cmd, cmdsize, data, datasize); case USB_TYPE_OHCI: if (MODESEGMENT) return -1; - return ohci_send_pipe(pipe_fl, dir, NULL, 0, data, datasize); + return ohci_send_pipe(pipe_fl, dir, cmd, cmdsize, data, datasize); case USB_TYPE_EHCI: - return ehci_send_pipe(pipe_fl, dir, NULL, 0, data, datasize); + return ehci_send_pipe(pipe_fl, dir, cmd, cmdsize, data, datasize); case USB_TYPE_XHCI: if (MODESEGMENT) return -1; - return xhci_send_pipe(pipe_fl, dir, NULL, 0, data, datasize); + return xhci_send_pipe(pipe_fl, dir, cmd, cmdsize, data, datasize); } } @@ -135,8 +118,15 @@ int usb_send_default_control(struct usb_pipe *pipe, const struct usb_ctrlrequest *req , void *data) { - return usb_send_control(pipe, req->bRequestType & USB_DIR_IN - , req, sizeof(*req), data, req->wLength); + return usb_send_pipe(pipe, req->bRequestType & USB_DIR_IN + , req, sizeof(*req), data, req->wLength); +} + +// Send a message to a bulk endpoint +int +usb_send_bulk(struct usb_pipe *pipe_fl, int dir, void *data, int datasize) +{ + return usb_send_pipe(pipe_fl, dir, NULL, 0, data, datasize); } // Check if a pipe for a given controller is on the freelist |