[DeviceDrivers] uart configure issue.
uart configure shall not been performed if uart is not open.
This commit is contained in:
parent
45c7f03035
commit
99481cd0ac
@ -603,8 +603,18 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RT_DEVICE_CTRL_CONFIG:
|
case RT_DEVICE_CTRL_CONFIG:
|
||||||
/* configure device */
|
if (args)
|
||||||
serial->ops->configure(serial, (struct serial_configure *)args);
|
{
|
||||||
|
/* set serial configure */
|
||||||
|
serial->config = *(struct serial_configure *)args;
|
||||||
|
|
||||||
|
if (dev->ref_count)
|
||||||
|
{
|
||||||
|
/* serial device has been opened, to configure it */
|
||||||
|
serial->ops->configure(serial, (struct serial_configure *)args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user