blob: a75cbdaf0c1d754cc8c2d74d41cae99daaa0a9c1 [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;
6int usb_hub_init(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)
14
15struct usb_hub_descriptor {
16 u8 bDescLength;
17 u8 bDescriptorType;
18 u8 bNbrPorts;
19 u16 wHubCharacteristics;
20 u8 bPwrOn2PwrGood;
21 u8 bHubContrCurrent;
22 // Variable length fields for DeviceRemovable[], PortPwrCtrlMask[] follow.
23} PACKED;
24
25#define USB_PORT_FEAT_CONNECTION 0
26#define USB_PORT_FEAT_ENABLE 1
27#define USB_PORT_FEAT_SUSPEND 2
28#define USB_PORT_FEAT_OVER_CURRENT 3
29#define USB_PORT_FEAT_RESET 4
30#define USB_PORT_FEAT_POWER 8
31#define USB_PORT_FEAT_LOWSPEED 9
32#define USB_PORT_FEAT_C_CONNECTION 16
33#define USB_PORT_FEAT_C_ENABLE 17
34#define USB_PORT_FEAT_C_SUSPEND 18
35#define USB_PORT_FEAT_C_OVER_CURRENT 19
36#define USB_PORT_FEAT_C_RESET 20
37#define USB_PORT_FEAT_TEST 21
38#define USB_PORT_FEAT_INDICATOR 22
39#define USB_PORT_FEAT_C_PORT_L1 23
40
41struct usb_port_status {
42 u16 wPortStatus;
43 u16 wPortChange;
44} PACKED;
45
46#define USB_PORT_STAT_CONNECTION 0x0001
47#define USB_PORT_STAT_ENABLE 0x0002
48#define USB_PORT_STAT_SUSPEND 0x0004
49#define USB_PORT_STAT_OVERCURRENT 0x0008
50#define USB_PORT_STAT_RESET 0x0010
51#define USB_PORT_STAT_L1 0x0020
52#define USB_PORT_STAT_POWER 0x0100
Kevin O'Connor190cc622010-03-09 19:43:52 -050053#define USB_PORT_STAT_SPEED_SHIFT 9
54#define USB_PORT_STAT_SPEED_MASK (0x3 << USB_PORT_STAT_SPEED_SHIFT)
Kevin O'Connor54671c12010-02-15 18:58:12 -050055#define USB_PORT_STAT_LOW_SPEED 0x0200
56#define USB_PORT_STAT_HIGH_SPEED 0x0400
57#define USB_PORT_STAT_TEST 0x0800
58#define USB_PORT_STAT_INDICATOR 0x1000
59
60#endif // ush-hid.h