/* See mss_uart.h for details of how to use this function.  */
size_t MSS_UART_get_rx(mss_uart_instance_t *this_uart, uint8_t *rx_buff, size_t buff_size)
/* See mss_uart.h for details of how to use this function.  */
size_t MSS_UART_get_rx(mss_uart_instance_t *this_uart, uint8_t *rx_buff, size_t buff_size)
{
    size_t rx_size = 0u;
    uint8_t status = 0u;
    ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));
    ASSERT(rx_buff != ((uint8_t *)0));
    ASSERT(buff_size > 0u);
    if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) &&
       (rx_buff != ((uint8_t *)0)) && (buff_size > 0u))
    {
        status = this_uart->hw_reg->LSR;
        this_uart->status |= status;
        while(((status & MSS_UART_DATA_READY) != 0u) &&
              (rx_size < buff_size))
        {
            rx_buff[rx_size] = this_uart->hw_reg->RBR;
            ++rx_size;
            status = this_uart->hw_reg->LSR;
            this_uart->status |= status;
        }
    }
    return rx_size;
}