From 9c460f753f4d566f90a6bca4b4537b0fc7d2a70c Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Thu, 10 Nov 2022 16:43:43 +0000 Subject: [PATCH 1/2] Avoid calling SetupZerosSendBuffer when there are no IN eps --- lib_xua/src/core/buffer/decouple/decouple.xc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index 2e64ecd0..ac27864a 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -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) From 0db1b08948cba80632b29044d084f3fc27635847 Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Fri, 11 Nov 2022 08:53:47 +0000 Subject: [PATCH 2/2] Add changelog entry --- CHANGELOG.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4e76454a..c13729eb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ lib_xua Change Log ================== +UNRELEASED +---------- + + * FIXED: Exception on startup when USB input disabled + 3.3.1 -----