termiox.h File

Purpose

Defines the structure of the termiox file, which provides the extended terminal interface.

Description

The termiox.h file contains an extended terminal interface to support asynchronous hardware flow control. It defines the termiox structure and ioctl operations using this structure. The termiox structure in the termiox.h file contains the following fields:

The termiox.h file also supports ioctl hardware flow control operations.

Field Descriptions
x_hflag Describes the hardware flow control mode. The possible modes are:
CDXON
Enables CD hardware flow control on output. When set, output will occur only if the `receive line signal detector' (CD) line is raised by the connected device. If the CD line is dropped by the connected device, output is suspended until the CD line is raised.
CTSXON
Enables CTS hardware flow control on output. When set, output will occur only if the `clear to send' (CTS) line is raised by the connected device. If the CTS line is dropped by the connected device, output is suspended until the CTS line is raised.
DTRXOFF
Enables DTR hardware flow control on input. When set, the `data terminal ready' (DTR) line is raised. If the port needs to have its input stopped, it will drop the DTR line. It is assumed that the connected device will stop its output until DTR is raised.
RTSXOFF
Enables RTS hardware flow control on input. When set, the `request to send' (RTS) line is raised. If the port needs to have its input stopped, it will drop the RTS line. It is assumed that the connected device will stop its output until RTS is raised.

It is not possible to use simultaneously the following flow control modes:

  • RTS and DTR
  • CTS and CD.

Different hardware flow control modes may be selected by setting the appropriate flags. For example:

  • Bi-directional RTS/CTS flow control by setting RTSXOFF and CTSXON
  • Bi-directional DTR/CTS flow control by setting DTRXOFF and CTSXON
  • Modem control or uni-directional CTS flow control by setting CTSXON.
x_cflag Reserved for future use.
x_rflag Reserved for future use.
x_sflag Describes the open discipline. This field must be set before the first open; it is usually done at configuration time. The possible disciplines are:
DTR_OPEN
DTR open discipline. On open, the discipline raises the `data terminal ready' (DTR) and `request to send' (RTS) lines, and waits for the `data carrier detect' (DCD) line to be raised. If the port is opened with the O_NDELAY or O_NONBLOCK flags, the wait is not done. The DTR and RTS lines are dropped at close time.
WT_OPEN
World trade open discipline. On open, the discipline behaves like the DTR open discipline if not in CDSTL mode. In CDSTL mode, the discipline does not raise the DTR line until the `ring indicate' (RI) line is raised. The DTR line is dropped when the DSR line drops for more than 20 milliseconds.

Hardware Flow Control Operations

The following ioctl operations are used for hardware flow control. To use these operations in a program, the program must contain an #include statement for the ioctl.h file. The argument to these operations is a pointer to a termiox structure.

Item Description
TCGETX Gets the terminal parameters. The current terminal parameters are stored in the structure.
TCSETX Sets the terminal parameters immediately. The current terminal parameters are set according to the structure. The change is immediate.
TCSETXW Sets the terminal parameters after end of output. The current terminal parameters are set according to the structure. The change occurs after all characters queued for output have been transmitted. This operation should be used when changing parameters will affect output.
TCSETXF Sets the terminal parameters after end of output and flushes input. The current terminal parameters are set according to the structure. All characters queued for output are first transmitted, then all characters queued for input are discarded, and then the change occurs.