/* Serial gets a char. 
This function will get a char from the UART */
static int serial_getc(struct rt_serial_device *serial)
/* Serial gets a char. 
This function will get a char from the UART */
static int serial_getc(struct rt_serial_device *serial)
{
    char c;
    int ch;
    struct usart_async_descriptor* desc;
    RT_ASSERT(serial != RT_NULL);
    desc = (struct usart_async_descriptor *)serial->parent.user_data;
    RT_ASSERT(desc != RT_NULL);
    ch = -1;
    if (usart_async_is_rx_not_empty(desc))
    {
        io_read(&desc->io, (uint8_t *)&c, 1);
        ch = c & 0xff;
    }
    return ch;
}