Improve I2S to PDM mic ratio naming clarity

This commit is contained in:
Sam Chesney
2017-02-24 11:37:57 +00:00
parent e0b1711f8f
commit 4ed791bb04
4 changed files with 14 additions and 15 deletions

View File

@@ -5,7 +5,7 @@ sc_usb_audio Change Log
----- -----
- ADDED: UserBufferManagementInit() to reset any state required in UserBufferManagement() - ADDED: UserBufferManagementInit() to reset any state required in UserBufferManagement()
- ADDED: I2S output up-sampling (enabled when AUD_TO_USB_RATIO is > 1) - ADDED: I2S output up-sampling (enabled when AUD_TO_USB_RATIO is > 1)
- ADDED: PDM Mic decimator output rate can now be controlled independently (via MICS_TO_AUD_RATIO) - ADDED: PDM Mic decimator output rate can now be controlled independently (via AUD_TO_MICS_RATIO)
- CHANGE: Rename I2S input down-sampling (enabled when AUD_TO_USB_RATIO is > 1, rather than via I2S_DOWNSAMPLE_FACTOR) - CHANGE: Rename I2S input down-sampling (enabled when AUD_TO_USB_RATIO is > 1, rather than via I2S_DOWNSAMPLE_FACTOR)
- RESOLVED: Crosstalk between input channels when I2S input down-sampling is enabled - RESOLVED: Crosstalk between input channels when I2S input down-sampling is enabled
- RESOLVED: Mic decimation data tables properly sized when mic sample-rate < USB audio sample-rate - RESOLVED: Mic decimation data tables properly sized when mic sample-rate < USB audio sample-rate

View File

@@ -501,7 +501,7 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
#endif #endif
unsigned audioToUsbRatioCounter = 0; unsigned audioToUsbRatioCounter = 0;
unsigned micsToAudioRatioCounter = 0; unsigned audioToMicsRatioCounter = 0;
#if (AUD_TO_USB_RATIO > 1) #if (AUD_TO_USB_RATIO > 1)
union i2sInDs3 union i2sInDs3
@@ -821,7 +821,7 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
if ((MICS_TO_AUD_RATIO - 1) == micsToAudioRatioCounter) if ((AUD_TO_MICS_RATIO - 1) == audioToMicsRatioCounter)
{ {
/* Get samples from PDM->PCM converter */ /* Get samples from PDM->PCM converter */
c_pdm_pcm <: 1; c_pdm_pcm <: 1;
@@ -833,11 +833,11 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
c_pdm_pcm :> samplesIn[readBuffNo][i]; c_pdm_pcm :> samplesIn[readBuffNo][i];
} }
} }
micsToAudioRatioCounter = 0; audioToMicsRatioCounter = 0;
} }
else else
{ {
++micsToAudioRatioCounter; ++audioToMicsRatioCounter;
} }
#endif #endif
} }
@@ -1328,7 +1328,7 @@ chanend ?c_config, chanend ?c
#if NUM_PDM_MICS > 0 #if NUM_PDM_MICS > 0
/* Send decimation factor to PDM task(s) */ /* Send decimation factor to PDM task(s) */
c_pdm_in <: curSamFreq / MICS_TO_AUD_RATIO; c_pdm_in <: curSamFreq / AUD_TO_MICS_RATIO;
#endif #endif
#ifdef ADAT_TX #ifdef ADAT_TX

View File

@@ -136,17 +136,16 @@
#endif #endif
/** /**
* @brief Ratio of the PDM microphone decimator sample rate to the I2S sample * @brief Ratio of the I2S sample rate to the PDM microphone decimator sample
* rate. Up and down-sampling will be enabled as necessary when the rates * rate.
* differ.
* *
* Default: 1 i.e. PDM microphone decimator and I2S are running at the sample rate. * Default: 1 i.e. I2S and PDM microphone decimators are running at the same sample rate.
*/ */
#ifndef MICS_TO_AUD_RATIO #ifndef AUD_TO_MICS_RATIO
#define MICS_TO_AUD_RATIO (1) #define AUD_TO_MICS_RATIO (1)
#else #else
#if (MICS_TO_AUD_RATIO != 3) && (MICS_TO_AUD_RATIO != 1) #if (AUD_TO_MICS_RATIO != 3) && (AUD_TO_MICS_RATIO != 1)
#error Unsupported PDM microphone decimator to I2S sample rate ratio #error Unsupported I2S to PDM microphone decimator sample rate ratio
#endif #endif
#endif #endif

View File

@@ -17,7 +17,7 @@
#include "mic_array.h" #include "mic_array.h"
#include "xua_pdm_mic.h" #include "xua_pdm_mic.h"
#define MAX_DECIMATION_FACTOR (96000/(MIN_FREQ/MICS_TO_AUD_RATIO)) #define MAX_DECIMATION_FACTOR (96000/(MIN_FREQ/AUD_TO_MICS_RATIO))
/* Hardware resources */ /* Hardware resources */
in port p_pdm_clk = PORT_PDM_CLK; in port p_pdm_clk = PORT_PDM_CLK;