TTYDEV

Structure for a tty device

Synopsis:

typedef struct ttydev_entry {
    iofunc_attr_t       attr;
    iofunc_mount_t      mount;
    TTYPOWER            power;
    TTYWAIT                     *waiting_read;
    TTYWAIT                     *waiting_write;
    TTYWAIT                     *waiting_drain;
    TTYWAIT                     *waiting_devctl;
    int                         c_cflag;
    int                         c_iflag;
    int                         c_lflag;
    int                         c_oflag;
    volatile unsigned           flags;
    volatile unsigned           xflags;
    volatile unsigned           eflags;
    volatile unsigned           lflags;
    unsigned int        bcnt;
    unsigned int        fwdcnt;
    struct ttydev_entry         *timer;
    int                         timeout;
    int                         timeout_reset;
    union {
        uint64_t        tmrs;
        struct {
            char            drn_tmr;
            char            tx_tmr;
            char            brk_tmr;
            char            dtr_tmr;
            char            spare_tmr;
            char            rsvd1;
            char            rsvd2;
            char            rsvd3;
        }   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;  
    int             linkid;
    void                        *reserved2;    
    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.
power
A power-management attribute.
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:

Flags indicate which event occurred. Then the driver sends the event to io-char.

The following events are currently defined:
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.
eflags
Event flag, extension to the event in the flags variable.
lflags
Logging flag.
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 the below available timers for io-char to use.
drn_tmr
Drain timer.
tx_tmr
Loses tx interrupt timer. Enabled by LOSES_TX_INTR. The timer causes tto() to be called to work around some parts that lose transmit interrupts.
brk_tmr
Break timer. Used only by io-char sending break; calls tto(TTO_CTRL, dtrchg).
dtr_tmr
dtr line timer. Used by io-char to set dtr line i.e. generate SIGHUP calls tto(TTO_CTRL, dtrchg).
spare_tmr
Spare timer for driver use ONLY .
dsr_tmr
For device-side driver where DSR is an output.
dcd_tmr
For device-side driver where DCD is an output.
rsvd3
Reserved for more timers to be added.
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(). For more information, see the QNX Neutrino Library Reference .
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
An array of three iofunc_notify_t structures that represent (in order), the input, output, and out-of-band notification list:

For information about this structure, see the entry for iofunc_notify() in the QNX Neutrino Library Reference.

extra
Used for PTYs.
waiting_open
The queue to store blocking clients waiting to open.
linkid
The ID returned from resmgr_attach().
reserved2
Reserved for use by io-char.
io_devctlext
Custom devctl command.
name
The device's name e.g. /dev/ser1.

Classification:

QNX Neutrino

See also:

TTYCTRL