slp − serial line protocol
is a protocol for reliably transmitting sequenced packets across serial connections. is used to communicate debugging requests between and and also to download images from via the prom monitor and standalone shell command 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 packet of the following uses: syn The first byte of an 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: DLE S. Whenever a receiver sees a SYN it should assume it is at the beginning of a new packet regardless of any previous 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 byte carries the 5 most significant bits of the data length for data packets. len1 The third byte of a packet carries the least significant 6 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 DLE’s. 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 seconds (currently 3 seconds). REXMIT_TIME starts after the packet has been transmitted. Should a receiver receive a obviously malformed packet, the receiver may immediately send an acknowledgement for the last correctly received packet. This will should cause the sender to immediate retransmit the packet without waiting for data The data portion contains the data desired to be transmitted as modified by any necessary DLE insertions. The following characters are replaced by <DLE char> pairs:
SYNDLE S
DLEDLE 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 two’s complement 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 complement addition of these bytes as unsigned characters to form an 18 bit sum. load(1spp), dbgmon(1spp), tip(1), rmtdbg(5spp)