root/include/linux/tty.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * 'tty.h' defines some structures used by tty_io.c and some defines.
   3  *
   4  * NOTE! Don't touch this without checking that nothing in rs_io.s or
   5  * con_io.s breaks. Some constants are hardwired into the system (mainly
   6  * offsets into 'tty_queue'
   7  */
   8 
   9 #ifndef _TTY_H
  10 #define _TTY_H
  11 
  12 #include <termios.h>
  13 
  14 #define TTY_BUF_SIZE 1024
  15 
  16 struct tty_queue {
  17         unsigned long data;
  18         unsigned long head;
  19         unsigned long tail;
  20         struct task_struct * proc_list;
  21         char buf[TTY_BUF_SIZE];
  22 };
  23 
  24 #define INC(a) ((a) = ((a)+1) & (TTY_BUF_SIZE-1))
  25 #define DEC(a) ((a) = ((a)-1) & (TTY_BUF_SIZE-1))
  26 #define EMPTY(a) ((a).head == (a).tail)
  27 #define LEFT(a) (((a).tail-(a).head-1)&(TTY_BUF_SIZE-1))
  28 #define LAST(a) ((a).buf[(TTY_BUF_SIZE-1)&((a).head-1)])
  29 #define FULL(a) (!LEFT(a))
  30 #define CHARS(a) (((a).head-(a).tail)&(TTY_BUF_SIZE-1))
  31 #define GETCH(queue,c) \
  32 (void)({c=(queue).buf[(queue).tail];INC((queue).tail);})
  33 #define PUTCH(c,queue) \
  34 (void)({(queue).buf[(queue).head]=(c);INC((queue).head);})
  35 
  36 #define INTR_CHAR(tty) ((tty)->termios.c_cc[VINTR])
  37 #define QUIT_CHAR(tty) ((tty)->termios.c_cc[VQUIT])
  38 #define ERASE_CHAR(tty) ((tty)->termios.c_cc[VERASE])
  39 #define KILL_CHAR(tty) ((tty)->termios.c_cc[VKILL])
  40 #define EOF_CHAR(tty) ((tty)->termios.c_cc[VEOF])
  41 #define START_CHAR(tty) ((tty)->termios.c_cc[VSTART])
  42 #define STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP])
  43 #define SUSPEND_CHAR(tty) ((tty)->termios.c_cc[VSUSP])
  44 
  45 struct tty_struct {
  46         struct termios termios;
  47         int pgrp;
  48         int stopped;
  49         void (*write)(struct tty_struct * tty);
  50         struct tty_queue read_q;
  51         struct tty_queue write_q;
  52         struct tty_queue secondary;
  53         };
  54 
  55 extern struct tty_struct tty_table[];
  56 
  57 /*      intr=^C         quit=^|         erase=del       kill=^U
  58         eof=^D          vtime=\0        vmin=\1         sxtc=\0
  59         start=^Q        stop=^S         susp=^Z         eol=\0
  60         reprint=^R      discard=^U      werase=^W       lnext=^V
  61         eol2=\0
  62 */
  63 #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
  64 
  65 void rs_init(void);
  66 void con_init(void);
  67 void tty_init(void);
  68 
  69 int tty_read(unsigned c, char * buf, int n);
  70 int tty_write(unsigned c, char * buf, int n);
  71 
  72 void rs_write(struct tty_struct * tty);
  73 void con_write(struct tty_struct * tty);
  74 
  75 void copy_to_cooked(struct tty_struct * tty);
  76 
  77 #endif

/* [previous][next][first][last][top][bottom][index][help] */