diff options
| author | Bernard Xiong <[email protected]> | 2014-02-28 18:42:53 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2014-02-28 18:42:53 +0800 |
| commit | 54b693b3a2b1d874cdc599f67e576a798002630a (patch) | |
| tree | a75ec8557b59c2dcbb16f7ae673d823ec75ae048 | |
| parent | 5aeedc4f3a3c3fcfffb0cd4a474f5faa75053839 (diff) | |
| parent | 9ab853aca3385f77f8a41a55c02ea425f14b0028 (diff) | |
Merge pull request #242 from bright-pan/master
Fix rt_serial_control() bug for customized command and indent the code
| -rw-r--r-- | components/drivers/serial/serial.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index a9b4e47b43..9a356b6f0c 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -346,20 +346,25 @@ static rt_err_t rt_serial_control(struct rt_device *dev, switch (cmd) { - case RT_DEVICE_CTRL_SUSPEND: - /* suspend device */ - dev->flag |= RT_DEVICE_FLAG_SUSPENDED; - break; + case RT_DEVICE_CTRL_SUSPEND: + /* suspend device */ + dev->flag |= RT_DEVICE_FLAG_SUSPENDED; + break; - case RT_DEVICE_CTRL_RESUME: - /* resume device */ - dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; - break; + case RT_DEVICE_CTRL_RESUME: + /* resume device */ + dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; + break; - case RT_DEVICE_CTRL_CONFIG: - /* configure device */ - serial->ops->configure(serial, (struct serial_configure *)args); - break; + case RT_DEVICE_CTRL_CONFIG: + /* configure device */ + serial->ops->configure(serial, (struct serial_configure *)args); + break; + + default : + /* control device */ + serial->ops->control(serial, cmd, args); + break; } return RT_EOK; |
