Kevin O'Connor | 54671c1 | 2010-02-15 18:58:12 -0500 | [diff] [blame] | 1 | #ifndef __USB_HUB_H |
| 2 | #define __USB_HUB_H |
| 3 | |
| 4 | // usb-hub.c |
Kevin O'Connor | 6a8e895 | 2012-03-08 07:20:30 -0500 | [diff] [blame] | 5 | struct usbdevice_s; |
Kevin O'Connor | d83c87b | 2013-01-21 01:14:12 -0500 | [diff] [blame] | 6 | int usb_hub_setup(struct usbdevice_s *usbdev); |
Kevin O'Connor | 54671c1 | 2010-02-15 18:58:12 -0500 | [diff] [blame] | 7 | |
| 8 | |
| 9 | /**************************************************************** |
| 10 | * hub flags |
| 11 | ****************************************************************/ |
| 12 | |
| 13 | #define USB_DT_HUB (USB_TYPE_CLASS | 0x09) |
Kevin O'Connor | 73fe49a | 2014-12-12 14:16:43 -0500 | [diff] [blame] | 14 | #define USB_DT_HUB3 (USB_TYPE_CLASS | 0x0a) |
| 15 | |
| 16 | #define HUB_REQ_SET_HUB_DEPTH 0x0C |
Kevin O'Connor | 54671c1 | 2010-02-15 18:58:12 -0500 | [diff] [blame] | 17 | |
| 18 | struct usb_hub_descriptor { |
| 19 | u8 bDescLength; |
| 20 | u8 bDescriptorType; |
| 21 | u8 bNbrPorts; |
| 22 | u16 wHubCharacteristics; |
| 23 | u8 bPwrOn2PwrGood; |
| 24 | u8 bHubContrCurrent; |
| 25 | // Variable length fields for DeviceRemovable[], PortPwrCtrlMask[] follow. |
| 26 | } PACKED; |
| 27 | |
| 28 | #define USB_PORT_FEAT_CONNECTION 0 |
| 29 | #define USB_PORT_FEAT_ENABLE 1 |
| 30 | #define USB_PORT_FEAT_SUSPEND 2 |
| 31 | #define USB_PORT_FEAT_OVER_CURRENT 3 |
| 32 | #define USB_PORT_FEAT_RESET 4 |
| 33 | #define USB_PORT_FEAT_POWER 8 |
| 34 | #define USB_PORT_FEAT_LOWSPEED 9 |
| 35 | #define USB_PORT_FEAT_C_CONNECTION 16 |
| 36 | #define USB_PORT_FEAT_C_ENABLE 17 |
| 37 | #define USB_PORT_FEAT_C_SUSPEND 18 |
| 38 | #define USB_PORT_FEAT_C_OVER_CURRENT 19 |
| 39 | #define USB_PORT_FEAT_C_RESET 20 |
| 40 | #define USB_PORT_FEAT_TEST 21 |
| 41 | #define USB_PORT_FEAT_INDICATOR 22 |
| 42 | #define USB_PORT_FEAT_C_PORT_L1 23 |
| 43 | |
| 44 | struct usb_port_status { |
| 45 | u16 wPortStatus; |
| 46 | u16 wPortChange; |
| 47 | } PACKED; |
| 48 | |
| 49 | #define USB_PORT_STAT_CONNECTION 0x0001 |
| 50 | #define USB_PORT_STAT_ENABLE 0x0002 |
| 51 | #define USB_PORT_STAT_SUSPEND 0x0004 |
| 52 | #define USB_PORT_STAT_OVERCURRENT 0x0008 |
| 53 | #define USB_PORT_STAT_RESET 0x0010 |
Kevin O'Connor | 73fe49a | 2014-12-12 14:16:43 -0500 | [diff] [blame] | 54 | #define USB_PORT_STAT_LINK_SHIFT 5 |
| 55 | #define USB_PORT_STAT_LINK_MASK (0x7 << USB_PORT_STAT_LINK_SHIFT) |
Kevin O'Connor | 54671c1 | 2010-02-15 18:58:12 -0500 | [diff] [blame] | 56 | #define USB_PORT_STAT_POWER 0x0100 |
Kevin O'Connor | 190cc62 | 2010-03-09 19:43:52 -0500 | [diff] [blame] | 57 | #define USB_PORT_STAT_SPEED_SHIFT 9 |
| 58 | #define USB_PORT_STAT_SPEED_MASK (0x3 << USB_PORT_STAT_SPEED_SHIFT) |
Kevin O'Connor | 54671c1 | 2010-02-15 18:58:12 -0500 | [diff] [blame] | 59 | #define USB_PORT_STAT_LOW_SPEED 0x0200 |
| 60 | #define USB_PORT_STAT_HIGH_SPEED 0x0400 |
| 61 | #define USB_PORT_STAT_TEST 0x0800 |
| 62 | #define USB_PORT_STAT_INDICATOR 0x1000 |
| 63 | |
| 64 | #endif // ush-hid.h |