Tty control structure
typedef struct chario_entry {
dispatch_t *dpp;
int coid;
int timerid;
unsigned max_devs;
unsigned num_devs;
struct sigevent event;
struct sigevent timer;
struct ttydev_entry *timer_list;
unsigned num_events;
struct ttydev_entry **event_queue;
intrspin_t lock;
} TTYCTRL;
A character driver shares the TTYCTRL with the
io-char library.
This structure is used to coordinate events, timers, and so on.
The members include:
- dpp
- A dispatch handle, returned by
dispatch_create().
Used only by io-char.
- coid
- The connection ID. Used only by io-char.
- timerid
- The timer ID. Used only by io-char.
- max_devs
- Used by io-char and the driver to define the maximum number of
devices supported.
- num_devs
- Used only by io-char to define the current number of
devices supported.
- event
- Used by the driver to send pulse events to io-char's event handler.
Flags are used to indicate which event occurred. The driver must send the event to io-char.
The following events are currently defined:
- EVENT_QUEUED -- there is an event queued.
- EVENT_SIGBRK -- POSIX job control for SIGBRK sends SIGINT. This event
is called by TTI_BREAK, so the driver probably doesn't need to
do this.
- EVENT_SIGHUP -- POSIX job control, TTI_HANGUP.
- EVENT_TTO -- not used.
- EVENT_READ -- used by io-char.
- EVENT_WRITE -- called by the driver. Unblock an application waiting to
write when the output buffer has room to take characters.
- EVENT_DRAIN -- called by the driver. The output buffer has drained (unblock someone waiting on the device to drain.)
- EVENT_TIMEOUT -- used by io-char.
- EVENT_NOTIFY_INPUT -- input notification (used by io-char). See the
notify entry in TTYDEV.
- EVENT_NOTIFY_OUTPUT -- output notification (used by io-char. See
the notify entry in TTYDEV.
- EVENT_NOTIFY_OBAND -- driver notifies io-char if out-of-band data is available.
- EVENT_CARRIER -- generated by TTI_CARRIER.
- EVENT_SIGQUIT -- job control, generated by TTI_QUIT
to notify that a QUIT character has been received.
- EVENT_SIGSUP -- job control, generated by TTI_SUSP to
notify that a SUSP character has been received.
- timer
- A pulse to call the timer handler. Used only by io-char.
- timer_list
- Used only by io-char, it provides a list of active timers.
- num_events
- Used by io-char and the driver, it displays the current number
of events for processing.
- event_queue
- An array of TTYDEV structures used by io-char and the driver to
queue events.
- lock
- A lock used to control access to this structure.
Use the dev_lock() and dev_unlock() macros to
access this member.
Photon
TTYDEV