blob: 399df579fdc99fcd49761152b50506252778773c [file] [log] [blame]
Kevin O'Connor54671c12010-02-15 18:58:12 -05001#ifndef __USB_HUB_H
2#define __USB_HUB_H
3
Kevin O'Connor8ebcac02010-03-09 19:58:23 -05004struct usbhub_s {
5 struct usb_pipe *pipe;
6 struct usb_s *cntl;
7 struct mutex_s lock;
8 u32 powerwait;
9 u32 port;
10 u32 threads;
11 u32 devcount;
12};
13
Kevin O'Connor54671c12010-02-15 18:58:12 -050014// usb-hub.c
Kevin O'Connor357bdfa2010-02-26 08:57:13 -050015struct usb_pipe;
16int usb_hub_init(struct usb_pipe *pipe);
Kevin O'Connor54671c12010-02-15 18:58:12 -050017
18
19/****************************************************************
20 * hub flags
21 ****************************************************************/
22
23#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
24
25struct usb_hub_descriptor {
26 u8 bDescLength;
27 u8 bDescriptorType;
28 u8 bNbrPorts;
29 u16 wHubCharacteristics;
30 u8 bPwrOn2PwrGood;
31 u8 bHubContrCurrent;
32 // Variable length fields for DeviceRemovable[], PortPwrCtrlMask[] follow.
33} PACKED;
34
35#define USB_PORT_FEAT_CONNECTION 0
36#define USB_PORT_FEAT_ENABLE 1
37#define USB_PORT_FEAT_SUSPEND 2
38#define USB_PORT_FEAT_OVER_CURRENT 3
39#define USB_PORT_FEAT_RESET 4
40#define USB_PORT_FEAT_POWER 8
41#define USB_PORT_FEAT_LOWSPEED 9
42#define USB_PORT_FEAT_C_CONNECTION 16
43#define USB_PORT_FEAT_C_ENABLE 17
44#define USB_PORT_FEAT_C_SUSPEND 18
45#define USB_PORT_FEAT_C_OVER_CURRENT 19
46#define USB_PORT_FEAT_C_RESET 20
47#define USB_PORT_FEAT_TEST 21
48#define USB_PORT_FEAT_INDICATOR 22
49#define USB_PORT_FEAT_C_PORT_L1 23
50
51struct usb_port_status {
52 u16 wPortStatus;
53 u16 wPortChange;
54} PACKED;
55
56#define USB_PORT_STAT_CONNECTION 0x0001
57#define USB_PORT_STAT_ENABLE 0x0002
58#define USB_PORT_STAT_SUSPEND 0x0004
59#define USB_PORT_STAT_OVERCURRENT 0x0008
60#define USB_PORT_STAT_RESET 0x0010
61#define USB_PORT_STAT_L1 0x0020
62#define USB_PORT_STAT_POWER 0x0100
63#define USB_PORT_STAT_LOW_SPEED 0x0200
64#define USB_PORT_STAT_HIGH_SPEED 0x0400
65#define USB_PORT_STAT_TEST 0x0800
66#define USB_PORT_STAT_INDICATOR 0x1000
67
68#endif // ush-hid.h