/* 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;
    status_t status;
    baudRatePerDataLine = baudRate_Bps / FLEXIO_MCULCD_DATA_BUS_WIDTH;
    baudRateDiv = (srcClock_Hz + baudRatePerDataLine) / (baudRatePerDataLine * 2U);
    if ((0U == baudRateDiv) || (baudRateDiv > (FLEXIO_BAUDRATE_DIV_MASK + 1U)))
    {
        status = kStatus_InvalidArgument;
    }
    else
    {
        baudRateDiv--;
        timerCompare = base->flexioBase->TIMCMP[base->timerIndex];
        timerCompare = (timerCompare & ~FLEXIO_BAUDRATE_DIV_MASK) | baudRateDiv;
        base->flexioBase->TIMCMP[base->timerIndex] = timerCompare;
        status = kStatus_Success;
    }
    return status;
}