SAMV71 Xplained Ultra Software Package 1.5

USBDescriptors.h File Reference

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  _USBGenericDescriptor
struct  _USBDeviceDescriptor
struct  _USBOtgDescriptor
struct  _USBDeviceQualifierDescriptor
struct  _USBConfigurationDescriptor
struct  _USBDeviceBOSDescriptor
struct  _USBDeviceCapabilities
struct  _USB_DeviceLPMDescriptor
 USB Device LPM Descriptor structure. More...
struct  _USBInterfaceAssociationDescriptor
struct  _USBInterfaceDescriptor
struct  _USBEndpointDescriptor
struct  __attribute__
 A standard USB string descriptor structure. More...
struct  __attribute__
 A standard USB string descriptor structure. More...

Defines

#define USBGenericDescriptor_DEVICE   1
#define USBGenericDescriptor_CONFIGURATION   2
#define USBGenericDescriptor_STRING   3
#define USBGenericDescriptor_INTERFACE   4
#define USBGenericDescriptor_ENDPOINT   5
#define USBGenericDescriptor_DEVICEQUALIFIER   6
#define USBGenericDescriptor_OTHERSPEEDCONFIGURATION   7
#define USBGenericDescriptor_INTERFACEPOWER   8
#define USBGenericDescriptor_OTG   9
#define USBGenericDescriptor_DEBUG   10
#define USBGenericDescriptor_INTERFACEASSOCIATION   11
#define USB_DT_BOS   0x0F
#define USBGenericDescriptor_DEVICE_CAPABILITY   0x10
#define USB_EP_TYPE_MASK   0x03
#define USB_EP_ADDR_MASK   0x0f
#define USB_EP_DIR_IN   0x80
 Endpoint transfer direction is IN.
#define USB_EP_DIR_OUT   0x00
 Endpoint transfer direction is OUT.
#define USB_REQ_DIR_OUT   (0<<7)
 USB request data transfer direction (bmRequestType).
#define USB_REQ_DIR_IN   (1<<7)
 Device to host.
#define USB_REQ_DIR_MASK   (1<<7)
 Mask.
#define USB_REQ_TYPE_STANDARD   (0<<5)
 USB request types (bmRequestType).
#define USB_REQ_TYPE_CLASS   (1<<5)
 Class-specific request.
#define USB_REQ_TYPE_VENDOR   (2<<5)
 Vendor-specific request.
#define USB_REQ_TYPE_MASK   (3<<5)
 Mask.
#define USB_REQ_RECIP_DEVICE   (0<<0)
 USB recipient codes (bmRequestType).
#define USB_REQ_RECIP_INTERFACE   (1<<0)
 Recipient interface.
#define USB_REQ_RECIP_ENDPOINT   (2<<0)
 Recipient endpoint.
#define USB_REQ_RECIP_OTHER   (3<<0)
 Recipient other.
#define USB_REQ_RECIP_MASK   (0x1F)
 Mask.
#define USB_DC_EXT_BESL_DEEP_OFFSET   8
#define USB_DC_EXT_BESL_DEEP(besl)   ((besl & 0xF) << USB_DC_EXT_BESL_DEEP_OFFSET)
#define USB_DC_EXT_BESL_BASELINE_OFFSET   12
#define USB_DC_EXT_BESL_BASELINE(besl)   ((besl & 0xF) << USB_DC_EXT_BESL_BASELINE_OFFSET)
#define BESL_125_US   0
#define BESL_150_US   1
#define BESL_200_US   2
#define BESL_300_US   3
#define BESL_400_US   4
#define BESL_500_US   5
#define BESL_1000_US   6
#define BESL_2000_US   7
#define BESL_3000_US   8
#define BESL_4000_US   9
#define BESL_5000_US   10
#define BESL_6000_US   11
#define BESL_7000_US   12
#define BESL_8000_US   13
#define BESL_9000_US   14
#define BESL_10000_US   15
#define USB_LPM_ATTRIBUT_BLINKSTATE_MASK   (0xF << 0)
#define USB_LPM_ATTRIBUT_BESL_MASK   (0xF << 4)
#define USB_LPM_ATTRIBUT_REMOTEWAKE_MASK   (1 << 8)
#define USB_LPM_ATTRIBUT_BLINKSTATE(value)   ((value & 0xF) << 0)
#define USB_LPM_ATTRIBUT_BESL(value)   ((value & 0xF) << 4)
#define USB_LPM_ATTRIBUT_REMOTEWAKE(value)   ((value & 1) << 8)
#define USB_LPM_ATTRIBUT_BLINKSTATE_L1   USB_LPM_ATTRIBUT_BLINKSTATE(1)
#define USBDeviceDescriptor_USB2_00   0x0200
#define USBDeviceDescriptor_USB2_01   0x0201
#define USBConfigurationDescriptor_BUSPOWERED_NORWAKEUP   0x80
#define USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP   0xC0
#define USBConfigurationDescriptor_BUSPOWERED_RWAKEUP   0xA0
#define USBConfigurationDescriptor_SELFPOWERED_RWAKEUP   0xE0
#define USBConfigurationDescriptor_REMOTE_WAKEUP   0x20
#define USBConfigurationDescriptor_POWER(power)   (power / 2)
#define USB_HOST_POWER_MAX   500
#define USBEndpointDescriptor_OUT   0
#define USBEndpointDescriptor_IN   1
#define USB_EP_DIR_IN   0x80
 Endpoint transfer direction is IN.
#define USB_EP_DIR_OUT   0x00
 Endpoint transfer direction is OUT.
#define USBEndpointDescriptor_CONTROL   0
#define USBEndpointDescriptor_ISOCHRONOUS   1
#define USBEndpointDescriptor_BULK   2
#define USBEndpointDescriptor_INTERRUPT   3
#define USBEndpointDescriptor_Asynchronous_ISOCHRONOUS   (1<<2)
#define USBEndpointDescriptor_Adaptive_ISOCHRONOUS   (2<<2)
#define USBEndpointDescriptor_Synchronous_ISOCHRONOUS   (3<<2)
#define USBEndpointDescriptor_Feedback_ISOCHRONOUS   (1<<2)
#define USBEndpointDescriptor_Explicit_Feedback_ISOCHRONOUS   (2<<2)
#define USBEndpointDescriptor_MAXCTRLSIZE_FS   64
#define USBEndpointDescriptor_MAXCTRLSIZE_HS   64
#define USBEndpointDescriptor_MAXBULKSIZE_FS   64
#define USBEndpointDescriptor_MAXBULKSIZE_HS   512
#define USBEndpointDescriptor_MAXINTERRUPTSIZE_FS   64
#define USBEndpointDescriptor_MAXINTERRUPTSIZE_HS   1024
#define USBEndpointDescriptor_MAXISOCHRONOUSSIZE_FS   1023
#define USBEndpointDescriptor_MAXISOCHRONOUSSIZE_HS   1024
#define USBEndpointDescriptor_ADDRESS(direction, number)   (((direction & 0x01) << 7) | (number & 0xF))
#define USBStringDescriptor_ENGLISH_US   0x09, 0x04
#define USBStringDescriptor_LENGTH(length)   ((length) * 2 + 2)
#define USBStringDescriptor_UNICODE(ascii)   (ascii), 0

Typedefs

typedef uint32_t(* USBDescriptorParseFunction )(void *descriptor, void *parseArg)

Enumerations

enum  usb_reqid {
  USB_REQ_GET_STATUS = 0, USB_REQ_CLEAR_FEATURE = 1, USB_REQ_SET_FEATURE = 3, USB_REQ_SET_ADDRESS = 5,
  USB_REQ_GET_DESCRIPTOR = 6, USB_REQ_SET_DESCRIPTOR = 7, USB_REQ_GET_CONFIGURATION = 8, USB_REQ_SET_CONFIGURATION = 9,
  USB_REQ_GET_INTERFACE = 10, USB_REQ_SET_INTERFACE = 11, USB_REQ_SYNCH_FRAME = 12
}
 

Standard USB requests (bRequest).


enum  usb_capability_type { USB_DC_USB20_EXTENSION = 0x02 }
 

USB Device Capability types.


enum  usb_capability_extension_attr { USB_DC_EXT_LPM = 0x00000002, USB_DC_EXT_BESL = 0x00000004, USB_DC_EXT_BESL_BASELINE_VALID = 0x00000008, USB_DC_EXT_BESL_DEEP_VALID = 0x00000010 }
 

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


enum  usb_interface_status { USB_IFACE_STATUS_RESERVED = 0 }
 

Standard USB Interface status flags.


enum  usb_endpoint_status { USB_EP_STATUS_HALTED = 1 }
 

Standard USB endpoint status flags.


enum  usb_endpoint_feature { USB_EP_FEATURE_HALT = 0 }
 

Standard USB endpoint feature/status flags.


enum  usb_device_feature {
  USB_DEV_FEATURE_REMOTE_WAKEUP = 1, USB_DEV_FEATURE_TEST_MODE = 2, USB_DEV_FEATURE_OTG_B_HNP_ENABLE = 3, USB_DEV_FEATURE_OTG_A_HNP_SUPPORT = 4,
  USB_DEV_FEATURE_OTG_A_ALT_HNP_SUPPORT = 5
}
 

Standard USB device feature flags.

More...

Functions

struct _USBGenericDescriptor __attribute__ ((__packed__)) USB_DeviceLPMDescriptor
 USB Device LPM Descriptor structure.
uint32_t USBGenericDescriptor_GetLength (const USBGenericDescriptor *descriptor)
uint8_t USBGenericDescriptor_GetType (const USBGenericDescriptor *descriptor)
USBGenericDescriptor * USBGenericDescriptor_GetNextDescriptor (const USBGenericDescriptor *descriptor)
USBGenericDescriptor * USBGenericDescriptor_Parse (const USBGenericDescriptor *descriptor, uint32_t totalLength, USBDescriptorParseFunction parseFunction, void *parseArg)
uint32_t USBConfigurationDescriptor_GetTotalLength (const USBConfigurationDescriptor *configuration)
unsigned char USBConfigurationDescriptor_GetNumInterfaces (const USBConfigurationDescriptor *configuration)
unsigned char USBConfigurationDescriptor_IsSelfPowered (const USBConfigurationDescriptor *configuration)
void USBConfigurationDescriptor_Parse (const USBConfigurationDescriptor *configuration, USBInterfaceDescriptor **interfaces, USBEndpointDescriptor **endpoints, USBGenericDescriptor **others)
uint8_t USBEndpointDescriptor_GetNumber (const USBEndpointDescriptor *endpoint)
uint8_t USBEndpointDescriptor_GetDirection (const USBEndpointDescriptor *endpoint)
uint8_t USBEndpointDescriptor_GetType (const USBEndpointDescriptor *endpoint)
uint16_t USBEndpointDescriptor_GetMaxPacketSize (const USBEndpointDescriptor *endpoint)
uint8_t USBEndpointDescriptor_GetInterval (const USBEndpointDescriptor *endpoint)

Variables

typedef __attribute__
 SBCTestUnitReady Data structure for the TEST UNIT READY command.
uint8_t bLength
uint8_t bDescriptorType
uint16_t bcdUSB
uint8_t bDeviceClass
uint8_t bDeviceSubClass
uint8_t bDeviceProtocol
uint8_t bMaxPacketSize0
uint16_t idVendor
uint16_t idProduct
uint16_t bcdDevice
uint8_t iManufacturer
uint8_t iProduct
uint8_t iSerialNumber
uint8_t bNumConfigurations
uint8_t bmAttributes
uint8_t bReserved
uint16_t wTotalLength
uint8_t bNumInterfaces
uint8_t bConfigurationValue
uint8_t iConfiguration
uint8_t bMaxPower
uint8_t bNumDeviceCaps
uint8_t bDevCapabilityType
USBDeviceBOSDescriptor bos
USBDeviceCapabilities capa_ext
uint8_t bFirstInterface
uint8_t bInterfaceCount
uint8_t bFunctionClass
uint8_t bFunctionSubClass
uint8_t bFunctionProtocol
uint8_t iFunction
uint8_t bInterfaceNumber
uint8_t bAlternateSetting
uint8_t bNumEndpoints
uint8_t bInterfaceClass
uint8_t bInterfaceSubClass
uint8_t bInterfaceProtocol
uint8_t iInterface
uint8_t bEndpointAddress
uint16_t wMaxPacketSize
uint8_t bInterval

Detailed Description

Purpose

Definitions and methods for USB descriptor structures described by the USB specification.

Usage

Definition in file USBDescriptors.h.


Variable Documentation

Value to select this alternate interface setting.

Definition at line 700 of file USBDescriptors.h.

uint16_t bcdDevice

Device release number in BCD format.

Definition at line 545 of file USBDescriptors.h.

uint16_t bcdUSB

USB specification release number in BCD format.

USB specification release number (in BCD format).

Definition at line 531 of file USBDescriptors.h.

Value for selecting this configuration.

Definition at line 609 of file USBDescriptors.h.

uint8_t bDescriptorType

Descriptor type.

Descriptor type (USBGenericDescriptor_DEVICE).

Descriptor type (USBGenericDescriptor_OTG).

Descriptor type (USBDESC_DEVICE_QUALIFIER or "USB device types").

Descriptor type (USBDESC_CONFIGURATION of USB Descriptor types USB Descriptor types).

Descriptor type (USBGenericDescriptor_INTERFACE).

Descriptor type (USBGenericDescriptor_ENDPOINT).

Definition at line 492 of file USBDescriptors.h.

uint8_t bDeviceClass

Device class code.

Definition at line 533 of file USBDescriptors.h.

uint8_t bDeviceProtocol

Device protocol code.

Definition at line 537 of file USBDescriptors.h.

uint8_t bDeviceSubClass

Device subclass code.

Definition at line 535 of file USBDescriptors.h.

Address and direction of the endpoint.

Definition at line 720 of file USBDescriptors.h.

uint8_t bFirstInterface

First Interface .

Definition at line 671 of file USBDescriptors.h.

uint8_t bFunctionClass

Function function code.

Definition at line 675 of file USBDescriptors.h.

Function protocol code.

Definition at line 679 of file USBDescriptors.h.

Function subclass code.

Definition at line 677 of file USBDescriptors.h.

uint8_t bInterfaceClass

Interface class code.

Definition at line 704 of file USBDescriptors.h.

uint8_t bInterfaceCount

Interface Count.

Definition at line 673 of file USBDescriptors.h.

Number of the interface in its configuration.

Definition at line 698 of file USBDescriptors.h.

Interface protocol code.

Definition at line 708 of file USBDescriptors.h.

Interface subclass code.

Definition at line 706 of file USBDescriptors.h.

uint8_t bInterval

Polling rate of the endpoint.

Definition at line 727 of file USBDescriptors.h.

uint8_t bLength

Length of the descriptor in bytes.

Size of this descriptor in bytes.

Size of the descriptor in bytes.

Definition at line 490 of file USBDescriptors.h.

uint8_t bmAttributes

Attribute Fields D7?: Reserved D1: HNP support D0: SRP support

Configuration characteristics.

Endpoint type and additional characteristics (for isochronous endpoints).

Definition at line 546 of file USBDescriptors.h.

uint8_t bMaxPacketSize0

Maximum packet size of endpoint 0 (in bytes).

Maximum packet size of endpoint 0.

Definition at line 539 of file USBDescriptors.h.

uint8_t bMaxPower

Maximum power consumption of the device when in this configuration.

Definition at line 615 of file USBDescriptors.h.

Number of possible configurations for the device.

Definition at line 553 of file USBDescriptors.h.

uint8_t bNumEndpoints

Number of endpoints used by the interface (excluding endpoint 0).

Definition at line 702 of file USBDescriptors.h.

uint8_t bNumInterfaces

Number of interfaces in this configuration.

Definition at line 607 of file USBDescriptors.h.

uint8_t bReserved

Reserved.

Definition at line 588 of file USBDescriptors.h.

uint8_t iConfiguration

Index of the configuration string descriptor.

Definition at line 611 of file USBDescriptors.h.

uint16_t idProduct

Product ID.

Definition at line 543 of file USBDescriptors.h.

uint16_t idVendor

Vendor ID.

Definition at line 541 of file USBDescriptors.h.

uint8_t iFunction

Index of the function string descriptor.

Definition at line 681 of file USBDescriptors.h.

uint8_t iInterface

Index of the interface string descriptor.

Definition at line 710 of file USBDescriptors.h.

uint8_t iManufacturer

Index of the manufacturer string descriptor.

Definition at line 547 of file USBDescriptors.h.

uint8_t iProduct

Index of the product string descriptor.

Definition at line 549 of file USBDescriptors.h.

uint8_t iSerialNumber

Index of the serial number string descriptor.

Definition at line 551 of file USBDescriptors.h.

uint16_t wMaxPacketSize

Maximum packet size (in bytes) of the endpoint.

Definition at line 725 of file USBDescriptors.h.

uint16_t wTotalLength

Length of all descriptors returned along with this configuration descriptor.

Definition at line 605 of file USBDescriptors.h.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines