/* Serial polling transmit data routines, This function will transmit data in a continuous loop by one by one byte.  */
rt_size_t _serial_poll_tx(struct rt_device *dev, rt_off_t pos, const void *buffer, rt_size_t size)
/* Serial polling transmit data routines, This function will transmit data in a continuous loop by one by one byte.  */
rt_size_t _serial_poll_tx(struct rt_device *dev, rt_off_t pos, const void *buffer, rt_size_t size)
{
    struct rt_serial_device *serial;
    rt_size_t putc_size;
    rt_uint8_t *putc_buffer;
    RT_ASSERT(dev != RT_NULL);
    serial = (struct rt_serial_device *)dev;
    RT_ASSERT(serial != RT_NULL);
    putc_buffer = (rt_uint8_t *)buffer;
    putc_size = size;
    while (size)
    {
        if (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM)
        {
            if (*putc_buffer == '\n')
                serial->ops->putc(serial, '\r');
        }
        serial->ops->putc(serial, *putc_buffer);
        ++ putc_buffer;
        -- size;
    }
     return putc_size - size;
}