From 8e861e0a5e9381eab58bfa8af7c11ae20bf12ff5 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Wed, 24 May 2017 10:45:56 +0100 Subject: [PATCH 1/4] DFU flash code run on tile[0] even if XUD_TILE and AUDIO_IO_TILE are not 0 --- CHANGELOG.rst | 1 + module_usb_audio/audio_io/audio_io.xc | 4 ++-- module_usb_audio/audio_io/xua_audio.h | 2 +- module_usb_audio/main.xc | 13 ++++++++++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e9482274..c77b3866 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ sc_usb_audio Change Log ----- - ADDED: DFU to UAC1 descriptors (guarded by DFU and FORCE_UAC1_DFU) - RESOLVED: Removed 'reinterpretation to type of larger alignment' warnings + - RESOLVED: DFU flash code run on tile[0] even if XUD_TILE and AUDIO_IO_TILE are not 0 7.1.0 ----- diff --git a/module_usb_audio/audio_io/audio_io.xc b/module_usb_audio/audio_io/audio_io.xc index e5e161c1..198ec462 100755 --- a/module_usb_audio/audio_io/audio_io.xc +++ b/module_usb_audio/audio_io/audio_io.xc @@ -1113,7 +1113,7 @@ chanend c_spdif_out, chanend c_dig_rx, #endif chanend ?c_config, chanend ?c -#if XUD_TILE != 0 +#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) , server interface i_dfu ?dfuInterface #endif #if (NUM_PDM_MICS > 0) @@ -1392,7 +1392,7 @@ chanend ?c_config, chanend ?c while (1) { -#if XUD_TILE != 0 +#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) [[combine]] par { diff --git a/module_usb_audio/audio_io/xua_audio.h b/module_usb_audio/audio_io/xua_audio.h index 12601237..0f7726b5 100644 --- a/module_usb_audio/audio_io/xua_audio.h +++ b/module_usb_audio/audio_io/xua_audio.h @@ -37,7 +37,7 @@ void audio(chanend c_in, chanend c_dig, #endif chanend ?c_config, chanend ?c_adc -#if (XUD_TILE != 0) +#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) , server interface i_dfu ?dfuInterface #endif #if (NUM_PDM_MICS > 0) diff --git a/module_usb_audio/main.xc b/module_usb_audio/main.xc index 45b47c67..0fafcbdc 100755 --- a/module_usb_audio/main.xc +++ b/module_usb_audio/main.xc @@ -415,7 +415,7 @@ void usb_audio_io(chanend c_aud_in, chanend ?c_adc, chanend ?c_adat_rx, chanend ?c_clk_ctl, chanend ?c_clk_int -#if (XUD_TILE != 0) +#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) , server interface i_dfu ?dfuInterface #endif #if (NUM_PDM_MICS > 0) @@ -459,7 +459,7 @@ void usb_audio_io(chanend c_aud_in, chanend ?c_adc, c_dig_rx, #endif c_aud_cfg, c_adc -#if XUD_TILE != 0 +#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) , dfuInterface #endif #if (NUM_PDM_MICS > 0) @@ -606,7 +606,7 @@ int main() , c_mix_ctl #endif ,c_aud_cfg, c_spdif_rx, c_adat_rx, c_clk_ctl, c_clk_int -#if XUD_TILE != 0 +#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) , dfuInterface #endif #if (NUM_PDM_MICS > 0) @@ -674,6 +674,13 @@ int main() } #endif +#if (XUD_TILE != 0 ) && (AUDIO_IO_TILE != 0) + /* Run flash code on its own - hope it gets combined */ +#warning Running DFU flash code on its own + on stdcore[0]: DFUHandler(dfuInterface, null); +#endif + + #if (NUM_PDM_MICS > 0) on stdcore[PDM_TILE]: pdm_mic(c_ds_output); #ifdef MIC_PROCESSING_USE_INTERFACE From b996cbc10cec92f63a5baffea8cf0be1c91e2a0c Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Wed, 24 May 2017 17:17:07 +0100 Subject: [PATCH 2/4] Update default product string to match SM+ pattern --- module_usb_audio/devicedefines.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module_usb_audio/devicedefines.h b/module_usb_audio/devicedefines.h index c9a195c5..f04bb4ad 100644 --- a/module_usb_audio/devicedefines.h +++ b/module_usb_audio/devicedefines.h @@ -479,19 +479,19 @@ /** * @brief Product string for Audio Class 2.0 mode. * - * Default: "xCore USB Audio 2.0" + * Default: "XMOS xCORE (UAC2.0)" */ #ifndef PRODUCT_STR_A2 -#define PRODUCT_STR_A2 "xCORE USB Audio 2.0" +#define PRODUCT_STR_A2 "XMOS xCORE (UAC2.0)" #endif /** * @brief Product string for Audio Class 1.0 mode * - * Default: "xCore USB Audio 1.0" + * Default: "XMOS xCORE (UAC1.0)" */ #ifndef PRODUCT_STR_A1 -#define PRODUCT_STR_A1 "xCORE USB Audio 1.0" +#define PRODUCT_STR_A1 "XMOS xCORE (UAC1.0)" #endif /** From 1a729e8eb732b2c83c7223efcc4801bdded81d94 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 25 May 2017 10:24:38 +0100 Subject: [PATCH 3/4] Added START_IN_DFU to host and xcore code --- module_dfu/host/xmos_dfu_osx/xmosdfu.cpp | 7 +++++-- module_dfu/src/dfu.xc | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/module_dfu/host/xmos_dfu_osx/xmosdfu.cpp b/module_dfu/host/xmos_dfu_osx/xmosdfu.cpp index da327ac7..1b48c0bc 100755 --- a/module_dfu/host/xmos_dfu_osx/xmosdfu.cpp +++ b/module_dfu/host/xmos_dfu_osx/xmosdfu.cpp @@ -351,7 +351,8 @@ int main(int argc, char **argv) { fprintf(stderr, "failed to initialise libusb\n"); return -1; } - +//#define START_IN_DFU 1 +#ifndef START_IN_DFU r = find_xmos_device(0, listdev); if (r < 0) { @@ -369,6 +370,7 @@ int main(int argc, char **argv) { return -1; } printf("XMOS DFU application started - Interface %d claimed\n", XMOS_DFU_IF); +#endif /* Dont go into DFU mode for save/restore */ if(save) @@ -382,17 +384,18 @@ int main(int argc, char **argv) { else if(!listdev) { +#ifndef START_IN_DFU printf("Detaching device from application mode.\n"); xmos_dfu_resetintodfu(XMOS_DFU_IF); libusb_release_interface(devh, XMOS_DFU_IF); libusb_close(devh); - printf("Waiting for device to restart and enter DFU mode...\n"); // Wait for device to enter dfu mode and restart system("sleep 20"); +#endif // NOW IN DFU APPLICATION MODE diff --git a/module_dfu/src/dfu.xc b/module_dfu/src/dfu.xc index 5a528334..34985cc9 100644 --- a/module_dfu/src/dfu.xc +++ b/module_dfu/src/dfu.xc @@ -339,7 +339,11 @@ int DFUReportResetState(chanend ?c_user_cmd) unsigned flag; flag = GetDFUFlag(); - //if (DFU_reset_override == 0x11042011) +//#define START_IN_DFU 1 +#ifdef START_IN_DFU + flag = 0x11042011; +#endif + if (flag == 0x11042011) { unsigned int cmd_data[16]; From f706e09d2ac914ada264f187aa1bc3c368f02cd8 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 25 May 2017 11:51:50 +0100 Subject: [PATCH 4/4] Added bus disconnect code to X200 reboot (see bugzilla #17377) --- module_usb_audio/reboot.xc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/module_usb_audio/reboot.xc b/module_usb_audio/reboot.xc index 7213db6d..461a8e95 100644 --- a/module_usb_audio/reboot.xc +++ b/module_usb_audio/reboot.xc @@ -7,6 +7,8 @@ #define XS1_SU_PERIPH_USB_ID 0x1 #if (XUD_SERIES_SUPPORT == XUD_X200_SERIES) +#include "xs2_su_registers.h" +#define XS2_SU_PERIPH_USB_ID 0x1 #define PLL_MASK 0x7FFFFFFF #else #define PLL_MASK 0xFFFFFFFF @@ -33,6 +35,12 @@ void device_reboot_aux(void) unsigned int tileId; unsigned int tileArrayLength; +#if (XUD_SERIES_SUPPORT == XUD_X200_SERIES) + /* 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); +#endif + /* Find size of tile array - note in future tools versions this will be available from platform.h */ asm volatile ("ldc %0, tile.globound":"=r"(tileArrayLength)); @@ -61,14 +69,6 @@ void device_reboot_aux(void) /* Reboots XMOS device by writing to the PLL config register */ void device_reboot(chanend spare) { -#if (XUD_SERIES_SUPPORT != XUD_U_SERIES) - //outct(spare, XS1_CT_END); // have to do this before freeing the chanend - //inct(spare); // Receive end ct from usb_buffer to close down in both directions - - /* Need a spare chanend so we can talk to the pll register */ - //asm("freer res[%0]"::"r"(spare)); -#endif device_reboot_aux(); - while(1); }