/* Serial port receive idle process. This need add to uart idle ISR. */
static void dma_uart_rx_idle_isr(struct rt_serial_device *serial)
/* Serial port receive idle process. This need add to uart idle ISR. */
static void dma_uart_rx_idle_isr(struct rt_serial_device *serial)
{
    struct n32_uart *uart = (struct n32_uart *) serial->parent.user_data;
    rt_size_t recv_total_index, recv_len;
    rt_base_t level;
    level = rt_hw_interrupt_disable();
    recv_total_index = uart->dma.setting_recv_len - DMA_GetCurrDataCounter(uart->dma.rx_ch);
    recv_len = recv_total_index - uart->dma.last_recv_index;
    uart->dma.last_recv_index = recv_total_index;
    rt_hw_interrupt_enable(level);
    if (recv_len)
        rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_DMADONE | (recv_len << 8));
    USART_ReceiveData(uart->uart_device);
    DMA_ClearFlag(uart->dma.rx_gl_flag, uart->dma.rx_dma_type);
}