SLIP interface

The SLIP interface is handled by a task using a state machine. See SLIP\SLIPCOM.FTH.

SLIP equates

$C0 equ FRAME_END               \ -- char
Frame end character.

$DB equ FRAME_ESCAPE            \ -- char
Frame escape character.

$DC equ TRANS_FRAME_END         \ -- char
Trans Frame end character.

$DD equ TRANS_FRAME_ESCAPE      \ -- char
Trans Frame escape character.

#1000 equ SLIP_RX_TIMEOUT       \ -- ms
Receive timout in milliseconds.

Slip input functions

: (gotSlipChar) \ char --
Char is saved in the input buffer.

: gotTransFrameEsc      \ --
Received a TRANS_FRAME_ESCAPE.

: gotTransFrameEnd      \ --
Received a TRANS_FRAME_END.

: gotFrameEsc   \ --
Received a FRAME_ESCAPE.

: StartOfPacket \ --
Set up for a new packet.

: EndOfPacket   \ --
We got the end of a packet.

: gotFrameEnd   \ --
We received a FRAME_END character.

: GotSlipChar   \ char --
Handle an incoming SLIP char

: GetSlipChars  \ --
Receive characters from a SLIP port until all are in.

Slip output functions

: Send>Slip     { *pb *rt | ln -- int }
Send the data in the supplied PBuf (chain).

*PB

the first pbuf in the chain (only 1 allowed)

*RT

points to the required routing table entry

int

number of bytes sent if OK else SOCKET_ERROR.

: (SendSlipChar)        \ char --
Sends the char to the SLIP port.

: send_frame_esc_char   \ --
Sends the escape sequence to the SLIP port.

: send_frame_end_char   \ --
Sends the escape sequence to the SLIP port.

: SendSlipChar  \ char --
Sends the character to the SLIP port, processing escape characters.

: SlipTx        \ *pbuf --
Send the pbuf chain out of the slip port.

SLIP support task

0 value SlipDevice      \ -- addr
You MUST define a REAL serial port device for SLIP.

: DoSlipPort    \ -- ; task action
The action of the slip tasks.

task SlipPortTask       \ -- addr
Slip port task.

: RunSlipTask   \ --
Run the SLIP port task. Changes will be necessary to support multiple SLIP devices. The technique used by the TELNET launcher is appropriate. See SERVICES\TELNET.FTH.