mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
[DeviceDrivers] uart configure issue.
uart configure shall not been performed if uart is not open.
This commit is contained in:
1 parent
45c7f03035
commit
99481cd0ac
1 file changed
+12
-2
@@ -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 :
|
||||
|
||||
Reference in new issue
Block a user