1 /* 2 * SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include "sdkconfig.h" 8 9 #ifdef CONFIG_VFS_SUPPORT_TERMIOS 10 11 #include <sys/termios.h> 12 #include <sys/errno.h> 13 cfgetispeed(const struct termios * p)14speed_t cfgetispeed(const struct termios *p) 15 { 16 return p ? p->c_ispeed : B0; 17 } 18 cfgetospeed(const struct termios * p)19speed_t cfgetospeed(const struct termios *p) 20 { 21 return p ? p->c_ospeed : B0; 22 } 23 cfsetispeed(struct termios * p,speed_t sp)24int cfsetispeed(struct termios *p, speed_t sp) 25 { 26 if (p) { 27 p->c_ispeed = sp; 28 return 0; 29 } else { 30 errno = EINVAL; 31 return -1; 32 } 33 } 34 cfsetospeed(struct termios * p,speed_t sp)35int cfsetospeed(struct termios *p, speed_t sp) 36 { 37 if (p) { 38 p->c_ospeed = sp; 39 return 0; 40 } else { 41 errno = EINVAL; 42 return -1; 43 } 44 } 45 46 #endif // CONFIG_VFS_SUPPORT_TERMIOS 47