O2S C Library 1.8.2
Provide high-level data-structures and other fundamental tools for C projects
Loading...
Searching...
No Matches
serial_options.h
Go to the documentation of this file.
1#pragma once
2
3/* ************************************************************************** */
4/* ____ _ _____ ____ _ _ _ _____ _ _ ____ ____ */
5/* / ___| / \ | ___| _ \ / \ | \ | | |_ _| || | | _ \/ ___| */
6/* \___ \ / _ \ | |_ | |_) | / _ \ | \| | | | | || |_| | | \___ \ */
7/* ___) / ___ \| _| | _ < / ___ \| |\ | | | |__ _| |_| |___) | */
8/* |____/_/ \_|_| |_| \_/_/ \_|_| \_| |_| |_| |____/|____/ */
9/* */
16/* ************************************************************************** */
17
18#include <termios.h>
19
20#include <stdbool.h>
21#include <stdint.h> // uint*_t
22
31{
32 uint32_t ignore_break :1;
33 uint32_t signal_break :1;
35 uint32_t mark_errors :1;
36 uint32_t parity_check :1;
37 uint32_t strip_8th_bit :1;
38 uint32_t map_nl_to_cr :1;
39 uint32_t ignore_cr :1;
40 uint32_t map_cr_to_nl :1;
42 uint32_t map_upper_to_lower :1;
46 uint32_t ring_bell_when_full :1;
47 uint32_t is_utf8 :1;
48 uint32_t _unused :16;
49 uint32_t _dont_modify_speed :1; /* Used when setting speed */
50};
51
56{
57 uint32_t enable_processing :1;
59 uint32_t map_lower_to_upper :1;
60 uint32_t map_nl_to_crnl :1;
61 uint32_t map_cr_to_nl :1;
62 uint32_t no_cr :1;
63 uint32_t nl_returns :1;
64 uint32_t use_fill :1;
65 uint32_t fill_is_del :1;
66 uint32_t _nl_delay :1;
67 uint32_t _cr_delay :2;
68 uint32_t _tab_delay :2;
69 uint32_t _backspace_delay :1;
70 uint32_t vertical_tab_delay :1;
71 uint32_t _formfeed_delay :1;
72};
73
83{
84 uint32_t _speed_4lsb :4; /* Least significant 4-bits of the line speed */
85 uint32_t character_size :2;
86 uint32_t two_stop_bits :1;
87 uint32_t read :1;
89 uint32_t enable_parity :1;
91 uint32_t odd_parity :1;
93 uint32_t hang_up :1;
94 uint32_t is_local :1;
95 uint32_t _speed_is_extra :1; /* For non-posix baud rates */
96};
97
105{
107 uint32_t enable_signals :1;
108 uint32_t canonical :1;
109 uint32_t _uppercase_only :1; /* Not supported under Linux */
110 uint32_t echo :1; /* Echo input characters. */
111 uint32_t echo_erasure :1; /* requires canonical mode */
112 uint32_t echo_kill :1; /* requires canonical mode */
113 uint32_t echo_nl :1; /* requires canonical mode */
114 uint32_t disable_flush :1;
116 uint32_t tostop :1;
117 uint32_t _echo_control :1; /* Escape control characters */
118 uint32_t _echo_print :1; /* Print chars when erased, if ICANON and ECHO */
119 uint32_t _misc :4;
120 uint32_t enable_processing :1; /* implementation-defined input processing */
121};
122
138
143{
144 uint8_t array[NCCS];
145
146 struct
147 {
148 uint8_t interrupt;
149 uint8_t quit;
150 uint8_t erase;
151 uint8_t kill;
152 uint8_t end_of_file;
154 uint8_t timeout;
156 uint8_t minimum;
157 };
158};
159
161typedef union serial_options serial_options_t;
162
167{
169
170 struct
171 {
176 uint8_t line_discipline;
180 uint32_t input_speed;
182 uint32_t output_speed;
183 };
184};
185
209
228
331
344
389
character_size
Possible values of serial_control_modes::character_size.
@ character_size_6
rarely used
@ character_size_5
for Baudot code
@ character_size_7
for true ASCII
@ character_size_8
for most kinds of data
Verbose alternative to termios.c_cflag.
uint32_t enable_parity
Enable parity generation on output and parity checking for input.
uint32_t hang_up
Lower modem control lines after last process closes the device (hang up).
uint32_t is_local
Ignore modem control lines.
uint32_t two_stop_bits
Set two stop bits, rather than one.
uint32_t read
Enable receiver.
uint32_t character_size
Number of bits used by a single character.
uint32_t odd_parity
If set, then parity for input and output is odd; otherwise even parity is used.
Verbose alternative to termios.c_iflag.
uint32_t mark_errors
Mark parity and framing errors.
uint32_t map_cr_to_nl
Map \r to \n on input.
uint32_t map_upper_to_lower
Map uppercase characters to lowercase on input.
uint32_t strip_8th_bit
Strip 8th bit off characters.
uint32_t ignore_break
Ignore break condition.
uint32_t is_utf8
Input is UTF8.
uint32_t discard_invalid_chars
Ignore characters with parity errors.
uint32_t signal_break
Signal interrupt on break.
uint32_t enable_start_stop_out
Enable start/stop output control.
uint32_t ignore_cr
Ignore Carriage Returns (\r)
uint32_t any_can_restart_output
Enable any character to restart output.
uint32_t map_nl_to_cr
Map \n to \r on input.
uint32_t parity_check
Enable input parity check.
uint32_t enable_start_stop_in
Enable start/stop input control.
uint32_t ring_bell_when_full
Ring bell when input queue is full.
Verbose alternative to termios.c_lflag.
uint32_t enable_signals
Generate a signal when INTR, QUIT, SUSP, or DSUSP are received.
uint32_t canonical
Enable canonical mode.
uint32_t tostop
Send SIGTOU to background jobs attempting to write to the terminal.
Verbose alternative to termios.c_oflag.
uint32_t map_nl_to_crnl
Map \n to \r\n on output.
uint32_t map_cr_to_nl
Map \r to \n on output.
uint32_t map_lower_to_upper
Map lowercase characters to lowercase on output.
uint32_t no_cr
No \r output at colum 0.
uint32_t use_fill
Use fill characters for delay.
uint32_t nl_returns
\n performs \r function
uint32_t fill_is_del
Fill is DEL
uint32_t enable_processing
Post-process output.
Terminal special characters.
uint8_t quit
Send a SIGQUIT signal.
uint8_t interrupt
Send a SIGINT signal.
uint8_t array[NCCS]
Standard array.
uint8_t timeout
Timeout in deciseconds for noncanonical read.
uint8_t minimum
Minimum number of characters for noncanonical read.
Holds a struct termios that can be modified using the verbose alternatives.
struct termios termios
Standard structure.
uint32_t input_speed
Input line speed, see Line speed.
struct serial_output_modes output
Output mode flags.
struct serial_control_modes control
Control mode flags.
union serial_control_characters control_characters
Terminal special characters.
uint32_t output_speed
Output line speed, see Line speed.
struct serial_input_modes input
Input mode flags.
struct serial_local_modes local
Local mode flags.