From 0cc9b20c15460213e488bf5e70963b941482f628 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Tue, 14 Jan 2025 16:06:02 -0600 Subject: Add source. --- sdk/dev/flowctrl.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 sdk/dev/flowctrl.c (limited to 'sdk/dev/flowctrl.c') diff --git a/sdk/dev/flowctrl.c b/sdk/dev/flowctrl.c new file mode 100644 index 0000000..7977b1c --- /dev/null +++ b/sdk/dev/flowctrl.c @@ -0,0 +1,47 @@ +/* + * Serial line flow control option settings. + * $Id$ + * Copyright (c) 1997 by Tycho Softworks. + * For conditions of distribution and reuse see product license. + */ + +#include +#ifndef TERMIOS_H_MISSING +#include +#endif + +#ifndef CRTSCTS +#ifdef CTSFLOW +#define CRTSCTS CTSFLOW | CRTSFL +#endif +#endif + +int setflowctrl(stty_t stty, FLOWCONTROL flow) +{ +#ifndef TERMIOS_H_MISSING + + struct termios *tios = stty; + tios->c_cflag &= ~CRTSCTS; + tios->c_iflag &= ~(IXON | IXOFF | IXANY); + + switch(flow) + { + case FC_HARD: + tios->c_cflag |= CRTSCTS; + break; + case FC_SOFT: + tios->c_iflag |= (IXON | IXOFF | IXANY); + break; + case FC_FULL: + tios->c_cflag |= CRTSCTS; + tios->c_iflag |= (IXON | IXOFF | IXANY); + break; + } +#endif + return 0; +} + + + + + -- cgit v1.2.3-54-g00ecf