Annotation of Gnu-Mach/device/tty.h, revision 1.1.1.1

1.1       root        1: /* 
                      2:  * Mach Operating System
                      3:  * Copyright (c) 1993-1990 Carnegie Mellon University
                      4:  * All Rights Reserved.
                      5:  * 
                      6:  * Permission to use, copy, modify and distribute this software and its
                      7:  * documentation is hereby granted, provided that both the copyright
                      8:  * notice and this permission notice appear in all copies of the
                      9:  * software, derivative works or modified versions, and any portions
                     10:  * thereof, and that both notices appear in supporting documentation.
                     11:  * 
                     12:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
                     13:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
                     14:  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     15:  * 
                     16:  * Carnegie Mellon requests users of this software to return to
                     17:  * 
                     18:  *  Software Distribution Coordinator  or  [email protected]
                     19:  *  School of Computer Science
                     20:  *  Carnegie Mellon University
                     21:  *  Pittsburgh PA 15213-3890
                     22:  * 
                     23:  * any improvements or extensions that they make and grant Carnegie Mellon
                     24:  * the rights to redistribute these changes.
                     25:  */
                     26: /*
                     27:  *     Author: David B. Golub, Carnegie Mellon University
                     28:  *     Date:   7/90
                     29:  *
                     30:  *     Compatibility TTY structure for existing TTY device drivers.
                     31:  */
                     32: 
                     33: #ifndef        _DEVICE_TTY_H_
                     34: #define        _DEVICE_TTY_H_
                     35: 
                     36: #include <kern/lock.h>
                     37: #include <kern/queue.h>
                     38: #include <mach/port.h>
                     39: 
                     40: #include <device/device_types.h>
                     41: #include <device/tty_status.h>
                     42: #include <device/cirbuf.h>
                     43: #include <device/io_req.h>
                     44: 
                     45: #ifdef luna88k
                     46: #include <luna88k/jtermio.h>
                     47: #endif
                     48: 
                     49: struct tty {
                     50:        decl_simple_lock_data(,t_lock)
                     51:        struct cirbuf   t_inq;          /* input buffer */
                     52:        struct cirbuf   t_outq;         /* output buffer */
                     53:        char *          t_addr;         /* device pointer */
                     54:        int             t_dev;          /* device number */
                     55:        int             (*t_start)(struct tty *);
                     56:                                        /* routine to start output */
                     57: #define        t_oproc t_start
                     58:        int             (*t_stop)(struct tty *, int);
                     59:                                        /* routine to stop output */
                     60:        int             (*t_mctl)(struct tty *, int, int);
                     61:                                        /* (optional) routine to control
                     62:                                           modem signals */
                     63:        char            t_ispeed;       /* input speed */
                     64:        char            t_ospeed;       /* output speed */
                     65:        char            t_breakc;       /* character to deliver when 'break'
                     66:                                           condition received */
                     67:        int             t_flags;        /* mode flags */
                     68:        int             t_state;        /* current state */
                     69:        int             t_line;         /* fake line discipline number,
                     70:                                           for old drivers - always 0 */
                     71:        queue_head_t    t_delayed_read; /* pending read requests */
                     72:        queue_head_t    t_delayed_write;/* pending write requests */
                     73:        queue_head_t    t_delayed_open; /* pending open requests */
                     74: 
                     75: /*
                     76:  * Items beyond this point should be removed to device-specific
                     77:  * extension structures.
                     78:  */
                     79:        int             (*t_getstat)(); /* routine to get status */
                     80:        int             (*t_setstat)(); /* routine to set status */
                     81:        dev_ops_t       t_tops;         /* another device to possibly
                     82:                                           push through */
                     83: };
                     84: typedef struct tty     *tty_t;
                     85: 
                     86: /*
                     87:  * Common TTY service routines
                     88:  */
                     89: extern io_return_t char_open(
                     90:        int             dev,
                     91:        struct tty *    tp,
                     92:        dev_mode_t      mode,
                     93:        io_req_t        ior);
                     94: 
                     95: extern io_return_t char_read(
                     96:        struct tty *    tp,
                     97:        io_req_t        ior);
                     98: 
                     99: extern io_return_t char_write(
                    100:        struct tty *    tp,
                    101:        io_req_t        ior);
                    102: 
                    103: extern void ttyinput(
                    104:        unsigned int    c,
                    105:        struct tty *    tp);
                    106: 
                    107: extern boolean_t ttymodem(
                    108:        struct tty *    tp,
                    109:        boolean_t       carrier_up);
                    110: 
                    111: extern void tty_queue_completion(
                    112:        queue_t         queue);
                    113: #define        tt_open_wakeup(tp) \
                    114:        (tty_queue_completion(&(tp)->t_delayed_open))
                    115: #define        tt_write_wakeup(tp) \
                    116:        (tty_queue_completion(&(tp)->t_delayed_write))
                    117: 
                    118: extern void ttychars(
                    119:        struct tty *    tp);
                    120: 
                    121: #define        TTMINBUF        90
                    122: 
                    123: short  tthiwat[NSPEEDS], ttlowat[NSPEEDS];
                    124: #define        TTHIWAT(tp)     tthiwat[(tp)->t_ospeed]
                    125: #define        TTLOWAT(tp)     ttlowat[(tp)->t_ospeed]
                    126: 
                    127: /* internal state bits */
                    128: #define        TS_INIT         0x00000001      /* tty structure initialized */
                    129: #define        TS_TIMEOUT      0x00000002      /* delay timeout in progress */
                    130: #define        TS_WOPEN        0x00000004      /* waiting for open to complete */
                    131: #define        TS_ISOPEN       0x00000008      /* device is open */
                    132: #define        TS_FLUSH        0x00000010      /* outq has been flushed during DMA */
                    133: #define        TS_CARR_ON      0x00000020      /* software copy of carrier-present */
                    134: #define        TS_BUSY         0x00000040      /* output in progress */
                    135: #define        TS_ASLEEP       0x00000080      /* wakeup when output done */
                    136: 
                    137: #define        TS_TTSTOP       0x00000100      /* output stopped by ctl-s */
                    138: #define        TS_HUPCLS       0x00000200      /* hang up upon last close */
                    139: #define        TS_TBLOCK       0x00000400      /* tandem queue blocked */
                    140: 
                    141: #define        TS_NBIO         0x00001000      /* tty in non-blocking mode */
                    142: #define        TS_ONDELAY      0x00002000      /* device is open; software copy of 
                    143:                                         * carrier is not present */
                    144: #define        TS_MIN          0x00004000      /* buffer input chars, if possible */
                    145: #define        TS_MIN_TO       0x00008000      /* timeout for the above is active */
                    146: 
                    147: #define TS_OUT          0x00010000     /* tty in use for dialout only */
                    148: #define        TS_RTS_DOWN     0x00020000      /* modem pls stop */
                    149: 
                    150: #define TS_TRANSLATE   0x00100000      /* translation device enabled */
                    151: #define TS_KDB         0x00200000      /* should enter kdb on ALT */
                    152: 
                    153: #define        TS_MIN_TO_RCV   0x00400000      /* character recived during 
                    154:                                           receive timeout interval */
                    155: 
                    156: /* flags - old names defined in terms of new ones */
                    157: 
                    158: #define        TANDEM          TF_TANDEM
                    159: #define        ODDP            TF_ODDP
                    160: #define        EVENP           TF_EVENP
                    161: #define        ANYP            (ODDP|EVENP)
                    162: #define        MDMBUF          TF_MDMBUF
                    163: #define        LITOUT          TF_LITOUT
                    164: #define        NOHANG          TF_NOHANG
                    165: 
                    166: #define        ECHO            TF_ECHO
                    167: #define        CRMOD           TF_CRMOD
                    168: #define        XTABS           TF_XTABS
                    169: 
                    170: /* these are here only to let old code compile - they are never set */
                    171: #define        RAW             LITOUT
                    172: #define        PASS8           LITOUT
                    173: 
                    174: /*
                    175:  * Hardware bits.
                    176:  * SHOULD NOT BE HERE.
                    177:  */
                    178: #define        DONE    0200
                    179: #define        IENABLE 0100
                    180: 
                    181: /*
                    182:  * Modem control commands.
                    183:  */
                    184: #define        DMSET           0
                    185: #define        DMBIS           1
                    186: #define        DMBIC           2
                    187: #define        DMGET           3
                    188: 
                    189: /*
                    190:  * Fake 'line discipline' switch, for the benefit of old code
                    191:  * that wants to call through it.
                    192:  */
                    193: struct ldisc_switch {
                    194:        int     (*l_read) (struct tty *, io_req_t);     /* read */
                    195:        int     (*l_write)(struct tty *, io_req_t);     /* write */
                    196:        void    (*l_rint) (unsigned int, struct tty *); /* character input */
                    197:        boolean_t (*l_modem)(struct tty *, boolean_t);  /* modem change */
                    198:        void    (*l_start)(struct tty *);               /* start output */
                    199: };
                    200: 
                    201: extern struct ldisc_switch     linesw[];
                    202: 
                    203: #endif /* _DEVICE_TTY_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.