Lines Matching refs:tty

141 static int  open(struct tty_struct *tty, struct file * filp);
142 static void close(struct tty_struct *tty, struct file * filp);
143 static void hangup(struct tty_struct *tty);
144 static void set_termios(struct tty_struct *tty, struct ktermios *old_termios);
146 static int write(struct tty_struct *tty, const unsigned char *buf, int count);
147 static int put_char(struct tty_struct *tty, unsigned char ch);
148 static void send_xchar(struct tty_struct *tty, char ch);
149 static void wait_until_sent(struct tty_struct *tty, int timeout);
150 static int write_room(struct tty_struct *tty);
151 static void flush_chars(struct tty_struct *tty);
152 static void flush_buffer(struct tty_struct *tty);
153 static void tx_hold(struct tty_struct *tty);
154 static void tx_release(struct tty_struct *tty);
156 static int ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
157 static int chars_in_buffer(struct tty_struct *tty);
158 static void throttle(struct tty_struct * tty);
159 static void unthrottle(struct tty_struct * tty);
160 static int set_break(struct tty_struct *tty, int break_state);
442 static int block_til_ready(struct tty_struct *tty, struct file * filp,struct slgt_info *info);
513 static int tiocmget(struct tty_struct *tty);
514 static int tiocmset(struct tty_struct *tty,
516 static int set_break(struct tty_struct *tty, int break_state);
632 static void ldisc_receive_buf(struct tty_struct *tty, in ldisc_receive_buf() argument
636 if (!tty) in ldisc_receive_buf()
638 ld = tty_ldisc_ref(tty); in ldisc_receive_buf()
641 ld->ops->receive_buf(tty, data, flags, count); in ldisc_receive_buf()
648 static int open(struct tty_struct *tty, struct file *filp) in open() argument
654 line = tty->index; in open()
663 if (sanity_check(info, tty->name, "open")) in open()
670 tty->driver_data = info; in open()
671 info->port.tty = tty; in open()
697 retval = block_til_ready(tty, filp, info); in open()
707 if (tty->count == 1) in open()
708 info->port.tty = NULL; /* tty layer will release tty struct */ in open()
717 static void close(struct tty_struct *tty, struct file *filp) in close() argument
719 struct slgt_info *info = tty->driver_data; in close()
721 if (sanity_check(info, tty->name, "close")) in close()
725 if (tty_port_close_start(&info->port, tty, filp) == 0) in close()
730 wait_until_sent(tty, info->timeout); in close()
731 flush_buffer(tty); in close()
732 tty_ldisc_flush(tty); in close()
737 tty_port_close_end(&info->port, tty); in close()
738 info->port.tty = NULL; in close()
740 DBGINFO(("%s close exit, count=%d\n", tty->driver->name, info->port.count)); in close()
743 static void hangup(struct tty_struct *tty) in hangup() argument
745 struct slgt_info *info = tty->driver_data; in hangup()
748 if (sanity_check(info, tty->name, "hangup")) in hangup()
752 flush_buffer(tty); in hangup()
760 info->port.tty = NULL; in hangup()
767 static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) in set_termios() argument
769 struct slgt_info *info = tty->driver_data; in set_termios()
772 DBGINFO(("%s set_termios\n", tty->driver->name)); in set_termios()
778 !(tty->termios.c_cflag & CBAUD)) { in set_termios()
787 tty->termios.c_cflag & CBAUD) { in set_termios()
789 if (!(tty->termios.c_cflag & CRTSCTS) || in set_termios()
790 !test_bit(TTY_THROTTLED, &tty->flags)) { in set_termios()
800 !(tty->termios.c_cflag & CRTSCTS)) { in set_termios()
801 tty->hw_stopped = 0; in set_termios()
802 tx_release(tty); in set_termios()
818 static int write(struct tty_struct *tty, in write() argument
822 struct slgt_info *info = tty->driver_data; in write()
825 if (sanity_check(info, tty->name, "write")) in write()
833 if (!count || tty->stopped || tty->hw_stopped) in write()
854 static int put_char(struct tty_struct *tty, unsigned char ch) in put_char() argument
856 struct slgt_info *info = tty->driver_data; in put_char()
860 if (sanity_check(info, tty->name, "put_char")) in put_char()
874 static void send_xchar(struct tty_struct *tty, char ch) in send_xchar() argument
876 struct slgt_info *info = tty->driver_data; in send_xchar()
879 if (sanity_check(info, tty->name, "send_xchar")) in send_xchar()
891 static void wait_until_sent(struct tty_struct *tty, int timeout) in wait_until_sent() argument
893 struct slgt_info *info = tty->driver_data; in wait_until_sent()
898 if (sanity_check(info, tty->name, "wait_until_sent")) in wait_until_sent()
933 static int write_room(struct tty_struct *tty) in write_room() argument
935 struct slgt_info *info = tty->driver_data; in write_room()
938 if (sanity_check(info, tty->name, "write_room")) in write_room()
945 static void flush_chars(struct tty_struct *tty) in flush_chars() argument
947 struct slgt_info *info = tty->driver_data; in flush_chars()
950 if (sanity_check(info, tty->name, "flush_chars")) in flush_chars()
954 if (info->tx_count <= 0 || tty->stopped || in flush_chars()
955 tty->hw_stopped || !info->tx_buf) in flush_chars()
966 static void flush_buffer(struct tty_struct *tty) in flush_buffer() argument
968 struct slgt_info *info = tty->driver_data; in flush_buffer()
971 if (sanity_check(info, tty->name, "flush_buffer")) in flush_buffer()
979 tty_wakeup(tty); in flush_buffer()
985 static void tx_hold(struct tty_struct *tty) in tx_hold() argument
987 struct slgt_info *info = tty->driver_data; in tx_hold()
990 if (sanity_check(info, tty->name, "tx_hold")) in tx_hold()
1002 static void tx_release(struct tty_struct *tty) in tx_release() argument
1004 struct slgt_info *info = tty->driver_data; in tx_release()
1007 if (sanity_check(info, tty->name, "tx_release")) in tx_release()
1027 static int ioctl(struct tty_struct *tty, in ioctl() argument
1030 struct slgt_info *info = tty->driver_data; in ioctl()
1034 if (sanity_check(info, tty->name, "ioctl")) in ioctl()
1040 if (tty->flags & (1 << TTY_IO_ERROR)) in ioctl()
1103 static int get_icount(struct tty_struct *tty, in get_icount() argument
1107 struct slgt_info *info = tty->driver_data; in get_icount()
1191 static long slgt_compat_ioctl(struct tty_struct *tty, in slgt_compat_ioctl() argument
1194 struct slgt_info *info = tty->driver_data; in slgt_compat_ioctl()
1197 if (sanity_check(info, tty->name, "compat_ioctl")) in slgt_compat_ioctl()
1230 rc = ioctl(tty, cmd, arg); in slgt_compat_ioctl()
1341 static int chars_in_buffer(struct tty_struct *tty) in chars_in_buffer() argument
1343 struct slgt_info *info = tty->driver_data; in chars_in_buffer()
1345 if (sanity_check(info, tty->name, "chars_in_buffer")) in chars_in_buffer()
1355 static void throttle(struct tty_struct * tty) in throttle() argument
1357 struct slgt_info *info = tty->driver_data; in throttle()
1360 if (sanity_check(info, tty->name, "throttle")) in throttle()
1363 if (I_IXOFF(tty)) in throttle()
1364 send_xchar(tty, STOP_CHAR(tty)); in throttle()
1365 if (tty->termios.c_cflag & CRTSCTS) { in throttle()
1376 static void unthrottle(struct tty_struct * tty) in unthrottle() argument
1378 struct slgt_info *info = tty->driver_data; in unthrottle()
1381 if (sanity_check(info, tty->name, "unthrottle")) in unthrottle()
1384 if (I_IXOFF(tty)) { in unthrottle()
1388 send_xchar(tty, START_CHAR(tty)); in unthrottle()
1390 if (tty->termios.c_cflag & CRTSCTS) { in unthrottle()
1402 static int set_break(struct tty_struct *tty, int break_state) in set_break() argument
1404 struct slgt_info *info = tty->driver_data; in set_break()
1408 if (sanity_check(info, tty->name, "set_break")) in set_break()
1999 struct tty_struct *tty = info->port.tty; in bh_transmit() local
2002 if (tty) in bh_transmit()
2003 tty_wakeup(tty); in bh_transmit()
2046 if (info->port.tty) { in cts_change()
2047 if (info->port.tty->hw_stopped) { in cts_change()
2049 info->port.tty->hw_stopped = 0; in cts_change()
2055 info->port.tty->hw_stopped = 1; in cts_change()
2092 if (info->port.tty) in dcd_change()
2093 tty_hangup(info->port.tty); in dcd_change()
2172 if (info->port.tty) { in isr_serial()
2177 do_SAK(info->port.tty); in isr_serial()
2331 if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) { in isr_txeom()
2447 if (info->port.tty) in startup()
2448 clear_bit(TTY_IO_ERROR, &info->port.tty->flags); in startup()
2485 if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) { in shutdown()
2494 if (info->port.tty) in shutdown()
2495 set_bit(TTY_IO_ERROR, &info->port.tty->flags); in shutdown()
2526 (info->port.tty && info->port.tty->termios.c_cflag & CREAD)) in program_hw()
2540 if (!info->port.tty) in change_params()
2544 cflag = info->port.tty->termios.c_cflag; in change_params()
2576 info->params.data_rate = tty_get_baud_rate(info->port.tty); in change_params()
2597 if (I_INPCK(info->port.tty)) in change_params()
2599 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) in change_params()
2601 if (I_IGNPAR(info->port.tty)) in change_params()
2603 if (I_IGNBRK(info->port.tty)) { in change_params()
2608 if (I_IGNPAR(info->port.tty)) in change_params()
3185 static int tiocmget(struct tty_struct *tty) in tiocmget() argument
3187 struct slgt_info *info = tty->driver_data; in tiocmget()
3213 static int tiocmset(struct tty_struct *tty, in tiocmset() argument
3216 struct slgt_info *info = tty->driver_data; in tiocmset()
3265 static int block_til_ready(struct tty_struct *tty, struct file *filp, in block_til_ready() argument
3275 DBGINFO(("%s block_til_ready\n", tty->driver->name)); in block_til_ready()
3277 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ in block_til_ready()
3283 if (tty->termios.c_cflag & CLOCAL) in block_til_ready()
3302 if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags)) in block_til_ready()
3322 DBGINFO(("%s block_til_ready wait\n", tty->driver->name)); in block_til_ready()
3323 tty_unlock(tty); in block_til_ready()
3325 tty_lock(tty); in block_til_ready()
3338 DBGINFO(("%s block_til_ready ready, rc=%d\n", tty->driver->name, retval)); in block_til_ready()
4651 struct tty_struct *tty = info->port.tty; in rx_get_frame() local
4768 ldisc_receive_buf(tty, info->tmp_rbuf, info->flag_buf, framesize); in rx_get_frame()
4802 ldisc_receive_buf(info->port.tty, info->rbufs[i].buf, in rx_get_buf()
4989 struct tty_struct *oldtty = info->port.tty; in irq_test()
4993 info->port.tty = NULL; in irq_test()
5021 info->port.tty = oldtty; in irq_test()
5061 struct tty_struct *oldtty = info->port.tty; in loopback_test()
5069 info->port.tty = NULL; in loopback_test()
5105 info->port.tty = oldtty; in loopback_test()