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()
677 wait_event_interruptible_tty(tty, info->port.close_wait, in open()
706 retval = block_til_ready(tty, filp, info); in open()
716 if (tty->count == 1) in open()
717 info->port.tty = NULL; /* tty layer will release tty struct */ in open()
726 static void close(struct tty_struct *tty, struct file *filp) in close() argument
728 struct slgt_info *info = tty->driver_data; in close()
730 if (sanity_check(info, tty->name, "close")) in close()
734 if (tty_port_close_start(&info->port, tty, filp) == 0) in close()
739 wait_until_sent(tty, info->timeout); in close()
740 flush_buffer(tty); in close()
741 tty_ldisc_flush(tty); in close()
746 tty_port_close_end(&info->port, tty); in close()
747 info->port.tty = NULL; in close()
749 DBGINFO(("%s close exit, count=%d\n", tty->driver->name, info->port.count)); in close()
752 static void hangup(struct tty_struct *tty) in hangup() argument
754 struct slgt_info *info = tty->driver_data; in hangup()
757 if (sanity_check(info, tty->name, "hangup")) in hangup()
761 flush_buffer(tty); in hangup()
769 info->port.tty = NULL; in hangup()
776 static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) in set_termios() argument
778 struct slgt_info *info = tty->driver_data; in set_termios()
781 DBGINFO(("%s set_termios\n", tty->driver->name)); in set_termios()
787 !(tty->termios.c_cflag & CBAUD)) { in set_termios()
796 tty->termios.c_cflag & CBAUD) { in set_termios()
798 if (!(tty->termios.c_cflag & CRTSCTS) || in set_termios()
799 !test_bit(TTY_THROTTLED, &tty->flags)) { in set_termios()
809 !(tty->termios.c_cflag & CRTSCTS)) { in set_termios()
810 tty->hw_stopped = 0; in set_termios()
811 tx_release(tty); in set_termios()
827 static int write(struct tty_struct *tty, in write() argument
831 struct slgt_info *info = tty->driver_data; in write()
834 if (sanity_check(info, tty->name, "write")) in write()
842 if (!count || tty->stopped || tty->hw_stopped) in write()
863 static int put_char(struct tty_struct *tty, unsigned char ch) in put_char() argument
865 struct slgt_info *info = tty->driver_data; in put_char()
869 if (sanity_check(info, tty->name, "put_char")) in put_char()
883 static void send_xchar(struct tty_struct *tty, char ch) in send_xchar() argument
885 struct slgt_info *info = tty->driver_data; in send_xchar()
888 if (sanity_check(info, tty->name, "send_xchar")) in send_xchar()
900 static void wait_until_sent(struct tty_struct *tty, int timeout) in wait_until_sent() argument
902 struct slgt_info *info = tty->driver_data; in wait_until_sent()
907 if (sanity_check(info, tty->name, "wait_until_sent")) in wait_until_sent()
942 static int write_room(struct tty_struct *tty) in write_room() argument
944 struct slgt_info *info = tty->driver_data; in write_room()
947 if (sanity_check(info, tty->name, "write_room")) in write_room()
954 static void flush_chars(struct tty_struct *tty) in flush_chars() argument
956 struct slgt_info *info = tty->driver_data; in flush_chars()
959 if (sanity_check(info, tty->name, "flush_chars")) in flush_chars()
963 if (info->tx_count <= 0 || tty->stopped || in flush_chars()
964 tty->hw_stopped || !info->tx_buf) in flush_chars()
975 static void flush_buffer(struct tty_struct *tty) in flush_buffer() argument
977 struct slgt_info *info = tty->driver_data; in flush_buffer()
980 if (sanity_check(info, tty->name, "flush_buffer")) in flush_buffer()
988 tty_wakeup(tty); in flush_buffer()
994 static void tx_hold(struct tty_struct *tty) in tx_hold() argument
996 struct slgt_info *info = tty->driver_data; in tx_hold()
999 if (sanity_check(info, tty->name, "tx_hold")) in tx_hold()
1011 static void tx_release(struct tty_struct *tty) in tx_release() argument
1013 struct slgt_info *info = tty->driver_data; in tx_release()
1016 if (sanity_check(info, tty->name, "tx_release")) in tx_release()
1036 static int ioctl(struct tty_struct *tty, in ioctl() argument
1039 struct slgt_info *info = tty->driver_data; in ioctl()
1043 if (sanity_check(info, tty->name, "ioctl")) in ioctl()
1049 if (tty->flags & (1 << TTY_IO_ERROR)) in ioctl()
1112 static int get_icount(struct tty_struct *tty, in get_icount() argument
1116 struct slgt_info *info = tty->driver_data; in get_icount()
1200 static long slgt_compat_ioctl(struct tty_struct *tty, in slgt_compat_ioctl() argument
1203 struct slgt_info *info = tty->driver_data; in slgt_compat_ioctl()
1206 if (sanity_check(info, tty->name, "compat_ioctl")) in slgt_compat_ioctl()
1239 rc = ioctl(tty, cmd, arg); in slgt_compat_ioctl()
1350 static int chars_in_buffer(struct tty_struct *tty) in chars_in_buffer() argument
1352 struct slgt_info *info = tty->driver_data; in chars_in_buffer()
1354 if (sanity_check(info, tty->name, "chars_in_buffer")) in chars_in_buffer()
1364 static void throttle(struct tty_struct * tty) in throttle() argument
1366 struct slgt_info *info = tty->driver_data; in throttle()
1369 if (sanity_check(info, tty->name, "throttle")) in throttle()
1372 if (I_IXOFF(tty)) in throttle()
1373 send_xchar(tty, STOP_CHAR(tty)); in throttle()
1374 if (tty->termios.c_cflag & CRTSCTS) { in throttle()
1385 static void unthrottle(struct tty_struct * tty) in unthrottle() argument
1387 struct slgt_info *info = tty->driver_data; in unthrottle()
1390 if (sanity_check(info, tty->name, "unthrottle")) in unthrottle()
1393 if (I_IXOFF(tty)) { in unthrottle()
1397 send_xchar(tty, START_CHAR(tty)); in unthrottle()
1399 if (tty->termios.c_cflag & CRTSCTS) { in unthrottle()
1411 static int set_break(struct tty_struct *tty, int break_state) in set_break() argument
1413 struct slgt_info *info = tty->driver_data; in set_break()
1417 if (sanity_check(info, tty->name, "set_break")) in set_break()
2004 struct tty_struct *tty = info->port.tty; in bh_transmit() local
2007 if (tty) in bh_transmit()
2008 tty_wakeup(tty); in bh_transmit()
2051 if (info->port.tty) { in cts_change()
2052 if (info->port.tty->hw_stopped) { in cts_change()
2054 info->port.tty->hw_stopped = 0; in cts_change()
2060 info->port.tty->hw_stopped = 1; in cts_change()
2097 if (info->port.tty) in dcd_change()
2098 tty_hangup(info->port.tty); in dcd_change()
2177 if (info->port.tty) { in isr_serial()
2182 do_SAK(info->port.tty); in isr_serial()
2336 if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) { in isr_txeom()
2452 if (info->port.tty) in startup()
2453 clear_bit(TTY_IO_ERROR, &info->port.tty->flags); in startup()
2490 if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) { in shutdown()
2499 if (info->port.tty) in shutdown()
2500 set_bit(TTY_IO_ERROR, &info->port.tty->flags); in shutdown()
2531 (info->port.tty && info->port.tty->termios.c_cflag & CREAD)) in program_hw()
2545 if (!info->port.tty) in change_params()
2549 cflag = info->port.tty->termios.c_cflag; in change_params()
2581 info->params.data_rate = tty_get_baud_rate(info->port.tty); in change_params()
2602 if (I_INPCK(info->port.tty)) in change_params()
2604 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) in change_params()
2606 if (I_IGNPAR(info->port.tty)) in change_params()
2608 if (I_IGNBRK(info->port.tty)) { in change_params()
2613 if (I_IGNPAR(info->port.tty)) in change_params()
3190 static int tiocmget(struct tty_struct *tty) in tiocmget() argument
3192 struct slgt_info *info = tty->driver_data; in tiocmget()
3218 static int tiocmset(struct tty_struct *tty, in tiocmset() argument
3221 struct slgt_info *info = tty->driver_data; in tiocmset()
3270 static int block_til_ready(struct tty_struct *tty, struct file *filp, in block_til_ready() argument
3280 DBGINFO(("%s block_til_ready\n", tty->driver->name)); in block_til_ready()
3282 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ in block_til_ready()
3288 if (tty->termios.c_cflag & CLOCAL) in block_til_ready()
3307 if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags)) in block_til_ready()
3328 DBGINFO(("%s block_til_ready wait\n", tty->driver->name)); in block_til_ready()
3329 tty_unlock(tty); in block_til_ready()
3331 tty_lock(tty); in block_til_ready()
3344 DBGINFO(("%s block_til_ready ready, rc=%d\n", tty->driver->name, retval)); in block_til_ready()
4656 struct tty_struct *tty = info->port.tty; in rx_get_frame() local
4773 ldisc_receive_buf(tty, info->tmp_rbuf, info->flag_buf, framesize); in rx_get_frame()
4807 ldisc_receive_buf(info->port.tty, info->rbufs[i].buf, in rx_get_buf()
4994 struct tty_struct *oldtty = info->port.tty; in irq_test()
4998 info->port.tty = NULL; in irq_test()
5026 info->port.tty = oldtty; in irq_test()
5066 struct tty_struct *oldtty = info->port.tty; in loopback_test()
5074 info->port.tty = NULL; in loopback_test()
5110 info->port.tty = oldtty; in loopback_test()