Merge branch 'master' into pdm_replay

This commit is contained in:
Brendon Le Comte
2017-05-25 13:36:53 +01:00
committed by GitHub
8 changed files with 37 additions and 22 deletions

View File

@@ -5,6 +5,7 @@ sc_usb_audio Change Log
----- -----
- ADDED: DFU to UAC1 descriptors (guarded by DFU and FORCE_UAC1_DFU) - ADDED: DFU to UAC1 descriptors (guarded by DFU and FORCE_UAC1_DFU)
- RESOLVED: Removed 'reinterpretation to type of larger alignment' warnings - 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 7.1.0
----- -----

View File

@@ -351,7 +351,8 @@ int main(int argc, char **argv) {
fprintf(stderr, "failed to initialise libusb\n"); fprintf(stderr, "failed to initialise libusb\n");
return -1; return -1;
} }
//#define START_IN_DFU 1
#ifndef START_IN_DFU
r = find_xmos_device(0, listdev); r = find_xmos_device(0, listdev);
if (r < 0) if (r < 0)
{ {
@@ -369,6 +370,7 @@ int main(int argc, char **argv) {
return -1; return -1;
} }
printf("XMOS DFU application started - Interface %d claimed\n", XMOS_DFU_IF); printf("XMOS DFU application started - Interface %d claimed\n", XMOS_DFU_IF);
#endif
/* Dont go into DFU mode for save/restore */ /* Dont go into DFU mode for save/restore */
if(save) if(save)
@@ -382,17 +384,18 @@ int main(int argc, char **argv) {
else if(!listdev) else if(!listdev)
{ {
#ifndef START_IN_DFU
printf("Detaching device from application mode.\n"); printf("Detaching device from application mode.\n");
xmos_dfu_resetintodfu(XMOS_DFU_IF); xmos_dfu_resetintodfu(XMOS_DFU_IF);
libusb_release_interface(devh, XMOS_DFU_IF); libusb_release_interface(devh, XMOS_DFU_IF);
libusb_close(devh); libusb_close(devh);
printf("Waiting for device to restart and enter DFU mode...\n"); printf("Waiting for device to restart and enter DFU mode...\n");
// Wait for device to enter dfu mode and restart // Wait for device to enter dfu mode and restart
system("sleep 20"); system("sleep 20");
#endif
// NOW IN DFU APPLICATION MODE // NOW IN DFU APPLICATION MODE

View File

@@ -339,7 +339,11 @@ int DFUReportResetState(chanend ?c_user_cmd)
unsigned flag; unsigned flag;
flag = GetDFUFlag(); flag = GetDFUFlag();
//if (DFU_reset_override == 0x11042011) //#define START_IN_DFU 1
#ifdef START_IN_DFU
flag = 0x11042011;
#endif
if (flag == 0x11042011) if (flag == 0x11042011)
{ {
unsigned int cmd_data[16]; unsigned int cmd_data[16];

View File

@@ -1113,7 +1113,7 @@ chanend c_spdif_out,
chanend c_dig_rx, chanend c_dig_rx,
#endif #endif
chanend ?c_config, chanend ?c chanend ?c_config, chanend ?c
#if XUD_TILE != 0 #if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0)
, server interface i_dfu ?dfuInterface , server interface i_dfu ?dfuInterface
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
@@ -1392,7 +1392,7 @@ chanend ?c_config, chanend ?c
while (1) while (1)
{ {
#if XUD_TILE != 0 #if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0)
[[combine]] [[combine]]
par par
{ {

View File

@@ -37,7 +37,7 @@ void audio(chanend c_in,
chanend c_dig, chanend c_dig,
#endif #endif
chanend ?c_config, chanend ?c_adc chanend ?c_config, chanend ?c_adc
#if (XUD_TILE != 0) #if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0)
, server interface i_dfu ?dfuInterface , server interface i_dfu ?dfuInterface
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)

View File

@@ -479,19 +479,19 @@
/** /**
* @brief Product string for Audio Class 2.0 mode. * @brief Product string for Audio Class 2.0 mode.
* *
* Default: "xCore USB Audio 2.0" * Default: "XMOS xCORE (UAC2.0)"
*/ */
#ifndef PRODUCT_STR_A2 #ifndef PRODUCT_STR_A2
#define PRODUCT_STR_A2 "xCORE USB Audio 2.0" #define PRODUCT_STR_A2 "XMOS xCORE (UAC2.0)"
#endif #endif
/** /**
* @brief Product string for Audio Class 1.0 mode * @brief Product string for Audio Class 1.0 mode
* *
* Default: "xCore USB Audio 1.0" * Default: "XMOS xCORE (UAC1.0)"
*/ */
#ifndef PRODUCT_STR_A1 #ifndef PRODUCT_STR_A1
#define PRODUCT_STR_A1 "xCORE USB Audio 1.0" #define PRODUCT_STR_A1 "XMOS xCORE (UAC1.0)"
#endif #endif
/** /**

View File

@@ -415,7 +415,7 @@ void usb_audio_io(chanend c_aud_in, chanend ?c_adc,
chanend ?c_adat_rx, chanend ?c_adat_rx,
chanend ?c_clk_ctl, chanend ?c_clk_ctl,
chanend ?c_clk_int chanend ?c_clk_int
#if (XUD_TILE != 0) #if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0)
, server interface i_dfu ?dfuInterface , server interface i_dfu ?dfuInterface
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
@@ -459,7 +459,7 @@ void usb_audio_io(chanend c_aud_in, chanend ?c_adc,
c_dig_rx, c_dig_rx,
#endif #endif
c_aud_cfg, c_adc c_aud_cfg, c_adc
#if XUD_TILE != 0 #if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0)
, dfuInterface , dfuInterface
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
@@ -606,7 +606,7 @@ int main()
, c_mix_ctl , c_mix_ctl
#endif #endif
,c_aud_cfg, c_spdif_rx, c_adat_rx, c_clk_ctl, c_clk_int ,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 , dfuInterface
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
@@ -674,6 +674,13 @@ int main()
} }
#endif #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
#ifndef PDM_RECORD #ifndef PDM_RECORD
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
on stdcore[PDM_TILE]: pdm_mic(c_ds_output); on stdcore[PDM_TILE]: pdm_mic(c_ds_output);

View File

@@ -7,6 +7,8 @@
#define XS1_SU_PERIPH_USB_ID 0x1 #define XS1_SU_PERIPH_USB_ID 0x1
#if (XUD_SERIES_SUPPORT == XUD_X200_SERIES) #if (XUD_SERIES_SUPPORT == XUD_X200_SERIES)
#include "xs2_su_registers.h"
#define XS2_SU_PERIPH_USB_ID 0x1
#define PLL_MASK 0x7FFFFFFF #define PLL_MASK 0x7FFFFFFF
#else #else
#define PLL_MASK 0xFFFFFFFF #define PLL_MASK 0xFFFFFFFF
@@ -33,6 +35,12 @@ void device_reboot_aux(void)
unsigned int tileId; unsigned int tileId;
unsigned int tileArrayLength; 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 */ /* 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)); 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 */ /* Reboots XMOS device by writing to the PLL config register */
void device_reboot(chanend spare) 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(); device_reboot_aux();
while(1); while(1);
} }