1
0
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:
Nick Patavalis
2015-08-22 16:49:57 +03:00
parent 991ddfe638
commit 5916997d40
2 changed files with 17 additions and 0 deletions

10
term.c
View File

@ -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
View File

@ -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 */