Merge branch 'develop' into xross-patch-2

This commit is contained in:
oscarbailey-xmos
2020-12-08 15:55:27 +00:00
committed by GitHub
29 changed files with 2348 additions and 69 deletions

View File

@@ -36,9 +36,10 @@ extern unsigned int g_curSamFreqMultiplier;
#define SET_SHARED_GLOBAL0(x,y) SET_SHARED_GLOBAL(x,y)
#endif
/* Global var for speed. Related to feedback. Used by input stream to determine IN packet size */
unsigned g_speed;
/* Initialise g_speed now so we get a sensible packet size until we start properly calculating feedback in the SoF case */
/* Without this, zero size input packets fill the input FIFO and it takes a long time to clear out when feedback starts */
/* This can cause a delay to the decouple ISR being serviced pushing our I2S timing. Initialising solves this */
unsigned g_speed = (AUDIO_CLASS == 2) ? (DEFAULT_FREQ/8000) << 16 : (DEFAULT_FREQ/1000) << 16;
unsigned g_freqChange = 0;
unsigned feedbackValid = 0;

View File

@@ -118,6 +118,9 @@ char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A2;
char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A1;
#endif
/* Global variable for current USB Serial Number strings */
char g_serial_str[XUA_MAX_STR_LEN] = SERIAL_STR;
/* Subslot */
const unsigned g_subSlot_Out_HS[OUTPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES,
#if(OUTPUT_FORMAT_COUNT > 1)
@@ -289,6 +292,9 @@ void XUA_Endpoint0_setStrTable() {
concatenateAndCopyStrings(g_product_str, "", g_strTable.usbInputTermStr_Audio2);
concatenateAndCopyStrings(g_product_str, "", g_strTable.usbOutputTermStr_Audio2);
#endif
// update Serial strings
concatenateAndCopyStrings(g_serial_str, "", g_strTable.serialStr);
}
void XUA_Endpoint0_setVendorStr(char* vendor_str) {
@@ -301,6 +307,11 @@ void XUA_Endpoint0_setProductStr(char* product_str) {
concatenateAndCopyStrings(product_str, "", g_product_str);
}
void XUA_Endpoint0_setSerialStr(char* serial_str) {
debug_printf("XUA_Endpoint0_setSerialStr() with string %s\n", serial_str);
concatenateAndCopyStrings(serial_str, "", g_serial_str);
}
char* XUA_Endpoint0_getVendorStr() {
return g_strTable.vendorStr;
}
@@ -313,6 +324,10 @@ char* XUA_Endpoint0_getProductStr() {
#endif
}
char* XUA_Endpoint0_getSerialStr() {
return g_strTable.serialStr;
}
void XUA_Endpoint0_setProductId(unsigned short pid) {
#if (AUDIO_CLASS == 1)
devDesc_Audio1.idProduct = pid;

View File

@@ -40,6 +40,7 @@
#define XUA_CTRL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\08"
#define XUA_MIDI_OUT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\09"
#define XUA_MIDI_IN_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a"
#define XUA_SERIAL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0b"
// The value below must match the length of XUA_DESCR_EMPTY_STRING.
#define XUA_MAX_STR_LEN (32)
@@ -334,7 +335,7 @@ StringDescTable_t g_strTable =
{
.langID = "\x09\x04", /* US English */
.vendorStr = XUA_VENDOR_EMPTY_STRING,
.serialStr = "",
.serialStr = XUA_SERIAL_EMPTY_STRING,
#if (AUDIO_CLASS == 2)
.productStr_Audio2 = XUA_PRODUCT_EMPTY_STRING,
.outputInterfaceStr_Audio2 = XUA_PRODUCT_EMPTY_STRING,
@@ -434,7 +435,7 @@ USB_Descriptor_Device_t devDesc_Audio1 =
.bcdDevice = BCD_DEVICE,
.iManufacturer = offsetof(StringDescTable_t, vendorStr)/sizeof(char *),
.iProduct = offsetof(StringDescTable_t, productStr_Audio1)/sizeof(char *),
.iSerialNumber = 0,
.iSerialNumber = offsetof(StringDescTable_t, serialStr)/sizeof(char *),
.bNumConfigurations = 1
};
#endif
@@ -470,7 +471,7 @@ USB_Descriptor_Device_t devDesc_Audio2 =
.bcdDevice = BCD_DEVICE,
.iManufacturer = offsetof(StringDescTable_t, vendorStr)/sizeof(char *),
.iProduct = offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *),
.iSerialNumber = 0,
.iSerialNumber = offsetof(StringDescTable_t, serialStr)/sizeof(char *),
.bNumConfigurations = 0x02 /* Set to 2 such that windows does not load composite driver */
};
@@ -493,7 +494,7 @@ unsigned char devDesc_Null[] =
(BCD_DEVICE >> 8), /* 13 bcdDevice : Device release number */
offsetof(StringDescTable_t, vendorStr)/sizeof(char *),
offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *),
0, /* 16 iSerialNumber : Index of serial number decriptor */
offsetof(StringDescTable_t, serialStr)/sizeof(char *), /* 16 iSerialNumber : Index of serial number decriptor */
0x01 /* 17 bNumConfigurations : Number of possible configs */
};
#endif

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2015-2019, XMOS Ltd, All rights reserved
// Copyright (c) 2015-2020, XMOS Ltd, All rights reserved
#include "xua.h"
@@ -115,7 +115,7 @@ void XUA_PdmBuffer(streaming chanend c_ds_output[2], chanend c_audio)
dc[1].mic_gain_compensation[2]=0;
dc[1].mic_gain_compensation[3]=0;
dc[1].channel_count = 4;
dc[0].async_interface_enabled = 0;
dc[1].async_interface_enabled = 0;
mic_array_decimator_configure(c_ds_output, decimatorCount, dc);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved
// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved
#include <xs1.h>
#include <platform.h>
#include <print.h>
@@ -61,7 +61,7 @@ unsigned int divide, unsigned curSamFreq)
}
#endif
#if defined(__XS2A__)
#if defined(__XS2A__) || defined(__XS3A__)
unsafe
{
/* Clock bitclock clock block from master clock pin (divided) */