sergensio_baud - Man Page
Control serial parameters on a sergensio
Synopsis
#include <gensio/sergensio.h>
- typedef void (*sergensio_done)(struct sergensio *sio, int err,
unsigned int val, void *cb_data);
- typedef void (*sergensio_done_sig)(struct sergensio *sio, int err,
const char *sig, unsigned int len,
void *cb_data);- int sergensio_baud(struct sergensio *sio, unsigned int baud,
sergensio_done done, void *cb_data);
- int sergensio_datasize(struct sergensio *sio, unsigned int datasize,
sergensio_done done, void *cb_data);
- #define SERGENSIO_PARITY_NONE
#define SERGENSIO_PARITY_ODD
#define SERGENSIO_PARITY_EVEN
#define SERGENSIO_PARITY_MARK
#define SERGENSIO_PARITY_SPACE- int sergensio_parity(struct sergensio *sio, unsigned int parity,
sergensio_done done, void *cb_data);
- int sergensio_stopbits(struct sergensio *sio, unsigned int stopbits,
sergensio_done done, void *cb_data);
- #define SERGENSIO_FLOWCONTROL_NONE
#define SERGENSIO_FLOWCONTROL_XON_XOFF
#define SERGENSIO_FLOWCONTROL_RTS_CTS- int sergensio_flowcontrol(struct sergensio *sio,
unsigned int flowcontrol,
sergensio_done done, void *cb_data);- #define SERGENSIO_FLOWCONTROL_DCD
#define SERGENSIO_FLOWCONTROL_DTR
#define SERGENSIO_FLOWCONTROL_DSR- int sergensio_iflowcontrol(struct sergensio *sio,
unsigned int iflowcontrol,
sergensio_done done, void *cb_data);- #define SERGENSIO_BREAK_ON
#define SERGENSIO_BREAK_OFF
- int sergensio_sbreak(struct sergensio *sio, unsigned int breakv,
sergensio_done done, void *cb_data);
- int sergensio_send_break(struct sergensio *sio);
- #define SERGENSIO_DTR_ON
#define SERGENSIO_DTR_OFF
- int sergensio_dtr(struct sergensio *sio, unsigned int dtr,
sergensio_done done, void *cb_data);
- #define SERGENSIO_RTS_ON
#define SERGENSIO_RTS_OFF
- int sergensio_rts(struct sergensio *sio, unsigned int rts,
sergensio_done done, void *cb_data);
- #define SERGENSIO_CTS_AUTO
#define SERGENSIO_CTS_OFF
- int sergensio_cts(struct sergensio *sio, unsigned int cts,
sergensio_done done, void *cb_data);
- #define SERGENSIO_DCD_DSR_ON
#define SERGENSIO_DCD_DSR_OFF
- int sergensio_dcd_dsr(struct sergensio *sio, unsigned int dcd_dsr,
sergensio_done done, void *cb_data);
- #define SERGENSIO_RI_ON
#define SERGENSIO_RI_OFF
- int sergensio_ri(struct sergensio *sio, unsigned int ri,
sergensio_done done, void *cb_data);
- int sergensio_signature(struct sergensio *sio,
const char *sig, unsigned int len,
sergensio_done_sig done, void *cb_data);- #define SERGENSIO_LINESTATE_DATA_READY
#define SERGENSIO_LINESTATE_OVERRUN_ERR
#define SERGENSIO_LINESTATE_PARITY_ERR
#define SERGENSIO_LINESTATE_FRAMING_ERR
#define SERGENSIO_LINESTATE_BREAK
#define SERGENSIO_LINESTATE_XMIT_HOLD_EMPTY
#define SERGENSIO_LINESTATE_XMIT_SHIFT_EMPTY
#define SERGENSIO_LINESTATE_TIMEOUT_ERR- int sergensio_linestate(struct sergensio *sio, unsigned int linestate);
- #define SERGENSIO_MODEMSTATE_CTS_CHANGED
#define SERGENSIO_MODEMSTATE_DSR_CHANGED
#define SERGENSIO_MODEMSTATE_RI_CHANGED
#define SERGENSIO_MODEMSTATE_CD_CHANGED
#define SERGENSIO_MODEMSTATE_CTS
#define SERGENSIO_MODEMSTATE_DSR
#define SERGENSIO_MODEMSTATE_RI
#define SERGENSIO_MODEMSTATE_CD- int sergensio_modemstate(struct sergensio *sio,
unsigned int modemstate);
- int sergensio_flowcontrol_state(struct sergensio *sio, bool val);
- #define SERGENSIO_FLUSH_RCV_BUFFER
#define SERGENSIO_FLUSH_XMIT_BUFFER
#define SERGENSIO_FLUSH_RCV_XMIT_BUFFERSint sergensio_flush(struct sergensio *sio, unsigned int val);
int sergensio_send_break(struct sergensio *sio);
Description
Handle various serial port functions.
Serial Port Controls
On a client sergensio, these function set various settings on the serial port. The setting is not necessariy done immediately as it may have to be sent as a message. If you supply a done function, it is called when the set operation is known to be complete. The set operation may not work (the hardware may not support it, etc.), the done function will report the current value of the setting.
If you just want the current value of the setting, you can pass in a zero to all the functions below and it will just report the value in the done function.
There are blocking function for all of these, see sergensio_b_alloc(3) for detais on those. These are all non-blocking.
- sergensio_baud - Set the baud rate to the integer value. Not all
system and hardware support all baud rates, check the done function to see what the baud rate was actually set to.
sergensio_datasize - Set the data size, 5, 6, 7, 8 are supported.
sergensio_parity - Set the parity value
sergensio_stopbits - Set the number of stop bits, either 1 or 2.
sergensio_flowcontrol - Set the outgoing flow-control type.
sergensio_iflowcontrol - Set the incoming flow control type.
sergensio_sbreak - Turn on or off the break signal.
sergensio_dtr - Set the DTR value.
sergensio_rts - Set the RTS value.
sergensio_send_break - Send a break signal (on for a bit then off) on the line.
On a server gensio, the above functions are used to respond to an event setting the value. Pass in the actual value. The done value is ignored on the server.
On a connection that is on the modem side of the serial port (like ipmisol), there are a different set of control commands, the above may or may not work.
Instead, use the following. Note that passing 0 to these may or may not return the current value, they may return an error.
- sergensio_cts - Set the CTS value to auto (managed by the hardware) or
off (tell the other end not to send d<ata).
sergensio_dcd_rts - Set the DCD and RTS value to be enabled or disabled.
sergensio_ri - Set the ring indicator value to be enabled or disabled.
Signature
Though not really part of serial port control, the telnet RFC2217 spec has a signature that can be used to identify the server. The sergensio_signature function fetches the signature (on the client side) or reponsed to a request for the signature (on the server side).
State Functions
On the client side, the serial port state functions set the state information the user is interested in receiving. For instance, if the user wants to know about parity errors, they could set SERGENSIO_LINESTATE_OVERRUN_ERR in the linestate and they would receive linestate events with parity errors.
On the server side, these are used to report state information. The gensio itself doesn't track what the client has requested, that is up to the server code itself.
- sergensio_linestate - Various information (mostly error) about what
has happened on the serial line. Not all sergensios support requesting this information.
- sergensio_modemstate - CTS, DSR, RI, and CD line on the serial port.
On the client side, the user should set what values they want to received with that _CHANGED values. The other values are ignored on the client side. On the server side, this is used to report current values and which values have changed to cause the report.
Other Serial Port Controls
These function do other miscellaneous functions on a serial port.
- sergensio_flowcontrol_state - Tell the remote end of the serial port to
stop sending using flow control.
- sergensio_flush - Flush all data from buffers to the serial port.
- sergensio_send_break - Send a short break signal on the serial port.
The length is implementation dependent.
Return Values
Zero is returned on success, or a gensio error on failure.
See Also
Author
Corey Minyard <minyard@acm.org>
Referenced By
gensio_event(3), sergensio(5), sergensio_b_alloc(3), sergensio_event(3).
The man pages sergensio_cts(3), sergensio_datasize(3), sergensio_dcd_dsr(3), sergensio_dtr(3), sergensio_flowcontrol(3), sergensio_flowcontrol_state(3), sergensio_flush(3), sergensio_iflowcontrol(3), sergensio_linestate(3), sergensio_modemstate(3), sergensio_parity(3), sergensio_ri(3), sergensio_rts(3), sergensio_sbreak(3), sergensio_send_break(3), sergensio_signature(3) and sergensio_stopbits(3) are aliases of sergensio_baud(3).