Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
@@ -9,6 +9,8 @@ lib_xua Change Log
|
||||
* CHANGED: Explicit feedback EP enabled by default (see
|
||||
UAC_FORCE_FEEDBACK_EP)
|
||||
* FIXED: Incorrect conditional compilation of HID report code
|
||||
* FIXED: Input/output descriptors written when input/output not enabled. (Audio
|
||||
class 1.0 mode using XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES)
|
||||
|
||||
* Changes to dependencies:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
#include <xs1.h>
|
||||
@@ -665,7 +665,7 @@ void clockGen (streaming chanend ?c_spdif_rx, chanend ?c_adat_rx, out port p, ch
|
||||
/* Inspect for if we need to produce an edge */
|
||||
if ((adatCounters.receivedSamples >= adatCounters.samplesPerTick))
|
||||
{
|
||||
/* Check edge is about right... S/PDIF may have changed freq... */
|
||||
/* Check edge is about right... ADAT may have changed freq... */
|
||||
if (timeafter(adatReceivedTime, (timeLastEdge + LOCAL_CLOCK_INCREMENT - LOCAL_CLOCK_MARGIN)))
|
||||
{
|
||||
/* Record edge time */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
/**
|
||||
* @brief Implements endpoint zero for an USB Audio 1.0/2.0 device
|
||||
@@ -492,37 +492,44 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(c
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES //change USB descriptor frequencies and bit resolution values here
|
||||
#ifdef XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES //change USB descriptor frequencies and bit resolution values here
|
||||
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_device_to_usb_bit_res() >> 3; //sub frame rate = bit rate /8
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_device_to_usb_bit_res() & 0xff); //bit resolution
|
||||
const int num_of_usb_descriptor_freq = 3; //This should be =3 according to the comments "using a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h
|
||||
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_usb_to_device_bit_res() >> 3; //sub frame rate = bit rate /8
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_usb_to_device_bit_res() & 0xff); //bit resolution
|
||||
#if( 0 < NUM_USB_CHAN_IN )
|
||||
|
||||
const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "using a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h
|
||||
int i=0;
|
||||
for(i=0;i<num_of_usb_descriptor_freq;i++)
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_device_to_usb_bit_res() >> 3; //sub frame rate = bit rate /8
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_device_to_usb_bit_res() & 0xff); //bit resolution
|
||||
|
||||
for(int i=0;i<num_of_usb_descriptor_freq;i++)
|
||||
{
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = get_device_to_usb_rate() & 0xff;
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (get_device_to_usb_rate() & 0xff00)>> 8;
|
||||
cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (get_device_to_usb_rate() & 0xff0000)>> 16;
|
||||
}
|
||||
cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size
|
||||
cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size
|
||||
|
||||
for(i=0;i<num_of_usb_descriptor_freq;i++)
|
||||
#endif // NUM_USB_CHAN_IN
|
||||
|
||||
#if( 0 < NUM_USB_CHAN_OUT )
|
||||
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_usb_to_device_bit_res() >> 3; //sub frame rate = bit rate /8
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_usb_to_device_bit_res() & 0xff); //bit resolution
|
||||
|
||||
for(int i=0;i<num_of_usb_descriptor_freq;i++)
|
||||
{
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = get_usb_to_device_rate() & 0xff;
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (get_usb_to_device_rate() & 0xff00)>> 8;
|
||||
cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (get_usb_to_device_rate() & 0xff0000)>> 16;
|
||||
}
|
||||
|
||||
cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size
|
||||
cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size
|
||||
|
||||
cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size
|
||||
cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size
|
||||
cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size
|
||||
cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size
|
||||
#endif // NUM_USB_CHAN_OUT
|
||||
|
||||
#endif
|
||||
#endif // XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES
|
||||
|
||||
#if( 0 < HID_CONTROLS )
|
||||
hidReportInit();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright 2011-2021 XMOS LIMITED.
|
||||
// Copyright 2011-2022 XMOS LIMITED.
|
||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||
|
||||
|
||||
#include <xs1.h>
|
||||
#include <print.h>
|
||||
#include "xua.h"
|
||||
@@ -15,7 +13,6 @@
|
||||
/* FAST_MIXER has a bit of a nasty implentation but is more effcient */
|
||||
#define FAST_MIXER 1
|
||||
|
||||
|
||||
//#ifdef OUT_VOLUME_IN_MIXER
|
||||
static unsigned int multOut_array[NUM_USB_CHAN_OUT + 1];
|
||||
static xc_ptr multOut;
|
||||
@@ -252,51 +249,53 @@ static inline void GetSamplesFromHost(chanend c)
|
||||
#pragma unsafe arrays
|
||||
static inline void GiveSamplesToDevice(chanend c, xc_ptr ptr, xc_ptr multOut)
|
||||
{
|
||||
{
|
||||
#if(NUM_USB_CHAN_OUT == 0)
|
||||
outuint(c, 0);
|
||||
#else
|
||||
#pragma loop unroll
|
||||
for (int i=0; i<NUM_USB_CHAN_OUT; i++)
|
||||
{
|
||||
int sample, x;
|
||||
for (int i=0; i<NUM_USB_CHAN_OUT; i++)
|
||||
{
|
||||
int sample, x;
|
||||
#if defined(OUT_VOLUME_IN_MIXER) && defined(OUT_VOLUME_AFTER_MIX)
|
||||
int mult;
|
||||
int h;
|
||||
unsigned l;
|
||||
int mult;
|
||||
int h;
|
||||
unsigned l;
|
||||
#endif
|
||||
int index;
|
||||
int index;
|
||||
|
||||
#if MAX_MIX_COUNT > 0
|
||||
/* If mixer turned on sort out the channel mapping */
|
||||
/* If mixer turned on sort out the channel mapping */
|
||||
|
||||
/* Read pointer to sample from the map */
|
||||
read_via_xc_ptr_indexed(index, ptr, i);
|
||||
/* Read pointer to sample from the map */
|
||||
read_via_xc_ptr_indexed(index, ptr, i);
|
||||
|
||||
/* Read the actual sample value */
|
||||
read_via_xc_ptr_indexed(sample, samples, index);
|
||||
/* Read the actual sample value */
|
||||
read_via_xc_ptr_indexed(sample, samples, index);
|
||||
#else
|
||||
unsafe
|
||||
{
|
||||
/* Read the actual sample value */
|
||||
sample = ptr_samples[i];
|
||||
}
|
||||
unsafe
|
||||
{
|
||||
/* Read the actual sample value */
|
||||
sample = ptr_samples[i];
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(OUT_VOLUME_IN_MIXER) && defined(OUT_VOLUME_AFTER_MIX)
|
||||
/* Do volume control processing */
|
||||
/* Do volume control processing */
|
||||
#warning OUT Vols in mixer, AFTER mix & map
|
||||
read_via_xc_ptr_indexed(mult, multOut, i);
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
h<<=3; // Shift used to be done in audio thread but now done here incase of 32bit support
|
||||
read_via_xc_ptr_indexed(mult, multOut, i);
|
||||
{h, l} = macs(mult, sample, 0, 0);
|
||||
h<<=3; // Shift used to be done in audio thread but now done here incase of 32bit support
|
||||
#error
|
||||
#if (STREAM_FORMAT_OUTPUT_RESOLUTION_32BIT_USED == 1)
|
||||
h |= (l >>29)& 0x7; // Note: This step is not required if we assume sample depth is 24bit (rather than 32bit)
|
||||
// Note: We need all 32bits for Native DSD
|
||||
h |= (l >>29)& 0x7; // Note: This step is not required if we assume sample depth is 24bit (rather than 32bit)
|
||||
// Note: We need all 32bits for Native DSD
|
||||
#endif
|
||||
outuint(c, h);
|
||||
outuint(c, h);
|
||||
#else
|
||||
outuint(c, sample);
|
||||
outuint(c, sample);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#pragma unsafe arrays
|
||||
@@ -603,9 +602,6 @@ static void mixer1(chanend c_host, chanend c_mix_ctl, chanend c_mixer2)
|
||||
}
|
||||
#else /* IF MAX_MIX_COUNT > 0 */
|
||||
/* No mixes, this thread runs on its own doing just volume */
|
||||
#if(NUM_USB_CHAN_OUT == 0)
|
||||
outuint(c_mixer2, 0);
|
||||
#endif
|
||||
GiveSamplesToDevice(c_mixer2, samples_to_device_map, multOut);
|
||||
GetSamplesFromDevice(c_mixer2);
|
||||
GetSamplesFromHost(c_host);
|
||||
|
||||
Reference in New Issue
Block a user