1sergensio_baud.3(3)        Library Functions Manual        sergensio_baud.3(3)
2
3
4

NAME

6       sergensio_baud,  sergensio_datasize,  sergensio_parity, sergensio_stop‐
7       bits, sergensio_flowcontrol, sergensio_iflowcontrol,  sergensio_sbreak,
8       sergensio_dtr, sergensio_rts, sergensio_signature, sergensio_linestate,
9       sergensio_modemstate,   sergensio_flowcontrol_state,   sergensio_flush,
10       sergensio_send_break - Control serial parameters on a sergensio
11

SYNOPSIS

13       #include <gensio/sergensio.h>
14
15       typedef void (*sergensio_done)(struct sergensio *sio, int err,
16                           unsigned int val, void *cb_data);
17
18       typedef void (*sergensio_done_sig)(struct sergensio *sio, int err,
19                           const char *sig, unsigned int len,
20                           void *cb_data);
21
22       int sergensio_baud(struct sergensio *sio, unsigned int baud,
23                           sergensio_done done, void *cb_data);
24
25       int sergensio_datasize(struct sergensio *sio, unsigned int datasize,
26                           sergensio_done done, void *cb_data);
27
28       #define SERGENSIO_PARITY_NONE
29       #define SERGENSIO_PARITY_ODD
30       #define SERGENSIO_PARITY_EVEN
31       #define SERGENSIO_PARITY_MARK
32       #define SERGENSIO_PARITY_SPACE
33
34       int sergensio_parity(struct sergensio *sio, unsigned int parity,
35                           sergensio_done done, void *cb_data);
36
37       int sergensio_stopbits(struct sergensio *sio, unsigned int stopbits,
38                           sergensio_done done, void *cb_data);
39
40       #define SERGENSIO_FLOWCONTROL_NONE
41       #define SERGENSIO_FLOWCONTROL_XON_XOFF
42       #define SERGENSIO_FLOWCONTROL_RTS_CTS
43
44       int sergensio_flowcontrol(struct sergensio *sio,
45                           unsigned int flowcontrol,
46                           sergensio_done done, void *cb_data);
47
48       #define SERGENSIO_FLOWCONTROL_DCD
49       #define SERGENSIO_FLOWCONTROL_DTR
50       #define SERGENSIO_FLOWCONTROL_DSR
51
52       int sergensio_iflowcontrol(struct sergensio *sio,
53                           unsigned int iflowcontrol,
54                           sergensio_done done, void *cb_data);
55
56       #define SERGENSIO_BREAK_ON
57       #define SERGENSIO_BREAK_OFF
58
59       int sergensio_sbreak(struct sergensio *sio, unsigned int breakv,
60                           sergensio_done done, void *cb_data);
61
62       int sergensio_send_break(struct sergensio *sio);
63
64       #define SERGENSIO_DTR_ON
65       #define SERGENSIO_DTR_OFF
66
67       int sergensio_dtr(struct sergensio *sio, unsigned int dtr,
68                           sergensio_done done, void *cb_data);
69
70       #define SERGENSIO_RTS_ON
71       #define SERGENSIO_RTS_OFF
72
73       int sergensio_rts(struct sergensio *sio, unsigned int rts,
74                           sergensio_done done, void *cb_data);
75
76       #define SERGENSIO_CTS_AUTO
77       #define SERGENSIO_CTS_OFF
78
79       int sergensio_cts(struct sergensio *sio, unsigned int cts,
80                           sergensio_done done, void *cb_data);
81
82       #define SERGENSIO_DCD_DSR_ON
83       #define SERGENSIO_DCD_DSR_OFF
84
85       int sergensio_dcd_dsr(struct sergensio *sio, unsigned int dcd_dsr,
86                           sergensio_done done, void *cb_data);
87
88       #define SERGENSIO_RI_ON
89       #define SERGENSIO_RI_OFF
90
91       int sergensio_ri(struct sergensio *sio, unsigned int ri,
92                           sergensio_done done, void *cb_data);
93
94       int sergensio_signature(struct sergensio *sio,
95                           const char *sig, unsigned int len,
96                           sergensio_done_sig done, void *cb_data);
97
98       #define SERGENSIO_LINESTATE_DATA_READY
99       #define SERGENSIO_LINESTATE_OVERRUN_ERR
100       #define SERGENSIO_LINESTATE_PARITY_ERR
101       #define SERGENSIO_LINESTATE_FRAMING_ERR
102       #define SERGENSIO_LINESTATE_BREAK
103       #define SERGENSIO_LINESTATE_XMIT_HOLD_EMPTY
104       #define SERGENSIO_LINESTATE_XMIT_SHIFT_EMPTY
105       #define SERGENSIO_LINESTATE_TIMEOUT_ERR
106
107       int sergensio_linestate(struct sergensio *sio, unsigned int linestate);
108
109       #define SERGENSIO_MODEMSTATE_CTS_CHANGED
110       #define SERGENSIO_MODEMSTATE_DSR_CHANGED
111       #define SERGENSIO_MODEMSTATE_RI_CHANGED
112       #define SERGENSIO_MODEMSTATE_CD_CHANGED
113       #define SERGENSIO_MODEMSTATE_CTS
114       #define SERGENSIO_MODEMSTATE_DSR
115       #define SERGENSIO_MODEMSTATE_RI
116       #define SERGENSIO_MODEMSTATE_CD
117
118       int sergensio_modemstate(struct sergensio *sio,
119                           unsigned int modemstate);
120
121       int sergensio_flowcontrol_state(struct sergensio *sio, bool val);
122
123       #define SERGENSIO_FLUSH_RCV_BUFFER
124       #define SERGENSIO_FLUSH_XMIT_BUFFER
125       #define SERGENSIO_FLUSH_RCV_XMIT_BUFFERS
126
127       int sergensio_flush(struct sergensio *sio, unsigned int val);
128
129       int sergensio_send_break(struct sergensio *sio);
130

DESCRIPTION

132       Handle various serial port functions.
133
134
135   SERIAL PORT CONTROLS
136       On  a  client sergensio, these function set various settings on the se‐
137       rial port.  The setting is not necessariy done immediately  as  it  may
138       have  to  be  sent  as a message.  If you supply a done function, it is
139       called when the set operation is known to be complete.  The set  opera‐
140       tion  may  not  work  (the hardware may not support it, etc.), the done
141       function will report the current value of the setting.
142
143       If you just want the current value of the setting, you can  pass  in  a
144       zero  to  all  the functions below and it will just report the value in
145       the done function.
146
147       There are blocking function for all of these, see  sergensio_b_alloc(3)
148       for detais on those.  These are all non-blocking.
149
150       sergensio_baud - Set the baud rate to the integer value.  Not all
151                           system  and  hardware support all baud rates, check
152                           the done function to see what the baud rate was ac‐
153                           tually set to.
154
155       sergensio_datasize - Set the data size, 5, 6, 7, 8 are supported.
156
157       sergensio_parity - Set the parity value
158
159       sergensio_stopbits - Set the number of stop bits, either 1 or 2.
160
161       sergensio_flowcontrol - Set the outgoing flow-control type.
162
163       sergensio_iflowcontrol - Set the incoming flow control type.
164
165       sergensio_sbreak - Turn on or off the break signal.
166
167       sergensio_dtr - Set the DTR value.
168
169       sergensio_rts - Set the RTS value.
170
171       sergensio_send_break  -  Send a break signal (on for a bit then off) on
172       the line.
173
174       On a server gensio, the above functions are used to respond to an event
175       setting  the  value.   Pass in the actual value.  The done value is ig‐
176       nored on the server.
177
178       On a connection that is on the modem side of the serial port (like  ip‐
179       misol), there are a different set of control commands, the above may or
180       may not work.
181
182       Instead, use the following.  Note that passing 0 to these  may  or  may
183       not return the current value, they may return an error.
184
185       sergensio_cts - Set the CTS value to auto (managed by the hardware) or
186                           off (tell the other end not to send d<ata).
187
188       sergensio_dcd_rts  -  Set  the  DCD and RTS value to be enabled or dis‐
189       abled.
190
191       sergensio_ri - Set the ring indicator value to be enabled or disabled.
192
193
194   SIGNATURE
195       Though not really part of serial port control, the telnet RFC2217  spec
196       has  a  signature that can be used to identify the server.  The sergen‐
197       sio_signature function fetches the signature (on the  client  side)  or
198       reponsed to a request for the signature (on the server side).
199
200
201   STATE FUNCTIONS
202       On  the  client side, the serial port state functions set the state in‐
203       formation the user is interested in receiving.  For  instance,  if  the
204       user wants to know about parity errors, they could set SERGENSIO_LINES‐
205       TATE_OVERRUN_ERR in the linestate  and  they  would  receive  linestate
206       events with parity errors.
207
208       On  the  server  side, these are used to report state information.  The
209       gensio itself doesn't track what the client has requested, that  is  up
210       to the server code itself.
211
212       sergensio_linestate - Various information (mostly error) about what
213                           has  happened  on the serial line.  Not all sergen‐
214                           sios support requesting this information.
215
216       sergensio_modemstate - CTS, DSR, RI, and CD line on the serial port.
217                           On the client side, the user should set what values
218                           they  want  to  received with that _CHANGED values.
219                           The other values are ignored on  the  client  side.
220                           On  the server side, this is used to report current
221                           values and which values have changed to  cause  the
222                           report.
223
224   OTHER SERIAL PORT CONTROLS
225       These function do other miscellaneous functions on a serial port.
226
227       sergensio_flowcontrol_state - Tell the remote end of the serial port to
228                           stop sending using flow control.
229
230       sergensio_flush - Flush all data from buffers to the serial port.
231
232       sergensio_send_break - Send a short break signal on the serial port.
233                           The length is implementation dependent.
234

RETURN VALUES

236       Zero is returned on success, or a gensio error on failure.
237

SEE ALSO

239       sergensio(5), sergensio_b_alloc(3)
240

AUTHOR

242       Corey Minyard <minyard@acm.org>
243
244
245
246                                  20 Jul 2020              sergensio_baud.3(3)
Impressum