mirror of
https://github.com/UzixLS/picocom.git
synced 2025-07-19 07:21:18 +03:00
Added term_baud_ok(). Check if baudrate is valid.
This commit is contained in:
10
term.c
10
term.c
@ -270,6 +270,16 @@ Bspeed(speed_t code)
|
||||
return speed;
|
||||
}
|
||||
|
||||
int
|
||||
term_baud_ok(int baud)
|
||||
{
|
||||
#ifndef USE_CUSTOM_BAUD
|
||||
return (Bcode(baud) != BNONE) ? 1 : 0;
|
||||
#else
|
||||
return (baud >= 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
static int
|
||||
|
7
term.h
7
term.h
@ -65,6 +65,7 @@
|
||||
* F term_break - generate a break condition on a device
|
||||
* F term_baud_up - return next higher baudrate
|
||||
* F term_baud_down - return next lower baudrate
|
||||
* F term_baud_ok - check if baudrate is valid
|
||||
* F term_strerror - return a string describing current error condition
|
||||
* F term_perror - print a string describing the current error condition
|
||||
* G term_errno - current error condition of the library
|
||||
@ -634,6 +635,12 @@ int term_baud_up (int baud);
|
||||
*/
|
||||
int term_baud_down (int baud);
|
||||
|
||||
/* F term_baud_ok
|
||||
*
|
||||
* Returns non-zero if "baud" is a valid baudrate, zero otherwise.
|
||||
*/
|
||||
int term_baud_ok(int baud);
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
#endif /* of TERM_H */
|
||||
|
Reference in New Issue
Block a user