/* This function is used to get I2S source clock frequency.  */
static uint32_t I2S_GetSourceClockFreq(I2S_T *i2s)
/* This function is used to get I2S source clock frequency.  */
static uint32_t I2S_GetSourceClockFreq(I2S_T *i2s)
{
    uint32_t u32Freq, u32ClkSrcSel;
    u32ClkSrcSel = CLK->CLKSEL3 & CLK_CLKSEL3_I2S0SEL_Msk;
    switch (u32ClkSrcSel)
    {
    case CLK_CLKSEL3_I2S0SEL_HXT:
        u32Freq = __HXT;
        break;
    case CLK_CLKSEL3_I2S0SEL_PLL:
        u32Freq = CLK_GetPLLClockFreq();
        break;
    case CLK_CLKSEL3_I2S0SEL_HIRC:
        u32Freq = __HIRC;
        break;
    case CLK_CLKSEL3_I2S0SEL_PCLK0:
        u32Freq = (uint32_t)CLK_GetPCLK0Freq();
        break;
    default:
        u32Freq = __HIRC;
        break;
    }
    return u32Freq;
}