Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ TTYDEV

Media Vault

Software Library

Restoration Projects

Artifacts Sought

TTYDEV

[Previous] [Contents] [Index] [Next]

TTYDEV

Structure for a tty device

Synopsis:

typedef struct ttydev_entry {
    iofunc_attr_t           attr;
    iofunc_mount_t          mount;
    TTYWAIT                 *waiting_read;
    TTYWAIT                 *waiting_write;
    TTYWAIT                 *waiting_drain;
    int                     c_cflag;
    int                     c_iflag;
    int                     c_lflag;
    int                     c_oflag;
    volatile unsigned       flags;
    volatile unsigned       xflags;
    int                     bcnt;
    int                     fwdcnt;
    struct ttydev_entry     *timer;
    int                     timeout;
    int                     timeout_reset;
    union {
        int                 tmrs;
        struct {
            char            spare_tmr;
            char            tx_tmr;
            char            brk_tmr;
            char            dtr_tmr;
        }   s;
    }       un;
    pid_t                   brkpgrp;
    pid_t                   huppid;
    cc_t                    c_cc[NCCS];
    unsigned char           fifo;
    unsigned char           fwd;
    unsigned char           prefix_cnt;
    unsigned char           oband_data;
    int                     highwater;
    int                     baud;
    struct winsize          winsize;
    TTYBUF                  obuf;
    TTYBUF                  ibuf;
    TTYBUF                  cbuf;
    iofunc_notify_t         notify[3];
    struct ttydev_entry     *extra;
    TTYWAIT                 *waiting_open;  
    void                    *reserved2;     /* reserved for use by io-char */
    int                     (*io_devctlext)(resmgr_context_t *ctp, io_devctl_t *msg, iofunc_ocb_t *ocb);
    char                    name[TTY_NAME_MAX];
    } TTYDEV;

Description:

A character driver shares the TTYDEV structure with the io-char library.

This structure is used to handle devices shared between the driver and io-char.

The members include:

attr
A resource manager attribute
mount
Related to resource manager information
waiting_read
The queue to store blocking clients waiting to read
waiting_write
The queue to store blocking clients waiting to write
waiting_drain
The queue to store blocking clients waiting to drain.
c_cflag
POSIX termios flag describing the hardware control of the terminal
c_iflag
POSIX termios flag describing the basic terminal input control
c_lflag
POSIX termios flag used to control various terminal functions
c_oflag
POSIX termios flag describing the basic terminal output control
flags
The following flags are currently defined:
  • OHW_PAGED -- the output hardware flow control (set by io-char and used by the driver)
  • IHW_PAGED -- input hardware flow control is asserted; the device's highwater mark has been reached and doesn't want to receive any more data. This flag also asserts the RTS line.
  • OSW_PAGED -- output software flow control is asserted; the device should not transmit any data (set by io-char and used by the driver)
  • ISW_PAGED -- input software flow control is asserted; the device's highwater mark has been reached and doesn't want to receive any more data. This flag also transmits VSTOP.
  • EDIT_INSERT -- for edit mode. Insert or overstrike typing mode.
  • EDIT_PREFIX -- for edit mode. Look for edit keys which begin with a fixed prefix, e.g. ESC [ ansi" used with POSIX c_cc[VPREFIX].
  • OBAND_DATA -- indicates that out-of-band data is available
  • LOSES_TX_INTR -- tells the character device library (io-char) that the device sometimes fails to generate TX interrupts. With this knowledge of the hardware's short comings, the io-char library will take extra precautions when transmitting data, by using an internal countdown timer to keep track of the time between TX interrupts. If the timer expires before the next TX interrupt comes in, the io-char library assumes the hardware failed to generate the interrupt and attempts to transmit more data by calling tto(). If there's no more data to be transmitted, the countdown timer isn't reloaded.
  • TIMER_ACTIVE -- used by io-char
  • TIMER_KEEP -- used by io-char
  • NOTTY -- used by PTYs
  • NL_INSERT -- used to notify application if a \n was changed to a \r
  • ISAPTY -- used by PTYs
  • PTY_MASTER_ONLY -- used by PTYs
  • LITERAL -- used by io-char
  • FIRST_TIME_ALONE -- used by io-char
xflags
OSW_PAGED_OVERRIDE -- override OSW_PAGED to allow transmission of controlled characters when in a software flow control suspend state. This flag is set by io-char and is used and cleared by the driver.
bcnt
Internal to io-char and used to determine the number of bytes needed to notify a read client.
fwdcnt
Internal to io-char and used to determine the number of fwd counts.
timer
Used by io-char.
timeout
Used by io-char.
timeout_reset
Used by io-char.
tmrs
One of several available for io-char to use.
spare_tmr
Spare used only by io-char for drain.
tx_tmr
Enabled by LOSES_TX_INTR. The timer causes tto() to be called to work around some parts that lose transmit interrupts.
brk_tmr
Used only by io-char sending break; calls tto() (TTO_CTRL, dtrchg).
dtr_tmr
Used by io-char to set dtr line i.e. generate SIGHUP calls tto() (TTO_CTRL, dtrchg).
brkpgrp
Used by io-char.
huppid
Used by io-char.
c_cc
POSIX special control-characters.
fifo
Used only by the driver.
fwd
Forward character used by io-char. It's used with fwdcnt to implement forward, described in readcond().
prefix_cnt
For io-char only.
oband_data
Out-of-band data set by the driver in <intr.c>. The application gets it from io-char via a devctl().
highwater
Set by the driver and used by io-char to determine when to invoke flow control. (Make sure this value is LESS than the input buffer size).
baud
The device's baud rate.
winsize
Used only by io-char.
obuf
The output buffer.
ibuf
The input buffer.
cbuf
The canonical buffer.
notify
The notify list. It implements iofunc_notify_trigger() resource manager information. The following arguments are used:
  • notify[0] -- notify for input used by io-char
  • notify[1] -- notify for output to the driver, <tto.c>
  • notify[2] -- notify for data that out-of=band to the driver, <intr.c>
extra
Used for PTYs.
waiting_open
The queue to store blocking clients waiting to open.
io_devctlext
Custom devctl command.
name
The device's name i.e. /dev/ser1

Classification:

QNX Neutrino

See also:

TTYCTRL


[Previous] [Contents] [Index] [Next]

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026