SLP(5spp) RISC/os Reference Manual SLP(5spp)
NAME
slp - serial line protocol
SYNOPSIS
#include <protocol.h>
#include <protoio.h>
DESCRIPTION
Slp is a protocol for reliably transmitting sequenced pack-
ets across serial connections. Slp is used to communicate
debugging requests between pdbx(1spp) and dbgmon(1spp), and
also to download images from tip(1) via the prom monitor and
standalone shell command load(1spp). Slp packets have the
following format:
struct slp_packet {
char syn; /* start of packet is ASCII SYN */
struct type_len { /* char indicating pkt type and len */
char unused:1, /* bit 7 ignored */
one:1, /* bit 6 must be 1 */
type:1, /* bit 5: 1 => data pkt, 0 => ack pkt */
lenhi:5; /* bits 4 - 0: bits 10 - 6 of data len */
};
struct len1 { /* char containing lsb of len */
char unused:1, /* bit 7 ignored */
one:1, /* bit 6 must be 1 */
lenlo:6; /* bits 5 - 0: bits 5 - 0 of data len */
};
struct seq { /* char with pkt sequence */
char unused:1, /* bit 7 ignored */
one:1, /* bit 6 must be 1 */
seq:6; /* bits 5 - 0: packet sequence number */
};
char data[len+extra_dle];/* data, length is len + extra DLE chars */
struct csum { /* 18 bit 2's cmpl csum, all but SYN and csum bytes */
char unused:1, /* bit 7 ignored */
one:1, /* bit 6 must be 1 */
csumhi:6; /* bits 5 - 0: bits 17 - 12 of csum */
char unused:1, /* bit 7 ignored */
one:1, /* bit 6 must be 1 */
csummid:6; /* bits 5 - 0: bits 11 - 6 of csum */
char unused:1, /* bit 7 ignored */
one:1, /* bit 6 must be 1 */
csumlo:6; /* bits 5 - 0: bits 5 - 0 of csum */
};
The fields of the slp packet of the following uses:
syn The first byte of an slp packet is always an ASCII SYN
(0x16) character. An ASCII SYN character never appears
elsewhere in a packet; should a SYN be present in the
data field, it is replaced with the two character
sequence:
Printed 1/6/92 Page 1
SLP(5spp) RISC/os Reference Manual SLP(5spp)
DLE S.
Whenever a receiver sees a SYN, it should assume it is
at the beginning of a new packet regardless of any pre-
vious state.
type_len
The second byte of a packet indicates whether the
packet is an acknowledgement of a previously received
packet or a new data packet. Acknowledge packets have
bit 5 of this byte equal to zero. An acknowledgement
packet is sent to indicate the reception of a data
packet. It may not carry data; acknowledge packets
must have a data length of zero indicated in the
type_len and len1 portions of a packet. The current
implementation of the protocol only allows a single
outstanding, unacknowledged packet. Data packets have
bit 5 of this byte equal to one. Data packets carry
data to be transmitted. The type_len byte carries the
five most significant bits of the data length for data
packets.
len1 The third byte of a packet carries the least signifi-
cant six bits of the data length. The data length
indicated by the concatenation of the type_len and len1
bytes is the original length of the data before any
data in the data field has been escaped with DLEs.
Lengths are restricted to be between 0 and 1023
inclusive.
seq The sequence field carries the data packet sequence
number for data packets; in acknowledge packets, the
sequence field contains the sequence number plus 1 of
the data packet being acknowledged. Data packets are
sequenced starting with zero. Sequence numbers wrap
from 63 back to zero. A data packet is acknowledged by
an acknowledge packet that carries the sequence number
that follows the sequence number in the data packet. A
data packet with a sequence field of 0 is acknowledged
by an acknowledge packet with a sequence field of 1;
data packet with a sequence of 63 is acknowledged by an
acknowledge packet with a sequence field of 0. The
sender of a packet should not transmit another packet
until the current packet has been acknowledged. The
sender of a packet should retransmit the packet if it
has not been acknowledged within REXMITTIME seconds
(currently 3 seconds). REXMIT_TIME starts after the
packet has been transmitted. Should a receiver receive
an obviously malformed packet, the receiver can immedi-
ately send an acknowledgement for the last correctly
received packet. This will cause the sender to immedi-
ately retransmit the packet without waiting for
Page 2 Printed 1/6/92
SLP(5spp) RISC/os Reference Manual SLP(5spp)
REXMITTIME.
data The data portion contains the data to be transmitted as
modified by any necessary DLE insertions. The follow-
ing characters are replaced by <DLE char> pairs:
SYN DLE S
DLE DLE D
CTL(C) DLE C
CTL(S) DLE s
CTL(Q) DLE q
Escaping CTL(S) and CTL(Q) allows these character to be
used for flow control if so desired. Escaping CTL(C)
allows CTL(C) to be used as a keyboard interrupt. The
data length transmitted in the length fields of a
packet are the length of the unescaped data.
csum The final three bytes of a packet are the 2's comple-
ment checksum of all bytes of the packet with the
exception of the initial SYN character and the three
checksum bytes. The checksum is formed by 2's comple-
ment addition of these bytes as unsigned characters to
form an 18 bit sum.
SEE ALSO
load(1spp), dbgmon(1spp), tip(1), rmtdbg(5spp)
Printed 1/6/92 Page 3