Fix defines in audio_device.c
This commit is contained in:
parent
97d1609c72
commit
2134c1a875
|
@ -429,7 +429,6 @@ bool tud_audio_set_itf_close_EP_cb(uint8_t rhport, tusb_control_request_t const
|
||||||
{
|
{
|
||||||
(void) rhport;
|
(void) rhport;
|
||||||
(void) p_request;
|
(void) p_request;
|
||||||
startVal = 0;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2085,43 +2085,67 @@ static void audiod_parse_for_AS_params(audiod_interface_t* audio, uint8_t const
|
||||||
// Look for a Class-Specific AS Interface Descriptor(4.9.2) to verify format type and format and also to get number of physical channels
|
// Look for a Class-Specific AS Interface Descriptor(4.9.2) to verify format type and format and also to get number of physical channels
|
||||||
if (tu_desc_type(p_desc) == TUSB_DESC_CS_INTERFACE && tu_desc_subtype(p_desc) == AUDIO_CS_AS_INTERFACE_AS_GENERAL)
|
if (tu_desc_type(p_desc) == TUSB_DESC_CS_INTERFACE && tu_desc_subtype(p_desc) == AUDIO_CS_AS_INTERFACE_AS_GENERAL)
|
||||||
{
|
{
|
||||||
|
#if CFG_TUD_AUDIO_ENABLE_EP_IN && CFG_TUD_AUDIO_ENABLE_EP_OUT
|
||||||
if (itf != audio->ep_in_as_intf_num && itf != audio->ep_out_as_intf_num) break; // Abort loop, this interface has no EP, this driver does not support this currently
|
if (itf != audio->ep_in_as_intf_num && itf != audio->ep_out_as_intf_num) break; // Abort loop, this interface has no EP, this driver does not support this currently
|
||||||
|
#endif
|
||||||
|
#if CFG_TUD_AUDIO_ENABLE_EP_IN && !CFG_TUD_AUDIO_ENABLE_EP_OUT
|
||||||
|
if (itf != audio->ep_in_as_intf_num) break;
|
||||||
|
#endif
|
||||||
|
#if !CFG_TUD_AUDIO_ENABLE_EP_IN && CFG_TUD_AUDIO_ENABLE_EP_OUT
|
||||||
|
if (itf != audio->ep_out_as_intf_num) break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CFG_TUD_AUDIO_ENABLE_EP_IN
|
||||||
if (itf == audio->ep_in_as_intf_num)
|
if (itf == audio->ep_in_as_intf_num)
|
||||||
{
|
{
|
||||||
audio->n_channels_tx = ((audio_desc_cs_as_interface_t const * )p_desc)->bNrChannels;
|
audio->n_channels_tx = ((audio_desc_cs_as_interface_t const * )p_desc)->bNrChannels;
|
||||||
audio->format_type_tx = ((audio_desc_cs_as_interface_t const * )p_desc)->bFormatType;
|
audio->format_type_tx = ((audio_desc_cs_as_interface_t const * )p_desc)->bFormatType;
|
||||||
|
|
||||||
#if CFG_TUD_AUDIO_ENABLE_TYPE_I_ENCODING || CFG_TUD_AUDIO_ENABLE_TYPE_I_DECODING
|
#if CFG_TUD_AUDIO_ENABLE_TYPE_I_ENCODING
|
||||||
audio->format_type_I_tx = ((audio_desc_cs_as_interface_t const * )p_desc)->bmFormats;
|
audio->format_type_I_tx = ((audio_desc_cs_as_interface_t const * )p_desc)->bmFormats;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CFG_TUD_AUDIO_ENABLE_EP_OUT
|
||||||
if (itf == audio->ep_out_as_intf_num)
|
if (itf == audio->ep_out_as_intf_num)
|
||||||
{
|
{
|
||||||
audio->n_channels_rx = ((audio_desc_cs_as_interface_t const * )p_desc)->bNrChannels;
|
audio->n_channels_rx = ((audio_desc_cs_as_interface_t const * )p_desc)->bNrChannels;
|
||||||
audio->format_type_rx = ((audio_desc_cs_as_interface_t const * )p_desc)->bFormatType;
|
audio->format_type_rx = ((audio_desc_cs_as_interface_t const * )p_desc)->bFormatType;
|
||||||
#if CFG_TUD_AUDIO_ENABLE_TYPE_I_ENCODING || CFG_TUD_AUDIO_ENABLE_TYPE_I_DECODING
|
#if CFG_TUD_AUDIO_ENABLE_TYPE_I_DECODING
|
||||||
audio->format_type_I_rx = ((audio_desc_cs_as_interface_t const * )p_desc)->bmFormats;
|
audio->format_type_I_rx = ((audio_desc_cs_as_interface_t const * )p_desc)->bmFormats;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for a Type I Format Type Descriptor(2.3.1.6 - Audio Formats)
|
// Look for a Type I Format Type Descriptor(2.3.1.6 - Audio Formats)
|
||||||
#if CFG_TUD_AUDIO_ENABLE_TYPE_I_ENCODING || CFG_TUD_AUDIO_ENABLE_TYPE_I_DECODING
|
#if CFG_TUD_AUDIO_ENABLE_TYPE_I_ENCODING || CFG_TUD_AUDIO_ENABLE_TYPE_I_DECODING
|
||||||
if (tu_desc_type(p_desc) == TUSB_DESC_CS_INTERFACE && tu_desc_subtype(p_desc) == AUDIO_CS_AS_INTERFACE_FORMAT_TYPE && ((audio_desc_type_I_format_t const * )p_desc)->bFormatType == AUDIO_FORMAT_TYPE_I)
|
if (tu_desc_type(p_desc) == TUSB_DESC_CS_INTERFACE && tu_desc_subtype(p_desc) == AUDIO_CS_AS_INTERFACE_FORMAT_TYPE && ((audio_desc_type_I_format_t const * )p_desc)->bFormatType == AUDIO_FORMAT_TYPE_I)
|
||||||
{
|
{
|
||||||
|
#if CFG_TUD_AUDIO_ENABLE_EP_IN && CFG_TUD_AUDIO_ENABLE_EP_OUT
|
||||||
if (itf != audio->ep_in_as_intf_num && itf != audio->ep_out_as_intf_num) break; // Abort loop, this interface has no EP, this driver does not support this currently
|
if (itf != audio->ep_in_as_intf_num && itf != audio->ep_out_as_intf_num) break; // Abort loop, this interface has no EP, this driver does not support this currently
|
||||||
|
#endif
|
||||||
|
#if CFG_TUD_AUDIO_ENABLE_EP_IN && !CFG_TUD_AUDIO_ENABLE_EP_OUT
|
||||||
|
if (itf != audio->ep_in_as_intf_num) break;
|
||||||
|
#endif
|
||||||
|
#if !CFG_TUD_AUDIO_ENABLE_EP_IN && CFG_TUD_AUDIO_ENABLE_EP_OUT
|
||||||
|
if (itf != audio->ep_out_as_intf_num) break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CFG_TUD_AUDIO_ENABLE_EP_IN
|
||||||
if (itf == audio->ep_in_as_intf_num)
|
if (itf == audio->ep_in_as_intf_num)
|
||||||
{
|
{
|
||||||
audio->n_bytes_per_sampe_tx = ((audio_desc_type_I_format_t const * )p_desc)->bSubslotSize;
|
audio->n_bytes_per_sampe_tx = ((audio_desc_type_I_format_t const * )p_desc)->bSubslotSize;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CFG_TUD_AUDIO_ENABLE_EP_OUT
|
||||||
if (itf == audio->ep_out_as_intf_num)
|
if (itf == audio->ep_out_as_intf_num)
|
||||||
{
|
{
|
||||||
audio->n_bytes_per_sampe_rx = ((audio_desc_type_I_format_t const * )p_desc)->bSubslotSize;
|
audio->n_bytes_per_sampe_rx = ((audio_desc_type_I_format_t const * )p_desc)->bSubslotSize;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue