Refactor USB hub code.
[seabios.git] / src / usb.h
index b5cbf2ecc2c0cdceb1798f68076df3a4334d8641..f28a3a7f869552df89a6723b538e65b66f47d348 100644 (file)
--- a/src/usb.h
+++ b/src/usb.h
@@ -4,6 +4,7 @@
 
 #include "util.h" // struct mutex_s
 
+// Information on a USB end point.
 struct usb_pipe {
     struct usb_s *cntl;
     u8 type;
@@ -24,6 +25,26 @@ struct usb_s {
     u8 maxaddr;
 };
 
+// Information for enumerating USB hubs
+struct usbhub_s {
+    struct usbhub_op_s *op;
+    struct usb_pipe *pipe;
+    struct usb_s *cntl;
+    struct mutex_s lock;
+    u32 powerwait;
+    u32 port;
+    u32 threads;
+    u32 portcount;
+    u32 devcount;
+};
+
+// Hub callback (32bit) info
+struct usbhub_op_s {
+    int (*detect)(struct usbhub_s *hub, u32 port);
+    int (*reset)(struct usbhub_s *hub, u32 port);
+    void (*disconnect)(struct usbhub_s *hub, u32 port);
+};
+
 #define USB_TYPE_UHCI 1
 #define USB_TYPE_OHCI 2
 #define USB_TYPE_EHCI 3
@@ -175,9 +196,7 @@ struct usb_endpoint_descriptor {
 
 // usb.c
 void usb_setup(void);
-struct usbhub_s;
-struct usb_pipe *usb_set_address(struct usbhub_s *hub, int port, int speed);
-int configure_usb_device(struct usb_pipe *pipe);
+void usb_enumerate(struct usbhub_s *hub);
 int send_default_control(struct usb_pipe *pipe, const struct usb_ctrlrequest *req
                          , void *data);
 int usb_send_bulk(struct usb_pipe *pipe, int dir, void *data, int datasize);