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

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