forked from PAWPAW-Mirror/lib_xua
Fix DSD implementation (HW tested for DSD64 & DSD128)
This commit is contained in:
@@ -312,7 +312,8 @@ static inline unsigned DoSampleTransfer(chanend ?c_out, const int readBuffNo, co
|
|||||||
|
|
||||||
|
|
||||||
/* This function performs the DSD native loop and outputs a 32b DSD stream per loop */
|
/* This function performs the DSD native loop and outputs a 32b DSD stream per loop */
|
||||||
static inline void DoDsdNative(unsigned samplesOut[], unsigned &dsdSample_l, unsigned &dsdSample_r, unsigned divide){
|
static inline void DoDsdNative(unsigned samplesOut[], unsigned &dsdSample_l, unsigned &dsdSample_r, unsigned divide)
|
||||||
|
{
|
||||||
#if (DSD_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT > 0)
|
#if (DSD_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT > 0)
|
||||||
/* 8 bits per chan, 1st 1-bit sample in MSB */
|
/* 8 bits per chan, 1st 1-bit sample in MSB */
|
||||||
dsdSample_l = samplesOut[0];
|
dsdSample_l = samplesOut[0];
|
||||||
@@ -360,7 +361,8 @@ static inline void DoDsdNative(unsigned samplesOut[], unsigned &dsdSample_l, uns
|
|||||||
|
|
||||||
/* 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. */
|
and outputs a 32b word into the port buffer every other cycle. */
|
||||||
static inline void DoDsdDop(unsigned &everyOther, unsigned samplesOut[], unsigned &dsdSample_l, unsigned &dsdSample_r, unsigned divide){
|
static inline void DoDsdDop(int &everyOther, unsigned samplesOut[], unsigned &dsdSample_l, unsigned &dsdSample_r, unsigned divide)
|
||||||
|
{
|
||||||
#if (DSD_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT > 0)
|
#if (DSD_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT > 0)
|
||||||
if(!everyOther)
|
if(!everyOther)
|
||||||
{
|
{
|
||||||
@@ -423,7 +425,6 @@ static inline void DoDsdDop(unsigned &everyOther, unsigned samplesOut[], unsigne
|
|||||||
}
|
}
|
||||||
#endif // __XS2A__
|
#endif // __XS2A__
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,7 +433,7 @@ static inline void DoDsdDop(unsigned &everyOther, unsigned samplesOut[], unsigne
|
|||||||
When in DoP mode, this function will check for a single absence of the DoP marker and exit deliver() with the command
|
When in DoP mode, this function will check for a single absence of the DoP marker and exit deliver() with the command
|
||||||
to restart in I2S mode. */
|
to restart in I2S mode. */
|
||||||
|
|
||||||
static inline void DoDsdDopCheck(unsigned &dsdMode, int &dsdCount, unsigned curSamFreq, unsigned samplesOut[], unsigned &dsdMarker){
|
static inline int DoDsdDopCheck(unsigned &dsdMode, int &dsdCount, unsigned curSamFreq, unsigned samplesOut[], unsigned &dsdMarker){
|
||||||
#if (DSD_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT > 0)
|
#if (DSD_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT > 0)
|
||||||
/* Check for DSD - note we only move into DoP mode if valid DoP Freq */
|
/* Check for DSD - note we only move into DoP mode if valid DoP Freq */
|
||||||
/* Currently we only check on channel 0 - we get all 0's on channels without data */
|
/* Currently we only check on channel 0 - we get all 0's on channels without data */
|
||||||
@@ -478,6 +479,7 @@ static inline void DoDsdDopCheck(unsigned &dsdMode, int &dsdCount, unsigned curS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -913,7 +915,8 @@ unsigned static deliver_master(chanend ?c_out, chanend ?c_spd_out
|
|||||||
doI2SClocks(divide);
|
doI2SClocks(divide);
|
||||||
|
|
||||||
} // !dsdMode
|
} // !dsdMode
|
||||||
DoDsdDopCheck(dsdMode, dsdCount, curSamFreq, samplesOut, dsdMarker);
|
int ret = DoDsdDopCheck(dsdMode, dsdCount, curSamFreq, samplesOut, dsdMarker);
|
||||||
|
if (ret == 0) return 0;
|
||||||
|
|
||||||
#ifdef I2S_MODE_TDM
|
#ifdef I2S_MODE_TDM
|
||||||
/* Increase frameCount by 2 since we have output two channels (per data line) */
|
/* Increase frameCount by 2 since we have output two channels (per data line) */
|
||||||
|
|||||||
Reference in New Issue
Block a user