io.serial.linux: some useful extra termios constants
parent
97de22755c
commit
8762d1c593
|
@ -33,6 +33,7 @@ FUNCTION: int tcsendbreak ( int i1, int i2 )
|
||||||
FUNCTION: void cfmakeraw ( termios* t )
|
FUNCTION: void cfmakeraw ( termios* t )
|
||||||
FUNCTION: int cfsetspeed ( termios* t, speed_t s )
|
FUNCTION: int cfsetspeed ( termios* t, speed_t s )
|
||||||
|
|
||||||
|
! See /usr/include/bits/termios.h
|
||||||
CONSTANT: TCSANOW 0
|
CONSTANT: TCSANOW 0
|
||||||
CONSTANT: TCSADRAIN 1
|
CONSTANT: TCSADRAIN 1
|
||||||
CONSTANT: TCSAFLUSH 2
|
CONSTANT: TCSAFLUSH 2
|
||||||
|
@ -110,7 +111,7 @@ CONSTANT: CRTSCTS 0o020000000000
|
||||||
! lflags
|
! lflags
|
||||||
CONSTANT: ISIG 0o0000001
|
CONSTANT: ISIG 0o0000001
|
||||||
CONSTANT: ICANON 0o0000002
|
CONSTANT: ICANON 0o0000002
|
||||||
CONSTANT: XCASE 0o0000004
|
CONSTANT: XCASE 0o0000004
|
||||||
CONSTANT: ECHO 0o0000010
|
CONSTANT: ECHO 0o0000010
|
||||||
CONSTANT: ECHOE 0o0000020
|
CONSTANT: ECHOE 0o0000020
|
||||||
CONSTANT: ECHOK 0o0000040
|
CONSTANT: ECHOK 0o0000040
|
||||||
|
@ -124,6 +125,25 @@ CONSTANT: FLUSHO 0o0010000
|
||||||
CONSTANT: PENDIN 0o0040000
|
CONSTANT: PENDIN 0o0040000
|
||||||
CONSTANT: IEXTEN 0o0100000
|
CONSTANT: IEXTEN 0o0100000
|
||||||
|
|
||||||
|
! c_cc characters
|
||||||
|
CONSTANT: VINTR 0
|
||||||
|
CONSTANT: VQUIT 1
|
||||||
|
CONSTANT: VERASE 2
|
||||||
|
CONSTANT: VKILL 3
|
||||||
|
CONSTANT: VEOF 4
|
||||||
|
CONSTANT: VTIME 5
|
||||||
|
CONSTANT: VMIN 6
|
||||||
|
CONSTANT: VSWTC 7
|
||||||
|
CONSTANT: VSTART 8
|
||||||
|
CONSTANT: VSTOP 9
|
||||||
|
CONSTANT: VSUSP 10
|
||||||
|
CONSTANT: VEOL 11
|
||||||
|
CONSTANT: VREPRINT 12
|
||||||
|
CONSTANT: VDISCARD 13
|
||||||
|
CONSTANT: VWERASE 14
|
||||||
|
CONSTANT: VLNEXT 15
|
||||||
|
CONSTANT: VEOL2 16
|
||||||
|
|
||||||
M: linux lookup-baud ( n -- n )
|
M: linux lookup-baud ( n -- n )
|
||||||
H{
|
H{
|
||||||
{ 0 0o0000000 }
|
{ 0 0o0000000 }
|
||||||
|
|
|
@ -22,11 +22,11 @@ IN: io.serial.linux
|
||||||
: serial-fd ( serial -- fd )
|
: serial-fd ( serial -- fd )
|
||||||
stream>> in>> handle>> fd>> ;
|
stream>> in>> handle>> fd>> ;
|
||||||
|
|
||||||
|
: get-fd-termios ( fd -- serial )
|
||||||
|
termios <struct> [ tcgetattr io-error ] keep ;
|
||||||
|
|
||||||
: set-termios ( serial -- )
|
: set-termios ( serial -- )
|
||||||
[
|
[ serial-fd get-fd-termios ] keep termios<< ;
|
||||||
serial-fd
|
|
||||||
termios <struct> [ tcgetattr io-error ] keep
|
|
||||||
] keep termios<< ;
|
|
||||||
|
|
||||||
: configure-termios ( serial -- )
|
: configure-termios ( serial -- )
|
||||||
dup termios>>
|
dup termios>>
|
||||||
|
|
Loading…
Reference in New Issue