1
0
mirror of https://github.com/UzixLS/picocom.git synced 2025-07-19 07:21:18 +03:00

OSX custom baudrates: fixed and refactored

This commit is contained in:
Joe Merten
2016-12-16 16:04:20 +01:00
parent deffd18c24
commit a502f76e5d
5 changed files with 254 additions and 56 deletions

65
term.c
View File

@ -61,6 +61,11 @@
#include "termios2.h"
#endif
#if defined(__APPLE__) && defined(USE_CUSTOM_BAUD)
/* only for OSX, Tiger and above */
#include "custbaud_osx.h"
#endif
#include "term.h"
/***************************************************************************/
@ -170,68 +175,14 @@ term_perror (const char *prefix)
#ifndef B460800
#define B460800 460800
#endif
#ifndef B500000
#define B500000 500000
#endif
#ifndef B576000
#define B576000 576000
#endif
#ifndef B921600
#define B921600 921600
#endif
#ifndef B1000000
#define B1000000 1000000
#endif
#ifndef B1152000
#define B1152000 1152000
#endif
#ifndef B1500000
#define B1500000 1500000
#endif
#ifndef B2000000
#define B2000000 2000000
#endif
#ifndef B2500000
#define B2500000 2500000
#endif
#ifndef B3000000
#define B3000000 3000000
#endif
#ifndef B3500000
#define B3500000 3500000
#endif
#ifndef B4000000
#define B4000000 4000000
#endif
#endif /* __APPLE__ */
/***************************************************************************/
/* Custom baudrates support for OSX */
#if defined(__APPLE__) && defined (USE_CUSTOM_BAUD)
int cfsetospeed_custom(struct termios *tiop, int speed) {
return cfsetospeed(tiop, speed);
}
int cfsetispeed_custom(struct termios *tiop, int speed) {
return cfsetispeed(tiop, speed);
}
int cfgetospeed_custom(struct termios *tiop) {
return cfgetospeed(tiop);
}
int cfgetispeed_custom(struct termios *tiop) {
return cfgetispeed(tiop);
}
#endif /* __APPLE__ && USE_CUSTOM_BAUD */
/***************************************************************************/
#define BNONE 0xFFFFFFFF
struct baud_codes {
@ -374,6 +325,12 @@ term_baud_ok(int baud)
#endif
}
int
term_baud_std(int baud)
{
return (Bcode(baud) != BNONE) ? 1 : 0;
}
/**************************************************************************/
static int