X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdevices%2Fusb_hub.c;fp=src%2Fdevices%2Fusb_hub.c;h=01bbfb9d6b2d1ddad0ef494e78aac280dc4a1086;hb=b4e9c266d656c6b595cc57920a34937776acc300;hp=0000000000000000000000000000000000000000;hpb=6ffbc2b68c34c2d1e42d5f6bcd8f2b94b82d05d7;p=pintos-anon diff --git a/src/devices/usb_hub.c b/src/devices/usb_hub.c new file mode 100644 index 0000000..01bbfb9 --- /dev/null +++ b/src/devices/usb_hub.c @@ -0,0 +1,54 @@ +#include "devices/usb.h" +#include "devices/usb_hub.h" +#include + +#define USB_CLASS_HUB 0x09 + +#define REQ_HUB_GET_STATUS 0 +#define REQ_HUB_CLEAR_FEATURE 1 +#define REQ_HUB_SET_FEATURE 2 +#define REQ_HUB_GET_DESC 6 +#define REQ_HUB_SET_DESC 7 +#define REQ_HUB_CLEAR_TT_BUF 8 +#define REQ_HUB_RESET_TT 9 +#define REQ_HUB_GET_TT_STATE 10 +#define REQ_HUB_STOP_TT 11 + +#define HUB_SEL_HUB_POWER 0 +#define HUB_SEL_OVER_CURRENT 1 +#define HUB_SEL_PORT_CONN 0 +#define HUB_SEL_PORT_ENABLE 1 +#define HUB_SEL_PORT_SUSPEND 2 +#define HUB_SEL_PORT_OVER_CURRENT 3 +#define HUB_SEL_PORT_RESET 4 +#define HUB_SEL_PORT_POWER 8 +#define HUB_SEL_PORT_LOW_SPEED 9 + +#define SETUP_DESC_HUB 0x29 + +static void* hub_attached(struct usb_iface*); +static void hub_detached(class_info); + +static struct usb_class hub_class = { + .attached = hub_attached, + .detached = hub_detached, + .class_id = USB_CLASS_HUB, + .name = "hub" + }; + + +void usb_hub_init(void) +{ + usb_register_class(&hub_class); +} + + +static void* hub_attached(struct usb_iface* ui UNUSED) +{ + return NULL; +} + +static void hub_detached(class_info info UNUSED) +{ +} +