/* Enable smartcard module UART mode and set baudrate. 
HIDDEN_SYMBOLS */
uint32_t SCUART_Open(SC_T *sc, uint32_t u32Baudrate)
/* Enable smartcard module UART mode and set baudrate. 
HIDDEN_SYMBOLS */
uint32_t SCUART_Open(SC_T *sc, uint32_t u32Baudrate)
{
    uint32_t u32ClkFreq = SCUART_GetClock(sc), u32Div;
    u32Div = (u32ClkFreq + (u32Baudrate >> 1) - 1UL) / u32Baudrate - 1UL;
    sc->CTL = SC_CTL_SCEN_Msk | SC_CTL_NSB_Msk;
    sc->UARTCTL = SCUART_CHAR_LEN_8 | SCUART_PARITY_NONE | SC_UARTCTL_UARTEN_Msk;
    sc->ETUCTL = u32Div;
    return (u32ClkFreq / (u32Div + 1UL));
}