Zephyr API Documentation 4.5.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
usb_hub.h File Reference

USB Hub Class public header. More...

Go to the source code of this file.

Data Structures

struct  usb_hub_descriptor
 USB Hub Descriptor. More...
struct  usb_hub_status
 USB Hub Status. More...
struct  usb_hub_port_status
 USB Hub Port Status. More...

Macros

#define USB_HUB_DESC_BUF_SIZE   71
 Maximum hub descriptor size.
#define USB_HUB_GET_THINK_TIME(wHubCharacteristics)
 Get Think Time value from wHubCharacteristics field.
USB Hub Class Codes
#define USB_HUB_CLASS_CODE   0x09
 Hub class code.
#define USB_HUB_SUBCLASS_CODE   0x00
 Hub subclass code.
#define USB_HUB_PROTOCOL_FS   0x00
 Hub protocol codes, see USB 2.0 spec Table 11-17.
#define USB_HUB_PROTOCOL_HS_SINGLE_TT   0x01
 High-speed hub with single TT.
#define USB_HUB_PROTOCOL_HS_MULTI_TT   0x02
 High-speed hub with multiple TTs.
#define USB_HUB_PROTOCOL_CODE   USB_HUB_PROTOCOL_HS_SINGLE_TT
 Legacy alias, same as USB_HUB_PROTOCOL_HS_SINGLE_TT.
USB Hub Descriptor Types
#define USB_HUB_DESCRIPTOR_TYPE   0x29
 Hub descriptor type.
USB Hub Class Request Codes.

See Table 11-16 of the specification.

#define USB_HCREQ_GET_STATUS   0x00
 Get Status request.
#define USB_HCREQ_CLEAR_FEATURE   0x01
 Clear Feature request.
#define USB_HCREQ_SET_FEATURE   0x03
 Set Feature request.
#define USB_HCREQ_GET_DESCRIPTOR   0x06
 Get Descriptor request.
#define USB_HCREQ_SET_DESCRIPTOR   0x07
 Set Descriptor request.
#define USB_HCREQ_CLEAR_TT_BUFFER   0x08
 Clear TT Buffer request.
#define USB_HCREQ_RESET_TT   0x09
 Reset TT request.
#define USB_HCREQ_GET_TT_STATE   0x0A
 Get TT State request.
#define USB_HCREQ_STOP_TT   0x0B
 Stop TT request.
USB Hub Class Feature Selectors.

See Table 11-17 of the specification.

#define USB_HCFS_C_HUB_LOCAL_POWER   0x00
 Hub local power change feature selector.
#define USB_HCFS_C_HUB_OVER_CURRENT   0x01
 Hub over-current change feature selector.
#define USB_HCFS_PORT_CONNECTION   0x00
 Port connection feature selector.
#define USB_HCFS_PORT_ENABLE   0x01
 Port enable feature selector.
#define USB_HCFS_PORT_SUSPEND   0x02
 Port suspend feature selector.
#define USB_HCFS_PORT_OVER_CURRENT   0x03
 Port over-current feature selector.
#define USB_HCFS_PORT_RESET   0x04
 Port reset feature selector.
#define USB_HCFS_PORT_POWER   0x08
 Port power feature selector.
#define USB_HCFS_PORT_LOW_SPEED   0x09
 Port low speed feature selector.
#define USB_HCFS_C_PORT_CONNECTION   0x10
 Port connection change feature selector.
#define USB_HCFS_C_PORT_ENABLE   0x11
 Port enable change feature selector.
#define USB_HCFS_C_PORT_SUSPEND   0x12
 Port suspend change feature selector.
#define USB_HCFS_C_PORT_OVER_CURRENT   0x13
 Port over-current change feature selector.
#define USB_HCFS_C_PORT_RESET   0x14
 Port reset change feature selector.
#define USB_HCFS_PORT_TEST   0x15
 Port test feature selector.
#define USB_HCFS_PORT_INDICATOR   0x16
 Port indicator feature selector.
USB Hub Status Field, wHubStatus.

See Table 11-19 of the specification.

#define USB_HUB_STATUS_LOCAL_POWER   BIT(0)
 Hub local power status bit.
#define USB_HUB_STATUS_OVER_CURRENT   BIT(1)
 Hub over-current status bit.
USB Hub Change Field, wHubChange.

See Table 11-20 of the specification.

#define USB_HUB_CHANGE_LOCAL_POWER   BIT(0)
 Hub local power change bit.
#define USB_HUB_CHANGE_OVER_CURRENT   BIT(1)
 Hub over-current change bit.
USB Hub Port Status Field, wPortStatus.

See Table 11-21 of the specification.

#define USB_HUB_PORT_STATUS_CONNECTION   BIT(0)
 Port connection status bit.
#define USB_HUB_PORT_STATUS_ENABLE   BIT(1)
 Port enable status bit.
#define USB_HUB_PORT_STATUS_SUSPEND   BIT(2)
 Port suspend status bit.
#define USB_HUB_PORT_STATUS_OVER_CURRENT   BIT(3)
 Port over-current status bit.
#define USB_HUB_PORT_STATUS_RESET   BIT(4)
 Port reset status bit.
#define USB_HUB_PORT_STATUS_POWER   BIT(8)
 Port power status bit.
#define USB_HUB_PORT_STATUS_LOW_SPEED   BIT(9)
 Port low speed device attached bit.
#define USB_HUB_PORT_STATUS_HIGH_SPEED   BIT(10)
 Port high speed device attached bit.
#define USB_HUB_PORT_STATUS_TEST   BIT(11)
 Port test mode bit.
#define USB_HUB_PORT_STATUS_INDICATOR   BIT(12)
 Port indicator control bit.
USB Hub Port Change Field, wPortChange.

See Table 11-22 of the specification.

#define USB_HUB_PORT_CHANGE_CONNECTION   BIT(0)
 Port connection change bit.
#define USB_HUB_PORT_CHANGE_ENABLE   BIT(1)
 Port enable change bit.
#define USB_HUB_PORT_CHANGE_SUSPEND   BIT(2)
 Port suspend change bit.
#define USB_HUB_PORT_CHANGE_OVER_CURRENT   BIT(3)
 Port over-current change bit.
#define USB_HUB_PORT_CHANGE_RESET   BIT(4)
 Port reset change bit.

Detailed Description

USB Hub Class public header.

Macro Definition Documentation

◆ USB_HCFS_C_HUB_LOCAL_POWER

#define USB_HCFS_C_HUB_LOCAL_POWER   0x00

Hub local power change feature selector.

◆ USB_HCFS_C_HUB_OVER_CURRENT

#define USB_HCFS_C_HUB_OVER_CURRENT   0x01

Hub over-current change feature selector.

◆ USB_HCFS_C_PORT_CONNECTION

#define USB_HCFS_C_PORT_CONNECTION   0x10

Port connection change feature selector.

◆ USB_HCFS_C_PORT_ENABLE

#define USB_HCFS_C_PORT_ENABLE   0x11

Port enable change feature selector.

◆ USB_HCFS_C_PORT_OVER_CURRENT

#define USB_HCFS_C_PORT_OVER_CURRENT   0x13

Port over-current change feature selector.

◆ USB_HCFS_C_PORT_RESET

#define USB_HCFS_C_PORT_RESET   0x14

Port reset change feature selector.

◆ USB_HCFS_C_PORT_SUSPEND

#define USB_HCFS_C_PORT_SUSPEND   0x12

Port suspend change feature selector.

◆ USB_HCFS_PORT_CONNECTION

#define USB_HCFS_PORT_CONNECTION   0x00

Port connection feature selector.

◆ USB_HCFS_PORT_ENABLE

#define USB_HCFS_PORT_ENABLE   0x01

Port enable feature selector.

◆ USB_HCFS_PORT_INDICATOR

#define USB_HCFS_PORT_INDICATOR   0x16

Port indicator feature selector.

◆ USB_HCFS_PORT_LOW_SPEED

#define USB_HCFS_PORT_LOW_SPEED   0x09

Port low speed feature selector.

◆ USB_HCFS_PORT_OVER_CURRENT

#define USB_HCFS_PORT_OVER_CURRENT   0x03

Port over-current feature selector.

◆ USB_HCFS_PORT_POWER

#define USB_HCFS_PORT_POWER   0x08

Port power feature selector.

◆ USB_HCFS_PORT_RESET

#define USB_HCFS_PORT_RESET   0x04

Port reset feature selector.

◆ USB_HCFS_PORT_SUSPEND

#define USB_HCFS_PORT_SUSPEND   0x02

Port suspend feature selector.

◆ USB_HCFS_PORT_TEST

#define USB_HCFS_PORT_TEST   0x15

Port test feature selector.

◆ USB_HCREQ_CLEAR_FEATURE

#define USB_HCREQ_CLEAR_FEATURE   0x01

Clear Feature request.

◆ USB_HCREQ_CLEAR_TT_BUFFER

#define USB_HCREQ_CLEAR_TT_BUFFER   0x08

Clear TT Buffer request.

◆ USB_HCREQ_GET_DESCRIPTOR

#define USB_HCREQ_GET_DESCRIPTOR   0x06

Get Descriptor request.

◆ USB_HCREQ_GET_STATUS

#define USB_HCREQ_GET_STATUS   0x00

Get Status request.

◆ USB_HCREQ_GET_TT_STATE

#define USB_HCREQ_GET_TT_STATE   0x0A

Get TT State request.

◆ USB_HCREQ_RESET_TT

#define USB_HCREQ_RESET_TT   0x09

Reset TT request.

◆ USB_HCREQ_SET_DESCRIPTOR

#define USB_HCREQ_SET_DESCRIPTOR   0x07

Set Descriptor request.

◆ USB_HCREQ_SET_FEATURE

#define USB_HCREQ_SET_FEATURE   0x03

Set Feature request.

◆ USB_HCREQ_STOP_TT

#define USB_HCREQ_STOP_TT   0x0B

Stop TT request.

◆ USB_HUB_CHANGE_LOCAL_POWER

#define USB_HUB_CHANGE_LOCAL_POWER   BIT(0)

Hub local power change bit.

◆ USB_HUB_CHANGE_OVER_CURRENT

#define USB_HUB_CHANGE_OVER_CURRENT   BIT(1)

Hub over-current change bit.

◆ USB_HUB_CLASS_CODE

#define USB_HUB_CLASS_CODE   0x09

Hub class code.

◆ USB_HUB_DESC_BUF_SIZE

#define USB_HUB_DESC_BUF_SIZE   71

Maximum hub descriptor size.

7 bytes (fixed) + max 32 bytes (DeviceRemovable) + max 32 bytes (PortPwrCtrlMask)

◆ USB_HUB_DESCRIPTOR_TYPE

#define USB_HUB_DESCRIPTOR_TYPE   0x29

Hub descriptor type.

◆ USB_HUB_GET_THINK_TIME

#define USB_HUB_GET_THINK_TIME ( wHubCharacteristics)
Value:
(((((wHubCharacteristics) & 0x0060U) >> 5) + 1) << 3)

Get Think Time value from wHubCharacteristics field.

Parameters
wHubCharacteristicsHub descriptor field wHubCharacteristics.
Returns
Think time in full-speed bit times (8, 16, 24, or 32).

◆ USB_HUB_PORT_CHANGE_CONNECTION

#define USB_HUB_PORT_CHANGE_CONNECTION   BIT(0)

Port connection change bit.

◆ USB_HUB_PORT_CHANGE_ENABLE

#define USB_HUB_PORT_CHANGE_ENABLE   BIT(1)

Port enable change bit.

◆ USB_HUB_PORT_CHANGE_OVER_CURRENT

#define USB_HUB_PORT_CHANGE_OVER_CURRENT   BIT(3)

Port over-current change bit.

◆ USB_HUB_PORT_CHANGE_RESET

#define USB_HUB_PORT_CHANGE_RESET   BIT(4)

Port reset change bit.

◆ USB_HUB_PORT_CHANGE_SUSPEND

#define USB_HUB_PORT_CHANGE_SUSPEND   BIT(2)

Port suspend change bit.

◆ USB_HUB_PORT_STATUS_CONNECTION

#define USB_HUB_PORT_STATUS_CONNECTION   BIT(0)

Port connection status bit.

◆ USB_HUB_PORT_STATUS_ENABLE

#define USB_HUB_PORT_STATUS_ENABLE   BIT(1)

Port enable status bit.

◆ USB_HUB_PORT_STATUS_HIGH_SPEED

#define USB_HUB_PORT_STATUS_HIGH_SPEED   BIT(10)

Port high speed device attached bit.

◆ USB_HUB_PORT_STATUS_INDICATOR

#define USB_HUB_PORT_STATUS_INDICATOR   BIT(12)

Port indicator control bit.

◆ USB_HUB_PORT_STATUS_LOW_SPEED

#define USB_HUB_PORT_STATUS_LOW_SPEED   BIT(9)

Port low speed device attached bit.

◆ USB_HUB_PORT_STATUS_OVER_CURRENT

#define USB_HUB_PORT_STATUS_OVER_CURRENT   BIT(3)

Port over-current status bit.

◆ USB_HUB_PORT_STATUS_POWER

#define USB_HUB_PORT_STATUS_POWER   BIT(8)

Port power status bit.

◆ USB_HUB_PORT_STATUS_RESET

#define USB_HUB_PORT_STATUS_RESET   BIT(4)

Port reset status bit.

◆ USB_HUB_PORT_STATUS_SUSPEND

#define USB_HUB_PORT_STATUS_SUSPEND   BIT(2)

Port suspend status bit.

◆ USB_HUB_PORT_STATUS_TEST

#define USB_HUB_PORT_STATUS_TEST   BIT(11)

Port test mode bit.

◆ USB_HUB_PROTOCOL_CODE

#define USB_HUB_PROTOCOL_CODE   USB_HUB_PROTOCOL_HS_SINGLE_TT

Legacy alias, same as USB_HUB_PROTOCOL_HS_SINGLE_TT.

◆ USB_HUB_PROTOCOL_FS

#define USB_HUB_PROTOCOL_FS   0x00

Hub protocol codes, see USB 2.0 spec Table 11-17.

Full/Low-speed hub, no TT.

◆ USB_HUB_PROTOCOL_HS_MULTI_TT

#define USB_HUB_PROTOCOL_HS_MULTI_TT   0x02

High-speed hub with multiple TTs.

◆ USB_HUB_PROTOCOL_HS_SINGLE_TT

#define USB_HUB_PROTOCOL_HS_SINGLE_TT   0x01

High-speed hub with single TT.

◆ USB_HUB_STATUS_LOCAL_POWER

#define USB_HUB_STATUS_LOCAL_POWER   BIT(0)

Hub local power status bit.

◆ USB_HUB_STATUS_OVER_CURRENT

#define USB_HUB_STATUS_OVER_CURRENT   BIT(1)

Hub over-current status bit.

◆ USB_HUB_SUBCLASS_CODE

#define USB_HUB_SUBCLASS_CODE   0x00

Hub subclass code.