[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;
|
||||
|
||||
case RT_DEVICE_CTRL_CONFIG:
|
||||
/* configure device */
|
||||
serial->ops->configure(serial, (struct serial_configure *)args);
|
||||
if (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;
|
||||
|
||||
default :
|
||||
|
Loading…
x
Reference in New Issue
Block a user