ISERIALCTRL(3)
HP-UX
NAME
iserialctrl − sets serial interface for data exchange
SYNOPSIS
#include <sicl.h>
int iserialctrl (id, request, setting);
INST id;
int request;
unsigned long setting;
DESCRIPTION
Iserialctrl sets-up the serial interface for data exchange. This function takes request (one of the following values) and sets the interface to the setting. The following are valid values for request:
I_SERIAL_BAUD The setting parameter will be the new speed of the interface. The value should be a valid baud rate for the interface (for example, 300, 1200, 9600). The baud rate is represented as an unsigned long integer, in bits per second. If the value is not a recognizable baud rate, an err_param error is returned. The following are the supported baud rates: 50, 110, 300, 600, 1200, 2400, 4800, 7200, 9600, 19200, 38400, and 57600.
I_SERIAL_PARITY The following values are acceptable values for setting:
I_SERIAL_PAR_EVEN Even parity
I_SERIAL_PAR_ODD Odd parity
I_SERIAL_PAR_NONE No parity bit is used
I_SERIAL_PAR_MARK Parity is always one
I_SERIAL_PAR_SPACE Parity is always zero
I_SERIAL_STOP The following are acceptable values for setting:
I_SERIAL_STOP_1 1 stop bit
I_SERIAL_STOP_2 2 stop bits
I_SERIAL_WIDTH The following are acceptable values for setting:
I_SERIAL_CHAR_5 5 bit characters
I_SERIAL_CHAR_6 6 bit characters
I_SERIAL_CHAR_7 7 bit characters
I_SERIAL_CHAR_8 8 bit characters
I_SERIAL_READ_BUFSZ This is used to set the size of the read buffer. The setting parameter is used as the size of buffer to use. This value must be in the range of 1 and 32767.
I_SERIAL_WRITE_BUFSZ This is used to set the size of the write buffer. The setting parameter is used as the size of buffer to use. This value must be in the range of 1 and 32767.
I_SERIAL_DUPLEX The following are acceptable values for setting:
I_SERIAL_DUPLEX_FULL Use full duplex
I_SERIAL_DUPLEX_HALF Use half duplex
I_SERIAL_FLOW_CTRL The setting parameter must be set to one of the following values. If no flow control is to be used, set setting to zero (0). The following are the supported types of flow control:
I_SERIAL_FLOW_NONE No handshaking
I_SERIAL_FLOW_XON Software handshaking
I_SERIAL_FLOW_RTS_CTS Hardware handshaking
I_SERIAL_FLOW_DTR_DSR Hardware handshaking
I_SERIAL_READ_EOI Used to set the type of END Indicator to use for reads. In order for iscanf to work as specified, data must be terminated with an END indicator. The RS-232 interface has no standard way of doing this. SICL gives you two different methods of indicating EOI.
The first method is to use a character. The character can have a value between 0 and 0xff. Whenever this value is encountered in a read (iread, iscanf, or ipromptf), the read will terminate and the term reason will include I_TERM_END. The default for serial will be the newline character (0).
The second method is to use bit 7 (if numbered 0-7) of the data as the END indicator. The data would be bits 0 through 6 and, when bit 7 is set, that means EOI. The following values are valid for the setting parameter:
I_SERIAL_EOI_CHR(n) A character is used to indicate EOI, where n is the character. This is the default type, and 0 is used.
I_SERIAL_WRITE_EOI The setting parameter will contain the value of the type of END Indicator to use for reads. The following are valid values to use:
I_SERIAL_EOI_NONE No EOI indicator. This is the default for I_SERIAL_WRITE (iprintf).
I_SERIAL_EOI_BIT8 Use the eighth bit of the data to indicate EOI. On the last byte, the eighth bit will be masked off, and the result will be placed into the buffer.
I_SERIAL_RESET This will reset the serial interface. The following actions will occur: any pending writes will be aborted, the data in the input buffer will be discarded, and any error conditions will be reset. This differs from iclear in that no BREAK will be sent.
RETURN VALUE
Iserialctrl returns zero (0) if successful, or a non-zero error number if an error occurs.
SEE ALSO
AUTHOR
iserialctrl was developed by HP.
Hewlett-Packard Comapny — September 29, 1999