nRF5 SDK v13.0.0
Data Structures | Macros | Enumerations
USB standard descriptors

nRF52840 only: Module with types definitions used for standard descriptors. More...

Data Structures

struct  app_usbd_descriptor_header_t
 Common descriptor header. More...
 
struct  app_usbd_descriptor_device_t
 Device descriptor. More...
 
struct  app_usbd_descriptor_configuration_t
 Configuration descriptor. More...
 
struct  app_usbd_descriptor_string0_t
 Raw descriptor - String descriptor zero. More...
 
struct  app_usbd_descriptor_string_t
 Raw descriptor - Any normal string. More...
 
struct  app_usbd_descriptor_iface_t
 Interface descriptor. More...
 
struct  app_usbd_descriptor_ep_t
 Endpoint descriptor. More...
 
struct  app_usbd_descriptor_iad_t
 Interface association descriptor. More...
 

Macros

#define APP_USBD_U16_TO_RAW_DSC(val)
 Helper macro for translating unsigned 24 bit value to 2 byte raw descriptor. More...
 
#define APP_USBD_U24_TO_RAW_DSC(val)
 Helper macro for translating unsigned 24 bit value to 3 byte raw descriptor. More...
 
#define APP_USBD_U32_TO_RAW_DSC(val)
 Helper macro for translating unsigned 32 bit value to 4 byte raw descriptor. More...
 
#define APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_OFFSET   0
 
#define APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_MASK   BF_MASK(2, APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_OFFSET)
 
#define APP_USBD_DESCRIPTOR_EP_ATTR_SYNC_OFFSET   2
 
#define APP_USBD_DESCRIPTOR_EP_ATTR_SYNC_MASK   BF_MASK(2, APP_USBD_DESCRIPTOR_EP_ATTR_SYNC_OFFSET)
 
#define APP_USBD_DESCRIPTOR_EP_ATTR_USAGE_OFFSET   4
 
#define APP_USBD_DESCRIPTOR_EP_ATTR_USAGE_MASK   BF_MASK(2, APP_USBD_DESCRIPTOR_EP_ATTR_USAGE_OFFSET)
 

Enumerations

enum  app_usbd_descriptor_t {
  APP_USBD_DESCRIPTOR_DEVICE = 1,
  APP_USBD_DESCRIPTOR_CONFIGURATION = 2,
  APP_USBD_DESCRIPTOR_STRING = 3,
  APP_USBD_DESCRIPTOR_INTERFACE = 4,
  APP_USBD_DESCRIPTOR_ENDPOINT = 5,
  APP_USBD_DESCRIPTOR_DEVICE_QUALIFIER = 6,
  APP_USBD_DESCRIPTOR_OTHER_SPEED_CONFIGURATION = 7,
  APP_USBD_DESCRIPTOR_INTERFACE_POWER = 8,
  APP_USBD_DESCRIPTOR_OTG = 9,
  APP_USBD_DESCRIPTOR_DEBUG = 10,
  APP_USBD_DESCRIPTOR_INTERFACE_ASSOCIATION = 11
}
 Descriptor types. More...
 
enum  app_usbd_descriptor_configuration_attributes_t {
  APP_USBD_DESCRIPTOR_CONFIGURATION_ATTRIBUTE_ALWAYS_SET_MASK = 1U << 7,
  APP_USBD_DESCRIPTOR_CONFIGURATION_ATTRIBUTE_SELF_POWERED_MASK = 1U << 6,
  APP_USBD_DESCRIPTOR_CONFIGURATION_ATTRIBUTE_REMOTE_WAKEUP_MASK = 1U << 5
}
 Attributes masks. More...
 
enum  app_usbd_descriptor_ep_attr_bitmap_t {
  APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_CONTROL = 0 << 0,
  APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_ISOCHRONOUS = 1 << 0,
  APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_BULK = 2 << 0,
  APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_INTERRUPT = 3 << 0,
  APP_USBD_DESCRIPTOR_EP_ATTR_SYNC_NONE = 0 << 2,
  APP_USBD_DESCRIPTOR_EP_ATTR_SYNC_ASYNCHRONOUS = 1 << 2,
  APP_USBD_DESCRIPTOR_EP_ATTR_SYNC_ADAPTIVE = 2 << 2,
  APP_USBD_DESCRIPTOR_EP_ATTR_SYNC_SYNCHRONOUS = 3 << 2,
  APP_USBD_DESCRIPTOR_EP_ATTR_USAGE_DATA = 0 << 4,
  APP_USBD_DESCRIPTOR_EP_ATTR_USAGE_FEEDBACK = 1 << 4,
  APP_USBD_DESCRIPTOR_EP_ATTR_USAGE_IMPLICIT = 2 << 4
}
 Endpoint attributes mnemonics. More...
 

Detailed Description

nRF52840 only: Module with types definitions used for standard descriptors.

Macro Definition Documentation

#define APP_USBD_DESCRIPTOR_EP_ATTR_SYNC_MASK   BF_MASK(2, APP_USBD_DESCRIPTOR_EP_ATTR_SYNC_OFFSET)

Mask of endpoint synchronization type attribute bits

#define APP_USBD_DESCRIPTOR_EP_ATTR_SYNC_OFFSET   2

Offset of endpoint synchronization type attribute bits

#define APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_MASK   BF_MASK(2, APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_OFFSET)

Mask of endpoint type attribute bits

#define APP_USBD_DESCRIPTOR_EP_ATTR_TYPE_OFFSET   0

Offset of endpoint type attribute bits

#define APP_USBD_DESCRIPTOR_EP_ATTR_USAGE_MASK   BF_MASK(2, APP_USBD_DESCRIPTOR_EP_ATTR_USAGE_OFFSET)

Mask of endpoint usage type attribute bits

#define APP_USBD_DESCRIPTOR_EP_ATTR_USAGE_OFFSET   4

Offset of endpoint usage type attribute bits

#define APP_USBD_U16_TO_RAW_DSC (   val)
Value:
(uint8_t)(val), \
(uint8_t)(((val) / (256)))

Helper macro for translating unsigned 24 bit value to 2 byte raw descriptor.

#define APP_USBD_U24_TO_RAW_DSC (   val)
Value:
(uint8_t)(val), \
(uint8_t)(((val) / (256))), \
(uint8_t)(((val) / (256 * 256)))

Helper macro for translating unsigned 24 bit value to 3 byte raw descriptor.

#define APP_USBD_U32_TO_RAW_DSC (   val)
Value:
(uint8_t)(val), \
(uint8_t)(((val) / (256))), \
(uint8_t)(((val) / (256 * 256))) \
(uint8_t)(((val) / (256 * 256 * 256)))

Helper macro for translating unsigned 32 bit value to 4 byte raw descriptor.

Enumeration Type Documentation

Attributes masks.

Masks used for attributes in configuration.

Enumerator
APP_USBD_DESCRIPTOR_CONFIGURATION_ATTRIBUTE_ALWAYS_SET_MASK 

This is reserved descriptor that has always to be set

APP_USBD_DESCRIPTOR_CONFIGURATION_ATTRIBUTE_SELF_POWERED_MASK 

Attribute that informs that device is self powered

APP_USBD_DESCRIPTOR_CONFIGURATION_ATTRIBUTE_REMOTE_WAKEUP_MASK 

Attribute that informs that device has Remove Wakeup functionality

Descriptor types.

Descriptor types used in two situations:

  • when processing APP_USBD_SETUP_STDREQ_GET_DESCRIPTOR SETUP request, the required descriptor type may be placed in wValue in HighByte.
  • As a descriptor identifier itself inside descriptor stream.

According to chapter 9.6 of USB 2.0 specification, following descriptors may be requested directly by GetDescriptor method:

Enumerator
APP_USBD_DESCRIPTOR_DEVICE 

Device descriptor.

APP_USBD_DESCRIPTOR_CONFIGURATION 

Specific configuration descriptor. Configuration descriptor is always followed by all the related interface and endpoints descriptors.

APP_USBD_DESCRIPTOR_STRING 

String descriptor.

APP_USBD_DESCRIPTOR_INTERFACE 

Interface descriptor followed by all the related endpoints descriptors.

Note
It is returned together with APP_USBD_DESCRIPTOR_CONFIGURATION. Cannot be accessed by GetDescriptor or SetDescriptor
APP_USBD_DESCRIPTOR_ENDPOINT 

Endpoint descriptor.

Note
It is returned together with APP_USBD_DESCRIPTOR_CONFIGURATION. Cannot be accessed by GetDescriptor or SetDescriptor
APP_USBD_DESCRIPTOR_DEVICE_QUALIFIER 
Note
Not supported - used only in HighSpeed capable devices.
APP_USBD_DESCRIPTOR_OTHER_SPEED_CONFIGURATION 
Note
Not supported - our USB implementation supports only one speed.
APP_USBD_DESCRIPTOR_INTERFACE_POWER 
Note
Not supported
APP_USBD_DESCRIPTOR_OTG 
Note
Not supported - Our USB have not OTG functionality
APP_USBD_DESCRIPTOR_DEBUG 

Debug channel descriptor if available, can be only reached by GetDescriptor

APP_USBD_DESCRIPTOR_INTERFACE_ASSOCIATION 

Descriptor used to describe that two or more interfaces are associated to the same function.

Note
It is returned together with APP_USBD_DESCRIPTOR_CONFIGURATION. Cannot be accessed by GetDescriptor or SetDescriptor

Documentation feedback | Developer Zone | Subscribe | Updated