| 
    Zephyr Project API
    3.3.0
    
   A Scalable Open Source RTOS 
   | 
 
USB Chapter 9 structures and definitions. More...
Go to the source code of this file.
Data Structures | |
| struct | usb_req_type_field | 
| struct | usb_setup_packet | 
| struct | usb_desc_header | 
| struct | usb_device_descriptor | 
| struct | usb_cfg_descriptor | 
| struct | usb_if_descriptor | 
| struct | usb_ep_desc_bmattr | 
| struct | usb_ep_descriptor | 
| struct | usb_string_descriptor | 
| struct | usb_association_descriptor | 
Functions | |
| static bool | usb_reqtype_is_to_host (const struct usb_setup_packet *setup) | 
| Check if request transfer direction is to host.  More... | |
| static bool | usb_reqtype_is_to_device (const struct usb_setup_packet *setup) | 
| Check if request transfer direction is to device.  More... | |
USB Chapter 9 structures and definitions.
This file contains the USB Chapter 9 structures definitions and follows, with few exceptions, the USB Specification 2.0.
| #define USB_BCC_APPLICATION 0xFE | 
| #define USB_BCC_AUDIO 0x01 | 
USB Defined Base Class Codes from https://www.usb.org/defined-class-codes
| #define USB_BCC_CDC_CONTROL 0x02 | 
| #define USB_BCC_CDC_DATA 0x0A | 
| #define USB_BCC_HID 0x03 | 
| #define USB_BCC_MASS_STORAGE 0x08 | 
| #define USB_BCC_MISCELLANEOUS 0xEF | 
| #define USB_BCC_VENDOR 0xFF | 
| #define USB_BCC_VIDEO 0x0E | 
| #define USB_BCC_WIRELESS_CONTROLLER 0xE0 | 
| #define USB_BCD_DRN | 
USB Device release number (bcdDevice Descriptor field)
| #define USB_CONTROL_EP_IN (USB_EP_DIR_IN | 0U) | 
USB Control Endpoints IN address
| #define USB_CONTROL_EP_MPS 64U | 
USB Control Endpoints maximum packet size (MPS)
| #define USB_CONTROL_EP_OUT (USB_EP_DIR_OUT | 0U) | 
USB Control Endpoints OUT address
| #define USB_DEC_TO_BCD | ( | dec | ) | ((((dec) / 10) << 4) | ((dec) % 10)) | 
| #define USB_DESC_BOS 15 | 
| #define USB_DESC_CONFIGURATION 2 | 
| #define USB_DESC_CS_CONFIGURATION 0x22 | 
| #define USB_DESC_CS_DEVICE 0x21 | 
Class-Specific Descriptor Types as defined by USB Common Class Specification
| #define USB_DESC_CS_ENDPOINT 0x25 | 
| #define USB_DESC_CS_INTERFACE 0x24 | 
| #define USB_DESC_CS_STRING 0x23 | 
| #define USB_DESC_DEBUG 10 | 
| #define USB_DESC_DEVICE 1 | 
Descriptor Types defined in spec. Table 9-5
| #define USB_DESC_DEVICE_CAPABILITY 16 | 
| #define USB_DESC_DEVICE_QUALIFIER 6 | 
| #define USB_DESC_ENDPOINT 5 | 
| #define USB_DESC_INTERFACE 4 | 
| #define USB_DESC_INTERFACE_ASSOC 11 | 
| #define USB_DESC_INTERFACE_POWER 8 | 
| #define USB_DESC_OTG 9 | 
Additional Descriptor Types defined in USB 3 spec. Table 9-5
| #define USB_DESC_OTHER_SPEED 7 | 
| #define USB_DESC_STRING 3 | 
| #define USB_EP_DIR_IS_IN | ( | ep | ) | (USB_EP_GET_DIR(ep) == USB_EP_DIR_IN) | 
True if the endpoint is an IN endpoint
| #define USB_EP_DIR_IS_OUT | ( | ep | ) | (USB_EP_GET_DIR(ep) == USB_EP_DIR_OUT) | 
True if the endpoint is an OUT endpoint
| #define USB_EP_DIR_OUT 0U | 
USB OUT endpoint direction
| #define USB_EP_GET_ADDR | ( | idx, | |
| dir | |||
| ) | ((idx) | ((dir) & USB_EP_DIR_MASK)) | 
Get endpoint address from endpoint index and direction
| #define USB_EP_GET_DIR | ( | ep | ) | ((ep) & USB_EP_DIR_MASK) | 
Get direction based on endpoint address
| #define USB_EP_GET_IDX | ( | ep | ) | ((ep) & ~USB_EP_DIR_MASK) | 
Get endpoint index (number) from endpoint address
| #define USB_EP_TRANSFER_TYPE_MASK 0x3U | 
USB endpoint transfer type mask
| #define USB_EP_TYPE_BULK 2U | 
USB endpoint transfer type bulk
| #define USB_EP_TYPE_CONTROL 0U | 
USB endpoint transfer type control
| #define USB_EP_TYPE_INTERRUPT 3U | 
USB endpoint transfer type interrupt
| #define USB_EP_TYPE_ISO 1U | 
USB endpoint transfer type isochronous
| #define USB_GET_DESCRIPTOR_INDEX | ( | wValue | ) | ((uint8_t)(wValue)) | 
Macro to obtain descriptor index from USB_SREQ_GET_DESCRIPTOR request
| #define USB_GET_DESCRIPTOR_TYPE | ( | wValue | ) | ((uint8_t)((wValue) >> 8)) | 
Macro to obtain descriptor type from USB_SREQ_GET_DESCRIPTOR request
| #define USB_GET_STATUS_REMOTE_WAKEUP BIT(1) | 
| #define USB_GET_STATUS_SELF_POWERED BIT(0) | 
Bits used for GetStatus response defined in spec. Figure 9-4
| #define USB_REQTYPE_DIR_TO_DEVICE 0 | 
USB Setup packet RequestType Direction values (from Table 9-2)
| #define USB_REQTYPE_DIR_TO_HOST 1 | 
| #define USB_REQTYPE_GET_DIR | ( | bmRequestType | ) | (((bmRequestType) >> 7) & 0x01U) | 
Get data transfer direction from bmRequestType
| #define USB_REQTYPE_GET_RECIPIENT | ( | bmRequestType | ) | ((bmRequestType) & 0x1FU) | 
Get request recipient from bmRequestType
| #define USB_REQTYPE_GET_TYPE | ( | bmRequestType | ) | (((bmRequestType) >> 5) & 0x03U) | 
Get request type from bmRequestType
| #define USB_REQTYPE_RECIPIENT_DEVICE 0 | 
USB Setup packet RequestType Recipient values (from Table 9-2)
| #define USB_REQTYPE_RECIPIENT_ENDPOINT 2 | 
| #define USB_REQTYPE_RECIPIENT_INTERFACE 1 | 
| #define USB_REQTYPE_RECIPIENT_OTHER 3 | 
| #define USB_REQTYPE_TYPE_CLASS 1 | 
| #define USB_REQTYPE_TYPE_RESERVED 3 | 
| #define USB_REQTYPE_TYPE_STANDARD 0 | 
USB Setup packet RequestType Type values (from Table 9-2)
| #define USB_REQTYPE_TYPE_VENDOR 2 | 
| #define USB_SCD_REMOTE_WAKEUP BIT(5) | 
| #define USB_SCD_RESERVED BIT(7) | 
USB Standard Configuration Descriptor Characteristics from Table 9-10
| #define USB_SCD_SELF_POWERED BIT(6) | 
| #define USB_SFS_ENDPOINT_HALT 0x00 | 
USB Standard Feature Selectors defined in spec. Table 9-6
| #define USB_SFS_REMOTE_WAKEUP 0x01 | 
| #define USB_SFS_TEST_MODE 0x02 | 
| #define USB_SREQ_CLEAR_FEATURE 0x01 | 
| #define USB_SREQ_GET_CONFIGURATION 0x08 | 
| #define USB_SREQ_GET_DESCRIPTOR 0x06 | 
| #define USB_SREQ_GET_INTERFACE 0x0A | 
| #define USB_SREQ_GET_STATUS 0x00 | 
USB Standard Request Codes defined in spec. Table 9-4
| #define USB_SREQ_SET_ADDRESS 0x05 | 
| #define USB_SREQ_SET_CONFIGURATION 0x09 | 
| #define USB_SREQ_SET_DESCRIPTOR 0x07 | 
| #define USB_SREQ_SET_FEATURE 0x03 | 
| #define USB_SREQ_SET_INTERFACE 0x0B | 
| #define USB_SREQ_SYNCH_FRAME 0x0C | 
| #define USB_SRN_1_1 0x0110 | 
USB Specification Release Numbers (bcdUSB Descriptor field)
| #define USB_SRN_2_0 0x0200 | 
| #define USB_SRN_2_1 0x0210 | 
      
  | 
  inlinestatic | 
Check if request transfer direction is to device.
| setup | Pointer to USB Setup packet | 
      
  | 
  inlinestatic | 
Check if request transfer direction is to host.
| setup | Pointer to USB Setup packet |