/* brief Set the flexcomm output frequency. param id : flexcomm instance id freq : output frequency return 0 : the frequency range is out of range. 1 : switch successfully.  */
uint32_t CLOCK_SetFlexCommClock(uint32_t id, uint32_t freq)
/* brief Set the flexcomm output frequency. param id : flexcomm instance id freq : output frequency return 0 : the frequency range is out of range. 1 : switch successfully.  */
uint32_t CLOCK_SetFlexCommClock(uint32_t id, uint32_t freq)
{
    uint32_t input = CLOCK_GetFlexCommClkFreq(id);
    uint32_t mul;
    if ((freq > 48000000UL) || (freq > input) || (input / freq >= 2UL))
    {
        return 0UL;
    }
    else
    {
        mul                      = (uint32_t)((((uint64_t)input - freq) * 256ULL) / ((uint64_t)freq));
        SYSCON->FLEXFRGXCTRL[id] = (mul << 8U) | 0xFFU;
        return 1UL;
    }
}