Streamline call of tud_audio_set_itf_cb() within audiod_set_interface()

This commit is contained in:
Reinhard Panhuber 2022-03-20 12:08:27 +01:00
parent 5aba464270
commit 8ffdbfebce
1 changed files with 14 additions and 11 deletions

View File

@ -1631,7 +1631,7 @@ static bool audiod_set_interface(uint8_t rhport, tusb_control_request_t const *
#endif #endif
// Invoke callback - can be used to trigger data sampling if not already running // Invoke callback - can be used to trigger data sampling if not already running
if (tud_audio_set_itf_cb) TU_VERIFY(tud_audio_set_itf_cb(rhport, p_request)); // if (tud_audio_set_itf_cb) TU_VERIFY(tud_audio_set_itf_cb(rhport, p_request));
// Schedule first transmit if alternate interface is not zero i.e. streaming is disabled - in case no sample data is available a ZLP is loaded // Schedule first transmit if alternate interface is not zero i.e. streaming is disabled - in case no sample data is available a ZLP is loaded
// It is necessary to trigger this here since the refill is done with an RX FIFO empty interrupt which can only trigger if something was in there // It is necessary to trigger this here since the refill is done with an RX FIFO empty interrupt which can only trigger if something was in there
@ -1665,10 +1665,10 @@ static bool audiod_set_interface(uint8_t rhport, tusb_control_request_t const *
#if CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP #if CFG_TUD_AUDIO_ENABLE_FEEDBACK_EP
// In case of asynchronous EP, call Cb after ep_fb is set // In case of asynchronous EP, call Cb after ep_fb is set
if ( !(desc_ep->bmAttributes.sync == 0x01 && audio->ep_fb == 0) ) // if ( !(desc_ep->bmAttributes.sync == 0x01 && audio->ep_fb == 0) )
{ // {
if (tud_audio_set_itf_cb) TU_VERIFY(tud_audio_set_itf_cb(rhport, p_request)); // if (tud_audio_set_itf_cb) TU_VERIFY(tud_audio_set_itf_cb(rhport, p_request));
} // }
#else #else
// Invoke callback // Invoke callback
if (tud_audio_set_itf_cb) TU_VERIFY(tud_audio_set_itf_cb(rhport, p_request)); if (tud_audio_set_itf_cb) TU_VERIFY(tud_audio_set_itf_cb(rhport, p_request));
@ -1693,11 +1693,11 @@ static bool audiod_set_interface(uint8_t rhport, tusb_control_request_t const *
audio->fb_n_cycles_old = 0; audio->fb_n_cycles_old = 0;
#endif #endif
// Invoke callback after ep_out is set // // Invoke callback after ep_out is set
if (audio->ep_out != 0) // if (audio->ep_out != 0)
{ // {
if (tud_audio_set_itf_cb) TU_VERIFY(tud_audio_set_itf_cb(rhport, p_request)); // if (tud_audio_set_itf_cb) TU_VERIFY(tud_audio_set_itf_cb(rhport, p_request));
} // }
} }
#endif #endif
#endif // CFG_TUD_AUDIO_ENABLE_EP_OUT #endif // CFG_TUD_AUDIO_ENABLE_EP_OUT
@ -1709,6 +1709,9 @@ static bool audiod_set_interface(uint8_t rhport, tusb_control_request_t const *
TU_VERIFY(foundEPs == nEps); TU_VERIFY(foundEPs == nEps);
// Invoke one callback for a final set interface
if (tud_audio_set_itf_cb) TU_VERIFY(tud_audio_set_itf_cb(rhport, p_request));
// We are done - abort loop // We are done - abort loop
break; break;
} }
@ -2118,7 +2121,7 @@ void audiod_sof (uint8_t rhport, uint32_t frame_count)
// Buffer count checks ? // Buffer count checks ?
// Magic checks // Magic checks - where are they from?
if (feedback > 2949166){ // 45.0007 in 16.16 format if (feedback > 2949166){ // 45.0007 in 16.16 format
feedback = 2949166; feedback = 2949166;
} }