//*****************************************************************************
//
//! Waits for a character from the specified port.
//!
//! param ui32Base is the base address of the UART port.
//!
//! This function gets a character from the receive FIFO for the specified
//! port. If there are no characters available, this function waits until a
//! character is received before returning.
//!
//! return Returns the character read from the specified port, cast as a
//! e int32_t.
//
//*****************************************************************************
int32_t
UARTCharGet(uint32_t ui32Base)
[
//
// Check the arguments.
//
ASSERT(_UARTBaseValid(ui32Base));
//
// Wait until a char is available.
//
while(HWREG(ui32Base + UART_O_FR) & UART_FR_RXFE)
[
]
//
// Now get the char.
//
return(HWREG(ui32Base + UART_O_DR));
]
注意标注红色部分,其可能没有获取字符,停留在此等待。