From be45d04423b5a5ce5fa9c9735ffc91917146fc6b Mon Sep 17 00:00:00 2001 From: shuchitak Date: Wed, 19 Feb 2020 15:45:58 +0000 Subject: [PATCH 1/4] undo changes in xua_ep0_uacreqs --- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 47 ++++--------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index d08555b6..2fdd434c 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -17,13 +17,6 @@ #ifdef MIXER #include "mixer.h" #endif -#include "xua_conf_default.h" -#include "descriptor_defs.h" - - -#define DEBUG_UNIT XUA_EP0_UACREQS -#define DEBUG_PRINT_ENABLE_XUA_EP0_UACREQS 0 -#include "debug_print.h" #define CS_XU_MIXSEL (0x06) @@ -52,23 +45,8 @@ extern unsigned char channelMapUsb[NUM_USB_CHAN_IN]; extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS]; #endif - - /* Global var for current frequency, set to default freq */ -#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) -extern uint32_t get_usb_to_device_rate(); -extern uint32_t get_device_to_usb_rate(); -extern uint32_t get_usb_to_device_bit_res(); -extern uint32_t get_device_to_usb_bit_res(); -#define g_curUSBin_SamFreq get_device_to_usb_rate() -#define g_curUSBout_SamFreq get_usb_to_device_rate() - -unsigned int g_curSamFreq = DEFAULT_FREQ; // should no longer be used -#else -unsigned int g_curUSBin_SamFreq = DEFAULT_FREQ; -unsigned int g_curUSBout_SamFreq = DEFAULT_FREQ; -unsigned int g_curSamFreq = DEFAULT_FREQ; // should no longer be used -#endif +unsigned int g_curSamFreq = DEFAULT_FREQ; #if 0 unsigned int g_curSamFreq48000Family = DEFAULT_FREQ % 48000 == 0; @@ -1099,7 +1077,6 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp * bmRequestType.Recipient = Endpoint * bmRequestType.Type = Class * endpoint (wIndex & 0xff) is 0x01 or 0x82 - * wIndex is endpoint address for distinguishing input and output */ XUD_Result_t result; @@ -1130,8 +1107,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp /* Recontruct sample-freq */ int newSampleRate = (buffer, unsigned char[])[0] | ((buffer, unsigned char[])[1] << 8) | ((buffer, unsigned char[])[2] << 16); - if(((sp.wIndex == ENDPOINT_ADDRESS_IN_AUDIO) && (newSampleRate != g_curUSBin_SamFreq)) || \ - ((sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO) && (newSampleRate != g_curUSBout_SamFreq))) + if(newSampleRate != g_curSamFreq) { int curSamFreq44100Family; int curSamFreq48000Family; @@ -1143,25 +1119,18 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp if(curSamFreq48000Family || curSamFreq44100Family) { - if(sp.wIndex == ENDPOINT_ADDRESS_IN_AUDIO){ - g_curUSBin_SamFreq = newSampleRate; - /* Instruct audio thread to change sample freq */ - outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, g_curUSBin_SamFreq); - } - else{ //if sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO - g_curUSBout_SamFreq = newSampleRate; - /* Instruct audio thread to change sample freq */ - outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, g_curUSBout_SamFreq); - } + g_curSamFreq = newSampleRate; + + /* Instruct audio thread to change sample freq */ + outuint(c_audioControl, SET_SAMPLE_FREQ); + outuint(c_audioControl, g_curSamFreq); /* Wait for handshake back - i.e. pll locked and clocks okay */ chkct(c_audioControl, XS1_CT_END); /* Allow time for the change - feedback to stabilise */ FeedbackStabilityDelay(); - } + } } return XUD_SetBuffer(ep0_in, (buffer, unsigned char[]), 0); } From 4ae9956a139baeff95eb0ae17f0648d1ee020f05 Mon Sep 17 00:00:00 2001 From: shuchitak Date: Thu, 20 Feb 2020 09:20:24 +0000 Subject: [PATCH 2/4] changelog + source check --- CHANGELOG.rst | 2 +- lib_xua/src/core/buffer/decouple/decouple.xc | 2 +- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h | 2 +- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a01c8c9d..115011b7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -21,7 +21,7 @@ lib_xua Change Log events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop * ADDED: Ability to read or modify vendor and product IDs - * ADDED: Support of variable USB sampling frequency + * ADDED: Override USB descriptor with sampling frequency and bit-resolution set at boot time. 0.2.1 ----- diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index d7634195..b6dffe51 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved #include "xua.h" #if XUA_USB_EN diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h index ab4c613d..f8c7cc33 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2014-2020, XMOS Ltd, All rights reserved #ifndef _AUDIOREQUESTS_H_ #define _AUDIOREQUESTS_H_ diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 2fdd434c..2ce05108 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /** * @brief Implements relevant requests from the USB Audio 2.0 Specification * @author Ross Owen, XMOS Semiconductor From b31028a3d65ebb2d7c7c50736f7b5ab95d95fa79 Mon Sep 17 00:00:00 2001 From: shuchitak Date: Thu, 20 Feb 2020 09:28:16 +0000 Subject: [PATCH 3/4] undo copyright change --- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h | 2 +- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h index f8c7cc33..ab4c613d 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020, XMOS Ltd, All rights reserved +// Copyright (c) 2014-2018, XMOS Ltd, All rights reserved #ifndef _AUDIOREQUESTS_H_ #define _AUDIOREQUESTS_H_ diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 2ce05108..2fdd434c 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved /** * @brief Implements relevant requests from the USB Audio 2.0 Specification * @author Ross Owen, XMOS Semiconductor From abbafba3a714db5b4a4996e0f42e8a81246d3dbf Mon Sep 17 00:00:00 2001 From: shuchitak Date: Thu, 20 Feb 2020 09:59:52 +0000 Subject: [PATCH 4/4] changelog and source --- CHANGELOG.rst | 3 ++- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h | 2 +- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 115011b7..863e2c29 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -21,7 +21,8 @@ lib_xua Change Log events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop * ADDED: Ability to read or modify vendor and product IDs - * ADDED: Override USB descriptor with sampling frequency and bit-resolution set at boot time. + * ADDED: Override USB descriptor with sampling frequency and + bit-resolution set at boot time. 0.2.1 ----- diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h index ab4c613d..f8c7cc33 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2014-2020, XMOS Ltd, All rights reserved #ifndef _AUDIOREQUESTS_H_ #define _AUDIOREQUESTS_H_ diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 2fdd434c..2ce05108 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /** * @brief Implements relevant requests from the USB Audio 2.0 Specification * @author Ross Owen, XMOS Semiconductor