/* Set Baud Rate of MCAN. 
This function set the baud rate of MCAN. */
static void MCAN_SetBaudRate(CAN_Type *base, uint32_t sourceClock_Hz, uint32_t baudRateA_Bps, mcan_timing_config_t timingConfig)
/* Set Baud Rate of MCAN. 
This function set the baud rate of MCAN. */
static void MCAN_SetBaudRate(CAN_Type *base, uint32_t sourceClock_Hz, uint32_t baudRateA_Bps, mcan_timing_config_t timingConfig)
{
    uint32_t quantum = (1U + ((uint32_t)timingConfig.seg1 + 1U) + ((uint32_t)timingConfig.seg2 + 1U));
    uint32_t preDivA = baudRateA_Bps * quantum;
    assert(preDivA <= sourceClock_Hz);
    if (0U == preDivA)
    {
        preDivA = 1U;
    }
    preDivA = (sourceClock_Hz / preDivA) - 1U;
    if (preDivA > 0x1FFU)
    {
        preDivA = 0x1FFU;
    }
    timingConfig.preDivider = (uint16_t)preDivA;
    MCAN_SetArbitrationTimingConfig(base, &timingConfig);
}