blob: 880378ca143f832e64b0a16642ff09d30b755e1e [file] [log] [blame]
Kevin O'Connor54671c12010-02-15 18:58:12 -05001#ifndef __USB_HUB_H
2#define __USB_HUB_H
3
4// usb-hub.c
Kevin O'Connor6a8e8952012-03-08 07:20:30 -05005struct usbdevice_s;
Kevin O'Connord83c87b2013-01-21 01:14:12 -05006int usb_hub_setup(struct usbdevice_s *usbdev);
Kevin O'Connor54671c12010-02-15 18:58:12 -05007
8
9/****************************************************************
10 * hub flags
11 ****************************************************************/
12
13#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
Kevin O'Connor73fe49a2014-12-12 14:16:43 -050014#define USB_DT_HUB3 (USB_TYPE_CLASS | 0x0a)
15
16#define HUB_REQ_SET_HUB_DEPTH 0x0C
Kevin O'Connor54671c12010-02-15 18:58:12 -050017
18struct 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
44struct 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'Connor73fe49a2014-12-12 14:16:43 -050054#define USB_PORT_STAT_LINK_SHIFT 5
55#define USB_PORT_STAT_LINK_MASK (0x7 << USB_PORT_STAT_LINK_SHIFT)
Kevin O'Connor54671c12010-02-15 18:58:12 -050056#define USB_PORT_STAT_POWER 0x0100
Kevin O'Connor190cc622010-03-09 19:43:52 -050057#define USB_PORT_STAT_SPEED_SHIFT 9
58#define USB_PORT_STAT_SPEED_MASK (0x3 << USB_PORT_STAT_SPEED_SHIFT)
Kevin O'Connor54671c12010-02-15 18:58:12 -050059#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