/* Write data into transmit FIFO to send data out.  */
uint32_t SCUART_Write(SC_T *sc, uint8_t pu8TxBuf[], uint32_t u32WriteBytes)
/* Write data into transmit FIFO to send data out.  */
uint32_t SCUART_Write(SC_T *sc, uint8_t pu8TxBuf[], uint32_t u32WriteBytes)
{
    uint32_t u32Count;
    uint32_t u32Delay = (SystemCoreClock / SCUART_GetClock(sc)) * sc->ETUCTL * 12, i;
    g_SCUART_i32ErrCode = 0;
    for (u32Count = 0UL; u32Count != u32WriteBytes; u32Count++)
    {
        i = 0;
        while (SCUART_GET_TX_FULL(sc))
        {
            if (i++ > u32Delay)
            {
                g_SCUART_i32ErrCode = SCUART_TIMEOUT_ERR;
                return u32Count;
            }
        }
        sc->DAT = pu8TxBuf[u32Count];
    }
    return u32Count;
}