2022-06-17 10:59:56 -04:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2018-08-14 07:39:30 -04:00
|
|
|
|
|
|
|
#include "sdkconfig.h"
|
|
|
|
|
2019-07-02 11:14:58 -04:00
|
|
|
#ifdef CONFIG_VFS_SUPPORT_TERMIOS
|
2018-08-14 07:39:30 -04:00
|
|
|
|
|
|
|
#include <sys/termios.h>
|
|
|
|
#include <sys/errno.h>
|
|
|
|
|
|
|
|
speed_t cfgetispeed(const struct termios *p)
|
|
|
|
{
|
|
|
|
return p ? p->c_ispeed : B0;
|
|
|
|
}
|
|
|
|
|
|
|
|
speed_t cfgetospeed(const struct termios *p)
|
|
|
|
{
|
|
|
|
return p ? p->c_ospeed : B0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfsetispeed(struct termios *p, speed_t sp)
|
|
|
|
{
|
|
|
|
if (p) {
|
|
|
|
p->c_ispeed = sp;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
errno = EINVAL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int cfsetospeed(struct termios *p, speed_t sp)
|
|
|
|
{
|
|
|
|
if (p) {
|
|
|
|
p->c_ospeed = sp;
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
errno = EINVAL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-02 11:14:58 -04:00
|
|
|
#endif // CONFIG_VFS_SUPPORT_TERMIOS
|