Lines Matching +full:convert +full:- +full:rate
1 // SPDX-License-Identifier: GPL-2.0
15 * Routine which returns the baud rate of the tty
50 * Convert termios baud rate data into a speed. This should be called
53 * ->c_[io]speed directly as they are updated.
62 cbaud = termios->c_cflag & CBAUD; in tty_termios_baud_rate()
66 return termios->c_ospeed; in tty_termios_baud_rate()
80 * Convert termios baud rate data into a speed. This should be called
83 * ->c_[io]speed directly as they are updated.
90 unsigned int cbaud = (termios->c_cflag >> IBSHIFT) & CBAUD; in tty_termios_input_baud_rate()
97 return termios->c_ispeed; in tty_termios_input_baud_rate()
133 int ifound = -1, ofound = -1; in tty_termios_encode_baud_rate()
140 termios->c_ispeed = ibaud; in tty_termios_encode_baud_rate()
141 termios->c_ospeed = obaud; in tty_termios_encode_baud_rate()
143 if (((termios->c_cflag >> IBSHIFT) & CBAUD) != B0) in tty_termios_encode_baud_rate()
148 * digesting non-exact replies so fuzz a bit. in tty_termios_encode_baud_rate()
151 if ((termios->c_cflag & CBAUD) == BOTHER) { in tty_termios_encode_baud_rate()
156 if (((termios->c_cflag >> IBSHIFT) & CBAUD) == BOTHER) in tty_termios_encode_baud_rate()
159 termios->c_cflag &= ~CBAUD; in tty_termios_encode_baud_rate()
160 termios->c_cflag &= ~(CBAUD << IBSHIFT); in tty_termios_encode_baud_rate()
163 * Our goal is to find a close match to the standard baud rate in tty_termios_encode_baud_rate()
164 * returned. Walk the baud rate table and if we get a very close in tty_termios_encode_baud_rate()
170 if (obaud - oclose <= baud_table[i] && in tty_termios_encode_baud_rate()
172 termios->c_cflag |= baud_bits[i]; in tty_termios_encode_baud_rate()
175 if (ibaud - iclose <= baud_table[i] && in tty_termios_encode_baud_rate()
184 termios->c_cflag |= (baud_bits[i] << IBSHIFT); in tty_termios_encode_baud_rate()
190 if (ofound == -1) in tty_termios_encode_baud_rate()
191 termios->c_cflag |= BOTHER; in tty_termios_encode_baud_rate()
195 if (ifound == -1 && (ibaud != obaud || ibinput)) in tty_termios_encode_baud_rate()
196 termios->c_cflag |= (BOTHER << IBSHIFT); in tty_termios_encode_baud_rate()
201 * tty_encode_baud_rate - set baud rate of the tty
203 * @ibaud: input baud rate
204 * @obaud: output baud rate
213 tty_termios_encode_baud_rate(&tty->termios, ibaud, obaud); in tty_encode_baud_rate()