Merge pull request #303 from danielpieczko/no_usb_chans_in

Avoid calling SetupZerosSendBuffer when there are no IN eps
This commit is contained in:
danielpieczko
2022-11-16 10:06:03 +00:00
committed by GitHub
2 changed files with 11 additions and 0 deletions

View File

@@ -1,6 +1,11 @@
lib_xua Change Log
==================
UNRELEASED
----------
* FIXED: Exception on startup when USB input disabled
3.3.1
-----

View File

@@ -588,6 +588,7 @@ __builtin_unreachable();
}
}
#if (NUM_USB_CHAN_IN > 0)
/* Mark Endpoint (IN) ready with an appropriately sized zero buffer */
static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned sampFreq, unsigned slotSize,
xc_ptr aud_to_host_zeros)
@@ -619,6 +620,7 @@ static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned samp
XUD_SetReady_InPtr(aud_to_host_usb_ep, aud_to_host_zeros+4, mid);
}
#endif
#pragma unsafe arrays
void XUA_Buffer_Decouple(chanend c_mix_out
@@ -760,8 +762,10 @@ void XUA_Buffer_Decouple(chanend c_mix_out
/* Set buffer to send back to zeros buffer */
aud_to_host_buffer = aud_to_host_zeros;
#if (NUM_USB_CHAN_IN > 0)
/* Update size of zeros buffer (and sampsToWrite) */
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_In, aud_to_host_zeros);
#endif
/* Reset OUT buffer state */
outUnderflow = 1;
@@ -815,8 +819,10 @@ void XUA_Buffer_Decouple(chanend c_mix_out
/* Set buffer back to zeros buffer */
aud_to_host_buffer = aud_to_host_zeros;
#if (NUM_USB_CHAN_IN > 0)
/* Update size of zeros buffer (and sampsToWrite) */
SetupZerosSendBuffer(aud_to_host_usb_ep, sampFreq, g_curSubSlot_In, aud_to_host_zeros);
#endif
GET_SHARED_GLOBAL(usbSpeed, g_curUsbSpeed);
if (usbSpeed == XUD_SPEED_HS)