Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
USB device descriptors for a single interface

The following structures provide the USB device descriptors required for USB Device with a single interface CDC.

It is ready to use and do not require more definition.

Data Structures

struct  udc_desc_t
 Structure for USB Device Configuration Descriptor. More...
 

Macros

#define USB_DEVICE_EP_CTRL_SIZE   64
 Control endpoint size (Endpoint 0) More...
 
#define USB_DEVICE_NB_INTERFACE   (2*UDI_CDC_PORT_NB)
 Two interfaces for a CDC device. More...
 
#define USB_VERSION   USB_V2_0
 

Variables

COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE udc_desc_t 
udc_desc_fs
 USB Device Configuration Descriptor filled for full and high speed. More...
 
COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE udc_desc_t 
udc_desc_hs
 
COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE
usb_dev_desc_t 
udc_device_desc
 USB Device Descriptor. More...
 
COMPILER_WORD_ALIGNED
UDC_DESC_STORAGE
usb_dev_qual_desc_t 
udc_device_qual
 USB Device Qualifier Descriptor for HS. More...
 

UDC structures which content all USB Device definitions

UDC_DESC_STORAGE udi_api_tudi_apis [USB_DEVICE_NB_INTERFACE]
 Associate an UDI for each USB interface. More...
 
UDC_DESC_STORAGE udc_config_speed_t udc_config_fs [1]
 Add UDI with USB Descriptors FS & HS. More...
 
UDC_DESC_STORAGE udc_config_speed_t udc_config_hs [1]
 
UDC_DESC_STORAGE udc_config_t udc_config
 Add all information about USB Device in global structure for UDC. More...
 

Default endpoint configuration

The USBB, UDP, UDPHS and UOTGHS interfaces can support up to 2 CDC interfaces.

#define UDI_CDC_DATA_EP_IN_0   (1 | USB_EP_DIR_IN)
 
#define UDI_CDC_DATA_EP_OUT_0   (2 | USB_EP_DIR_OUT)
 
#define UDI_CDC_COMM_EP_0   (3 | USB_EP_DIR_IN)
 
#define UDI_CDC_DATA_EP_IN_1   (4 | USB_EP_DIR_IN)
 
#define UDI_CDC_DATA_EP_OUT_1   (5 | USB_EP_DIR_OUT)
 
#define UDI_CDC_COMM_EP_1   (6 | USB_EP_DIR_IN)
 
#define USB_DEVICE_MAX_EP   (3*UDI_CDC_PORT_NB)
 3 endpoints used per CDC interface More...
 

Default Interface numbers

#define UDI_CDC_COMM_IFACE_NUMBER_0   0
 
#define UDI_CDC_DATA_IFACE_NUMBER_0   1
 
#define UDI_CDC_COMM_IFACE_NUMBER_1   2
 
#define UDI_CDC_DATA_IFACE_NUMBER_1   3
 
#define UDI_CDC_COMM_IFACE_NUMBER_2   4
 
#define UDI_CDC_DATA_IFACE_NUMBER_2   5
 
#define UDI_CDC_COMM_IFACE_NUMBER_3   6
 
#define UDI_CDC_DATA_IFACE_NUMBER_3   7
 
#define UDI_CDC_COMM_IFACE_NUMBER_4   8
 
#define UDI_CDC_DATA_IFACE_NUMBER_4   9
 
#define UDI_CDC_COMM_IFACE_NUMBER_5   10
 
#define UDI_CDC_DATA_IFACE_NUMBER_5   11
 
#define UDI_CDC_COMM_IFACE_NUMBER_6   12
 
#define UDI_CDC_DATA_IFACE_NUMBER_6   13
 

#define UDI_CDC_COMM_EP_0   (3 | USB_EP_DIR_IN)
#define UDI_CDC_COMM_EP_1   (6 | USB_EP_DIR_IN)
#define UDI_CDC_COMM_IFACE_NUMBER_0   0

Referenced by udi_cdc_comm_enable().

#define UDI_CDC_COMM_IFACE_NUMBER_1   2
#define UDI_CDC_COMM_IFACE_NUMBER_2   4
#define UDI_CDC_COMM_IFACE_NUMBER_3   6
#define UDI_CDC_COMM_IFACE_NUMBER_4   8
#define UDI_CDC_COMM_IFACE_NUMBER_5   10
#define UDI_CDC_COMM_IFACE_NUMBER_6   12
#define UDI_CDC_DATA_EP_IN_0   (1 | USB_EP_DIR_IN)

Referenced by udi_cdc_tx_send().

#define UDI_CDC_DATA_EP_IN_1   (4 | USB_EP_DIR_IN)
#define UDI_CDC_DATA_EP_OUT_0   (2 | USB_EP_DIR_OUT)

Referenced by udi_cdc_rx_start().

#define UDI_CDC_DATA_EP_OUT_1   (5 | USB_EP_DIR_OUT)
#define UDI_CDC_DATA_IFACE_NUMBER_0   1
#define UDI_CDC_DATA_IFACE_NUMBER_1   3
#define UDI_CDC_DATA_IFACE_NUMBER_2   5
#define UDI_CDC_DATA_IFACE_NUMBER_3   7
#define UDI_CDC_DATA_IFACE_NUMBER_4   9
#define UDI_CDC_DATA_IFACE_NUMBER_5   11
#define UDI_CDC_DATA_IFACE_NUMBER_6   13
#define USB_DEVICE_EP_CTRL_SIZE   64

Control endpoint size (Endpoint 0)

Referenced by udd_ctrl_in_sent().

#define USB_DEVICE_MAX_EP   (3*UDI_CDC_PORT_NB)

3 endpoints used per CDC interface

Referenced by udd_enable(), and udd_ep_interrupt().

#define USB_DEVICE_NB_INTERFACE   (2*UDI_CDC_PORT_NB)

Two interfaces for a CDC device.

#define USB_VERSION   USB_V2_0

Initial value:
= {
.confdev_lsfs = &udc_device_desc,
.conf_lsfs = udc_config_fs,
.confdev_hs = &udc_device_desc,
.qualifier = &udc_device_qual,
.conf_hs = udc_config_hs,
.conf_bos = NULL,
}
UDC_DESC_STORAGE udc_config_speed_t udc_config_fs[1]
Add UDI with USB Descriptors FS & HS.
Definition: udi_cdc_desc.c:216
COMPILER_WORD_ALIGNED UDC_DESC_STORAGE usb_dev_qual_desc_t udc_device_qual
USB Device Qualifier Descriptor for HS.
Definition: udi_cdc_desc.c:103
COMPILER_WORD_ALIGNED UDC_DESC_STORAGE usb_dev_desc_t udc_device_desc
USB Device Descriptor.
Definition: udi_cdc_desc.c:65
UDC_DESC_STORAGE udc_config_speed_t udc_config_hs[1]
Definition: udi_cdc_desc.c:221

Add all information about USB Device in global structure for UDC.

Global variables of USB Device Descriptor and UDI links.

Referenced by udc_req_std_dev_get_descriptor(), and udc_req_std_dev_set_configuration().

Initial value:
= { {
}}
Standard USB configuration descriptor structure.
Definition: usb_protocol.h:410
UDC_DESC_STORAGE udi_api_t * udi_apis[USB_DEVICE_NB_INTERFACE]
Associate an UDI for each USB interface.
Definition: udi_cdc_desc.c:207
#define UDC_DESC_STORAGE
Defines the memory's location of USB descriptors.
Definition: udc_desc.h:70
COMPILER_WORD_ALIGNED UDC_DESC_STORAGE udc_desc_t udc_desc_fs
USB Device Configuration Descriptor filled for full and high speed.
Definition: udi_cdc_desc.c:154

Add UDI with USB Descriptors FS & HS.

Initial value:
= { {
}}
Standard USB configuration descriptor structure.
Definition: usb_protocol.h:410
UDC_DESC_STORAGE udi_api_t * udi_apis[USB_DEVICE_NB_INTERFACE]
Associate an UDI for each USB interface.
Definition: udi_cdc_desc.c:207
#define UDC_DESC_STORAGE
Defines the memory's location of USB descriptors.
Definition: udc_desc.h:70
COMPILER_WORD_ALIGNED UDC_DESC_STORAGE udc_desc_t udc_desc_hs
Definition: udi_cdc_desc.c:178
Initial value:
= {
.conf.bLength = sizeof(usb_conf_desc_t),
.conf.bDescriptorType = USB_DT_CONFIGURATION,
.conf.wTotalLength = LE16(sizeof(udc_desc_t)),
.conf.bNumInterfaces = USB_DEVICE_NB_INTERFACE,
.conf.bConfigurationValue = 1,
.conf.iConfiguration = 0,
.conf.bmAttributes = USB_CONFIG_ATTR_MUST_SET | USB_DEVICE_ATTR,
.udi_cdc_comm_0 = UDI_CDC_COMM_DESC_0,
.udi_cdc_data_0 = UDI_CDC_DATA_DESC_0_FS,
}
Definition: usb_protocol.h:191
#define USB_DEVICE_ATTR
Definition: conf_usb.h:53
#define USB_CONFIG_ATTR_MUST_SET
Must always be set.
Definition: usb_protocol.h:422
#define USB_DEVICE_NB_INTERFACE
Two interfaces for a CDC device.
Definition: udi_cdc_desc.c:55
Standard USB configuration descriptor structure.
Definition: usb_protocol.h:410
#define UDI_CDC_COMM_DESC_0
Definition: udi_cdc.h:138
#define UDI_CDC_DATA_DESC_0_FS
Definition: udi_cdc.h:139
#define USB_DEVICE_POWER
Definition: conf_usb.h:52
#define LE16(x)
Definition: compiler.h:886
#define USB_CONFIG_MAX_POWER(ma)
Max power in mA.
Definition: usb_protocol.h:427
Structure for USB Device Configuration Descriptor.
Definition: udi_cdc_desc.c:136

USB Device Configuration Descriptor filled for full and high speed.

Initial value:
= {
.conf.bLength = sizeof(usb_conf_desc_t),
.conf.bDescriptorType = USB_DT_CONFIGURATION,
.conf.wTotalLength = LE16(sizeof(udc_desc_t)),
.conf.bNumInterfaces = USB_DEVICE_NB_INTERFACE,
.conf.bConfigurationValue = 1,
.conf.iConfiguration = 0,
.conf.bmAttributes = USB_CONFIG_ATTR_MUST_SET | USB_DEVICE_ATTR,
.udi_cdc_comm_0 = UDI_CDC_COMM_DESC_0,
.udi_cdc_data_0 = UDI_CDC_DATA_DESC_0_HS,
}
Definition: usb_protocol.h:191
#define USB_DEVICE_ATTR
Definition: conf_usb.h:53
#define USB_CONFIG_ATTR_MUST_SET
Must always be set.
Definition: usb_protocol.h:422
#define USB_DEVICE_NB_INTERFACE
Two interfaces for a CDC device.
Definition: udi_cdc_desc.c:55
Standard USB configuration descriptor structure.
Definition: usb_protocol.h:410
#define UDI_CDC_COMM_DESC_0
Definition: udi_cdc.h:138
#define USB_DEVICE_POWER
Definition: conf_usb.h:52
#define LE16(x)
Definition: compiler.h:886
#define UDI_CDC_DATA_DESC_0_HS
Definition: udi_cdc.h:140
#define USB_CONFIG_MAX_POWER(ma)
Max power in mA.
Definition: usb_protocol.h:427
Structure for USB Device Configuration Descriptor.
Definition: udi_cdc_desc.c:136

USB Device Descriptor.

Initial value:
= {
.bLength = sizeof(usb_dev_qual_desc_t),
.bDescriptorType = USB_DT_DEVICE_QUALIFIER,
.bcdUSB = LE16(USB_VERSION),
.bDeviceClass = CDC_CLASS_DEVICE,
.bDeviceSubClass = 0,
.bDeviceProtocol = 0,
.bMaxPacketSize0 = USB_DEVICE_EP_CTRL_SIZE,
.bNumConfigurations = 1
}
#define USB_DEVICE_EP_CTRL_SIZE
Control endpoint size (Endpoint 0)
Definition: udi_cdc_conf.h:57
#define USB_VERSION
Definition: udi_cdc_desc.c:60
#define CDC_CLASS_DEVICE
USB Communication Device Class.
Definition: usb_protocol_cdc.h:51
Standard USB device qualifier descriptor structure.
Definition: usb_protocol.h:338
#define LE16(x)
Definition: compiler.h:886
Definition: usb_protocol.h:195

USB Device Qualifier Descriptor for HS.

Initial value:
= {
#define UDI_CDC_API(index, unused)
}

Associate an UDI for each USB interface.