From 25d4a74b59b483aab4fec9cc6b523761ace674bb Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 9 Jun 2021 16:16:34 +0100 Subject: [PATCH 01/19] Replace NO_USB symbol with XUA_USB_EN --- lib_xua/src/dfu/dfu.xc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/dfu/dfu.xc b/lib_xua/src/dfu/dfu.xc index 1570c7eb..f486624f 100644 --- a/lib_xua/src/dfu/dfu.xc +++ b/lib_xua/src/dfu/dfu.xc @@ -5,7 +5,7 @@ #include #include -#ifndef NO_USB +#if XUA_USB_EN #include "xud_device.h" #include "dfu_types.h" #include "flash_interface.h" @@ -581,6 +581,6 @@ int DFUDeviceRequests(XUD_ep ep0_out, XUD_ep &?ep0_in, USB_SetupPacket_t &sp, ch } return returnVal; } -#endif /* NO_USB */ +#endif /* XUA_USB_EN */ #endif From 95b80ebf720864651be3f079545aa7e0c11060ca Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 9 Jun 2021 16:17:02 +0100 Subject: [PATCH 02/19] Fix incorrect comment --- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 89169336..18d53f4d 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -1285,4 +1285,4 @@ XUD_Result_t AudioClassRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket return XUD_RES_ERR; } #endif -#endif /* NO_USB */ +#endif /* XUA_USB_EN */ From 32e06c1ad2f9f9ff1cb50369173108a618658a37 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 9 Jun 2021 16:17:57 +0100 Subject: [PATCH 03/19] Remove XS1 support and reassign clock block in conflict on XS3 --- lib_xua/src/core/uac_hwresources.h | 36 ++---------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/lib_xua/src/core/uac_hwresources.h b/lib_xua/src/core/uac_hwresources.h index 0142a2a9..a0b82d58 100644 --- a/lib_xua/src/core/uac_hwresources.h +++ b/lib_xua/src/core/uac_hwresources.h @@ -4,46 +4,14 @@ #ifndef _UAC_HWRESOURCES_H_ #define _UAC_HWRESOURCES_H_ -#if XUA_USB_EN -#include "xud.h" /* XMOS USB Device Layer defines and functions */ -#endif - -#if ((XUD_SERIES_SUPPORT != XUD_U_SERIES) && (XUD_SERIES_SUPPORT != XUD_X200_SERIES)) - -/* XUD_L_SERIES and XUD_G_SERIES */ - -#if (AUDIO_IO_TILE == XUD_TILE) -/* Note: L series ref clocked clocked from USB clock when USB enabled - use another clockblock for MIDI - * if MIDI and XUD on same tile. See XUD documentation. - * - * This is a clash with S/PDIF Tx but simultaneous S/PDIF and MIDI not currently supported on single tile device - * - */ -#define CLKBLK_MIDI XS1_CLKBLK_1; -#else -#define CLKBLK_MIDI XS1_CLKBLK_REF; -#endif - -#define CLKBLK_SPDIF_TX XS1_CLKBLK_1 -#define CLKBLK_SPDIF_RX XS1_CLKBLK_1 -#define CLKBLK_MCLK XS1_CLKBLK_2 /* Note, potentially used twice */ -#define CLKBLK_ADAT_RX XS1_CLKBLK_3 -#define CLKBLK_USB_RST XS1_CLKBLK_4 /* Clock block passed into L/G series XUD */ -#define CLKBLK_FLASHLIB XS1_CLKBLK_5 /* Clock block for use by flash lib */ - -#define CLKBLK_I2S_BIT XS1_CLKBLK_3 - -#else - /* XUD_U_SERIES, XUD_X200_SERIES */ /* Note, U-series XUD uses clock blocks 4 and 5 - see XUD_Ports.xc */ #define CLKBLK_MIDI XS1_CLKBLK_REF; #define CLKBLK_SPDIF_TX XS1_CLKBLK_1 #define CLKBLK_SPDIF_RX XS1_CLKBLK_1 -#define CLKBLK_MCLK XS1_CLKBLK_2 /* Note, potentially used twice */ +#define CLKBLK_MCLK XS1_CLKBLK_4 #define CLKBLK_FLASHLIB XS1_CLKBLK_3 /* Clock block for use by flash lib */ #define CLKBLK_ADAT_RX XS1_CLKBLK_REF /* Use REF for ADAT_RX on U/x200 series */ -#define CLKBLK_I2S_BIT XS1_CLKBLK_3 -#endif +#define CLKBLK_I2S_BIT XS1_CLKBLK_5 #endif /* _UAC_HWRESOURCES_H_ */ From 3f3007c3ac1b9b672649f6e6935fa75fb362d167 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 9 Jun 2021 16:18:34 +0100 Subject: [PATCH 04/19] Remove arguments no longer used by XUD --- lib_xua/src/core/main.xc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index 421793f2..a16599f7 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -346,8 +346,7 @@ VENDOR_REQUESTS_PARAMS_DEC_ /* USB Interface Core */ XUD_Main(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN, - c_sof, epTypeTableOut, epTypeTableIn, p_usb_rst, - null, 0, usbSpeed, XUD_PWR_CFG); + c_sof, epTypeTableOut, epTypeTableIn, usbSpeed, XUD_PWR_CFG); } /* USB Packet buffering Core */ From 285be1cd7ae0735f72875026422e7e65cd9ef6d3 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 9 Jun 2021 16:29:08 +0100 Subject: [PATCH 05/19] Update dependency on lib_xud to v2.0.0 --- lib_xua/module_build_info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 39315c72..3154fbd1 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -2,7 +2,7 @@ VERSION = 1.3.0 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ - lib_xud(>=1.0.0) \ + lib_xud(>=2.0.0) \ lib_spdif(>=4.0.0) \ lib_mic_array(>=4.0.0) From e98c0b11bc39993d83ab79a6b330bb82633bbac4 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 9 Jun 2021 16:29:28 +0100 Subject: [PATCH 06/19] Add change log entries --- CHANGELOG.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 74f0cf97..83a7e990 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,10 @@ lib_xua Change Log * ADDED: Build default HID Report descriptor at boot-time * ADDED: Function to return length of HID Report * CHANGED: HID Report to return multiple bytes + * CHANGED: NO_USB conditional compilation switch with XUA_USB_EN + * REMOVED: XS1 support + * CHANGED: Clock blocks used for BCLK and MCLK + * REMOVED: Arguments no longer supported by XUD_Main 1.2.0 ----- From 00eb07e63784e928ad592260e393d715277ab22b Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 15 Jun 2021 16:25:19 +0100 Subject: [PATCH 07/19] Change MCLK clock block to avoid overlap with XUD --- tests/xua_unit_tests/src/xua_unit_test_helper.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/xua_unit_tests/src/xua_unit_test_helper.xc b/tests/xua_unit_tests/src/xua_unit_test_helper.xc index ccb35260..d4c2911c 100644 --- a/tests/xua_unit_tests/src/xua_unit_test_helper.xc +++ b/tests/xua_unit_tests/src/xua_unit_test_helper.xc @@ -13,7 +13,7 @@ in port p_mclk_in = XS1_PORT_1D; /* Clock-block declarations */ clock clk_audio_bclk = on tile[0]: XS1_CLKBLK_1; /* Bit clock */ -clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_3; /* Master clock */ +clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_4; /* Master clock */ // Supply missing but unused function void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned sampRes_DAC, unsigned sampRes_ADC) From 6f146cccbc8ce32a51cf299baa536f2e222d12f1 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 11:07:33 +0100 Subject: [PATCH 08/19] Remove XS1-specific power saving functionality --- .../support/powersave/archU_powerSaving.h | 11 --- .../support/powersave/archU_powerSaving.xc | 70 ------------------- 2 files changed, 81 deletions(-) delete mode 100644 lib_xua/src/core/support/powersave/archU_powerSaving.h delete mode 100644 lib_xua/src/core/support/powersave/archU_powerSaving.xc diff --git a/lib_xua/src/core/support/powersave/archU_powerSaving.h b/lib_xua/src/core/support/powersave/archU_powerSaving.h deleted file mode 100644 index 51f8281d..00000000 --- a/lib_xua/src/core/support/powersave/archU_powerSaving.h +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2013-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef ARCH_U_POWER_SAVING_ -#define ARCH_U_POWER_SAVING_ - -/* Sets the voltage down by VOLTAGE_REDUCTION_mV (voltage is set to 10 * X + 600 mV), - * and adjusts other features to save power - */ -void archU_powerSaving(); - -#endif /*ARCH_U_POWER_SAVING_*/ diff --git a/lib_xua/src/core/support/powersave/archU_powerSaving.xc b/lib_xua/src/core/support/powersave/archU_powerSaving.xc deleted file mode 100644 index e6cd04c5..00000000 --- a/lib_xua/src/core/support/powersave/archU_powerSaving.xc +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2013-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. - -#if (XUD_SERIES_SUPPORT==1) -#include "archU_powerSaving.h" -#include -#include -#include -#include - -#if (XCC_MAJOR_VERSION >= 1300) -#include -#else -#define hwtimer_t timer -#endif - -#ifndef VOLTAGE_REDUCTION_mV -#define VOLTAGE_REDUCTION_mV 20 -#endif - -unsigned get_tile_id(tileref t); // Required for use with 12.0 tools. get_tile_id() available in xs1.h with 13.0 tools. - -#define ARCH_U_VOLTAGE_FIRST_STEP 39 // First step down from 1V -#define ARCH_U_SSWITCH_PRESCALER 8 // Sswitch down to 1/8 clk freq - -void archU_powerSaving() -{ - if (get_local_tile_id() == get_tile_id(tile[0])) - { - unsigned writeval[1]; - unsigned char writevalc[1]; - - // Reduce the VDDCORE voltage level - for (unsigned count=0; count < (VOLTAGE_REDUCTION_mV/10); count++) - { - hwtimer_t t; - int time; - - writeval[0] = (ARCH_U_VOLTAGE_FIRST_STEP - count); - write_periph_32(usb_tile, XS1_SU_PER_PWR_CHANEND_NUM, XS1_SU_PER_PWR_VOUT1_LVL_NUM, 1, writeval); - - t :> time; - time += (1 * PLATFORM_REFERENCE_MHZ); // Wait 1us per step - t when timerafter(time) :> void; - } - - // Set switch prescaler down - write_node_config_reg(tile[0], XS1_SSWITCH_CLK_DIVIDER_NUM, (ARCH_U_SSWITCH_PRESCALER - 1)); // PLL clk will be divided by value + 1 - - // Both DC-DCs in PWM mode, I/O and PLL supply on, Analogue & core on - writeval[0] = XS1_SU_PWR_VOUT1_EN_SET(0, 1); - writeval[0] = XS1_SU_PWR_VOUT2_EN_SET(writeval[0], 1); - writeval[0] = XS1_SU_PWR_VOUT5_EN_SET(writeval[0], 1); - writeval[0] = XS1_SU_PWR_VOUT6_EN_SET(writeval[0], 1); - write_periph_32(usb_tile, XS1_SU_PER_PWR_CHANEND_NUM, XS1_SU_PER_PWR_STATE_AWAKE_NUM, 1, writeval); - - // USB suspend off, voltage adjustable, sleep clock 32KHz - writeval[0] = XS1_SU_PWR_USB_PD_EN_SET(0, 1); - writeval[0] = XS1_SU_PWR_RST_VOUT_LVL_SET(writeval[0], 1); - writeval[0] = XS1_SU_PWR_LD_AWAKE_SET(writeval[0], 1); - write_periph_32(usb_tile, XS1_SU_PER_PWR_CHANEND_NUM, XS1_SU_PER_PWR_MISC_CTRL_NUM, 1, writeval); - - // Turn off on-chip silicon oscillator (20MHz or 32KHz) - writevalc[0] = XS1_SU_ON_SI_OSC_EN_SET(0, 1); - writevalc[0] = XS1_SU_ON_SI_OSC_SLOW_SET(writevalc[0], 1); - write_periph_8(usb_tile, XS1_SU_PER_OSC_CHANEND_NUM, XS1_SU_PER_OSC_ON_SI_CTRL_NUM, 1, writevalc); - } -} -#endif - From 45671148d57e82cb425f6c1ce5f10b7cc8c134ff Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 11:16:45 +0100 Subject: [PATCH 09/19] Remove powersave directory from the list of include and source directories --- lib_xua/module_build_info | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 3154fbd1..b2a6e144 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -40,7 +40,6 @@ INCLUDE_DIRS = $(EXPORT_INCLUDE_DIRS) \ src/core/pdm_mics \ src/core/ports \ src/core/support \ - src/core/support/powersave \ src/core/user \ src/core/user/audiostream \ src/core/user/hid \ @@ -58,7 +57,6 @@ SOURCE_DIRS = src/core \ src/core/pdm_mics \ src/core/ports \ src/core/support \ - src/core/support/powersave \ src/core/user/audiostream \ src/core/user/hostactive \ src/core/xuduser \ From 0130d3fb32c076a448d3db6a7c341cd7831b835b Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 12:45:02 +0100 Subject: [PATCH 10/19] Define the XUD_CORE_CLOCK to avoid warnings --- legacy_tests/app_test_i2s_loopback/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/legacy_tests/app_test_i2s_loopback/Makefile b/legacy_tests/app_test_i2s_loopback/Makefile index 4f54fc80..81a8e145 100644 --- a/legacy_tests/app_test_i2s_loopback/Makefile +++ b/legacy_tests/app_test_i2s_loopback/Makefile @@ -3,7 +3,7 @@ TARGET = xk-audio-216-mc.xn USED_MODULES = lib_xua \ module_i2c_shared module_i2c_single_port lib_logging -BUILD_FLAGS = -O0 -g -lflash -DXUD_SERIES_SUPPORT=4 -fxscope -save-temps -march=xs2a -DUSB_TILE=tile[1] +BUILD_FLAGS = -O0 -g -lflash -DXUD_SERIES_SUPPORT=4 -DXUD_CORE_CLOCK=600 -fxscope -save-temps -march=xs2a -DUSB_TILE=tile[1] BUILD_FLAGS_i2s_master_2in_2out_48khz = $(BUILD_FLAGS) \ -D ADAT_RX=0 -D ADAT_TX=0 -D SPDIF_RX=0 -D SPDIF_TX=0 -D MIDI=0 \ From 5fe76d37207b17c6242f09c66740441057d596ea Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 12:45:21 +0100 Subject: [PATCH 11/19] Remove XS1 support --- lib_xua/src/core/support/reboot.xc | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/lib_xua/src/core/support/reboot.xc b/lib_xua/src/core/support/reboot.xc index d4c33d27..df6c7c18 100644 --- a/lib_xua/src/core/support/reboot.xc +++ b/lib_xua/src/core/support/reboot.xc @@ -38,22 +38,12 @@ static void reset_tile(unsigned const tileId) */ void device_reboot(void) { -#if (XUD_SERIES_SUPPORT == 1) - /* Disconnect from bus */ - unsigned data[] = {4}; - write_periph_32(usb_tile, XS1_SU_PERIPH_USB_ID, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 1, data); - - /* Ideally we would reset SU1 here but then we loose power to the xcore and therefore the DFU flag */ - /* Disable USB and issue reset to xcore only - not analogue chip */ - write_node_config_reg(usb_tile, XS1_SU_CFG_RST_MISC_NUM,0b10); -#else - unsigned int localTileId = get_local_tile_id(); unsigned int tileId; unsigned int tileArrayLength; unsigned int localTileNum; -#if (XUD_SERIES_SUPPORT == 4) +#if defined(__XS2A__) /* Disconnect from bus */ unsigned data[] = {4}; write_periph_32(usb_tile, XS2_SU_PERIPH_USB_ID, XS1_GLX_PER_UIFM_FUNC_CONTROL_NUM, 1, data); @@ -75,24 +65,14 @@ void device_reboot(void) } } -#if defined(__XS2A__) || defined(__XS3A__) /* Reset all even tiles, starting from the remote ones */ for(int tileNum = tileArrayLength-2; tileNum>=0; tileNum-=2) -#else - /* Reset all tiles, starting from the remote ones */ - for(int tileNum = tileArrayLength-1; tileNum>=0; tileNum--) -#endif { /* Cannot cast tileref to unsigned! */ tileId = get_tile_id(tile[tileNum]); /* Do not reboot local tile (or tiles residing on the same node) yet */ -#if defined(__XS2A__) || defined(__XS3A__) if((localTileNum | 1) != (tileNum | 1)) - -#else - if(localTileNum != tileNum) -#endif { reset_tile(tileId); } @@ -100,7 +80,6 @@ void device_reboot(void) /* Finally reboot the node this tile resides on */ reset_tile(localTileId); -#endif while (1); } From a237472efbeb99394a8aac738babe2b290fba1fb Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 13:07:49 +0100 Subject: [PATCH 12/19] Define XUD_CORE_CLOCK to avoid warnings --- examples/AN00246_xua_example/Makefile | 3 ++- examples/AN00247_xua_example_spdif_tx/Makefile | 4 ++-- examples/AN00248_xua_example_pdm_mics/Makefile | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/AN00246_xua_example/Makefile b/examples/AN00246_xua_example/Makefile index 699e31b2..35489717 100644 --- a/examples/AN00246_xua_example/Makefile +++ b/examples/AN00246_xua_example/Makefile @@ -4,7 +4,8 @@ TARGET = xk-audio-216-mc.xn # The flags passed to xcc when building the application XCC_FLAGS = -fcomment-asm -Xmapper --map -Xmapper MAPFILE -O3 -report -save-temps \ - -g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DUSB_TILE=tile[1] -fxscope + -g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES \ + -DXUD_CORE_CLOCK=600 -DUSB_TILE=tile[1] -fxscope #-DSDA_HIGH=2 -DSCL_HIGH=1 -fxscope diff --git a/examples/AN00247_xua_example_spdif_tx/Makefile b/examples/AN00247_xua_example_spdif_tx/Makefile index 2003fdd8..f5b953ec 100644 --- a/examples/AN00247_xua_example_spdif_tx/Makefile +++ b/examples/AN00247_xua_example_spdif_tx/Makefile @@ -4,8 +4,8 @@ TARGET = xk-audio-216-mc.xn # The flags passed to xcc when building the application XCC_FLAGS = -fcomment-asm -Xmapper --map -Xmapper MAPFILE -O3 -report -save-temps \ - -g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DUSB_TILE=tile[1] \ - -DSDA_HIGH=2 -DSCL_HIGH=1 -fxscope + -g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES \ + -DXUD_CORE_CLOCK=600 -DUSB_TILE=tile[1] -DSDA_HIGH=2 -DSCL_HIGH=1 -fxscope # The USED_MODULES variable lists other module used by the application. These # modules will extend the SOURCE_DIRS, INCLUDE_DIRS and LIB_DIRS variables. diff --git a/examples/AN00248_xua_example_pdm_mics/Makefile b/examples/AN00248_xua_example_pdm_mics/Makefile index 9eefd8bc..e14afb94 100644 --- a/examples/AN00248_xua_example_pdm_mics/Makefile +++ b/examples/AN00248_xua_example_pdm_mics/Makefile @@ -4,8 +4,8 @@ TARGET = mic_array_ref.xn # The flags passed to xcc when building the application XCC_FLAGS = -fcomment-asm -Xmapper --map -Xmapper MAPFILE -O3 -report -save-temps \ - -g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DUSB_TILE=tile[1] \ - -DSDA_HIGH=2 -DSCL_HIGH=1 -fxscope + -g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES \ + -DXUD_CORE_CLOCK=600 -DUSB_TILE=tile[1] -DSDA_HIGH=2 -DSCL_HIGH=1 -fxscope # The USED_MODULES variable lists other module used by the application. These # modules will extend the SOURCE_DIRS, INCLUDE_DIRS and LIB_DIRS variables. From f01bf03605f69651eaa3c54bec13d670c1959165 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 13:08:22 +0100 Subject: [PATCH 13/19] Remove arguments no longer supported by XUD --- examples/AN00246_xua_example/src/app_xua_simple.xc | 1 - examples/AN00247_xua_example_spdif_tx/src/app_xua_simple.xc | 2 +- examples/AN00248_xua_example_pdm_mics/src/app_xua_simple.xc | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/AN00246_xua_example/src/app_xua_simple.xc b/examples/AN00246_xua_example/src/app_xua_simple.xc index 131a04db..f8302423 100644 --- a/examples/AN00246_xua_example/src/app_xua_simple.xc +++ b/examples/AN00246_xua_example/src/app_xua_simple.xc @@ -60,7 +60,6 @@ int main() /* Low level USB device layer core */ on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_SELF); /* Endpoint 0 core from lib_xua */ diff --git a/examples/AN00247_xua_example_spdif_tx/src/app_xua_simple.xc b/examples/AN00247_xua_example_spdif_tx/src/app_xua_simple.xc index 704479b8..d19f52c3 100644 --- a/examples/AN00247_xua_example_spdif_tx/src/app_xua_simple.xc +++ b/examples/AN00247_xua_example_spdif_tx/src/app_xua_simple.xc @@ -61,7 +61,7 @@ int main() par { /* Low level USB device layer core */ - on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_SELF); + on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_SELF); /* Endpoint 0 core from lib_xua */ /* Note, since we are not using many features we pass in null for quite a few params.. */ diff --git a/examples/AN00248_xua_example_pdm_mics/src/app_xua_simple.xc b/examples/AN00248_xua_example_pdm_mics/src/app_xua_simple.xc index 6b7b299e..a3263ac8 100644 --- a/examples/AN00248_xua_example_pdm_mics/src/app_xua_simple.xc +++ b/examples/AN00248_xua_example_pdm_mics/src/app_xua_simple.xc @@ -65,7 +65,7 @@ int main() par { /* Low level USB device layer core */ - on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, c_sof, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); /* Endpoint 0 core from lib_xua */ /* Note, since we are not using many features we pass in null for quite a few params.. */ From a3617a641f9ee908cc0cb81e1f2f77982a265303 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 13:33:26 +0100 Subject: [PATCH 14/19] Remove XS1 support --- lib_xua/src/core/support/reboot.xc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_xua/src/core/support/reboot.xc b/lib_xua/src/core/support/reboot.xc index df6c7c18..d7475eae 100644 --- a/lib_xua/src/core/support/reboot.xc +++ b/lib_xua/src/core/support/reboot.xc @@ -10,13 +10,9 @@ //Normally we would enumerate the XUD_SERIES_SUPPORT possibilities using defines in //xud.h but we have hard coded them to remove dependancy of sc_xud -#if (XUD_SERIES_SUPPORT == 4) #include "xs2_su_registers.h" #define XS2_SU_PERIPH_USB_ID 0x1 #define PLL_MASK 0x3FFFFFFF -#else -#define PLL_MASK 0xFFFFFFFF -#endif /* Note, this function is prototyped in xs1.h only from 13 tools onwards */ unsigned get_tile_id(tileref); From ada99bd1d9a695ca813a6c4abbc25334c18b9a8c Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 14:46:02 +0100 Subject: [PATCH 15/19] Remove XS1 support and tidy up white space --- lib_xua/src/core/main.xc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index a16599f7..afa1602e 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -187,20 +187,20 @@ on tile[XUD_TILE] : clock clk_spd_rx = CLKBLK_SPDIF_RX; #endif #if (XUA_NUM_PDM_MICS > 0) -in port p_pdm_clk = PORT_PDM_CLK; +in port p_pdm_clk = PORT_PDM_CLK; -in buffered port:32 p_pdm_mics = PORT_PDM_DATA; +in buffered port:32 p_pdm_mics = PORT_PDM_DATA; #if (PDM_TILE != AUDIO_IO_TILE) /* If Mics and I2S are not the same tile we need a separate MCLK port */ -in port p_pdm_mclk = PORT_PDM_MCLK; +in port p_pdm_mclk = PORT_PDM_MCLK; #endif #endif -#if(XUD_SERIES_SUPPORT == XUD_L_SERIES) && (ADAT_RX) +#if (defined(__XS2A__) && (ADAT_RX)) /* Cannot use default clock (CLKBLK_REF) for ADAT RX since it is tied to the -60MHz USB clock on G/L series parts. */ +60MHz USB clock on XS2 processors. */ on tile[XUD_TILE] : clock clk_adat_rx = CLKBLK_ADAT_RX; #endif @@ -212,15 +212,14 @@ on tile[XUD_TILE] : clock clk_audio_mclk_usb = CLKBLK_MCLK; on tile[XUD_TILE] : in port p_mclk_in_usb = PORT_MCLK_IN_USB; #endif -on tile[AUDIO_IO_TILE] : clock clk_audio_bclk = CLKBLK_I2S_BIT; /* Bit clock */ +on tile[AUDIO_IO_TILE] : clock clk_audio_bclk = CLKBLK_I2S_BIT; /* Bit clock */ /* L/G Series needs a port to use for USB reset */ -#if (XUD_SERIES_SUPPORT != XUD_U_SERIES) && defined(PORT_USB_RESET) +#if ((defined(__XS2A__) || defined (__XS3A__)) && defined(PORT_USB_RESET)) /* This define is checked since it could be on a shift reg or similar */ on tile[XUD_TILE] : out port p_usb_rst = PORT_USB_RESET; #else -/* Reset port not required for U series due to built in Phy */ #define p_usb_rst null #endif @@ -726,8 +725,8 @@ int main() { set_thread_fast_mode_on(); -#if(XUD_SERIES_SUPPORT == XUD_L_SERIES) - /* Can't use REF clock on L-series as this is usb clock */ +#if defined(__XS2A__) + /* Can't use REF clock as this is usb clock */ set_port_clock(p_adat_rx, clk_adat_rx); start_clock(clk_adat_rx); #endif From 0f0e8506b3a6e66e6cd2f2df808336078c3b84af Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 14:46:31 +0100 Subject: [PATCH 16/19] Remove unused symbol and obsolete comment --- lib_xua/src/core/support/reboot.xc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib_xua/src/core/support/reboot.xc b/lib_xua/src/core/support/reboot.xc index d7475eae..7c78928e 100644 --- a/lib_xua/src/core/support/reboot.xc +++ b/lib_xua/src/core/support/reboot.xc @@ -5,11 +5,6 @@ #include #include -#define XS1_SU_PERIPH_USB_ID 0x1 - -//Normally we would enumerate the XUD_SERIES_SUPPORT possibilities using defines in -//xud.h but we have hard coded them to remove dependancy of sc_xud - #include "xs2_su_registers.h" #define XS2_SU_PERIPH_USB_ID 0x1 #define PLL_MASK 0x3FFFFFFF From 4dbe332b2cdec04fd96f74fac442142c9da42cc0 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 14:47:03 +0100 Subject: [PATCH 17/19] Add XS3 support and remove XS1 support --- lib_xua/src/dfu/dfu.xc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib_xua/src/dfu/dfu.xc b/lib_xua/src/dfu/dfu.xc index f486624f..43064281 100644 --- a/lib_xua/src/dfu/dfu.xc +++ b/lib_xua/src/dfu/dfu.xc @@ -11,13 +11,11 @@ #include "flash_interface.h" #include "dfu_interface.h" -#if (XUD_SERIES_SUPPORT==4) -/* xCORE-200 */ +#if defined(__XS3A__) +#define FLAG_ADDRESS 0xfffcc +#elif defined(__XS2A__) /* Note range 0x7FFC8 - 0x7FFFF guarenteed to be untouched by tools */ #define FLAG_ADDRESS 0x7ffcc -#else -/* Note range 0x1FFC8 - 0x1FFFF guarenteed to be untouched by tools */ -#define FLAG_ADDRESS 0x1ffcc #endif /* Store Flag to fixed address */ From 5ea315fee83eb68a95d6e531696316d7406f108a Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 14:56:57 +0100 Subject: [PATCH 18/19] Remove unused variable --- examples/AN00247_xua_example_spdif_tx/src/hwsupport.xc | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/AN00247_xua_example_spdif_tx/src/hwsupport.xc b/examples/AN00247_xua_example_spdif_tx/src/hwsupport.xc index 203fa38e..84e0464b 100644 --- a/examples/AN00247_xua_example_spdif_tx/src/hwsupport.xc +++ b/examples/AN00247_xua_example_spdif_tx/src/hwsupport.xc @@ -22,7 +22,6 @@ out port p_gpio = on tile[0]:XS1_PORT_8C; void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned sampRes_DAC, unsigned sampRes_ADC) { - unsigned char data[1] = {0}; unsigned char gpioVal = 0; /* Set master clock select appropriately and put ADC and DAC into reset */ From 01c2874953cbb1fa543a8ef75e1b94ddcd05f89c Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 16 Jun 2021 16:16:13 +0100 Subject: [PATCH 19/19] Added warning when re-booting and XS3 part --- lib_xua/src/core/support/reboot.xc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_xua/src/core/support/reboot.xc b/lib_xua/src/core/support/reboot.xc index 7c78928e..e3f4eb2a 100644 --- a/lib_xua/src/core/support/reboot.xc +++ b/lib_xua/src/core/support/reboot.xc @@ -38,6 +38,8 @@ void device_reboot(void) /* Disconnect from bus */ unsigned data[] = {4}; write_periph_32(usb_tile, XS2_SU_PERIPH_USB_ID, XS1_GLX_PER_UIFM_FUNC_CONTROL_NUM, 1, data); +#elif defined(__XS3A__) + #warning Assuming that tile reset also resets USB in XS3 architectures #endif tileArrayLength = sizeof(tile)/sizeof(tileref);