/* param base SPDIF base pointer. param clockSourceFreq_Hz SPDIF system clock frequency in hz.  */
uint32_t SPDIF_GetRxSampleRate(SPDIF_Type *base, uint32_t clockSourceFreq_Hz)
/* param base SPDIF base pointer. param clockSourceFreq_Hz SPDIF system clock frequency in hz.  */
uint32_t SPDIF_GetRxSampleRate(SPDIF_Type *base, uint32_t clockSourceFreq_Hz)
{
    uint32_t gain = s_spdif_gain[((base->SRPC & SPDIF_SRPC_GAINSEL_MASK) >> SPDIF_SRPC_GAINSEL_SHIFT)];
    uint32_t measure = 0, sampleRate = 0;
    uint64_t temp = 0;
    while ((base->SRPC & SPDIF_SRPC_LOCK_MASK) == 0U)
    {
    }
    measure = base->SRFM;
    temp = (uint64_t)measure * (uint64_t)clockSourceFreq_Hz;
    temp /= (uint64_t)(1024 * 1024 * 128 * gain);
    sampleRate = (uint32_t)temp;
    return sampleRate;
}