usb.patch, with conflicts and some warnings fixed
[pintos-anon] / src / devices / usb_hub.c
1 #include "devices/usb.h"
2 #include "devices/usb_hub.h"
3 #include <lib/debug.h>
4
5 #define USB_CLASS_HUB   0x09
6
7 #define REQ_HUB_GET_STATUS      0
8 #define REQ_HUB_CLEAR_FEATURE   1
9 #define REQ_HUB_SET_FEATURE     2
10 #define REQ_HUB_GET_DESC        6
11 #define REQ_HUB_SET_DESC        7
12 #define REQ_HUB_CLEAR_TT_BUF    8
13 #define REQ_HUB_RESET_TT        9
14 #define REQ_HUB_GET_TT_STATE    10
15 #define REQ_HUB_STOP_TT         11
16
17 #define HUB_SEL_HUB_POWER               0
18 #define HUB_SEL_OVER_CURRENT            1
19 #define HUB_SEL_PORT_CONN               0
20 #define HUB_SEL_PORT_ENABLE             1
21 #define HUB_SEL_PORT_SUSPEND            2
22 #define HUB_SEL_PORT_OVER_CURRENT       3
23 #define HUB_SEL_PORT_RESET              4
24 #define HUB_SEL_PORT_POWER              8
25 #define HUB_SEL_PORT_LOW_SPEED          9
26
27 #define SETUP_DESC_HUB                  0x29
28
29 static void* hub_attached(struct usb_iface*);
30 static void hub_detached(class_info);
31
32 static struct usb_class hub_class = {
33                 .attached = hub_attached,
34                 .detached = hub_detached,
35                 .class_id = USB_CLASS_HUB,
36                 .name = "hub"
37                 };
38
39
40 void usb_hub_init(void)
41 {
42         usb_register_class(&hub_class);
43 }
44
45
46 static void* hub_attached(struct usb_iface* ui UNUSED)
47 {
48         return NULL;
49 }
50
51 static void hub_detached(class_info info UNUSED)
52 {
53 }
54