]> xenbits.xensource.com Git - people/andrewcoop/seabios.git/commitdiff
usb: Use usb_send_pipe() now that all drivers have x_send_pipe()
authorKevin O'Connor <kevin@koconnor.net>
Wed, 31 Dec 2014 07:11:36 +0000 (02:11 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 7 Jan 2015 15:13:46 +0000 (10:13 -0500)
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>
src/hw/usb.c

index a262a98e174a071b9d7a355b6b0b1e496f057a70..773057ebe5fe32d547211c6153bb59f89dd9b2e1 100644 (file)
@@ -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