USBD_PHDC_CfgAdd
Description
Add a PHDC instance into the specified configuration. The PHDC instance was previously created by the function USBD_PHDC_Add
.
Files
usbd_phdc.h / usbd_phdc.c
Prototype
void USBD_PHDC_CfgAdd (CPU_INT08U class_nbr, CPU_INT08U dev_nbr, CPU_INT08U cfg_nbr, USBD_ERR *p_err);
Arguments
class_nbr
PHDC instance number.
dev_nbr
Device number.
cfg_nbr
Configuration index to add PHDC instance to.
p_err
Pointer to variable that will receive the return error code from this function.
USBD_ERR_NONE
USBD_ERR_INVALID_ARG
USBD_ERR_ALLOC
USBD_ERR_NULL_PTR
USBD_ERR_DEV_INVALID_NBR
USBD_ERR_DEV_INVALID_STATE
USBD_ERR_CFG_INVALID_NBR
USBD_ERR_IF_ALLOC
USBD_ERR_IF_ALT_ALLOC
USBD_ERR_IF_INVALID_NBR
USBD_ERR_EP_NONE_AVAIL
USBD_ERR_EP_ALLOC
Returned Value
None.
Callers
Application.
Notes / Warnings
USBD_PHDC_CfgAdd()
basically adds an Interface descriptor and its associated Endpoint descriptor(s) to the Configuration descriptor. One call toUSBD_PHDC_CfgAdd()
builds the Configuration descriptor corresponding to a PHDC device with the following format:Configuration Descriptor
|-- Interface Descriptor (PHDC)
|-- Endpoint Descriptor (Bulk OUT)
|-- Endpoint Descriptor (Bulk IN)
|-- Endpoint Descriptor (Interrupt IN) - optional
- The Interrupt IN endpoint is optional. It will be added to the Interface descriptor if application specified that it will send low latency data when calling
USBD_PHDC_WrCfg()
. If
USBD_PHDC_CfgAdd()
is called several times from the application, it allows to create multiple instances and multiple configurations. For instance, the following architecture could be created for an high-speed device:High-speed
|-- Configuration 0
|-- Interface 0 (PHDC 0)
|-- Configuration 1
|-- Interface 0 (PHDC 0)
|-- Interface 1 (PHDC 1)
In that example, there are two instances of PHDC: 'PHDC 0' and 'PHDC 1', and two possible configurations for the device: 'Configuration 0' and 'Configuration 1'. 'Configuration 1' is composed of two interfaces. Each class instance has an association with one of the interfaces. If 'Configuration 1' is activated by the host, it allows the host to access two different functionalities offered by the device.