In the function, it has checked tx fifo is empty, fifo empty transfer data to uart fifo.
int32_t DrvUART_Write(E_UART_PORT u32Port,uint8_t *pu8TxBuf, uint32_t u32WriteBytes)
{
uint32_t u32Count, u32delayno;
UART_T * tUART;
tUART = (UART_T *)((uint32_t)UART0 + u32Port);
for (u32Count=0; u32Count<u32WriteBytes; u32Count++)
{
u32delayno = 0;
while (tUART->FSR.TE_FLAG !=1) /* Wait Tx empty and Time-out manner */ {
u32delayno++;
if ( u32delayno >= 0x40000000 )
return E_DRVUART_ERR_TIMEOUT;
}
tUART->DATA = pu8TxBuf[u32Count]; /* Send UART Data from buffer */
}
return E_SUCCESS;
} |