10#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
11#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
17#define C_HUB_LOCAL_POWER 0
18#define C_HUB_OVER_CURRENT 1
24#define USB_PORT_FEAT_CONNECTION 0
25#define USB_PORT_FEAT_ENABLE 1
26#define USB_PORT_FEAT_SUSPEND 2
27#define USB_PORT_FEAT_OVER_CURRENT 3
28#define USB_PORT_FEAT_RESET 4
29#define USB_PORT_FEAT_POWER 8
30#define USB_PORT_FEAT_LOWSPEED 9
31#define USB_PORT_FEAT_HIGHSPEED 10
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
44typedef struct usb_port_status
54#define USB_PORT_STAT_CONNECTION 0x0001
55#define USB_PORT_STAT_ENABLE 0x0002
56#define USB_PORT_STAT_SUSPEND 0x0004
57#define USB_PORT_STAT_OVERCURRENT 0x0008
58#define USB_PORT_STAT_RESET 0x0010
60#define USB_PORT_STAT_POWER 0x0100
61#define USB_PORT_STAT_LOW_SPEED 0x0200
62#define USB_PORT_STAT_HIGH_SPEED 0x0400
63#define USB_PORT_STAT_TEST 0x0800
64#define USB_PORT_STAT_INDICATOR 0x1000
72#define USB_PORT_STAT_C_CONNECTION 0x0001
73#define USB_PORT_STAT_C_ENABLE 0x0002
74#define USB_PORT_STAT_C_SUSPEND 0x0004
75#define USB_PORT_STAT_C_OVERCURRENT 0x0008
76#define USB_PORT_STAT_C_RESET 0x0010
82#define HUB_CHAR_LPSM 0x0003
83#define HUB_CHAR_COMPOUND 0x0004
84#define HUB_CHAR_OCPM 0x0018
85#define HUB_CHAR_TTTT 0x0060
86#define HUB_CHAR_PORTIND 0x0080
89typedef struct usb_hub_status
91 __packed uint16_t wHubStatus;
92 __packed uint16_t wHubChange;
108#define HUB_STATUS_LOCAL_POWER 0x0001
109#define HUB_STATUS_OVERCURRENT 0x0002
110#define HUB_CHANGE_LOCAL_POWER 0x0001
111#define HUB_CHANGE_OVERCURRENT 0x0002
122#define MAX_PORTS_PER_HUB 8
129typedef struct usb_hub_descriptor
131 __packed uint8_t bDescLength;
132 __packed uint8_t bDescriptorType;
133 __packed uint8_t bNbrPorts;
134 __packed uint16_t wHubCharacteristics;
135 __packed uint8_t bPwrOn2PwrGood;
136 __packed uint8_t bHubContrCurrent;
137 __packed uint8_t DeviceRemovable[MAX_PORTS_PER_HUB/8];
138 __packed uint8_t PortPwrCtrlMask[MAX_PORTS_PER_HUB/8];
144 uint8_t bDescriptorType;
146 uint16_t wHubCharacteristics;
147 uint8_t bPwrOn2PwrGood;
148 uint8_t bHubContrCurrent;
149 uint8_t DeviceRemovable[MAX_PORTS_PER_HUB/8];
150 uint8_t PortPwrCtrlMask[MAX_PORTS_PER_HUB/8];
155typedef struct usb_hub
161 USB_LIST_T event_list;
162 USB_HUB_DESC_T descriptor;
163 char buffer[(USB_MAXCHILDREN + 1 + 7) / 8];
169extern USB_HUB_T * usbh_alloc_hubdev(
void);
170extern void usbh_free_hubdev(USB_HUB_T *hub);
void *__dso_handle __attribute__((weak))
HIDDEN_SYMBOLS struct usb_device USB_DEV_T