|
|
1.1 root 1: /*
2: * Kernel portion of typewriter structure.
3: */
4: #ifndef __SYS_KTTY_H__
5: #define __SYS_KTTY_H__
6:
7: #include <sys/types.h>
8: #include <poll.h>
9: #include <sys/clist.h>
10: #include <sgtty.h>
11: #ifdef _I386
12: #include <termio.h>
13: #endif
14: #include <sys/timeout.h>
15:
16: #define NCIB 256 /* Input buffer */
17: #define OHILIM 128 /* Output buffer hi water mark */
18: #define OLOLIM 40 /* Output buffer lo water mark */
19: #define IHILIM 512 /* Input buffer hi water mark */
20: #define ILOLIM 40 /* Input buffer lo water mark */
21: #define ITSLIM (IHILIM-(IHILIM/4)) /* Input buffer tandem stop mark */
22: #define ESC '\\' /* Some characters */
23:
24: typedef struct tty {
25: CQUEUE t_oq; /* Output queue */
26: CQUEUE t_iq; /* Input queue */
27: char *t_ddp; /* Device specific */
28: int (*t_start)(); /* Start function */
29: int (*t_param)(); /* Load parameters function */
30: char t_dispeed; /* Default input speed */
31: char t_dospeed; /* Default output speed */
32: int t_open; /* Open count */
33: int t_flags; /* Flags */
34: char t_nfill; /* Number of fill characters */
35: char t_fillb; /* The fill character */
36: int t_ibx; /* Input buffer index */
37: char t_ib[NCIB]; /* Input buffer */
38: int t_hpos; /* Horizontal position */
39: int t_opos; /* Original horizontal position */
40: struct sgttyb t_sgttyb;/* Stty/gtty information */
41: struct tchars t_tchars;/* Tchars information */
42: #ifdef _I386
43: struct termio t_termio;
44: #endif
45: int t_group; /* Process group */
46: int t_escape; /* Pending escape count */
47: event_t t_ipolls; /* List of input polls enabled on device */
48: event_t t_opolls; /* List of output polls enabled on device */
49: TIM t_rawtim; /* Raw timing struct */
50: int t_cs_sel; /* 0 for resident drivers, CS for loadable */
51: #ifdef _I386
52: TIM t_vtime; /* VTIME timing struct */
53: TIM t_sbrk; /* TCSBRK timing struct */
54: #endif
55: } TTY;
56:
57: /*
58: * Test macros.
59: * Assume `tp' holds a TTY pointer.
60: * `c' a character.
61: * Be very careful if you work on the
62: * tty driver that this is true.
63: */
64: #define ISBRK (tp->t_tchars.t_brkc == c)
65: #define stopc (tp->t_tchars.t_stopc)
66: #define startc (tp->t_tchars.t_startc)
67:
68: /*
69: * The following are not part of S5 sgtty.
70: */
71: #define ISRIN (tp->t_sgttyb.sg_flags&RAWIN)
72: #define ISCRT (tp->t_sgttyb.sg_flags&CRT)
73:
74: #if _I386
75:
76: #define ISEOF (tp->t_termio.c_cc[VEOF] == c)
77: #define ISERASE (tp->t_termio.c_cc[VERASE] == c)
78: #define ISINTR (tp->t_termio.c_cc[VINTR] == c)
79: #define ISKILL (tp->t_termio.c_cc[VKILL] == c)
80: #define ISQUIT (tp->t_termio.c_cc[VQUIT] == c)
81: #define ISSTART (CSTART == c)
82: #define ISSTOP (CSTOP == c)
83:
84: #define ISBBYB ((tp->t_termio.c_lflag & ICANON) == 0)
85: #define ISCBRK ((tp->t_termio.c_lflag & ICANON) == 0)
86: #define ISECHO (tp->t_termio.c_lflag & ECHO)
87: #define ISICRNL (tp->t_termio.c_iflag & ICRNL)
88: #define ISIGNCR (tp->t_termio.c_iflag & IGNCR)
89: #define ISISIG (tp->t_termio.c_lflag & ISIG)
90: #define ISISTRIP (tp->t_termio.c_iflag & ISTRIP)
91: #define ISIXON (tp->t_termio.c_iflag & IXON)
92: #define ISIXANY (tp->t_termio.c_iflag & IXANY)
93: #define ISOCRNL (tp->t_termio.c_oflag & OCRNL)
94: #define ISONLCR (tp->t_termio.c_oflag & ONLCR)
95: #define ISROUT ((tp->t_termio.c_oflag & OPOST) == 0)
96: #define ISTAND (tp->t_termio.c_iflag & IXOFF)
97: #define ISXTABS ((tp->t_termio.c_oflag & TABDLY) == TAB3)
98:
99: #define ISXSTOP (tp->t_flags & T_XSTOP)
100: #else
101:
102: #define ISEOF (tp->t_tchars.t_eofc == c)
103: #define ISINTR (tp->t_tchars.t_intrc == c)
104: #define ISQUIT (tp->t_tchars.t_quitc == c)
105: #define ISSTART (tp->t_tchars.t_startc == c)
106: #define ISSTOP (tp->t_tchars.t_stopc == c)
107:
108: #define ISBBYB (tp->t_sgttyb.sg_flags&(RAWIN|CBREAK))
109: #define ISCBRK (tp->t_sgttyb.sg_flags&CBREAK)
110: #define ISECHO (tp->t_sgttyb.sg_flags&ECHO)
111: #define ISERASE (tp->t_sgttyb.sg_erase == c)
112: #define ISICRNL (tp->t_sgttyb.sg_flags&CRMOD)
113: #define ISIGNCR 0
114: #define ISISIG (!ISRIN)
115: #define ISISTRIP (!ISRIN)
116: #define ISIXON (!ISRIN)
117: #define ISKILL (tp->t_sgttyb.sg_kill == c)
118: #define ISOCRNL 0
119: #define ISONLCR (tp->t_sgttyb.sg_flags&CRMOD)
120: #define ISROUT (tp->t_sgttyb.sg_flags&RAWOUT)
121: #define ISTAND (tp->t_sgttyb.sg_flags&TANDEM)
122: #define ISXTABS (tp->t_sgttyb.sg_flags&XTABS)
123:
124: #endif
125:
126: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.