/* param base Pointer to FLEXIO_I2S_Type structure param format Pointer to FlexIO I2S audio data format structure. param srcClock_Hz I2S master clock source frequency in Hz.  */
void FLEXIO_I2S_MasterSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format, uint32_t srcClock_Hz)
/* param base Pointer to FLEXIO_I2S_Type structure param format Pointer to FlexIO I2S audio data format structure. param srcClock_Hz I2S master clock source frequency in Hz.  */
void FLEXIO_I2S_MasterSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_format_t *format, uint32_t srcClock_Hz)
{
    uint32_t timDiv  = srcClock_Hz / (format->sampleRate_Hz * format->bitWidth * 2U);
    uint32_t bclkDiv = 0;
    if ((timDiv % 2UL) != 0UL)
    {
        timDiv += 1U;
    }
    base->flexioBase->TIMCMP[base->fsTimerIndex] = FLEXIO_TIMCMP_CMP(format->bitWidth * timDiv - 1U);
    bclkDiv                                        = ((timDiv / 2U - 1U) | ((format->bitWidth * 2UL - 1UL) << 8U));
    base->flexioBase->TIMCMP[base->bclkTimerIndex] = FLEXIO_TIMCMP_CMP(bclkDiv);
}