/* serial register for STM32 support STM32F103VB and STM32F103ZE  */
rt_err_t rt_hw_serial_register(rt_device_t device, const char *name, rt_uint32_t flag, struct avr32_serial_device *serial)
/* serial register for STM32 support STM32F103VB and STM32F103ZE  */
rt_err_t rt_hw_serial_register(rt_device_t device, const char *name, rt_uint32_t flag, struct avr32_serial_device *serial)
{
    RT_ASSERT(device != RT_NULL);
    if ((flag & RT_DEVICE_FLAG_DMA_RX) ||
        (flag & RT_DEVICE_FLAG_INT_TX))
    {
        RT_ASSERT(0);
    }
    device->type        = RT_Device_Class_Char;
    device->rx_indicate = RT_NULL;
    device->tx_complete = RT_NULL;
    device->init        = rt_serial_init;
    device->open        = rt_serial_open;
    device->close       = rt_serial_close;
    device->read        = rt_serial_read;
    device->write       = rt_serial_write;
    device->control     = rt_serial_control;
    device->user_data   = serial;
    return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag);
}