O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
Loading...
Searching...
No Matches
serial_input_modes Struct Reference

Verbose alternative to termios.c_iflag. More...

#include <serial_options.h>

Data Fields

uint32_t ignore_break:1
 Ignore break condition.
uint32_t signal_break:1
 Signal interrupt on break.
uint32_t discard_invalid_chars:1
 Ignore characters with parity errors.
uint32_t mark_errors:1
 Mark parity and framing errors.
uint32_t parity_check:1
 Enable input parity check.
uint32_t strip_8th_bit:1
 Strip 8th bit off characters.
uint32_t map_nl_to_cr:1
 Map \n to \r on input.
uint32_t ignore_cr:1
 Ignore Carriage Returns (\r)
uint32_t map_cr_to_nl:1
 Map \r to \n on input.
uint32_t map_upper_to_lower:1
 Map uppercase characters to lowercase on input.
uint32_t enable_start_stop_out:1
 Enable start/stop output control.
uint32_t any_can_restart_output:1
 Enable any character to restart output.
uint32_t enable_start_stop_in:1
 Enable start/stop input control.
uint32_t ring_bell_when_full:1
 Ring bell when input queue is full.
uint32_t is_utf8:1
 Input is UTF8.

Detailed Description

Verbose alternative to termios.c_iflag.

Documentation source: https://www.gnu.org/software/libc/manual/html_node/Input-Modes.html.

This section describes the terminal attribute flags that control fairly low-level aspects of input processing: handling of parity errors, break signals, flow control, and RET and LFD characters.

Definition at line 30 of file serial_options.h.

Field Documentation

◆ any_can_restart_output

uint32_t serial_input_modes::any_can_restart_output

Enable any character to restart output.

If this bit is set, any input character restarts output when output has been suspended with the STOP character.

Otherwise, only the START character restarts output.

This is a BSD extension; it exists only on BSD systems and GNU/Linux and GNU/Hurd systems.

Definition at line 44 of file serial_options.h.

◆ discard_invalid_chars

uint32_t serial_input_modes::discard_invalid_chars

Ignore characters with parity errors.

If this bit is set, any byte with a framing or parity error is ignored.

This is only useful if parity_check is also set.

Definition at line 34 of file serial_options.h.

◆ enable_start_stop_in

uint32_t serial_input_modes::enable_start_stop_in

Enable start/stop input control.

If this bit is set, start/stop control on input is enabled.

In other words, the computer sends STOP and START characters as necessary to prevent input from coming in faster than programs are reading it. The idea is that the actual terminal hardware that is generating the input data responds to a STOP character by suspending transmission, and to a START character by resuming transmission. See Special Characters for Flow Control.

Definition at line 45 of file serial_options.h.

◆ enable_start_stop_out

uint32_t serial_input_modes::enable_start_stop_out

Enable start/stop output control.

If this bit is set, start/stop control on output is enabled.

In other words, if the computer receives a STOP character, it suspends output until a START character is received. In this case, the STOP and START characters are never passed to the application program. If this bit is not set, then START and STOP can be read as ordinary characters. See Special Characters for Flow Control.

Definition at line 43 of file serial_options.h.

◆ ignore_break

uint32_t serial_input_modes::ignore_break

Ignore break condition.

If this bit is set, break conditions are ignored.

A break condition is defined in the context of asynchronous serial data transmission as a series of zero-value bits longer than a single byte.

Definition at line 32 of file serial_options.h.

◆ ignore_cr

uint32_t serial_input_modes::ignore_cr

Ignore Carriage Returns (\r)

If this bit is set, carriage return characters (\r) are discarded on input.

Discarding carriage return may be useful on terminals that send both carriage return and linefeed when you type the RET key.

Definition at line 39 of file serial_options.h.

◆ map_cr_to_nl

uint32_t serial_input_modes::map_cr_to_nl

Map \r to \n on input.

If this bit is set and ignore_cr is not set, carriage return characters (\r) received as input are passed to the application as newline characters (\n).

Definition at line 40 of file serial_options.h.

◆ map_nl_to_cr

uint32_t serial_input_modes::map_nl_to_cr

Map \n to \r on input.

If this bit is set, newline characters (\n) received as input are passed to the application as carriage return characters (\r).

Definition at line 38 of file serial_options.h.

◆ mark_errors

uint32_t serial_input_modes::mark_errors

Mark parity and framing errors.

If this bit is set, input bytes with parity or framing errors are marked when passed to the program.

This bit is meaningful only when parity_check is set and discard_invalid_chars is not set.

The way erroneous bytes are marked is with two preceding bytes, 0377 and \0. Thus, the program actually reads three bytes for one erroneous byte received from the terminal.

If a valid byte has the value 0377, and strip_8th_bit (see below) is not set, the program might confuse it with the prefix that marks a parity error. So a valid byte 0377 is passed to the program as two bytes, 0377 0377, in this case.

Definition at line 35 of file serial_options.h.

◆ parity_check

uint32_t serial_input_modes::parity_check

Enable input parity check.

If this bit is set, input parity checking is enabled.

If it is not set, no checking at all is done for parity errors on input; the characters are simply passed through to the application.

Parity checking on input processing is independent of whether parity detection and generation on the underlying terminal hardware is enabled; see serial_control_modes. For example, you could clear the parity_check input mode flag and set the serial_control_modes::enable_parity control mode flag to ignore parity errors on input, but still generate parity on output.

If this bit is set, what happens when a parity error is detected depends on whether the discard_invalid_chars or mark_errors bits are set. If neither of these bits are set, a byte with a parity error is passed to the application as a \0 character.

Definition at line 36 of file serial_options.h.

◆ ring_bell_when_full

uint32_t serial_input_modes::ring_bell_when_full

Ring bell when input queue is full.

If this bit is set, then filling up the terminal input buffer sends a BEL character (code 007) to the terminal to ring the bell.

This is a BSD extension.

Definition at line 46 of file serial_options.h.

◆ signal_break

uint32_t serial_input_modes::signal_break

Signal interrupt on break.

If this bit is set and ignore_break is not set, a break condition clears the terminal input and output queues and raises a SIGINT signal for the foreground process group associated with the terminal.

If neither signal_break nor ignore_break are set, a break condition is passed to the application as a single \0 character if mark_errors is not set, or otherwise as a three-character sequence \0377 \0 \0.

Definition at line 33 of file serial_options.h.

◆ strip_8th_bit

uint32_t serial_input_modes::strip_8th_bit

Strip 8th bit off characters.

If this bit is set, valid input bytes are stripped to seven bits; otherwise, all eight bits are available for programs to read.

Definition at line 37 of file serial_options.h.