PROTOCOL(3spp) RISC/os Reference Manual 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 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 file 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 file 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 file descriptor for the the serial port that was used
for communication.
Printed 1/6/92 Page 1
PROTOCOL(3spp) RISC/os Reference Manual PROTOCOL(3spp)
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 initial-
ized 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 file 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 be
transmitted should be pointed to by the character pointer
buf and be of length cnt bytes. Pkt_type should be
DATA_PKTTYPE.
This code can, 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 accom-
plish 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)
Page 2 Printed 1/6/92