Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ protocol(3spp) — UMIPS/BSD System Programmer's Package 2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

protocol(5spp)

PROTOCOL(3spp)

NAME

protocol − serial line protocol routines

SYNOPSIS

#include <saio/protocol.h>
#include <saio/protoio.h>

void init_proto(fd)
pdev_t fd;

void proto_enable(fd)
pdev_t fd;

void proto_disable(fd)
pdev_t fd;

int len = getpkt(fd, buf, cnt, pkt_typep)
pdev_t fd;
char *buf;
unsigned cnt;
int *pkt_typep;

void putpkt(fd, buf, cnt, pkt_type)
pdev_t fd;
char *buf;
unsigned cnt;
int pkt_type;

DESCRIPTION

These routines implement the serial line protocol used by the debug monitor dbgmon(1spp), for remote debugging mode; and the prom monitor download command load(1spp).

Init_proto must be called to initiate the protocol sequence counters before any other protocol routines are invoked.  It should be invoked each time a protocol connection is attempted.  The argument fd should be the descriptor for the serial port that will be used for communication. 

Proto_enable must be called to configure the serial port indicated by fd for use by the protocol routines.  Proto_enable puts the line in "raw" mode and flushes any pending input and output on the serial port.  Fd should be the descriptor for the the serial port that will be used for communication. 

Proto_disable should be called after the protocol session is complete to restore the line to "cooked" mode.  Fd should be the descriptor for the the serial port that was used for communication. 

Getpkt blocks until it receives a properly sequenced and checksummed packet on the serial line indicated by fd. The packet will be returned in the buffer pointed to by buf. The buffer is assumed to be cnt bytes long.  If the received packet is longer than cnt bytes it is discarded.  Pkt_typep is a pointer to a integer variable that should be initialized to DATA_PKTTYPE.  Other values for pkt_typep are used internally by the protocol code.  Getpkt acknowledges the reception of the packet to its remote partner and returns the length of the packet. 

Putpkt transmits a packet on the descriptor fd and waits until the packet is acknowledged by its remote partner.  Putpkt will periodically retransmit the packet until the packet is acknowledged.  The packet to transmitted should be pointed to by the character pointer buf and be of length cnt bytes.  Pkt_type should be DATA_PKTTYPE. 

This code may with reasonable effort be incorporated into host system programs to act as the remote partner for the standalone code utilizing the protocol.  In order to accomplish this the macros defined in protoio.h must be altered to fit the host environment and timer support along the lines of set_timer(3spp) must be provided.

SEE ALSO

protocol(5spp)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026