Added the ability to offset DAC data from ADC data (useful if ADC and DAC do not agree on TDM formats as on the xCORE-200-MC-AUDIO board.

This commit is contained in:
Ross Owen
2016-02-04 12:39:18 +00:00
parent 7353d4d0a4
commit 75815a0da6
2 changed files with 11 additions and 2 deletions

View File

@@ -3,8 +3,11 @@ sc_usb_audio Change Log
6.15.1
------
- ADDED: Ability to offset DAC data from ADC data. Useful if ADC and DAC do not agree
on TDM formats as on the xCORE-200-MC-AUDIO board. See I2S_ADC_TO_DAC_SAMP_OFFSET
- RESOLVED: DAC data mis-alignment issue in TDM slave mode
6.15.0
------
- CHANGE: Removed 32kHz sample-rate support when PDM microphones enabled (lib_mic_array

View File

@@ -106,6 +106,12 @@ extern void device_reboot(void);
#define MAX_DIVIDE (MAX_DIVIDE_48)
#endif
/* Useful for correcting a difference in sample clock polarity between DAC and ADC */
#ifndef I2S_ADC_TO_DAC_SAMP_OFFSET
#define I2S_ADC_TO_DAC_SAMP_OFFSET 0
#endif
#ifndef CODEC_MASTER
static inline void doI2SClocks(unsigned divide)
{
@@ -656,7 +662,7 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
/* Output "even" channel to DAC (i.e. left) */
for(int i = 0; i < I2S_CHANS_DAC; i+=I2S_CHANS_PER_FRAME)
{
p_i2s_dac[index++] <: bitrev(samplesOut[(frameCount)+i]);
p_i2s_dac[index++] <: bitrev(samplesOut[((frameCount+I2S_ADC_TO_DAC_SAMP_OFFSET)&(I2S_CHANS_PER_FRAME-1))+i]);
}
#endif
@@ -761,7 +767,7 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
#pragma loop unroll
for(int i = 1; i < I2S_CHANS_DAC; i+=I2S_CHANS_PER_FRAME)
{
p_i2s_dac[index++] <: bitrev(samplesOut[frameCount+i]);
p_i2s_dac[index++] <: bitrev(samplesOut[(frameCount+i+I2S_ADC_TO_DAC_SAMP_OFFSET)&(I2S_CHANS_PER_FRAME-1)]);
}
#endif