summaryrefslogtreecommitdiff
path: root/tools/termios_linux.h
AgeCommit message (Collapse)AuthorFilesLines
2021-10-21tools: termios_linux.h: Fix tcsendbreak() implementationPali Rohár1-1/+5
There are two Linux ioctls which implements tcsendbreak() functionality: TCSBRK and TCSBRKP TCSBRK with non-zero parameter implements tcdrain() and with zero parameter implements tcsendbreak() for duration of 0.25s. TCSBRKP with zero parameter is same as TCSBRK and with non-zero parameter implements tcsendbreak() for duration in deciseconds specified by parameter. TCSBRKP does not have to be provided by older toolchain versions. So tcsendbreak() has to either use TCSBRK with zero parameter or TCSBRKP with any parameter. Fix code to use TCSBRKP and fallback to TCSBRK with 0. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2021-10-01tools: kwboot: Allow any baudrate on LinuxPali Rohár1-0/+189
The A38x platform supports more baudrates than just those defined by the Bn constants, and some of them are higher than the highest Bn baudrate (the highest is 4 MBd while A38x support 5.15 MBd). On Linux, add support for arbitrary baudrates. (Since there is no standard POSIX API to specify arbitrary baudrate for a tty device, this change is Linux-specific.) We need to use raw TCGETS2/TCSETS2 or TCGETS/TCSETS ioctls with the BOTHER flag in struct termios2/termios, defined in Linux headers <asm/ioctls.h> (included by <sys/ioctl.h>) and <asm/termbits.h>. Since these headers conflict with glibc's header file <termios.h>, it is not possible to use libc's termios functions and we need to reimplement them via ioctl() calls. Note that the Bnnn constants from <termios.h> need not be compatible with Bnnn constants from <asm/termbits.h>. Signed-off-by: Pali Rohár <pali@kernel.org> [ termios macros rewritten to static inline functions (for type control) and moved to tools/termios_linux.h ] Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>