qmk_firmware/internals_usb_protocol_group.md
2020-11-10 15:02:44 +00:00

52 KiB

group usb_protocol_group

This module defines constants and data structures provided by the USB 2.0 specification.

Summary

Members Descriptions
define USB_V2_0 Value for field bcdUSB.
define USB_V2_1 USB Specification version 2.01.
define USB_REQ_DIR_OUT USB request data transfer direction (bmRequestType)
define USB_REQ_DIR_IN Device to host.
define USB_REQ_DIR_MASK Mask.
define USB_REQ_TYPE_STANDARD USB request types (bmRequestType)
define USB_REQ_TYPE_CLASS Class-specific request.
define USB_REQ_TYPE_VENDOR Vendor-specific request.
define USB_REQ_TYPE_MASK Mask.
define USB_REQ_RECIP_DEVICE USB recipient codes (bmRequestType)
define USB_REQ_RECIP_INTERFACE Recipient interface.
define USB_REQ_RECIP_ENDPOINT Recipient endpoint.
define USB_REQ_RECIP_OTHER Recipient other.
define USB_REQ_RECIP_MASK Mask.
define HIRD_50_US
define HIRD_125_US
define HIRD_200_US
define HIRD_275_US
define HIRD_350_US
define HIRD_425_US
define HIRD_500_US
define HIRD_575_US
define HIRD_650_US
define HIRD_725_US
define HIRD_800_US
define HIRD_875_US
define HIRD_950_US
define HIRD_1025_US
define HIRD_1100_US
define HIRD_1175_US
define USB_LPM_ATTRIBUT_BLINKSTATE_MASK Fields definition from a LPM TOKEN
define USB_LPM_ATTRIBUT_FIRD_MASK
define USB_LPM_ATTRIBUT_REMOTEWAKE_MASK
define USB_LPM_ATTRIBUT_BLINKSTATE
define USB_LPM_ATTRIBUT_FIRD
define USB_LPM_ATTRIBUT_REMOTEWAKE
define USB_LPM_ATTRIBUT_BLINKSTATE_L1
define USB_EP_ADDR_MASK Mask selecting the index part of an endpoint address.
define USB_EP_DIR_IN Endpoint transfer direction is IN.
define USB_EP_DIR_OUT Endpoint transfer direction is OUT.
define USB_MAX_DESC_LEN Maximum length in bytes of a USB descriptor.
define USB_CONFIG_ATTR_MUST_SET Must always be set.
define USB_CONFIG_ATTR_BUS_POWERED Bus-powered.
define USB_CONFIG_ATTR_SELF_POWERED Self-powered.
define USB_CONFIG_ATTR_REMOTE_WAKEUP remote wakeup supported
define USB_CONFIG_MAX_POWER Max power in mA.
enum usb_reqid Standard USB requests (bRequest)
enum usb_device_status Standard USB device status flags.
enum usb_interface_status Standard USB Interface status flags.
enum usb_endpoint_status Standard USB endpoint status flags.
enum usb_device_feature Standard USB device feature flags.
enum usb_device_hs_test_mode Test Mode possible on HS USB device.
enum usb_endpoint_feature Standard USB endpoint feature/status flags.
enum usb_test_mode_selector Standard USB Test Mode Selectors.
enum usb_descriptor_type Standard USB descriptor types.
enum usb_capability_type USB Device Capability types.
enum usb_capability_extension_attr USB Device Capability - USB 2.0 Extension To fill bmAttributes field of usb_capa_ext_desc_t structure.
enum usb_ep_type Standard USB endpoint transfer types.
enum usb_langid Standard USB language IDs for string descriptors.
struct usb_setup_req_t A USB Device SETUP request.
struct usb_dev_desc_t Standard USB device descriptor structure.
struct usb_dev_qual_desc_t Standard USB device qualifier descriptor structure.
struct usb_dev_bos_desc_t USB Device BOS descriptor structure.
struct usb_dev_capa_ext_desc_t USB Device Capabilities - USB 2.0 Extension Descriptor structure.
struct usb_dev_lpm_desc_t USB Device LPM Descriptor structure.
struct usb_association_desc_t Standard USB Interface Association Descriptor structure.
struct usb_conf_desc_t Standard USB configuration descriptor structure.
struct usb_iad_desc_t Standard USB association descriptor structure.
struct usb_iface_desc_t Standard USB interface descriptor structure.
struct usb_ep_desc_t Standard USB endpoint descriptor structure.
struct usb_str_desc_t A standard USB string descriptor structure.
struct usb_str_lgid_desc_t

Members

define USB_V2_0

Value for field bcdUSB.

USB Specification version 2.00

define USB_V2_1

USB Specification version 2.01.

define USB_REQ_DIR_OUT

USB request data transfer direction (bmRequestType)

Host to device

define USB_REQ_DIR_IN

Device to host.

define USB_REQ_DIR_MASK

Mask.

define USB_REQ_TYPE_STANDARD

USB request types (bmRequestType)

Standard request

define USB_REQ_TYPE_CLASS

Class-specific request.

define USB_REQ_TYPE_VENDOR

Vendor-specific request.

define USB_REQ_TYPE_MASK

Mask.

define USB_REQ_RECIP_DEVICE

USB recipient codes (bmRequestType)

Recipient device

define USB_REQ_RECIP_INTERFACE

Recipient interface.

define USB_REQ_RECIP_ENDPOINT

Recipient endpoint.

define USB_REQ_RECIP_OTHER

Recipient other.

define USB_REQ_RECIP_MASK

Mask.

define HIRD_50_US

define HIRD_125_US

define HIRD_200_US

define HIRD_275_US

define HIRD_350_US

define HIRD_425_US

define HIRD_500_US

define HIRD_575_US

define HIRD_650_US

define HIRD_725_US

define HIRD_800_US

define HIRD_875_US

define HIRD_950_US

define HIRD_1025_US

define HIRD_1100_US

define HIRD_1175_US

define USB_LPM_ATTRIBUT_BLINKSTATE_MASK

Fields definition from a LPM TOKEN

define USB_LPM_ATTRIBUT_FIRD_MASK

define USB_LPM_ATTRIBUT_REMOTEWAKE_MASK

define USB_LPM_ATTRIBUT_BLINKSTATE

define USB_LPM_ATTRIBUT_FIRD

define USB_LPM_ATTRIBUT_REMOTEWAKE

define USB_LPM_ATTRIBUT_BLINKSTATE_L1

define USB_EP_ADDR_MASK

Mask selecting the index part of an endpoint address.

define USB_EP_DIR_IN

Endpoint transfer direction is IN.

define USB_EP_DIR_OUT

Endpoint transfer direction is OUT.

define USB_MAX_DESC_LEN

Maximum length in bytes of a USB descriptor.

The maximum length of a USB descriptor is limited by the 8-bit bLength field.

define USB_CONFIG_ATTR_MUST_SET

Must always be set.

define USB_CONFIG_ATTR_BUS_POWERED

Bus-powered.

define USB_CONFIG_ATTR_SELF_POWERED

Self-powered.

define USB_CONFIG_ATTR_REMOTE_WAKEUP

remote wakeup supported

define USB_CONFIG_MAX_POWER

Max power in mA.

enum usb_reqid

Values Descriptions
USB_REQ_GET_STATUS
USB_REQ_CLEAR_FEATURE
USB_REQ_SET_FEATURE
USB_REQ_SET_ADDRESS
USB_REQ_GET_DESCRIPTOR
USB_REQ_SET_DESCRIPTOR
USB_REQ_GET_CONFIGURATION
USB_REQ_SET_CONFIGURATION
USB_REQ_GET_INTERFACE
USB_REQ_SET_INTERFACE
USB_REQ_SYNCH_FRAME

Standard USB requests (bRequest)

enum usb_device_status

Values Descriptions
USB_DEV_STATUS_BUS_POWERED
USB_DEV_STATUS_SELF_POWERED
USB_DEV_STATUS_REMOTEWAKEUP

Standard USB device status flags.

enum usb_interface_status

Values Descriptions
USB_IFACE_STATUS_RESERVED

Standard USB Interface status flags.

enum usb_endpoint_status

Values Descriptions
USB_EP_STATUS_HALTED

Standard USB endpoint status flags.

enum usb_device_feature

Values Descriptions
USB_DEV_FEATURE_REMOTE_WAKEUP Remote wakeup enabled.
USB_DEV_FEATURE_TEST_MODE USB test mode.
USB_DEV_FEATURE_OTG_B_HNP_ENABLE
USB_DEV_FEATURE_OTG_A_HNP_SUPPORT
USB_DEV_FEATURE_OTG_A_ALT_HNP_SUPPORT

Standard USB device feature flags.

valid for SetFeature request.

enum usb_device_hs_test_mode

Values Descriptions
USB_DEV_TEST_MODE_J
USB_DEV_TEST_MODE_K
USB_DEV_TEST_MODE_SE0_NAK
USB_DEV_TEST_MODE_PACKET
USB_DEV_TEST_MODE_FORCE_ENABLE

Test Mode possible on HS USB device.

valid for USB_DEV_FEATURE_TEST_MODE request.

enum usb_endpoint_feature

Values Descriptions
USB_EP_FEATURE_HALT

Standard USB endpoint feature/status flags.

enum usb_test_mode_selector

Values Descriptions
USB_TEST_J
USB_TEST_K
USB_TEST_SE0_NAK
USB_TEST_PACKET
USB_TEST_FORCE_ENABLE

Standard USB Test Mode Selectors.

enum usb_descriptor_type

Values Descriptions
USB_DT_DEVICE
USB_DT_CONFIGURATION
USB_DT_STRING
USB_DT_INTERFACE
USB_DT_ENDPOINT
USB_DT_DEVICE_QUALIFIER
USB_DT_OTHER_SPEED_CONFIGURATION
USB_DT_INTERFACE_POWER
USB_DT_OTG
USB_DT_IAD
USB_DT_BOS
USB_DT_DEVICE_CAPABILITY

Standard USB descriptor types.

enum usb_capability_type

Values Descriptions
USB_DC_USB20_EXTENSION

USB Device Capability types.

enum usb_capability_extension_attr

Values Descriptions
USB_DC_EXT_LPM

USB Device Capability - USB 2.0 Extension To fill bmAttributes field of usb_capa_ext_desc_t structure.

enum usb_ep_type

Values Descriptions
USB_EP_TYPE_CONTROL
USB_EP_TYPE_ISOCHRONOUS
USB_EP_TYPE_BULK
USB_EP_TYPE_INTERRUPT
USB_EP_TYPE_MASK

Standard USB endpoint transfer types.

enum usb_langid

Values Descriptions
USB_LANGID_EN_US English (United States)

Standard USB language IDs for string descriptors.

struct usb_setup_req_t

A USB Device SETUP request.

The data payload of SETUP packets always follows this structure.

Summary

Members Descriptions
public uint8_t bmRequestType
public uint8_t bRequest
public le16_t wValue
public le16_t wIndex
public le16_t wLength

Members

public uint8_t bmRequestType

public uint8_t bRequest

public le16_t wValue

public le16_t wIndex

public le16_t wLength

struct usb_dev_desc_t

Standard USB device descriptor structure.

Summary

Members Descriptions
public uint8_t bLength
public uint8_t bDescriptorType
public le16_t bcdUSB
public uint8_t bDeviceClass
public uint8_t bDeviceSubClass
public uint8_t bDeviceProtocol
public uint8_t bMaxPacketSize0
public le16_t idVendor
public le16_t idProduct
public le16_t bcdDevice
public uint8_t iManufacturer
public uint8_t iProduct
public uint8_t iSerialNumber
public uint8_t bNumConfigurations

Members

public uint8_t bLength

public uint8_t bDescriptorType

public le16_t bcdUSB

public uint8_t bDeviceClass

public uint8_t bDeviceSubClass

public uint8_t bDeviceProtocol

public uint8_t bMaxPacketSize0

public le16_t idVendor

public le16_t idProduct

public le16_t bcdDevice

public uint8_t iManufacturer

public uint8_t iProduct

public uint8_t iSerialNumber

public uint8_t bNumConfigurations

struct usb_dev_qual_desc_t

Standard USB device qualifier descriptor structure.

This descriptor contains information about the device when running at the "other" speed (i.e. if the device is currently operating at high speed, this descriptor can be used to determine what would change if the device was operating at full speed.)

Summary

Members Descriptions
public uint8_t bLength
public uint8_t bDescriptorType
public le16_t bcdUSB
public uint8_t bDeviceClass
public uint8_t bDeviceSubClass
public uint8_t bDeviceProtocol
public uint8_t bMaxPacketSize0
public uint8_t bNumConfigurations
public uint8_t bReserved

Members

public uint8_t bLength

public uint8_t bDescriptorType

public le16_t bcdUSB

public uint8_t bDeviceClass

public uint8_t bDeviceSubClass

public uint8_t bDeviceProtocol

public uint8_t bMaxPacketSize0

public uint8_t bNumConfigurations

public uint8_t bReserved

struct usb_dev_bos_desc_t

USB Device BOS descriptor structure.

The BOS descriptor (Binary device Object Store) defines a root descriptor that is similar to the configuration descriptor, and is the base descriptor for accessing a family of related descriptors. A host can read a BOS descriptor and learn from the wTotalLength field the entire size of the device-level descriptor set, or it can read in the entire BOS descriptor set of device capabilities. The host accesses this descriptor using the GetDescriptor() request. The descriptor type in the GetDescriptor() request is set to BOS.

Summary

Members Descriptions
public uint8_t bLength
public uint8_t bDescriptorType
public le16_t wTotalLength
public uint8_t bNumDeviceCaps

Members

public uint8_t bLength

public uint8_t bDescriptorType

public le16_t wTotalLength

public uint8_t bNumDeviceCaps

struct usb_dev_capa_ext_desc_t

USB Device Capabilities - USB 2.0 Extension Descriptor structure.

Defines the set of USB 1.1-specific device level capabilities.

Summary

Members Descriptions
public uint8_t bLength
public uint8_t bDescriptorType
public uint8_t bDevCapabilityType
public le32_t bmAttributes

Members

public uint8_t bLength

public uint8_t bDescriptorType

public uint8_t bDevCapabilityType

public le32_t bmAttributes

struct usb_dev_lpm_desc_t

USB Device LPM Descriptor structure.

The BOS descriptor and capabilities descriptors for LPM.

Summary

Members Descriptions
public usb_dev_bos_desc_t bos
public usb_dev_capa_ext_desc_t capa_ext

Members

public usb_dev_bos_desc_t bos

public usb_dev_capa_ext_desc_t capa_ext

struct usb_association_desc_t

Standard USB Interface Association Descriptor structure.

Summary

Members Descriptions
public uint8_t bLength size of this descriptor in bytes
public uint8_t bDescriptorType INTERFACE descriptor type.
public uint8_t bFirstInterface Number of interface.
public uint8_t bInterfaceCount value to select alternate setting
public uint8_t bFunctionClass Class code assigned by the USB.
public uint8_t bFunctionSubClass Sub-class code assigned by the USB.
public uint8_t bFunctionProtocol Protocol code assigned by the USB.
public uint8_t iFunction Index of string descriptor.

Members

public uint8_t bLength

size of this descriptor in bytes

public uint8_t bDescriptorType

INTERFACE descriptor type.

public uint8_t bFirstInterface

Number of interface.

public uint8_t bInterfaceCount

value to select alternate setting

public uint8_t bFunctionClass

Class code assigned by the USB.

public uint8_t bFunctionSubClass

Sub-class code assigned by the USB.

public uint8_t bFunctionProtocol

Protocol code assigned by the USB.

public uint8_t iFunction

Index of string descriptor.

struct usb_conf_desc_t

Standard USB configuration descriptor structure.

Summary

Members Descriptions
public uint8_t bLength
public uint8_t bDescriptorType
public le16_t wTotalLength
public uint8_t bNumInterfaces
public uint8_t bConfigurationValue
public uint8_t iConfiguration
public uint8_t bmAttributes
public uint8_t bMaxPower

Members

public uint8_t bLength

public uint8_t bDescriptorType

public le16_t wTotalLength

public uint8_t bNumInterfaces

public uint8_t bConfigurationValue

public uint8_t iConfiguration

public uint8_t bmAttributes

public uint8_t bMaxPower

struct usb_iad_desc_t

Standard USB association descriptor structure.

Summary

Members Descriptions
public uint8_t bLength Size of this descriptor in bytes.
public uint8_t bDescriptorType Interface descriptor type.
public uint8_t bFirstInterface Number of interface.
public uint8_t bInterfaceCount value to select alternate setting
public uint8_t bFunctionClass Class code assigned by the USB.
public uint8_t bFunctionSubClass Sub-class code assigned by the USB.
public uint8_t bFunctionProtocol Protocol code assigned by the USB.
public uint8_t iFunction Index of string descriptor.

Members

public uint8_t bLength

Size of this descriptor in bytes.

public uint8_t bDescriptorType

Interface descriptor type.

public uint8_t bFirstInterface

Number of interface.

public uint8_t bInterfaceCount

value to select alternate setting

public uint8_t bFunctionClass

Class code assigned by the USB.

public uint8_t bFunctionSubClass

Sub-class code assigned by the USB.

public uint8_t bFunctionProtocol

Protocol code assigned by the USB.

public uint8_t iFunction

Index of string descriptor.

struct usb_iface_desc_t

Standard USB interface descriptor structure.

Summary

Members Descriptions
public uint8_t bLength
public uint8_t bDescriptorType
public uint8_t bInterfaceNumber
public uint8_t bAlternateSetting
public uint8_t bNumEndpoints
public uint8_t bInterfaceClass
public uint8_t bInterfaceSubClass
public uint8_t bInterfaceProtocol
public uint8_t iInterface

Members

public uint8_t bLength

public uint8_t bDescriptorType

public uint8_t bInterfaceNumber

public uint8_t bAlternateSetting

public uint8_t bNumEndpoints

public uint8_t bInterfaceClass

public uint8_t bInterfaceSubClass

public uint8_t bInterfaceProtocol

public uint8_t iInterface

struct usb_ep_desc_t

Standard USB endpoint descriptor structure.

Summary

Members Descriptions
public uint8_t bLength
public uint8_t bDescriptorType
public uint8_t bEndpointAddress
public uint8_t bmAttributes
public le16_t wMaxPacketSize
public uint8_t bInterval

Members

public uint8_t bLength

public uint8_t bDescriptorType

public uint8_t bEndpointAddress

public uint8_t bmAttributes

public le16_t wMaxPacketSize

public uint8_t bInterval

struct usb_str_desc_t

A standard USB string descriptor structure.

Summary

Members Descriptions
public uint8_t bLength
public uint8_t bDescriptorType

Members

public uint8_t bLength

public uint8_t bDescriptorType

struct usb_str_lgid_desc_t

Summary

Members Descriptions
public usb_str_desc_t desc
public le16_t string

Members

public usb_str_desc_t desc

public le16_t string