/* param base USART peripheral base address. param baudRate_Bps USART baudrate to be set.. param enableMode32k true is 32k mode, false is normal mode. param srcClock_Hz USART clock source frequency in HZ. retval kStatus_USART_BaudrateNotSupport Baudrate is not support in current clock source. retval kStatus_Success Set baudrate succeed. retval kStatus_InvalidArgument One or more arguments are invalid.  */
status_t USART_Enable32kMode(USART_Type *base, uint32_t baudRate_Bps, bool enableMode32k, uint32_t srcClock_Hz)
/* param base USART peripheral base address. param baudRate_Bps USART baudrate to be set.. param enableMode32k true is 32k mode, false is normal mode. param srcClock_Hz USART clock source frequency in HZ. retval kStatus_USART_BaudrateNotSupport Baudrate is not support in current clock source. retval kStatus_Success Set baudrate succeed. retval kStatus_InvalidArgument One or more arguments are invalid.  */
status_t USART_Enable32kMode(USART_Type *base, uint32_t baudRate_Bps, bool enableMode32k, uint32_t srcClock_Hz)
{
    status_t result = kStatus_Success;
    base->CFG &= ~(USART_CFG_ENABLE_MASK);
    if (enableMode32k)
    {
        base->CFG |= USART_CFG_MODE32K_MASK;
        if ((9600U % baudRate_Bps) == 0U)
        {
            base->BRG = 9600U / baudRate_Bps - 1U;
        }
        else
        {
            return kStatus_USART_BaudrateNotSupport;
        }
    }
    else
    {
        base->CFG &= ~(USART_CFG_MODE32K_MASK);
        result = USART_SetBaudRate(base, baudRate_Bps, srcClock_Hz);
        if (kStatus_Success != result)
        {
            return result;
        }
    }
    base->CFG |= USART_CFG_ENABLE_MASK;
    return result;
}