USBD_Audio_CfgAdd

Description

Add an audio class instance into the specified configuration. The audio class instance was previously created by the function USBD_Audio_Add.

Files

usbd_audio.h / usbd_audio.c

Prototype

void  USBD_Audio_CfgAdd (CPU_INT08U   class_nbr,
                         CPU_INT08U   dev_nbr,
                         CPU_INT08U   cfg_nbr,
                         USBD_ERR    *p_err);


Arguments

class_nbr

Class instance number.

dev_nbr

Device number.

cfg_nbr

Configuration index to add audio class 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

  1. If USBD_Audio_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:
    Audio Class 0 (device number 0)
        |-- Configuration 0
        |-- Configuration 1
    Audio Class 1 (device number 1)
        |-- Configuration 0
        |-- Configuration 1


  2. The Configuration Descriptor corresponding to an audio device has the following format:

    Configuration Descriptor
    |-- Interface Descriptor (AudioControl)                                [standard]
        |-- Header Descriptor [class-specific]
        |-- Unit Descriptor(s)                                             [class-specific]
        |-- Terminal Descriptor(s)                                         [class-specific]
    |-- Endpoint Descriptor (Interrupt IN) - optional                      [standard]
        |-- Interface Descriptor (AudioStreaming)                          [standard]
        |-- AS Interface Descriptor                                        [class-specific]
            |-- AS Format Type Descriptor                                  [class-specific]
        |-- AS Format-Specific Descriptor(s)                               [class-specific]
        |-- Endpoint Descriptor (Isochronous IN or OUT Data)               [standard]
            |-- AS Isochronous Audio Data Endpoint Descriptor              [class-specific]
            |-- Endpoint Descriptor (Isochronous OUT or IN Synch endpoint) [standard]
        |-- Interface Descriptor (AudioStreaming)                          [standard]
            |-- ...
        |-- Interface Descriptor (AudioStreaming)                          [standard]
            |-- ...

The function USBD_Audio_CfgAdd() only adds the AudioControl interface descriptor. Other standard and class-specific descriptors are added by functions:

USBD_Audio_IT_Add

USBD_Audio_OT_Add

USBD_Audio_FU_Add

USBD_Audio_MU_Add

USBD_Audio_SU_Add

USBD_Audio_AS_IF_Add