mikroSDK Reference Manual
USB Types

Data Structures

struct  TU_ATTR_PACKED
 AUDIO Channel Cluster Descriptor (4.1) More...
 

Macros

#define TUSB_DESC_CONFIG_POWER_MA(x)   ((x)/2)
 

Typedefs

typedef TU_ATTR_PACKED_BEGIN TU_ATTR_BIT_FIELD_ORDER_BEGIN struct TU_ATTR_PACKED tusb_desc_device_t
 USB Device Descriptor.
 
typedef struct TU_ATTR_PACKED tusb_desc_bos_t
 
typedef struct TU_ATTR_PACKED tusb_desc_configuration_t
 USB Configuration Descriptor.
 
typedef struct TU_ATTR_PACKED tusb_desc_interface_t
 USB Interface Descriptor.
 
typedef struct TU_ATTR_PACKED tusb_desc_endpoint_t
 USB Endpoint Descriptor.
 
typedef struct TU_ATTR_PACKED tusb_desc_other_speed_t
 USB Other Speed Configuration Descriptor.
 
typedef struct TU_ATTR_PACKED tusb_desc_device_qualifier_t
 USB Device Qualifier Descriptor.
 
typedef struct TU_ATTR_PACKED tusb_desc_interface_assoc_t
 USB Interface Association Descriptor (IAD ECN)
 
typedef struct TU_ATTR_PACKED tusb_desc_string_t
 
typedef struct TU_ATTR_PACKED tusb_desc_bos_platform_t
 
typedef struct TU_ATTR_PACKED tusb_desc_webusb_url_t
 
typedef struct TU_ATTR_PACKED tusb_desc_dfu_functional_t
 
typedef struct TU_ATTR_PACKED tusb_control_request_t
 

Enumerations

enum  tusb_speed_t { TUSB_SPEED_FULL = 0 , TUSB_SPEED_LOW = 1 , TUSB_SPEED_HIGH = 2 , TUSB_SPEED_INVALID = 0xff }
 defined base on EHCI specs value for Endpoint Speed
 
enum  tusb_xfer_type_t { TUSB_XFER_CONTROL = 0 , TUSB_XFER_ISOCHRONOUS , TUSB_XFER_BULK , TUSB_XFER_INTERRUPT }
 defined base on USB Specs Endpoint's bmAttributes
 
enum  tusb_dir_t { TUSB_DIR_OUT = 0 , TUSB_DIR_IN = 1 , TUSB_DIR_IN_MASK = 0x80 }
 
enum  { TUSB_EPSIZE_BULK_FS = 64 , TUSB_EPSIZE_BULK_HS = 512 , TUSB_EPSIZE_ISO_FS_MAX = 1023 , TUSB_EPSIZE_ISO_HS_MAX = 1024 }
 
enum  tusb_iso_ep_attribute_t {
  TUSB_ISO_EP_ATT_NO_SYNC = 0x00 , TUSB_ISO_EP_ATT_ASYNCHRONOUS = 0x04 , TUSB_ISO_EP_ATT_ADAPTIVE = 0x08 , TUSB_ISO_EP_ATT_SYNCHRONOUS = 0x0C ,
  TUSB_ISO_EP_ATT_DATA = 0x00 , TUSB_ISO_EP_ATT_EXPLICIT_FB = 0x10 , TUSB_ISO_EP_ATT_IMPLICIT_FB = 0x20
}
 Isochronous End Point Attributes. More...
 
enum  tusb_desc_type_t {
  TUSB_DESC_DEVICE = 0x01 , TUSB_DESC_CONFIGURATION = 0x02 , TUSB_DESC_STRING = 0x03 , TUSB_DESC_INTERFACE = 0x04 ,
  TUSB_DESC_ENDPOINT = 0x05 , TUSB_DESC_DEVICE_QUALIFIER = 0x06 , TUSB_DESC_OTHER_SPEED_CONFIG = 0x07 , TUSB_DESC_INTERFACE_POWER = 0x08 ,
  TUSB_DESC_OTG = 0x09 , TUSB_DESC_DEBUG = 0x0A , TUSB_DESC_INTERFACE_ASSOCIATION = 0x0B , TUSB_DESC_BOS = 0x0F ,
  TUSB_DESC_DEVICE_CAPABILITY = 0x10 , TUSB_DESC_FUNCTIONAL = 0x21 , TUSB_DESC_CS_DEVICE = 0x21 , TUSB_DESC_CS_CONFIGURATION = 0x22 ,
  TUSB_DESC_CS_STRING = 0x23 , TUSB_DESC_CS_INTERFACE = 0x24 , TUSB_DESC_CS_ENDPOINT = 0x25 , TUSB_DESC_SUPERSPEED_ENDPOINT_COMPANION = 0x30 ,
  TUSB_DESC_SUPERSPEED_ISO_ENDPOINT_COMPANION = 0x31
}
 USB Descriptor Types.
 
enum  tusb_request_code_t {
  TUSB_REQ_GET_STATUS = 0 , TUSB_REQ_CLEAR_FEATURE = 1 , TUSB_REQ_RESERVED = 2 , TUSB_REQ_SET_FEATURE = 3 ,
  TUSB_REQ_RESERVED2 = 4 , TUSB_REQ_SET_ADDRESS = 5 , TUSB_REQ_GET_DESCRIPTOR = 6 , TUSB_REQ_SET_DESCRIPTOR = 7 ,
  TUSB_REQ_GET_CONFIGURATION = 8 , TUSB_REQ_SET_CONFIGURATION = 9 , TUSB_REQ_GET_INTERFACE = 10 , TUSB_REQ_SET_INTERFACE = 11 ,
  TUSB_REQ_SYNCH_FRAME = 12
}
 
enum  tusb_request_feature_selector_t { TUSB_REQ_FEATURE_EDPT_HALT = 0 , TUSB_REQ_FEATURE_REMOTE_WAKEUP = 1 , TUSB_REQ_FEATURE_TEST_MODE = 2 }
 
enum  tusb_request_type_t { TUSB_REQ_TYPE_STANDARD = 0 , TUSB_REQ_TYPE_CLASS , TUSB_REQ_TYPE_VENDOR , TUSB_REQ_TYPE_INVALID }
 
enum  tusb_request_recipient_t { TUSB_REQ_RCPT_DEVICE =0 , TUSB_REQ_RCPT_INTERFACE , TUSB_REQ_RCPT_ENDPOINT , TUSB_REQ_RCPT_OTHER }
 
enum  tusb_class_code_t {
  TUSB_CLASS_UNSPECIFIED = 0 , TUSB_CLASS_AUDIO = 1 , TUSB_CLASS_CDC = 2 , TUSB_CLASS_HID = 3 ,
  TUSB_CLASS_RESERVED_4 = 4 , TUSB_CLASS_PHYSICAL = 5 , TUSB_CLASS_IMAGE = 6 , TUSB_CLASS_PRINTER = 7 ,
  TUSB_CLASS_MSC = 8 , TUSB_CLASS_HUB = 9 , TUSB_CLASS_CDC_DATA = 10 , TUSB_CLASS_SMART_CARD = 11 ,
  TUSB_CLASS_RESERVED_12 = 12 , TUSB_CLASS_CONTENT_SECURITY = 13 , TUSB_CLASS_VIDEO = 14 , TUSB_CLASS_PERSONAL_HEALTHCARE = 15 ,
  TUSB_CLASS_AUDIO_VIDEO = 16 , TUSB_CLASS_DIAGNOSTIC = 0xDC , TUSB_CLASS_WIRELESS_CONTROLLER = 0xE0 , TUSB_CLASS_MISC = 0xEF ,
  TUSB_CLASS_APPLICATION_SPECIFIC = 0xFE , TUSB_CLASS_VENDOR_SPECIFIC = 0xFF
}
 
enum  misc_subclass_type_t { MISC_SUBCLASS_COMMON = 2 }
 
enum  misc_protocol_type_t { MISC_PROTOCOL_IAD = 1 }
 
enum  app_subclass_type_t { APP_SUBCLASS_USBTMC = 0x03 , APP_SUBCLASS_DFU_RUNTIME = 0x01 }
 
enum  device_capability_type_t {
  DEVICE_CAPABILITY_WIRELESS_USB = 0x01 , DEVICE_CAPABILITY_USB20_EXTENSION = 0x02 , DEVICE_CAPABILITY_SUPERSPEED_USB = 0x03 , DEVICE_CAPABILITY_CONTAINER_id = 0x04 ,
  DEVICE_CAPABILITY_PLATFORM = 0x05 , DEVICE_CAPABILITY_POWER_DELIVERY = 0x06 , DEVICE_CAPABILITY_BATTERY_INFO = 0x07 , DEVICE_CAPABILITY_PD_CONSUMER_PORT = 0x08 ,
  DEVICE_CAPABILITY_PD_PROVIDER_PORT = 0x09 , DEVICE_CAPABILITY_SUPERSPEED_PLUS = 0x0A , DEVICE_CAPABILITY_PRECESION_TIME_MEASUREMENT = 0x0B , DEVICE_CAPABILITY_WIRELESS_USB_EXT = 0x0C ,
  DEVICE_CAPABILITY_BILLBOARD = 0x0D , DEVICE_CAPABILITY_AUTHENTICATION = 0x0E , DEVICE_CAPABILITY_BILLBOARD_EX = 0x0F , DEVICE_CAPABILITY_CONFIGURATION_SUMMARY = 0x10
}
 
enum  { TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP = TU_BIT(5) , TUSB_DESC_CONFIG_ATT_SELF_POWERED = TU_BIT(6) }
 
enum  xfer_result_t {
  XFER_RESULT_SUCCESS = 0 , XFER_RESULT_FAILED , XFER_RESULT_STALLED , XFER_RESULT_TIMEOUT ,
  XFER_RESULT_INVALID
}
 
enum  { DESC_OFFSET_LEN = 0 , DESC_OFFSET_TYPE = 1 }
 
enum  { INTERFACE_INVALID_NUMBER = 0xff }
 
enum  microsoft_os_20_type_t {
  MS_OS_20_SET_HEADER_DESCRIPTOR = 0x00 , MS_OS_20_SUBSET_HEADER_CONFIGURATION = 0x01 , MS_OS_20_SUBSET_HEADER_FUNCTION = 0x02 , MS_OS_20_FEATURE_COMPATBLE_ID = 0x03 ,
  MS_OS_20_FEATURE_REG_PROPERTY = 0x04 , MS_OS_20_FEATURE_MIN_RESUME_TIME = 0x05 , MS_OS_20_FEATURE_MODEL_ID = 0x06 , MS_OS_20_FEATURE_CCGP_DEVICE = 0x07 ,
  MS_OS_20_FEATURE_VENDOR_REVISION = 0x08
}
 
enum  { CONTROL_STAGE_IDLE , CONTROL_STAGE_SETUP , CONTROL_STAGE_DATA , CONTROL_STAGE_ACK }
 
enum  { TUSB_INDEX_INVALID_8 = 0xFFu }
 

Functions list

 TU_VERIFY_STATIC (sizeof(tusb_desc_device_t)==18, "size is not correct")
 
 TU_VERIFY_STATIC (sizeof(tusb_desc_bos_t)==5, "size is not correct")
 
uint8_t const * tu_desc_find (uint8_t const *desc, uint8_t const *end, uint8_t byte1)
 
uint8_t const * tu_desc_find2 (uint8_t const *desc, uint8_t const *end, uint8_t byte1, uint8_t byte2)
 
uint8_t const * tu_desc_find3 (uint8_t const *desc, uint8_t const *end, uint8_t byte1, uint8_t byte2, uint8_t byte3)
 

Enumeration Type Documentation

◆ tusb_iso_ep_attribute_t

Enumerator
TUSB_ISO_EP_ATT_DATA 

Data End Point.

TUSB_ISO_EP_ATT_EXPLICIT_FB 

Feedback End Point.

TUSB_ISO_EP_ATT_IMPLICIT_FB 

Data endpoint that also serves as an implicit feedback.