Specifications

HighWire MTP-2 - 1.2, September 4, 2002 dprservice (7D) 99
7. Data Path Routing (DPR)
7-1. dprservice (7D)
The DPR service is a part of all protocol support packages for SBE's HighWire
boards. The host interface to the DPR service is implemented using the
streams putmsg(2) and getmsg(2) calls. Each exchange consists of first a
putmsg with the command in the structure sent as the control part of the
putmsg and a data buffer if required by the command. The response to the
command is received using a getmsg with control and data buffers large
enough to receive the response. The received control part has the same
command as was sent with a possible error code. Any parameters returned
will follow in the control buffer or in the data buffer as appropriate. The only
commands that use the data buffer are the read, write and print/report
commands; write on the putmsg call and the others on the getmsg call.
Although for every putmsg there will be a getmsg response, there is no
requirement that each putmsg be immediately followed by a getmsg, only that
there be one getmsg for each putmsg. That is, a whole sequence of putmsg
calls may be issued to set up the DPR followed by the getmsg calls to retrieve
their responses.
The DPR_ENABLE_CLKERR_CALLBACK command is special because it
enables the board to send unsolicited messages to the host program. The
host must have a task waiting to receive these messages with a getmsg at any
time and deal with them as appropriate. This may be accomplished with a
task hanging on getmsg or by setting the file descriptor to non-blocking and
call getmsg periodically in a loop.
The libdpr (3sbe) provides an alternate method to controlling the DPR service
using read-, write-, and ioctl-like functions. See Section 7-2, libdpr (3sbe).
Synopsis
#include "sbe_types.h"
#define __INCboardh /* prevent including the board.h file */
#include "dprd_if.h"
#include "sbe_lib.h"
#include "uppa.h"
#include <fcntl.h>
#include <sys/stropts.h>
int fildes;
struct strbuf prctl;
fildes = sbe_dataOpen (DPR_SERVICE, board, 0, oflags);
...
error = putmsg (fildes, &prctl, 0); /* if no data buffer to send */
error = getmsg (fildes, &prctl, 0); /* if no data buffer will be received */
cc -I/usr/include/sbe -lsbe -lsocket -lposix4 ...