Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Some constants are available to customize the class. These constants are located in the USB device configuration file, usbd_cfg.hTable - Audio Class Configuration Constants shows their description.

Excerpt

Anchor
Table - Audio Class Configuration Constants
Table - Audio Class Configuration Constants

Constant

Description

Possible Values
USBD_AUDIO_CFG_PLAYBACK_ENEnables or disables playback.   DEF_ENABLED or DEF_DISABLED
USBD_AUDIO_CFG_RECORD_EN

Enables or disables record.

Tip

USBD_AUDIO_CFG_PLAYBACK_EN and USBD_AUDIO_CFG_RECORD_EN can be DEF_DISABLED at the same time. In that case, only the AudioControl interface is active. No AudioStreaming interface can be defined. It may be useful to configure an audio device which does not interact with the host through USB for audio streaming.


DEF_ENABLED or DEF_DISABLED
USBD_AUDIO_CFG_FU_MAX_CTRLEnables all Feature Unit controls or disables all optional controls. When disabled, only the mute and volume controls are kept.DEF_ENABLED or DEF_DISABLED
USBD_AUDIO_CFG_MAX_NBR_AICConfigures the maximum number of class instances. Unless you plan on having multiple configurations or interfaces using different class instances, this can be set to 1.From 1 to 254. Default value is  1 .
USBD_AUDIO_CFG_MAX_NBR_CFGConfigures the maximum number of configurations in which audio class is used. Keep in mind that if you use a high-speed device, two configurations will be built, one for full-speed and another for high-speed.From 1 (full-speed) or 2 (high-speed) to 254. Default value is 2.
USBD_AUDIO_CFG_MAX_NBR_ITConfigures the maximum number of input terminals.From 1 to 255. Default value is  2.
USBD_AUDIO_CFG_MAX_NBR_OTConfigures the maximum number of output terminals.From 1 to 255. Default value is  2 .
USBD_AUDIO_CFG_MAX_NBR_FUConfigures the maximum number of feature units.From 1 to 255. Default value is  2 .
USBD_AUDIO_CFG_MAX_NBR_MUConfigures the maximum number of mixer units. A Mixer Unit is optional.From 0 to 255. Default value is  0 .
USBD_AUDIO_CFG_MAX_NBR_SUConfigures the maximum number of selector units. A Selector Unit is optional.  From 0 to 255. Default value is  0 .
USBD_AUDIO_CFG_MAX_NBR_AS_IF_PLAYBACKConfigures the maximum number of playback AudioStreaming interfaces per class instance.From 1 to 255. Default value is  1 .
USBD_AUDIO_CFG_MAX_NBR_AS_IF_RECORD Configures the maximum number of record AudioStreaming interfaces per class instance.From 1 to 255. Default value is    1 .
USBD_AUDIO_CFG_MAX_NBR_IF_ALTConfigures the maximum number of operational alternate setting interfaces per AudioStreaming interface.From 1 to 255. Default value is  2 .
USBD_AUDIO_CFG_CLASS_REQ_MAX_LENConfigures the maximum class-specific request playload length in bytes. Among all class-specific requests supported by Audio 1.0 class, the Graphic Equalizer control of the Feature Unit use the longest payload size for the SET_CUR request. The payload for the Graphic Equalizer control can take up to 34 bytes depending of the number of frequency bands present. If the Graphical Equalizer control is not used by any feature unit, this constant can be set to 4. Refer to audio 1.0 specification, Table 5-27 for more details about Graphic Equalizer control.From 1 to 34. Default value is  4 .
USBD_AUDIO_CFG_BUF_ALIGN_OCTETS

Configures the alignment in octets that audio buffers allocated for each AudioStreaming interface will use. The alignment is dependent of the peripheral used to move data between the memory and the audio peripheral. Note that this buffer alignment should be a multiple of the internal stack's buffer alignment set with the constant USBD_CFG_BUF_ALIGN_OCTETS as the audio buffers are passed to the USB device controller that can also have its alignment requirement. If your platform does not require buffer alignment, this should be set to USBD_AUDIO_CFG_BUF_ALIGN_OCTETS.

Warning

If the CPU cache is used with the audio buffers, USBD_AUDIO_CFG_BUF_ALIGN_OCTETS should also take into account the cache line size requirement. To sum up, the value of USBD_AUDIO_CFG_BUF_ALIGN_OCTETS is influenced by:

  • Audio peripheral alignment requirement
  • USB device controller alignment requirement
  • Cache alignment requirement

If all above requirements must be taken into account, USBD_AUDIO_CFG_BUF_ALIGN_OCTETS will be the worst case among all alignment requirements.


Typically 1, 2, 4 or 8. Default value is  USBD_CFG_BUF_ALIGN_OCTETS .
USBD_AUDIO_CFG_PLAYBACK_FEEDBACK_ENEnables or disables the playback feedback support. If an isochronous OUT endpoint using the asynchronous synchronization is associated to an AudioStreaming interface, you need to set DEF_ENABLED to enable the feedback support. Refer to section  Playback Feedback Correction for more details about the audio feedback.DEF_ENABLED or DEF_DISABLED
USBD_AUDIO_CFG_PLAYBACK_CORR_ENEnables or disables built-in playback stream correction.DEF_ENABLED or DEF_DISABLED
USBD_AUDIO_CFG_RECORD_CORR_ENEnables or disables built-in record stream correction.DEF_ENABLED or DEF_DISABLED
USBD_AUDIO_CFG_STAT_ENEnables or disables audio statistics for playback and record.DEF_ENABLED or DEF_DISABLED


The audio class uses two internal tasks to manage playback and record streams. The task priority and stack size shown in Table - Audio Internal Tasks' Configuration Constants are defined in the application configuration file, app_cfg.h. Refer to section Audio Class Stream Data Flow for more details about the audio internal tasks.

...