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