The cfsetospeed and cfsetispeed functions are usually used to set the baud rate. The cfgetispeed and cfgetospeed functions are used to obtain the baud rate information.
Cfsetospeed Function
Header file:
# Include <termios. h>
Function prototype:
Int cfsetospeed (struct termios * termptr, speed_t speed );
Parameters:
Struct termios * termptr-pointer to the termios Structure
Speed_t speed-output baud rate to be set
Return Value:
If the request is successful, 0 is returned. Otherwise,-1 is returned.
Cfsetispeed Function
Header file:
# Include <termios. h>
Function prototype:
Int cfsetispeed (struct termios * termptr, speed_t speed );
Parameters:
Struct termios * termptr-pointer to the termios Structure
Speed_t speed-the input baud rate to be set
Return Value:
If the request is successful, 0 is returned. Otherwise,-1 is returned.
Cfgetospeed Function
Header file:
# Include <termios. h>
Function prototype:
Speed_t cfgetospeed (const struct termios * termptr );
Parameters:
Const struct termios-pointer to the termios Structure
Return Value:
Returns the output baud rate.
Cfgetispeed Function
Header file:
# Include <termios. h>
Function prototype:
Speed_t cfgetispeed (const struct termios * termptr );
Parameters:
Const struct termios * termptr-pointer to the termios Structure
Return Value:
Returns the input baud rate.
Baud Rate Constant:
Cbaud mask
B0 0 Port
B50 50 Port
B75 75 Port
B110 100 Port
B134 134 Port
B150 150 Port
B200 200 Port
B300 300 Port
B600 600 Port
B1200 1200 Port
B1800 1800 Port
B2400 2400 Port
B9600 9600 Port
B19200 19200 Port
B38400 38400 Port
B57600 57600 Port
B115200 115200 Port