add constants for bsd serial

db4
Doug Coleman 2008-08-13 21:51:25 -05:00
parent e033d2e1b7
commit c5e3bdf668
3 changed files with 17 additions and 4 deletions

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences system serial ; USING: alien.syntax kernel sequences system serial ;
IN: serial.unix IN: serial.unix
M: bsd lookup-baud ( m -- n ) M: bsd lookup-baud ( m -- n )
@ -9,3 +9,16 @@ M: bsd lookup-baud ( m -- n )
7200 9600 14400 19200 28800 38400 57600 76800 115200 7200 9600 14400 19200 28800 38400 57600 76800 115200
230400 460800 921600 230400 460800 921600
} member? [ invalid-baud ] unless ; } member? [ invalid-baud ] unless ;
: TCSANOW 0 ; inline
: TCSADRAIN 1 ; inline
: TCSAFLUSH 2 ; inline
: TCSASOFT HEX: 10 ; inline
: TCIFLUSH 1 ; inline
: TCOFLUSH 2 ; inline
: TCIOFLUSH 3 ; inline
: TCOOFF 1 ; inline
: TCOON 2 ; inline
: TCIOFF 3 ; inline
: TCION 4 ; inline

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences system ; USING: alien.syntax kernel sequences system ;
IN: serial.unix.termios IN: serial.unix.termios
: NCCS 20 ; inline : NCCS 20 ; inline

View File

@ -5,10 +5,10 @@ io.streams.duplex io.unix.backend system kernel math math.bitfields
vocabs.loader unix serial serial.unix.termios ; vocabs.loader unix serial serial.unix.termios ;
IN: serial.unix IN: serial.unix
{ << {
{ [ os linux? ] [ "serial.unix.linux" ] } { [ os linux? ] [ "serial.unix.linux" ] }
{ [ os bsd? ] [ "serial.unix.bsd" ] } { [ os bsd? ] [ "serial.unix.bsd" ] }
} cond require } cond require >>
FUNCTION: speed_t cfgetispeed ( termios* t ) ; FUNCTION: speed_t cfgetispeed ( termios* t ) ;
FUNCTION: speed_t cfgetospeed ( termios* t ) ; FUNCTION: speed_t cfgetospeed ( termios* t ) ;