xpd: Cleaned up whitespace

This commit is contained in:
xross
2022-06-01 14:21:44 +01:00
parent 55e01e5b49
commit 206a895b74
34 changed files with 158 additions and 158 deletions

View File

@@ -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;
}

View File

@@ -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[] = {

View File

@@ -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

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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[] = {

View File

@@ -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

View File

@@ -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;
}

View File

@@ -16,7 +16,7 @@ void AudioHwInit()
/* DAC in reset */
p_gpio <: 0;
return;
return;
}
/* Configures the external audio hardware for the required sample frequency */

View File

@@ -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[] = {

View File

@@ -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

View File

@@ -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[] = {

View File

@@ -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);

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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
};

View File

@@ -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
};

View File

@@ -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))

View File

@@ -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])
{

View File

@@ -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();

View File

@@ -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;

View File

@@ -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.

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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)

View File

@@ -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);

View File

@@ -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<tileArrayLength; tileNum++)
for(int tileNum = 0; tileNum<tileArrayLength; tileNum++)
{
if (get_tile_id(tile[tileNum]) == localTileId)
{

View File

@@ -351,7 +351,7 @@ unsigned hidGetReportPeriod( const unsigned id )
return retVal;
}
unsigned hidGetReportTime( const unsigned id )
unsigned hidGetReportTime( const unsigned id )
{
swlock_acquire(&hidStaticVarLock);
unsigned retVal = 0U;
@@ -618,7 +618,7 @@ struct HID_validation_info {
/**
* @brief Validation step for hidReportValidate, checking the info struct to ensure correctness of Report IDs
*
*
* @param info The info struct that has been built by hidReportValidate to check
* @return unsigned HID_STATUS value
*/
@@ -653,7 +653,7 @@ static unsigned hidReportValidateInfoStructReportIDs( struct HID_validation_info
/**
* @brief Validation step for hidReportValidate, checking reports are the correct length specified in their location field
*
*
* @param info The info struct that has been built by hidReportValidate to check
* @return unsigned HID_STATUS value
*/
@@ -673,7 +673,7 @@ static unsigned hidReportValidateInfoStructReportLength( struct HID_validation_i
/**
* @brief Validation step for hidReportValidate, collections are correctly opened and closed
*
*
* @param info The info struct that has been built by hidReportValidate to check
* @return unsigned HID_STATUS value
*/
@@ -688,7 +688,7 @@ static unsigned hidReportValidateInfoStructCollections( struct HID_validation_in
/**
* @brief Validation step for hidReportValidate, High level - Checks the summarised information in the info struct by calling
* the subroutines for checking.
*
*
* @param info The info struct that has been built by hidReportValidate to check
* @return unsigned HID_STATUS value
*/
@@ -705,7 +705,7 @@ static unsigned hidReportValidateInfoStruct( struct HID_validation_info *info )
/**
* @brief Preparation step for hidReportValidate, Adds a report ID field into the information struct for validation
*
*
* @param info The info struct being built by hidReportValidate
* @param item The ReportId item being added
* @return unsigned HID_STATUS value
@@ -743,7 +743,7 @@ static unsigned hidReportValidateAddReportId( struct HID_validation_info *info,
/**
* @brief Preparation step for hidReportValidate, Adds a Usage Page field into the information struct for validation
*
*
* @param info The info struct being built by hidReportValidate
* @param item The UsagePage item being added
* @return unsigned HID_STATUS value
@@ -775,7 +775,7 @@ static unsigned hidReportValidateAddUsagePageItem( struct HID_validation_info *i
/**
* @brief Preparation step for hidReportValidate, Adds a Usage field into the information struct for validation
*
*
* @param info The info struct being built by hidReportValidate
* @param item The Usage item being added
* @return unsigned HID_STATUS value

View File

@@ -48,7 +48,7 @@
/**
* @brief Helper macro to configure the location field of USB_HID_Report_Element_t.
*
*
* @param id The report ID that this element is within.
* @param len (only relevant for the usage_page elements in hidReports) The length
* of the report under this report ID.
@@ -63,7 +63,7 @@
/**
* @brief Helper macro to configure the header field of USB_HID_Short_Item_t
*
*
* @param size The size of the report descriptor item (valid values: 0, 1, 2)
* @param type The type of the report descriptor item
* @param tag The tag
@@ -173,7 +173,7 @@ void hidCaptureReportTime( const unsigned id, const unsigned time );
* HID data has been reported to the USB Host.
*
* \warning This function will fail silently if given an id that is not
* either the value zero (in the case that Report IDs are not in use),
* either the value zero (in the case that Report IDs are not in use),
* or a Report ID that is in use.
*
* \param[in] id A HID Report ID.
@@ -183,10 +183,10 @@ void hidClearChangePending( const unsigned id );
/**
* @brief Get the next valid report ID - iterator style.
*
*
* This function will loop around and start returning the first report ID again once it has
* returned all valid report IDs.
*
*
* @param idPrev The previous returned id, or 0 if this is the first call
* @return unsigned The next valid report ID.
*/
@@ -342,7 +342,7 @@ unsigned hidGetReportTime( const unsigned id );
* whether unreported HID data exists for that Report ID.
*
* \warning This function will return zero if given an id that is not
* either the value zero (in the case that Report IDs are not in use),
* either the value zero (in the case that Report IDs are not in use),
* or a Report ID that is in use.
*
* \param[in] id A HID Report ID.
@@ -379,10 +379,10 @@ unsigned hidIsIdleActive( const unsigned id );
/**
* @brief Does the application use Report IDs?
*
*
* If the application is not using Report IDs, then the id value that is passed around
* everywhere can just be zero. Otherwise zero is an invalid ID.
*
*
* @return Boolean
* @retval 1 Report IDs are in use
* @retval 0 Report IDs are not in use
@@ -391,11 +391,11 @@ unsigned hidIsReportIdInUse ( void );
/**
* @brief Is the provided report ID valid for passing to other functions.
*
*
* e.g If Report IDs are not in use, then only 0 will return true.
* e.g If Report IDs are in use, then 0 will return false and the report IDs that
* are in use will return true when passed to this function.
*
*
* @param id The ID to check
* @return boolean
* @retval 0 The report ID is not valid, other functions may fail silently
@@ -448,7 +448,7 @@ void hidResetReportDescriptor( void );
* Host.
*
* \warning This function will fail silently if given an id that is not
* either the value zero (in the case that Report IDs are not in use),
* either the value zero (in the case that Report IDs are not in use),
* or a Report ID that is in use.
*
* \param[in] id A HID Report ID.
@@ -535,10 +535,10 @@ void hidSetReportPeriod( const unsigned id, const unsigned period );
/**
* @brief Development function: Validate the contents of hid_report_descriptor.h for common errors, printing
* error messages if any issues were found.
*
*
* This function is intended for use when developing the contents of hid_report_descriptor.h, which is static,
* so shouldn't be required for use in a production application.
*
*
* @return Validation result
* @retval HID_STATUS_GOOD The validation found no issues with the data structures defined
* in hid_report_descriptor.h

View File

@@ -8,7 +8,7 @@
* This includes constants from:
* - Device Class Definition for Human Interface Devices, version 1.11
* - HID Usage Tables for Universal Serial Bus, version 1.22
*
*
* This file is incomplete, but can be expanded with new constants as necessary.
*/

View File

@@ -800,7 +800,7 @@ void test_set_all_idle( void )
unsigned setIdle = hidIsIdleActive( reportId );
TEST_ASSERT_EQUAL_UINT( 0, setIdle );
setIdle = hidIsIdleActive( reportId2 );
setIdle = hidIsIdleActive( reportId2 );
TEST_ASSERT_EQUAL_UINT( 0, setIdle );
for ( reportId = 1; reportId <= HID_REPORT_COUNT; ++reportId ) {

View File

@@ -59,7 +59,7 @@ static const USB_HID_Short_Item_t hidUsageConsumerControl = {
* For internal purposes, a report element with ID of 0 must be included if report IDs are not being used.
*/
static const USB_HID_Report_Element_t hidReportPageConsumer = {
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
.item.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 },
.location = HID_REPORT_SET_LOC( 0, 2, 0, 0 )
};
@@ -94,7 +94,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[] = {