Lines Matching refs:termios
12 #include <linux/termios.h>
34 * Internal flag options for termios setting behavior
98 * Takes the termios rwsem to protect against parallel throttle/unthrottle
100 * termios data at this point when implementing software flow control.
216 struct ktermios *termios = &tty->termios;
222 NOSET_MASK(termios->c_iflag, old->c_iflag, locked->c_iflag);
223 NOSET_MASK(termios->c_oflag, old->c_oflag, locked->c_oflag);
224 NOSET_MASK(termios->c_cflag, old->c_cflag, locked->c_cflag);
225 NOSET_MASK(termios->c_lflag, old->c_lflag, locked->c_lflag);
226 termios->c_line = locked->c_line ? old->c_line : termios->c_line;
228 termios->c_cc[i] = locked->c_cc[i] ?
229 old->c_cc[i] : termios->c_cc[i];
235 * @new: New termios
236 * @old: Old termios
239 * the old termios structure to the new one. This is used in cases
257 * @a: termios
258 * @b: termios to compare
261 * between the two termios structures, or a speed change is needed.
276 * @cflag: termios cflag value
299 * @cflag: termios cflag value
322 * tty_set_termios - update termios values
326 * Perform updates to the termios values set on this terminal.
327 * A master pty's termios should never be set.
340 * Perform the actual termios internal changes under lock.
347 old_termios = tty->termios;
348 tty->termios = *new_termios;
351 tty->termios.c_cflag ^= (tty->termios.c_cflag ^ old_termios.c_cflag) & ADDRB;
356 tty_termios_copy_hw(&tty->termios, &old_termios);
371 * Translate a "termio" structure into a "termios". Ugh.
373 __weak int user_termio_to_kernel_termios(struct ktermios *termios,
381 termios->c_iflag = (0xffff0000 & termios->c_iflag) | v.c_iflag;
382 termios->c_oflag = (0xffff0000 & termios->c_oflag) | v.c_oflag;
383 termios->c_cflag = (0xffff0000 & termios->c_cflag) | v.c_cflag;
384 termios->c_lflag = (0xffff0000 & termios->c_lflag) | v.c_lflag;
385 termios->c_line = (0xffff0000 & termios->c_lflag) | v.c_line;
386 memcpy(termios->c_cc, v.c_cc, NCC);
391 * Translate a "termios" structure into a "termio". Ugh.
394 struct ktermios *termios)
398 v.c_iflag = termios->c_iflag;
399 v.c_oflag = termios->c_oflag;
400 v.c_cflag = termios->c_cflag;
401 v.c_lflag = termios->c_lflag;
402 v.c_line = termios->c_line;
403 memcpy(v.c_cc, termios->c_cc, NCC);
419 struct termios __user *u)
421 return copy_from_user(k, u, sizeof(struct termios));
423 __weak int kernel_termios_to_user_termios_1(struct termios __user *u,
426 return copy_to_user(u, k, sizeof(struct termios));
432 struct termios __user *u)
434 return copy_from_user(k, u, sizeof(struct termios));
436 __weak int kernel_termios_to_user_termios(struct termios __user *u,
439 return copy_to_user(u, k, sizeof(struct termios));
444 * set_termios - set termios values for a tty
449 * Helper function to prepare termios data and run necessary other
466 tmp_termios = tty->termios;
476 (struct termios __user *)arg))
485 (struct termios __user *)arg))
531 /* FIXME: Arguably if tmp_termios == tty->termios AND the
532 actual requested termios was not tmp_termios then we may
541 *kterm = tty->termios;
590 tmp.sg_ispeed = tty->termios.c_ispeed;
591 tmp.sg_ospeed = tty->termios.c_ospeed;
592 tmp.sg_erase = tty->termios.c_cc[VERASE];
593 tmp.sg_kill = tty->termios.c_cc[VKILL];
600 static void set_sgflags(struct ktermios *termios, int flags)
602 termios->c_iflag = ICRNL | IXON;
603 termios->c_oflag = 0;
604 termios->c_lflag = ISIG | ICANON;
606 termios->c_iflag = 0;
607 termios->c_lflag &= ~ICANON;
610 termios->c_lflag |= ECHO | ECHOE | ECHOK |
614 termios->c_oflag |= OPOST | ONLCR;
617 termios->c_iflag = 0;
618 termios->c_lflag &= ~(ISIG | ICANON);
620 if (!(termios->c_lflag & ICANON)) {
621 termios->c_cc[VMIN] = 1;
622 termios->c_cc[VTIME] = 0;
641 struct ktermios termios;
651 termios = tty->termios;
652 termios.c_cc[VERASE] = tmp.sg_erase;
653 termios.c_cc[VKILL] = tmp.sg_kill;
654 set_sgflags(&termios, tmp.sg_flags);
656 tty_termios_encode_baud_rate(&termios, termios.c_ispeed,
657 termios.c_ospeed);
659 tty_set_termios(tty, &termios);
670 tmp.t_intrc = tty->termios.c_cc[VINTR];
671 tmp.t_quitc = tty->termios.c_cc[VQUIT];
672 tmp.t_startc = tty->termios.c_cc[VSTART];
673 tmp.t_stopc = tty->termios.c_cc[VSTOP];
674 tmp.t_eofc = tty->termios.c_cc[VEOF];
675 tmp.t_brkc = tty->termios.c_cc[VEOL2]; /* what is brkc anyway? */
687 tty->termios.c_cc[VINTR] = tmp.t_intrc;
688 tty->termios.c_cc[VQUIT] = tmp.t_quitc;
689 tty->termios.c_cc[VSTART] = tmp.t_startc;
690 tty->termios.c_cc[VSTOP] = tmp.t_stopc;
691 tty->termios.c_cc[VEOF] = tmp.t_eofc;
692 tty->termios.c_cc[VEOL2] = tmp.t_brkc; /* what is brkc anyway? */
704 tmp.t_suspc = tty->termios.c_cc[VSUSP];
706 tmp.t_dsuspc = tty->termios.c_cc[VSUSP];
707 tmp.t_rprntc = tty->termios.c_cc[VREPRINT];
709 tmp.t_flushc = tty->termios.c_cc[VEOL2];
710 tmp.t_werasc = tty->termios.c_cc[VWERASE];
711 tmp.t_lnextc = tty->termios.c_cc[VLNEXT];
724 tty->termios.c_cc[VSUSP] = tmp.t_suspc;
726 tty->termios.c_cc[VEOL2] = tmp.t_dsuspc;
727 tty->termios.c_cc[VREPRINT] = tmp.t_rprntc;
729 tty->termios.c_cc[VEOL2] = tmp.t_flushc;
730 tty->termios.c_cc[VWERASE] = tmp.t_werasc;
731 tty->termios.c_cc[VLNEXT] = tmp.t_lnextc;
743 * layer to make it visible. All done with the termios rwsem
753 old = tty->termios;
754 tty->termios.c_cflag &= ~CLOCAL;
755 tty->termios.c_cflag |= bit;
817 if (kernel_termios_to_user_termios((struct termios __user *)arg, &kterm))
823 if (kernel_termios_to_user_termios_1((struct termios __user *)arg, &kterm))
849 if (kernel_termios_to_user_termios((struct termios __user *)arg, &kterm))
857 (struct termios __user *) arg))
866 if (kernel_termios_to_user_termios_1((struct termios __user *)arg, &kterm))
874 (struct termios __user *) arg))