|
|
1.1 root 1: /*
2: * Kernel portion of typewriter structure.
3: */
4: #ifndef KTTY_H
5: #define KTTY_H
6: #include <sys/types.h>
7: #include <sys/poll.h>
8: #include <sys/clist.h>
9: #include <sgtty.h>
10: #include <sys/timeout.h>
11:
12: #define NCIB 256 /* Input buffer */
13: #define OHILIM 128 /* Output buffer hi water mark */
14: #define OLOLIM 40 /* Output buffer lo water mark */
15: #define IHILIM 512 /* Input buffer hi water mark */
16: #define ILOLIM 40 /* Input buffer lo water mark */
17: #define ITSLIM (IHILIM-(IHILIM/4)) /* Input buffer tandem stop mark */
18: #define ESC '\\' /* Some characters */
19: #define SI_BUFSIZ 256 /* Silo buffer size */
20:
21: /*
22: * Raw Character Silo.
23: */
24: typedef struct silo {
25: unsigned char si_ix;
26: unsigned char si_ox;
27: unsigned char si_buf[SI_BUFSIZ];
28: } silo_t;
29:
30: typedef struct tty {
31: CQUEUE t_oq; /* Output queue */
32: CQUEUE t_iq; /* Input queue */
33: char *t_ddp; /* Device specific */
34: int (*t_start)(); /* Start function */
35: int (*t_param)(); /* Load parameters function */
36: char t_dispeed; /* Default input speed */
37: char t_dospeed; /* Default output speed */
38: int t_open; /* Open count */
39: int t_flags; /* Flags */
40: char t_nfill; /* Number of fill characters */
41: char t_fillb; /* The fill character */
42: int t_ibx; /* Input buffer index */
43: char t_ib[NCIB]; /* Input buffer */
44: int t_hpos; /* Horizontal position */
45: int t_opos; /* Original horizontal position */
46: struct sgttyb t_sgttyb;/* Stty/gtty information */
47: struct tchars t_tchars;/* Tchars information */
48: int t_group; /* Process group */
49: int t_escape; /* Pending escape count */
50: event_t t_ipolls; /* List of input polls enabled on device */
51: event_t t_opolls; /* List of output polls enabled on device */
52: TIM t_rawtim; /* Raw timing struct */
53: silo_t t_rawin; /* Raw input buffer */
54: silo_t t_rawout; /* Raw output buffer */
55: int t_cs_sel; /* 0 for resident drivers, CS for loadable */
56: } TTY;
57:
58: /*
59: * Test macros.
60: * Assume `tp' holds a TTY pointer.
61: * `c' a character.
62: * Be very careful if you work on the
63: * tty driver that this is true.
64: */
65: #define ISINTR (tp->t_tchars.t_intrc == c)
66: #define ISQUIT (tp->t_tchars.t_quitc == c)
67: #define ISEOF (tp->t_tchars.t_eofc == c)
68: #define ISBRK (tp->t_tchars.t_brkc == c)
69: #define ISSTART (tp->t_tchars.t_startc == c)
70: #define ISSTOP (tp->t_tchars.t_stopc == c)
71: #define ISCRMOD ((tp->t_sgttyb.sg_flags&CRMOD) != 0)
72: #define ISXTABS ((tp->t_sgttyb.sg_flags&XTABS) != 0)
73: #define ISECHO ((tp->t_sgttyb.sg_flags&ECHO) != 0)
74: #define ISERASE (tp->t_sgttyb.sg_erase == c)
75: #define ISKILL (tp->t_sgttyb.sg_kill == c)
76: #define stopc (tp->t_tchars.t_stopc)
77: #define startc (tp->t_tchars.t_startc)
78:
79: /*
80: * The following are not part of S5 sgtty.
81: */
82: #define ISRIN ((tp->t_sgttyb.sg_flags&RAWIN) != 0)
83: #define ISROUT ((tp->t_sgttyb.sg_flags&RAWOUT)!= 0)
84: #define ISCRT ((tp->t_sgttyb.sg_flags&CRT) != 0)
85: #define ISCBRK ((tp->t_sgttyb.sg_flags&CBREAK)!= 0)
86: #define ISTAND ((tp->t_sgttyb.sg_flags&TANDEM)!= 0)
87: #define ISBBYB ((tp->t_sgttyb.sg_flags&(RAWIN|CBREAK)) != 0)
88:
89: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.