Fixup CODEC_MASTER usage

This commit is contained in:
xross
2018-01-17 14:06:49 +00:00
parent 0d98f1ad9a
commit 55a9f03719
7 changed files with 24 additions and 27 deletions

View File

@@ -438,10 +438,6 @@
#define CODEC_MASTER (0)
#endif
#if defined(CODEC_MASTER) && (CODEC_MASTER == 0)
#undef CODEC_MASTER
#endif
/**
* @brief Vendor String used by the device. This is also pre-pended to various strings used by the design.
*

View File

@@ -88,12 +88,12 @@ extern buffered in port:32 p_i2s_adc[I2S_WIRES_ADC];
#endif
/* I2S LR/Bit clock I/O */
#ifndef CODEC_MASTER
extern buffered out port:32 p_lrclk;
extern buffered out port:32 p_bclk;
#else
#if CODEC_MASTER
extern buffered in port:32 p_lrclk;
extern buffered in port:32 p_bclk;
#else
extern buffered out port:32 p_lrclk;
extern buffered out port:32 p_bclk;
#endif
unsigned dsdMode = DSD_MODE_OFF;
@@ -341,7 +341,7 @@ static inline int DoDsdDopCheck(unsigned &dsdMode, int &dsdCount, unsigned curSa
}
#ifndef CODEC_MASTER
#if !CODEC_MASTER
static inline void InitPorts_master(unsigned divide)
{
unsigned tmp;
@@ -399,7 +399,7 @@ static inline void InitPorts_master(unsigned divide)
}
#endif
#ifdef CODEC_MASTER
#if CODEC_MASTER
static inline void InitPorts_slave(unsigned divide)
{
unsigned tmp;
@@ -440,7 +440,7 @@ static inline void InitPorts_slave(unsigned divide)
#ifndef CODEC_MASTER
#if (CODEC_MASTER == 0)
#pragma unsafe arrays
unsigned static deliver_master(chanend ?c_out, chanend ?c_spd_out
#ifdef ADAT_TX
@@ -581,6 +581,7 @@ unsigned static deliver_master(chanend ?c_out, chanend ?c_spd_out
asm volatile("in %0, res[%1]" : "=r"(sample) : "r"(p_i2s_adc[index++]));
sample = bitrev(sample);
int chanIndex = ((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i; // channels 0, 2, 4.. on each line.
#if (AUD_TO_USB_RATIO > 1)
if ((AUD_TO_USB_RATIO - 1) == audioToUsbRatioCounter)
{
@@ -809,10 +810,10 @@ unsigned static deliver_master(chanend ?c_out, chanend ?c_spd_out
#pragma xta endpoint "deliver_return"
return 0;
}
#endif //ndef CODEC_MASTER
#endif
#ifdef CODEC_MASTER
#if (CODEC_MASTER == 1)
/* I2S delivery thread */
#pragma unsafe arrays

View File

@@ -114,13 +114,12 @@ on tile[AUDIO_IO_TILE] : buffered in port:32 p_i2s_adc[I2S_WIRES_ADC] =
#endif
#ifndef CODEC_MASTER
on tile[AUDIO_IO_TILE] : buffered out port:32 p_lrclk = PORT_I2S_LRCLK;
on tile[AUDIO_IO_TILE] : buffered out port:32 p_bclk = PORT_I2S_BCLK;
#else
#if CODEC_MASTER
on tile[AUDIO_IO_TILE] : buffered in port:32 p_lrclk = PORT_I2S_LRCLK;
on tile[AUDIO_IO_TILE] : buffered in port:32 p_bclk = PORT_I2S_BCLK;
#else
on tile[AUDIO_IO_TILE] : buffered out port:32 p_lrclk = PORT_I2S_LRCLK;
on tile[AUDIO_IO_TILE] : buffered out port:32 p_bclk = PORT_I2S_BCLK;
#endif
/* Note, declared unsafe as sometimes we want to share this port

View File

@@ -18,7 +18,7 @@ void ConfigAudioPorts(
#endif
#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
#ifndef CODEC_MASTER
#if (CODEC_MASTER == 0)
buffered out port:32 ?p_lrclk,
buffered out port:32 p_bclk,
#else
@@ -41,7 +41,7 @@ void ConfigAudioPorts(
#endif
#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
#ifndef CODEC_MASTER
#if (CODEC_MASTER == 0)
port p_lrclk,
port p_bclk,
#else
@@ -66,7 +66,7 @@ void ConfigAudioPortsWrapper(
#endif
#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
#ifndef CODEC_MASTER
#if (CODEC_MASTER == 0)
buffered out port:32 ?p_lrclk,
buffered out port:32 p_bclk,
#else

View File

@@ -22,7 +22,7 @@ void ConfigAudioPorts(
#endif
#if (I2S_CHANS_DAC != 0) || (I2S_CHANS_ADC != 0)
#if !defined(CODEC_MASTER)
#if (CODEC_MASTER == 0)
buffered out port:32 ?p_lrclk,
buffered out port:32 p_bclk,
#else
@@ -32,7 +32,7 @@ void ConfigAudioPorts(
#endif
unsigned int divide, unsigned curSamFreq)
{
#if !defined(CODEC_MASTER)
#if (CODEC_MASTER == 0)
/* Note this call to stop_clock() will pause forever if the port clocking the clock-block is not low.
* deliver() should return with this being the case */
stop_clock(clk_audio_bclk);