/* See mss_uart.h for details of how to use this function.  */
void MSS_UART_set_rx_handler(mss_uart_instance_t *this_uart, mss_uart_irq_handler_t handler, mss_uart_rx_trig_level_t trigger_level)
/* See mss_uart.h for details of how to use this function.  */
void MSS_UART_set_rx_handler(mss_uart_instance_t *this_uart, mss_uart_irq_handler_t handler, mss_uart_rx_trig_level_t trigger_level)
{
    ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));
    ASSERT(handler != INVALID_IRQ_HANDLER );
    ASSERT(trigger_level < MSS_UART_FIFO_INVALID_TRIG_LEVEL);
    if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) &&
       (handler != INVALID_IRQ_HANDLER) &&
       (trigger_level < MSS_UART_FIFO_INVALID_TRIG_LEVEL))
    {
        this_uart->rx_handler = handler;
        this_uart->hw_reg->FCR = (this_uart->hw_reg->FCR &
                                 (uint8_t)(~((uint8_t)FCR_TRIG_LEVEL_MASK))) |
                                 (uint8_t)trigger_level;
        NVIC_ClearPendingIRQ(this_uart->irqn);
        set_bit_reg8(&this_uart->hw_reg->IER,ERBFI);
        NVIC_EnableIRQ(this_uart->irqn);
    }
}