TTYCTRL
Tty control structure
typedef struct chario_entry {
dispatch_t * dpp;
void * msg_ctp;
int tid;
int coid;
int timerid;
unsigned int ticksize_ms;
volatile int start;
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;
unsigned reserved1;
void * reserved2;
unsigned flags;
unsigned perm;
pthread_mutex_t timer_mutex;
struct ttylist_head {
struct ttydev_entry * tqh_first;
struct ttydev_entry ** tqh_last;
} dlist;
pthread_mutext_t mutex_lock;
} TTYCTRL;Description:
A character driver shares the TTYCTRL structure with the io-char library. This structure is used to coordinate events, timers, and so on.
The instance of the TTYCTRL structure using in the driver must be named
ttyctrl and be in the global scope.
The members include:
- dpp
- A dispatch handle, returned by dispatch_create. Used only by io-char.
- msg_ctp
- A pointer to the message context.
- tid
- A thread ID for the controller thread.
- coid
- The connection ID. Used only by io-char.
- timerid
- The timer ID. Used only by io-char.
- ticksize_ms
- The granularity of the time operations.
- start
- Indicates if the controller has been started.
- 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. Refer to the entry for TTYDEV.
- 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.
- reserved1
- Reserved; do not use.
- reserved2
- Reserved; do not use.
- flags
- Flags that indicate which event occurred. Refer to the entry for TTYDEV.
- perm
- Default permissions for device files.
- timer_mutex
- Protects access to timer-related data structures.
- dlist
-
A structure representing a list of all devices.
- tqh_first — A pointer to the first element.
- tqh_last — A pointer to the last element.
- mutex_lock
- Protects general locking in the controller.
Page updated:
