diff --git a/examples/AN00246_xua_example/src/app_xua_simple.xc b/examples/AN00246_xua_example/src/app_xua_simple.xc index f8302423..176a1a67 100644 --- a/examples/AN00246_xua_example/src/app_xua_simple.xc +++ b/examples/AN00246_xua_example/src/app_xua_simple.xc @@ -3,11 +3,11 @@ /* A very simple *example* of a USB audio application (and as such is un-verified for production) * - * It uses the main blocks from the lib_xua + * It uses the main blocks from the lib_xua * * - 2 in/ 2 out I2S only * - No DFU - * - I2S only + * - I2S only * */ @@ -31,7 +31,7 @@ in port p_for_mclk_count = PORT_MCLK_COUNT; /* Extra port for count in port p_mclk_in_usb = PORT_MCLK_IN_USB; /* Extra master clock input for the USB tile */ /* Clock-block declarations */ -clock clk_audio_bclk = on tile[0]: XS1_CLKBLK_4; /* Bit clock */ +clock clk_audio_bclk = on tile[0]: XS1_CLKBLK_4; /* Bit clock */ clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_5; /* Master clock */ clock clk_audio_mclk_usb = on tile[1]: XS1_CLKBLK_1; /* Master clock for USB tile */ @@ -51,17 +51,17 @@ int main() /* Channel for audio data between buffering cores and AudioHub/IO core */ chan c_aud; - + /* Channel for communicating control messages from EP0 to the rest of the device (via the buffering cores) */ chan c_aud_ctl; par { - /* Low level USB device layer core */ + /* Low level USB device layer core */ on tile[1]: XUD_Main(c_ep_out, 2, c_ep_in, 2, - c_sof, epTypeTableOut, epTypeTableIn, + 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.. */ on tile[1]: XUA_Endpoint0(c_ep_out[0], c_ep_in[0], c_aud_ctl, null, null, null, null); @@ -69,7 +69,7 @@ int main() /* Buffering cores - handles audio data to/from EP's and gives/gets data to/from the audio I/O core */ /* Note, this spawns two cores */ on tile[1]: { - + /* Connect master-clock clock-block to clock-block pin */ set_clock_src(clk_audio_mclk_usb, p_mclk_in_usb); /* Clock clock-block from mclk pin */ set_port_clock(p_for_mclk_count, clk_audio_mclk_usb); /* Clock the "count" port from the clock block */ @@ -82,7 +82,7 @@ int main() /* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */ on tile[0]: XUA_AudioHub(c_aud, clk_audio_mclk, clk_audio_bclk, p_mclk_in, p_lrclk, p_bclk, p_i2s_dac, p_i2s_adc); } - + return 0; } diff --git a/examples/AN00246_xua_example/src/hid_report_descriptor.h b/examples/AN00246_xua_example/src/hid_report_descriptor.h index cd789971..04fdcce4 100644 --- a/examples/AN00246_xua_example/src/hid_report_descriptor.h +++ b/examples/AN00246_xua_example/src/hid_report_descriptor.h @@ -127,7 +127,7 @@ static USB_HID_Report_Element_t* const hidConfigurableElements[] = { }; /* - * List HID Reports, one per Report ID. This should be a usage page item with the relevant + * List HID Reports, one per Report ID. This should be a usage page item with the relevant * If not using report IDs - still have one with report ID 0 */ static const USB_HID_Report_Element_t* const hidReports[] = { diff --git a/examples/AN00246_xua_example/src/hwsupport.xc b/examples/AN00246_xua_example/src/hwsupport.xc index 7507ed8c..1289a7b1 100644 --- a/examples/AN00246_xua_example/src/hwsupport.xc +++ b/examples/AN00246_xua_example/src/hwsupport.xc @@ -50,7 +50,7 @@ void AudioHwConfig2(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned delay_microseconds(20000); /* Take ADC out of reset */ - gpioVal |= P_GPIO_ADC_RST_N; + gpioVal |= P_GPIO_ADC_RST_N; p_gpio <: gpioVal; /* Configure ADC for I2S slave mode via I2C */ @@ -58,7 +58,7 @@ void AudioHwConfig2(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned dif = 0x01; /* I2S */ mode = 0x03; /* Slave mode all speeds */ - /* Reg 0x01: (GCTL) Global Mode Control Register + /* Reg 0x01: (GCTL) Global Mode Control Register * Bit[7]: CP-EN: Manages control-port mode * Bit[6]: CLKMODE: Setting puts part in 384x mode * Bit[5:4]: MDIV[1:0]: Set to 01 for /2 @@ -91,7 +91,7 @@ void AudioHwConfig2(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned * bit[0] : Power Down (PDN) : Powered down */ DAC_REGWRITE(CS4384_MODE_CTRL, 0b11000001); - + /* PCM Control (Address: 0x03) */ /* bit[7:4] : Digital Interface Format (DIF) : 0b0001 for I2S up to 24bit * bit[3:2] : Reserved diff --git a/examples/AN00246_xua_example/src/xua_conf.h b/examples/AN00246_xua_example/src/xua_conf.h index e0a0c36b..cd76b8c3 100644 --- a/examples/AN00246_xua_example/src/xua_conf.h +++ b/examples/AN00246_xua_example/src/xua_conf.h @@ -1,7 +1,7 @@ // Copyright 2017-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef _XUA_CONF_H_ +#ifndef _XUA_CONF_H_ #define _XUA_CONF_H_ #define NUM_USB_CHAN_OUT 2 /* Number of channels from host to device */ @@ -19,7 +19,7 @@ #define VENDOR_ID 0x20B1 #define PRODUCT_STR_A2 "XUA Example" #define PRODUCT_STR_A1 "XUA Example" -#define PID_AUDIO_1 1 +#define PID_AUDIO_1 1 #define PID_AUDIO_2 2 #define XUA_DFU_EN 0 /* Disable DFU (for simplicity of example */ #define MIC_DUAL_ENABLED 0 // Use multi-threaded design 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 d19f52c3..e4b2d9dc 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 @@ -3,7 +3,7 @@ /* A very simple *example* of a USB audio application (and as such is un-verified for production) * - * It uses the main blocks from the lib_xua + * It uses the main blocks from the lib_xua * * - S/PDIF output only * - No DFU @@ -51,7 +51,7 @@ int main() /* Channel for audio data between buffering cores and AudioHub/IO core */ chan c_aud; - + /* Channel for communicating control messages from EP0 to the rest of the device (via the buffering cores) */ chan c_aud_ctl; @@ -60,9 +60,9 @@ int main() par { - /* Low level USB device layer core */ + /* Low level USB device layer core */ 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.. */ on tile[1]: XUA_Endpoint0(c_ep_out[0], c_ep_in[0], c_aud_ctl, null, null, null, null); @@ -70,7 +70,7 @@ int main() /* Buffering cores - handles audio data to/from EP's and gives/gets data to/from the audio I/O core */ /* Note, this spawns two cores */ on tile[1]: { - + /* Connect master-clock clock-block to clock-block pin */ set_clock_src(clk_audio_mclk_usb, p_mclk_in_usb); /* Clock clock-block from mclk pin */ set_port_clock(p_for_mclk_count, clk_audio_mclk_usb); /* Clock the "count" port from the clock block */ @@ -78,28 +78,28 @@ int main() XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud); } - + /* AudioHub() (I2S) and S/SPDIF Tx are on the same tile */ on tile[0]: { /* Setup S/PDIF tx port from clock etc - note we do this before par to avoid parallel usage */ spdif_tx_port_config(p_spdif_tx, clk_spdif_tx, p_mclk_in, 7); - + par { while(1) { /* Run the S/PDIF transmitter task */ - spdif_tx(p_spdif_tx, c_spdif_tx); + spdif_tx(p_spdif_tx, c_spdif_tx); } - + /* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */ /* Note, since we are not using I2S we pass in null for LR and Bit clock ports and the I2S dataline ports */ XUA_AudioHub(c_aud, clk_audio_mclk, null, p_mclk_in, null, null, null, null, c_spdif_tx); } } } - + return 0; } diff --git a/examples/AN00247_xua_example_spdif_tx/src/hid_report_descriptor.h b/examples/AN00247_xua_example_spdif_tx/src/hid_report_descriptor.h index cd789971..04fdcce4 100644 --- a/examples/AN00247_xua_example_spdif_tx/src/hid_report_descriptor.h +++ b/examples/AN00247_xua_example_spdif_tx/src/hid_report_descriptor.h @@ -127,7 +127,7 @@ static USB_HID_Report_Element_t* const hidConfigurableElements[] = { }; /* - * List HID Reports, one per Report ID. This should be a usage page item with the relevant + * List HID Reports, one per Report ID. This should be a usage page item with the relevant * If not using report IDs - still have one with report ID 0 */ static const USB_HID_Report_Element_t* const hidReports[] = { diff --git a/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h b/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h index 8fee8c82..7072cb2b 100644 --- a/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h +++ b/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h @@ -1,7 +1,7 @@ // Copyright 2017-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef _XUA_CONF_H_ +#ifndef _XUA_CONF_H_ #define _XUA_CONF_H_ #define NUM_USB_CHAN_OUT 2 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 a3263ac8..21c24369 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 @@ -3,7 +3,7 @@ /* A very simple *example* of a USB audio application (and as such is un-verified for production) * - * It uses the main blocks from the lib_xua with the addition of PDM mic support using lib_mic_array + * It uses the main blocks from the lib_xua with the addition of PDM mic support using lib_mic_array * * - No DFU * @@ -24,7 +24,7 @@ in port p_pdm_mclk = PORT_PDM_MCLK; /* Master clock f in buffered port:32 p_pdm_mics = PORT_PDM_DATA; /* Port for PDM mic data */ -clock clk_pdm = on tile[0]: XS1_CLKBLK_1; /* Clock-block for PDM mics */ +clock clk_pdm = on tile[0]: XS1_CLKBLK_1; /* Clock-block for PDM mics */ /* Lib_xua port declarations. Note, the defines come from the xn file */ @@ -52,7 +52,7 @@ int main() /* Channel for audio data between buffering cores and AudioHub/IO core */ chan c_aud; - + /* Channel for communicating control messages from EP0 to the rest of the device (via the buffering cores) */ chan c_aud_ctl; @@ -64,26 +64,26 @@ int main() par { - /* Low level USB device layer core */ + /* Low level USB device layer core */ 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.. */ on tile[1]: XUA_Endpoint0(c_ep_out[0], c_ep_in[0], c_aud_ctl, null, null, null, null); - on tile[1]: + on tile[1]: { /* Connect master-clock clock-block to clock-block pin */ set_clock_src(clk_audio_mclk, p_mclk_in); /* Clock clock-block from mclk pin */ set_port_clock(p_for_mclk_count, clk_audio_mclk); /* Clock the "count" port from the clock block */ /* Note, AudioHub() will start the clock */ - + par { /* Buffering task - handles audio data to/from EP's and gives/gets data to/from the audio I/O core */ /* Note, this spawns two cores */ XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud); - + /* AudioHub/IO core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */ /* Note, since we are not using I2S we pass in null for LR and Bit clock ports and the I2S dataline ports */ XUA_AudioHub(c_aud, clk_audio_mclk, null, p_mclk_in, null, null, null, null, c_mic_pcm); @@ -105,7 +105,7 @@ int main() { /* PDM receive I/O task */ mic_array_pdm_rx(p_pdm_mics, c_4x_pdm_mic_0, c_4x_pdm_mic_1); - + /* Run two decimator tasks for 8 mics */ mic_array_decimate_to_pcm_4ch(c_4x_pdm_mic_0, c_ds_output[0], MIC_ARRAY_NO_INTERNAL_CHANS); mic_array_decimate_to_pcm_4ch(c_4x_pdm_mic_1, c_ds_output[1], MIC_ARRAY_NO_INTERNAL_CHANS); @@ -114,7 +114,7 @@ int main() } } } - + return 0; } diff --git a/examples/AN00248_xua_example_pdm_mics/src/audiohw.xc b/examples/AN00248_xua_example_pdm_mics/src/audiohw.xc index 288b2d0b..68158cd3 100644 --- a/examples/AN00248_xua_example_pdm_mics/src/audiohw.xc +++ b/examples/AN00248_xua_example_pdm_mics/src/audiohw.xc @@ -16,7 +16,7 @@ void AudioHwInit() /* DAC in reset */ p_gpio <: 0; - return; + return; } /* Configures the external audio hardware for the required sample frequency */ diff --git a/examples/AN00248_xua_example_pdm_mics/src/hid_report_descriptor.h b/examples/AN00248_xua_example_pdm_mics/src/hid_report_descriptor.h index cd789971..04fdcce4 100644 --- a/examples/AN00248_xua_example_pdm_mics/src/hid_report_descriptor.h +++ b/examples/AN00248_xua_example_pdm_mics/src/hid_report_descriptor.h @@ -127,7 +127,7 @@ static USB_HID_Report_Element_t* const hidConfigurableElements[] = { }; /* - * List HID Reports, one per Report ID. This should be a usage page item with the relevant + * List HID Reports, one per Report ID. This should be a usage page item with the relevant * If not using report IDs - still have one with report ID 0 */ static const USB_HID_Report_Element_t* const hidReports[] = { diff --git a/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h b/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h index 191d8953..6abe4bc7 100644 --- a/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h +++ b/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h @@ -1,7 +1,7 @@ // Copyright 2017-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef _XUA_CONF_H_ +#ifndef _XUA_CONF_H_ #define _XUA_CONF_H_ #define NUM_USB_CHAN_OUT 0 diff --git a/legacy_tests/app_test_i2s_loopback/hid_report_descriptor.h b/legacy_tests/app_test_i2s_loopback/hid_report_descriptor.h index e0b185f8..cf59d6ac 100644 --- a/legacy_tests/app_test_i2s_loopback/hid_report_descriptor.h +++ b/legacy_tests/app_test_i2s_loopback/hid_report_descriptor.h @@ -82,35 +82,35 @@ static const USB_HID_Report_Element_t hidReportPageConsumer = { /* * Define configurable items in the HID Report descriptor. */ -static USB_HID_Report_Element_t hidUsageByte0Bit5 = { - .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), - .item.data = { 0xE2, 0x00 }, - .location = HID_REPORT_SET_LOC( 0, 0, 0, 5 ) +static USB_HID_Report_Element_t hidUsageByte0Bit5 = { + .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), + .item.data = { 0xE2, 0x00 }, + .location = HID_REPORT_SET_LOC( 0, 0, 0, 5 ) }; // Mute -static USB_HID_Report_Element_t hidUsageByte0Bit4 = { - .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), - .item.data = { 0xEA, 0x00 }, - .location = HID_REPORT_SET_LOC( 0, 0, 0, 4 ) +static USB_HID_Report_Element_t hidUsageByte0Bit4 = { + .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), + .item.data = { 0xEA, 0x00 }, + .location = HID_REPORT_SET_LOC( 0, 0, 0, 4 ) }; // Vol- -static USB_HID_Report_Element_t hidUsageByte0Bit3 = { - .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), - .item.data = { 0xE9, 0x00 }, - .location = HID_REPORT_SET_LOC( 0, 0, 0, 3 ) +static USB_HID_Report_Element_t hidUsageByte0Bit3 = { + .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), + .item.data = { 0xE9, 0x00 }, + .location = HID_REPORT_SET_LOC( 0, 0, 0, 3 ) }; // Vol+ -static USB_HID_Report_Element_t hidUsageByte0Bit2 = { - .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), - .item.data = { 0xB6, 0x00 }, - .location = HID_REPORT_SET_LOC( 0, 0, 0, 2 ) +static USB_HID_Report_Element_t hidUsageByte0Bit2 = { + .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), + .item.data = { 0xB6, 0x00 }, + .location = HID_REPORT_SET_LOC( 0, 0, 0, 2 ) }; // Scan Prev -static USB_HID_Report_Element_t hidUsageByte0Bit1 = { - .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), - .item.data = { 0xB5, 0x00 }, - .location = HID_REPORT_SET_LOC( 0, 0, 0, 1 ) +static USB_HID_Report_Element_t hidUsageByte0Bit1 = { + .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), + .item.data = { 0xB5, 0x00 }, + .location = HID_REPORT_SET_LOC( 0, 0, 0, 1 ) }; // Scan Next -static USB_HID_Report_Element_t hidUsageByte0Bit0 = { - .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), - .item.data = { 0xB0, 0x00 }, - .location = HID_REPORT_SET_LOC( 0, 0, 0, 0 ) +static USB_HID_Report_Element_t hidUsageByte0Bit0 = { + .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), + .item.data = { 0xB0, 0x00 }, + .location = HID_REPORT_SET_LOC( 0, 0, 0, 0 ) }; // Play /* @@ -126,7 +126,7 @@ static USB_HID_Report_Element_t* const hidConfigurableElements[] = { }; /* - * List HID Reports, one per Report ID. This should be a usage page item with the relevant + * List HID Reports, one per Report ID. This should be a usage page item with the relevant * If not using report IDs - still have one with report ID 0 */ static const USB_HID_Report_Element_t* const hidReports[] = { diff --git a/legacy_tests/app_test_i2s_loopback/main.xc b/legacy_tests/app_test_i2s_loopback/main.xc index 9d012a49..e5053f8e 100644 --- a/legacy_tests/app_test_i2s_loopback/main.xc +++ b/legacy_tests/app_test_i2s_loopback/main.xc @@ -81,7 +81,7 @@ buffered out port:32 p_bclk = PORT_I2S_BCLK; /* I2S L/R-clock */ in port p_mclk_in = PORT_MCLK_IN; /* Clock-block declarations */ -clock clk_audio_bclk = on tile[AUDIO_IO_TILE]: XS1_CLKBLK_1; /* Bit clock */ +clock clk_audio_bclk = on tile[AUDIO_IO_TILE]: XS1_CLKBLK_1; /* Bit clock */ clock clk_audio_mclk = on tile[AUDIO_IO_TILE]: XS1_CLKBLK_2; /* Master clock */ #ifdef SIMULATION @@ -189,14 +189,14 @@ void checker(chanend c_checker, int disable) #ifdef SIMULATION -out port p_mclk_gen = on tile[AUDIO_IO_TILE] : XS1_PORT_1A; +out port p_mclk_gen = on tile[AUDIO_IO_TILE] : XS1_PORT_1A; clock clk_audio_mclk_gen = on tile[AUDIO_IO_TILE] : XS1_CLKBLK_3; void master_mode_clk_setup(void); #if CODEC_MASTER -out port p_bclk_gen = on tile[AUDIO_IO_TILE] : XS1_PORT_1B; +out port p_bclk_gen = on tile[AUDIO_IO_TILE] : XS1_PORT_1B; clock clk_audio_bclk_gen = on tile[AUDIO_IO_TILE] : XS1_CLKBLK_4; -out port p_lrclk_gen = on tile[AUDIO_IO_TILE] : XS1_PORT_1C; +out port p_lrclk_gen = on tile[AUDIO_IO_TILE] : XS1_PORT_1C; clock clk_audio_lrclk_gen = on tile[AUDIO_IO_TILE] : XS1_CLKBLK_5; void slave_mode_clk_setup(const unsigned samFreq, const unsigned chans_per_frame); #endif @@ -214,11 +214,11 @@ int main(void) chan c_checker; chan c_out; - par + par { - on tile[AUDIO_IO_TILE]: - { - par + on tile[AUDIO_IO_TILE]: + { + par { XUA_AudioHub(c_out, clk_audio_mclk, clk_audio_bclk, p_mclk_in, p_lrclk, p_bclk, p_i2s_dac, p_i2s_adc); generator(c_checker, c_out); diff --git a/legacy_tests/app_test_i2s_loopback/simulation.xc b/legacy_tests/app_test_i2s_loopback/simulation.xc index 68541ca1..9f5a6e07 100644 --- a/legacy_tests/app_test_i2s_loopback/simulation.xc +++ b/legacy_tests/app_test_i2s_loopback/simulation.xc @@ -22,7 +22,7 @@ void AudioHwInit() extern clock clk_audio_mclk_gen; -extern out port p_mclk_gen; +extern out port p_mclk_gen; void master_mode_clk_setup(void) { configure_clock_rate(clk_audio_mclk_gen, 25, 1); // Slighly faster than typical MCLK of 24.576MHz @@ -35,17 +35,17 @@ void master_mode_clk_setup(void) #if CODEC_MASTER -extern out port p_bclk_gen; +extern out port p_bclk_gen; extern clock clk_audio_bclk_gen; -extern out port p_lrclk_gen; +extern out port p_lrclk_gen; extern clock clk_audio_lrclk_gen; void slave_mode_clk_setup(const unsigned samFreq, const unsigned chans_per_frame){ const unsigned data_bits = 32; const unsigned mclk_freq = 24576000; - const unsigned mclk_bclk_ratio = mclk_freq / (chans_per_frame * samFreq * data_bits); - const unsigned bclk_lrclk_ratio = (chans_per_frame * data_bits); // 48.828Hz LRCLK + const unsigned mclk_bclk_ratio = mclk_freq / (chans_per_frame * samFreq * data_bits); + const unsigned bclk_lrclk_ratio = (chans_per_frame * data_bits); // 48.828Hz LRCLK //bclk configure_clock_src_divide(clk_audio_bclk_gen, p_mclk_gen, mclk_bclk_ratio/2); diff --git a/lib_xua/api/xua_audiohub.h b/lib_xua/api/xua_audiohub.h index e66296cb..2a91da13 100644 --- a/lib_xua/api/xua_audiohub.h +++ b/lib_xua/api/xua_audiohub.h @@ -37,13 +37,13 @@ * \param c_dig channel connected to the clockGen() thread for * receiving/transmitting samples */ -void XUA_AudioHub(chanend ?c_aud, - clock ?clk_audio_mclk, - clock ?clk_audio_bclk, +void XUA_AudioHub(chanend ?c_aud, + clock ?clk_audio_mclk, + clock ?clk_audio_bclk, in port p_mclk_in, buffered _XUA_CLK_DIR port:32 ?p_lrclk, buffered _XUA_CLK_DIR port:32 ?p_bclk, - buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC], + buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC], buffered in port:32 (&?p_i2s_adc)[I2S_WIRES_ADC] #if (XUA_SPDIF_TX_EN) //&& (SPDIF_TX_TILE != AUDIO_IO_TILE) , chanend c_spdif_tx diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index ca89acd1..0c9ccce8 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -57,8 +57,8 @@ #define PDM_TILE AUDIO_IO_TILE #endif -/** - * @brief Disable USB functionalty just leaving AudioHub +/** + * @brief Disable USB functionalty just leaving AudioHub */ #ifndef XUA_USB_EN #define XUA_USB_EN 1 @@ -1201,7 +1201,7 @@ enum USBEndpointNumber_Out #endif #ifndef XUA_ENDPOINT_COUNT_CUSTOM_IN -#define XUA_ENDPOINT_COUNT_CUSTOM_IN 0 +#define XUA_ENDPOINT_COUNT_CUSTOM_IN 0 #endif #define ENDPOINT_COUNT_IN (XUA_ENDPOINT_COUNT_IN + XUA_ENDPOINT_COUNT_CUSTOM_IN) @@ -1449,6 +1449,6 @@ enum USBEndpointNumber_Out #define _XUA_CLK_DIR out #endif -#if (CODEC_MASTER == 1) && (DSD_CHANS_DAC != 0) -#error CODEC_MASTER with DSD is currently unsupported +#if (CODEC_MASTER == 1) && (DSD_CHANS_DAC != 0) +#error CODEC_MASTER with DSD is currently unsupported #endif diff --git a/lib_xua/host/xmosdfu/libusb/OSX64/libusb.h b/lib_xua/host/xmosdfu/libusb/OSX64/libusb.h index b1b1a18c..193bc643 100644 --- a/lib_xua/host/xmosdfu/libusb/OSX64/libusb.h +++ b/lib_xua/host/xmosdfu/libusb/OSX64/libusb.h @@ -1277,7 +1277,7 @@ enum libusb_capability { * still have to call additional libusb functions such as * \ref libusb_detach_kernel_driver(). */ LIBUSB_CAP_HAS_HID_ACCESS = 0x0100, - /** The library supports detaching of the default USB driver, using + /** The library supports detaching of the default USB driver, using * \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */ LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101 }; diff --git a/lib_xua/host/xmosdfu/libusb/Win32/libusb.h b/lib_xua/host/xmosdfu/libusb/Win32/libusb.h index 430136b2..26bf91bd 100644 --- a/lib_xua/host/xmosdfu/libusb/Win32/libusb.h +++ b/lib_xua/host/xmosdfu/libusb/Win32/libusb.h @@ -1273,7 +1273,7 @@ enum libusb_capability { * still have to call additional libusb functions such as * \ref libusb_detach_kernel_driver(). */ LIBUSB_CAP_HAS_HID_ACCESS = 0x0100, - /** The library supports detaching of the default USB driver, using + /** The library supports detaching of the default USB driver, using * \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */ LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101 }; diff --git a/lib_xua/src/core/audiohub/audiohub_dsd.h b/lib_xua/src/core/audiohub/audiohub_dsd.h index f101160b..ad6da818 100644 --- a/lib_xua/src/core/audiohub/audiohub_dsd.h +++ b/lib_xua/src/core/audiohub/audiohub_dsd.h @@ -28,7 +28,7 @@ static inline void DoDsdNative(unsigned samplesOut[], unsigned &dsdSample_l, uns asm volatile("out res[%0], %1"::"r"(p_dsd_dac[1]),"r"(dsdSample_r)); } -/* This function performs the DOP loop and collects 16b of DSD per loop +/* This function performs the DOP loop and collects 16b of DSD per loop and outputs a 32b word into the port buffer every other cycle. */ static inline void DoDsdDop(int &everyOther, unsigned samplesOut[], unsigned &dsdSample_l, unsigned &dsdSample_r, unsigned divide) { @@ -38,7 +38,7 @@ static inline void DoDsdDop(int &everyOther, unsigned samplesOut[], unsigned &ds dsdSample_r = ((samplesOut[1] & 0xffff00) << 8); everyOther = 1; } - else + else { everyOther = 0; dsdSample_l = dsdSample_l | ((samplesOut[0] & 0xffff00) >> 8); @@ -77,7 +77,7 @@ static inline int DoDsdDopCheck(unsigned &dsdMode, int &dsdCount, unsigned curSa dsdMarker = DSD_MARKER_2; } } - else if(dsdMode == DSD_MODE_DOP) + else if(dsdMode == DSD_MODE_DOP) { /* If we are running in DOP mode, check if we need to come out */ if((DSD_MASK(samplesOut[0]) != DSD_MARKER_1) && (DSD_MASK(samplesOut[1]) != DSD_MARKER_1)) diff --git a/lib_xua/src/core/audiohub/audiohub_initport.xc b/lib_xua/src/core/audiohub/audiohub_initport.xc index 279250f8..0f49c594 100644 --- a/lib_xua/src/core/audiohub/audiohub_initport.xc +++ b/lib_xua/src/core/audiohub/audiohub_initport.xc @@ -73,7 +73,7 @@ void InitPorts_master(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, bu #endif } -#else +#else void InitPorts_slave(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, buffered _XUA_CLK_DIR port:32 p_bclk, buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC], buffered in port:32 (&?p_i2s_adc)[I2S_WIRES_ADC]) { diff --git a/lib_xua/src/core/audiohub/xua_audiohub.xc b/lib_xua/src/core/audiohub/xua_audiohub.xc index 25ef5059..6a42729a 100755 --- a/lib_xua/src/core/audiohub/xua_audiohub.xc +++ b/lib_xua/src/core/audiohub/xua_audiohub.xc @@ -32,7 +32,7 @@ #if (XUA_NUM_PDM_MICS > 0) #include "xua_pdm_mic.h" -#endif +#endif #if (AUD_TO_USB_RATIO > 1) #include "src.h" @@ -76,7 +76,7 @@ void InitPorts_slave #else void InitPorts_master #endif -(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, buffered _XUA_CLK_DIR port:32 p_bclk, buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC], +(unsigned divide, buffered _XUA_CLK_DIR port:32 p_lrclk, buffered _XUA_CLK_DIR port:32 p_bclk, buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC], buffered in port:32 (&?p_i2s_adc)[I2S_WIRES_ADC]); @@ -164,7 +164,7 @@ static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:3 if(I2S_MODE_TDM) { /* Only check for the rising edge of frame sync being in the right place because falling edge timing not specified */ - if (frameCount == 1) + if (frameCount == 1) { lrval &= 0xc0000000; // Mask off last two (MSB) frame clock bits which are the most recently sampled syncError += (lrval != 0x80000000); // We need MSB = 1 and MSB-1 = 0 to signify rising edge @@ -177,12 +177,12 @@ static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:3 } else { - if(frameCount == 0) + if(frameCount == 0) syncError += (lrval != 0x80000000); else syncError += (lrval != 0x7FFFFFFF); } - + return syncError; #else @@ -200,7 +200,7 @@ static inline int HandleSampleClock(int frameCount, buffered _XUA_CLK_DIR port:3 else p_lrclk <: 0x7fffffff; } - + return 0; #endif @@ -219,7 +219,7 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out #if (XUA_NUM_PDM_MICS > 0) , chanend c_pdm_pcm #endif - , buffered _XUA_CLK_DIR port:32 ?p_lrclk, + , buffered _XUA_CLK_DIR port:32 ?p_lrclk, buffered _XUA_CLK_DIR port:32 ?p_bclk, buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC], buffered in port:32 (&?p_i2s_adc)[I2S_WIRES_ADC] @@ -322,14 +322,14 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out InitPorts_master(divide, p_lrclk, p_bclk, p_i2s_dac, p_i2s_adc); #endif } - + /* Note we always expect syncError to be 0 when we are master */ while(!syncError) { #if (DSD_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT > 0) - if(dsdMode == DSD_MODE_NATIVE) + if(dsdMode == DSD_MODE_NATIVE) DoDsdNative(samplesOut, dsdSample_l, dsdSample_r, divide); - else if(dsdMode == DSD_MODE_DOP) + else if(dsdMode == DSD_MODE_DOP) DoDsdDop(everyOther, samplesOut, dsdSample_l, dsdSample_r, divide); else #endif @@ -471,7 +471,7 @@ unsigned static AudioHub_MainLoop(chanend ?c_out, chanend ?c_spd_out #endif } - frameCount++; + frameCount++; #if (I2S_CHANS_ADC != 0) index = 0; @@ -663,7 +663,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk, in port p_mclk_in, buffered _XUA_CLK_DIR port:32 ?p_lrclk, buffered _XUA_CLK_DIR port:32 ?p_bclk, - buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC], + buffered out port:32 (&?p_i2s_dac)[I2S_WIRES_DAC], buffered in port:32 (&?p_i2s_adc)[I2S_WIRES_ADC] #if (XUA_SPDIF_TX_EN) //&& (SPDIF_TX_TILE != AUDIO_IO_TILE) , chanend c_spdif_out @@ -717,7 +717,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk, start_clock(clk_mst_spd); #endif #endif - + /* Perform required CODEC/ADC/DAC initialisation */ AudioHwInit(); diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index 56f331bd..e3c947a7 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -747,7 +747,7 @@ void XUA_Buffer_Decouple(chanend c_mix_out inuint(c_mix_out); outct(c_mix_out, SET_SAMPLE_FREQ); outuint(c_mix_out, sampFreq); - + if(sampFreq != AUDIO_STOP_FOR_DFU) { inUnderflow = 1; diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index fbdbddb0..ec2ba41d 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -91,7 +91,7 @@ unsigned int fb_clocks[4]; #define FB_TOLERANCE 0x100 void XUA_Buffer( - register chanend c_aud_out, + register chanend c_aud_out, #if (NUM_USB_CHAN_IN > 0) register chanend c_aud_in, #endif @@ -196,7 +196,7 @@ unsafe{volatile unsigned * unsafe masterClockFreq_ptr;} * @param c_aud_fb chanend for feeback to xud * @return void */ -void XUA_Buffer_Ep(register chanend c_aud_out, +void XUA_Buffer_Ep(register chanend c_aud_out, #if (NUM_USB_CHAN_IN > 0) register chanend c_aud_in, #endif @@ -566,7 +566,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, { unsigned usb_speed; GET_SHARED_GLOBAL(usb_speed, g_curUsbSpeed); - + #if FB_USE_REF_CLOCK unsigned long long feedbackMul = 64ULL; @@ -642,7 +642,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, clockcounter = 0; } #else - + /* Assuming 48kHz from a 24.576 master clock (0.0407uS period) * MCLK ticks per SOF = 125uS / 0.0407 = 3072 MCLK ticks per SOF. * expected Feedback is 48000/8000 = 6 samples. so 0x60000 in 16:16 format. diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 6121effc..78467972 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -258,8 +258,8 @@ void XUA_Endpoint0_setVendorId(unsigned short vid) { } void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer) { - debug_printf("concatenateAndCopyStrings() for \"%s\" and \"%s\"\n", string1, string2); - + debug_printf("concatenateAndCopyStrings() for \"%s\" and \"%s\"\n", string1, string2); + memset(string_buffer, '\0', strlen(string_buffer)); uint32_t remaining_buffer_size = MIN(strlen(string1), XUA_MAX_STR_LEN-1); @@ -313,7 +313,7 @@ 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); } @@ -483,7 +483,7 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(c if (DFUReportResetState(null)) { assert((c_audioControl != NULL) && msg("DFU not supported when c_audioControl is null")); - + /* Stop audio */ outuint(c_audioControl, SET_SAMPLE_FREQ); outuint(c_audioControl, AUDIO_STOP_FOR_DFU); diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 48f4a187..6666a5ce 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -341,7 +341,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c setG_curSamFreqMultiplier(g_curSamFreq/(newMasterClock/512)); #endif -#if ADAT_RX +#if ADAT_RX /* Configure ADAT SMUX based on sample rate */ outuint(c_clk_ctl, SET_SMUX); if(g_curSamFreq < 88200) diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index 26ef4d39..37b4eedd 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -134,7 +134,7 @@ on tile[AUDIO_IO_TILE] : buffered out port:32 p_bclk = PORT_I2S_BCLK; on tile[AUDIO_IO_TILE] : in port p_mclk_in = PORT_MCLK_IN; -#if XUA_USB_EN +#if XUA_USB_EN on tile[XUD_TILE] : in port p_for_mclk_count = PORT_MCLK_COUNT; #endif @@ -635,7 +635,7 @@ int main() #endif /* XUA_USB_EN */ } - on tile[AUDIO_IO_TILE]: + on tile[AUDIO_IO_TILE]: { usb_audio_io(c_mix_out #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE) @@ -721,11 +721,11 @@ int main() #endif #ifndef PDM_RECORD -#if (XUA_NUM_PDM_MICS > 0) +#if (XUA_NUM_PDM_MICS > 0) #if (PDM_TILE != AUDIO_IO_TILE) /* PDM Mics running on a separate to AudioHub */ on stdcore[PDM_TILE]: - { + { xua_pdm_mic_config(p_pdm_mclk, p_pdm_clk, p_pdm_mics, clk_pdm); xua_pdm_mic(c_ds_output, p_pdm_mics); } diff --git a/lib_xua/src/core/mixer/mixer.xc b/lib_xua/src/core/mixer/mixer.xc index 4e982259..91f3dd86 100644 --- a/lib_xua/src/core/mixer/mixer.xc +++ b/lib_xua/src/core/mixer/mixer.xc @@ -366,7 +366,7 @@ static void mixer1(chanend c_host, chanend c_mix_ctl, chanend c_mixer2) /* Forward on Request for data to decouple thread */ outuint(c_host, request); -#if (MAX_MIX_COUNT > 0) +#if (MAX_MIX_COUNT > 0) /* Sync */ outuint(c_mixer2, 0); #endif @@ -543,8 +543,8 @@ static void mixer1(chanend c_host, chanend c_mix_ctl, chanend c_mixer2) /* Sync with mixer 2 (once it has swapped samples with audiohub) */ outuint(c_mixer2, 0); inuint(c_mixer2); - - /* Do the mixing */ + + /* Do the mixing */ #ifdef FAST_MIXER mixed = doMix0(samples, mix_mult_slice(0)); #else @@ -673,8 +673,8 @@ static void mixer2(chanend c_mixer1, chanend c_audio) { GiveSamplesToDevice(c_audio, samples_to_device_map, multOut); GetSamplesFromDevice(c_audio); - - /* Sync with mixer 1 (once it has swapped samples with the buffering sub-system) */ + + /* Sync with mixer 1 (once it has swapped samples with the buffering sub-system) */ inuint(c_mixer1); outuint(c_mixer1, 0); @@ -693,7 +693,7 @@ static void mixer2(chanend c_mixer1, chanend c_audio) #endif #endif - + #if (MAX_FREQ > 96000) /* Fewer mixes when running higher than 96kHz */ if (!mixer2_mix2_flag) diff --git a/lib_xua/src/core/pdm_mics/pdm_mic.xc b/lib_xua/src/core/pdm_mics/pdm_mic.xc index a69115d7..cbe8f26d 100644 --- a/lib_xua/src/core/pdm_mics/pdm_mic.xc +++ b/lib_xua/src/core/pdm_mics/pdm_mic.xc @@ -22,7 +22,7 @@ #define MAX_DECIMATION_FACTOR (96000/(MIN_FREQ/AUD_TO_MICS_RATIO)) /* Build time sized microphone delay line */ -#ifndef MIC_BUFFER_DEPTH +#ifndef MIC_BUFFER_DEPTH #define MIC_BUFFER_DEPTH 1 #endif @@ -229,7 +229,7 @@ void xua_pdm_mic_config(in port p_pdm_mclk, in port p_pdm_clk, buffered in port: unsigned micDiv = MCLK_48/3072000; configure_clock_src_divide(clk_pdm, p_pdm_mclk, micDiv/2); - + configure_port_clock_output(p_pdm_clk, clk_pdm); configure_in_port(p_pdm_mics, clk_pdm); start_clock(clk_pdm); @@ -243,7 +243,7 @@ void xua_pdm_mic(streaming chanend c_ds_output[2], buffered in port:32 p_pdm_mic #else #define c_4x_pdm_mic_1 null #endif - + par { mic_array_pdm_rx(p_pdm_mics, c_4x_pdm_mic_0, c_4x_pdm_mic_1); diff --git a/lib_xua/src/core/support/reboot.xc b/lib_xua/src/core/support/reboot.xc index 7c78928e..f5bd1575 100644 --- a/lib_xua/src/core/support/reboot.xc +++ b/lib_xua/src/core/support/reboot.xc @@ -22,7 +22,7 @@ static void reset_tile(unsigned const tileId) read_sswitch_reg(tileId, 6, pllVal); pllVal &= PLL_MASK; write_sswitch_reg_no_ack(tileId, 6, pllVal); -} +} /* Reboots XMOS device by writing to the PLL config register * Note - resetting is per *node* not tile @@ -42,12 +42,12 @@ void device_reboot(void) tileArrayLength = sizeof(tile)/sizeof(tileref); - /* Note - we could be in trouble if this doesn't return 0/1 since + /* Note - we could be in trouble if this doesn't return 0/1 since * this code doesn't properly handle any network topology other than a - * simple line + * simple line */ /* Find tile index of the local tile ID */ - for(int tileNum = 0; tileNum