undo changes in xua_ep0_uacreqs

This commit is contained in:
shuchitak
2020-02-19 15:45:58 +00:00
parent c63df2e961
commit be45d04423

View File

@@ -17,13 +17,6 @@
#ifdef MIXER #ifdef MIXER
#include "mixer.h" #include "mixer.h"
#endif #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) #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]; extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS];
#endif #endif
/* Global var for current frequency, set to default freq */ /* Global var for current frequency, set to default freq */
#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) unsigned int g_curSamFreq = DEFAULT_FREQ;
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
#if 0 #if 0
unsigned int g_curSamFreq48000Family = DEFAULT_FREQ % 48000 == 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.Recipient = Endpoint
* bmRequestType.Type = Class * bmRequestType.Type = Class
* endpoint (wIndex & 0xff) is 0x01 or 0x82 * endpoint (wIndex & 0xff) is 0x01 or 0x82
* wIndex is endpoint address for distinguishing input and output
*/ */
XUD_Result_t result; 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 */ /* Recontruct sample-freq */
int newSampleRate = (buffer, unsigned char[])[0] | ((buffer, unsigned char[])[1] << 8) | ((buffer, unsigned char[])[2] << 16); 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)) || \ if(newSampleRate != g_curSamFreq)
((sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO) && (newSampleRate != g_curUSBout_SamFreq)))
{ {
int curSamFreq44100Family; int curSamFreq44100Family;
int curSamFreq48000Family; 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(curSamFreq48000Family || curSamFreq44100Family)
{ {
if(sp.wIndex == ENDPOINT_ADDRESS_IN_AUDIO){ g_curSamFreq = newSampleRate;
g_curUSBin_SamFreq = newSampleRate;
/* Instruct audio thread to change sample freq */ /* Instruct audio thread to change sample freq */
outuint(c_audioControl, SET_SAMPLE_FREQ); outuint(c_audioControl, SET_SAMPLE_FREQ);
outuint(c_audioControl, g_curUSBin_SamFreq); outuint(c_audioControl, g_curSamFreq);
}
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);
}
/* Wait for handshake back - i.e. pll locked and clocks okay */ /* Wait for handshake back - i.e. pll locked and clocks okay */
chkct(c_audioControl, XS1_CT_END); chkct(c_audioControl, XS1_CT_END);
/* Allow time for the change - feedback to stabilise */ /* Allow time for the change - feedback to stabilise */
FeedbackStabilityDelay(); FeedbackStabilityDelay();
} }
} }
return XUD_SetBuffer(ep0_in, (buffer, unsigned char[]), 0); return XUD_SetBuffer(ep0_in, (buffer, unsigned char[]), 0);
} }