/* param base Pointer to the FLEXIO_MCULCD_Type structure. param baudRate_Bps Desired baud rate. param srcClock_Hz FLEXIO clock frequency in Hz. retval kStatus_Success Set successfully. retval kStatus_InvalidArgument Could not set the baud rate.  */
status_t FLEXIO_MCULCD_SetBaudRate(FLEXIO_MCULCD_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
/* param base Pointer to the FLEXIO_MCULCD_Type structure. param baudRate_Bps Desired baud rate. param srcClock_Hz FLEXIO clock frequency in Hz. retval kStatus_Success Set successfully. retval kStatus_InvalidArgument Could not set the baud rate.  */
status_t FLEXIO_MCULCD_SetBaudRate(FLEXIO_MCULCD_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
{
    uint32_t baudRateDiv;
    uint32_t baudRatePerDataLine;
    uint32_t timerCompare;
    baudRatePerDataLine = baudRate_Bps / FLEXIO_MCULCD_DATA_BUS_WIDTH;
    baudRateDiv = (srcClock_Hz + baudRatePerDataLine) / (baudRatePerDataLine * 2);
    if ((0 == baudRateDiv) || (baudRateDiv > (FLEXIO_BAUDRATE_DIV_MASK + 1U)))
    {
        return kStatus_InvalidArgument;
    }
    baudRateDiv--;
    timerCompare = base->flexioBase->TIMCMP[base->timerIndex];
    timerCompare = (timerCompare & ~FLEXIO_BAUDRATE_DIV_MASK) | baudRateDiv;
    base->flexioBase->TIMCMP[base->timerIndex] = timerCompare;
    return kStatus_Success;
}