• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/drivers/char/

Lines Matching refs:tty

16  * This module implements the tty line discipline N_HDLC for use with
17 * tty device drivers that support bit-synchronous HDLC communications.
21 * 1. tty write calls represent one complete transmit frame of data
34 * the tty flip buffer and call the line discipline receive
40 * tty read calls.
42 * 3. tty read calls returns an entire frame of data or nothing.
46 * of the tty flags
53 * These conventions allow the standard tty programming interface
98 #include <linux/tty.h>
101 #include <linux/string.h> /* used in new tty drivers */
102 #include <linux/signal.h> /* used in new tty drivers */
136 struct tty_struct *tty;
168 static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
170 static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
172 static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
174 static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp,
176 static int n_hdlc_tty_open(struct tty_struct *tty);
177 static void n_hdlc_tty_close(struct tty_struct *tty);
178 static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *cp,
180 static void n_hdlc_tty_wakeup(struct tty_struct *tty);
184 #define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data))
185 #define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty)
187 static void flush_rx_queue(struct tty_struct *tty)
189 struct n_hdlc *n_hdlc = tty2n_hdlc(tty);
196 static void flush_tx_queue(struct tty_struct *tty)
198 struct n_hdlc *n_hdlc = tty2n_hdlc(tty);
233 struct tty_struct *tty = n_hdlc2tty (n_hdlc);
240 wake_up_interruptible (&tty->read_wait);
241 wake_up_interruptible (&tty->write_wait);
243 if (tty->disc_data == n_hdlc)
244 tty->disc_data = NULL; /* Break the tty->n_hdlc link */
282 * @tty - pointer to tty info structure
285 * else, the tty is closed, or the tty detects a hangup.
287 static void n_hdlc_tty_close(struct tty_struct *tty)
289 struct n_hdlc *n_hdlc = tty2n_hdlc (tty);
296 printk (KERN_WARNING"n_hdlc: trying to close unopened tty!\n");
300 clear_bit(TTY_NO_WRITE_SPLIT,&tty->flags);
302 tty->disc_data = NULL;
303 if (tty == n_hdlc->backup_tty)
305 if (tty != n_hdlc->tty)
308 n_hdlc->tty = n_hdlc->backup_tty;
321 * @tty - pointer to tty info structure
325 static int n_hdlc_tty_open (struct tty_struct *tty)
327 struct n_hdlc *n_hdlc = tty2n_hdlc (tty);
332 tty->name);
336 printk (KERN_ERR"n_hdlc_tty_open:tty already associated!\n" );
346 tty->disc_data = n_hdlc;
347 n_hdlc->tty = tty;
348 tty->receive_room = 65536;
352 set_bit(TTY_NO_WRITE_SPLIT,&tty->flags);
356 tty_driver_flush_buffer(tty);
368 * @tty - pointer to tty instance data
372 * list and by the tty wakeup callback.
374 static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty)
407 tty->flags |= (1 << TTY_DO_WRITE_WAKEUP);
408 actual = tty->ops->write(tty, tbuf->buf, tbuf->count);
432 wake_up_interruptible(&tty->write_wait);
449 tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
466 * @tty - pointer to associated tty instance data
470 static void n_hdlc_tty_wakeup(struct tty_struct *tty)
472 struct n_hdlc *n_hdlc = tty2n_hdlc(tty);
480 if (tty != n_hdlc->tty) {
481 tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
485 n_hdlc_send_frames (n_hdlc, tty);
490 * n_hdlc_tty_receive - Called by tty driver when receive data is available
491 * @tty - pointer to tty instance data
496 * Called by tty low level driver when receive data is available. Data is
499 static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,
502 register struct n_hdlc *n_hdlc = tty2n_hdlc (tty);
509 /* This can happen if stuff comes in on the backup tty */
510 if (!n_hdlc || tty != n_hdlc->tty)
551 wake_up_interruptible (&tty->read_wait);
552 if (n_hdlc->tty->fasync != NULL)
553 kill_fasync (&n_hdlc->tty->fasync, SIGIO, POLL_IN);
559 * @tty - pointer to tty instance data
566 static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
569 struct n_hdlc *n_hdlc = tty2n_hdlc(tty);
590 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) {
595 n_hdlc = tty2n_hdlc (tty);
597 tty != n_hdlc->tty) {
612 interruptible_sleep_on (&tty->read_wait);
644 * @tty - pointer to associated tty device instance data
651 static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file,
654 struct n_hdlc *n_hdlc = tty2n_hdlc (tty);
682 add_wait_queue(&tty->write_wait, &wait);
694 n_hdlc = tty2n_hdlc (tty);
696 tty != n_hdlc->tty) {
709 remove_wait_queue(&tty->write_wait, &wait);
718 n_hdlc_send_frames(n_hdlc,tty);
726 * n_hdlc_tty_ioctl - process IOCTL system call for the tty device.
727 * @tty - pointer to tty instance data
734 static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
737 struct n_hdlc *n_hdlc = tty2n_hdlc (tty);
765 count = tty_chars_in_buffer(tty);
778 flush_tx_queue(tty);
783 error = n_tty_ioctl_helper(tty, file, cmd, arg);
792 * @tty - pointer to tty instance data
800 static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp,
803 struct n_hdlc *n_hdlc = tty2n_hdlc (tty);
809 if (n_hdlc && n_hdlc->magic == HDLC_MAGIC && tty == n_hdlc->tty) {
813 poll_wait(filp, &tty->read_wait, wait);
814 poll_wait(filp, &tty->write_wait, wait);
819 if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
823 if (!tty_is_writelocked(tty) &&
977 /* Release tty registration of line discipline */