gpib_write(3) CLIX gpib_write(3)
NAME
gpib_write, gpib_write_nw - Writes data to a General Purpose Interface Bus
(GPIB) device
LIBRARY
Intergraph Device Library (libix.a)
SYNOPSIS
#include <sys/xio/xio.h>
#include <sys/xio/xerr.h>
int gpib_write(
int channel ,
char *ldev ,
int lcnt ,
char *dbuf ,
int dcnt ,
int timeout ,
char *eoi ,
int *xfcnt );
int gpib_write_nw(
int channel ,
char *ldev ,
int lcnt ,
char *dbuf ,
int dcnt ,
int timeout ,
char *eoi ,
struct xiosb *xiosb ,
int efn );
PARAMETERS
channel An integer representing a GPIB channel
ldev A pointer to an array of primary GPIB devices
lcnt The number of addresses in ldev
dbuf A pointer to the buffer to be transferred
dcnt The size of the buffer to be transferred
timeout The number of 1/60 second intervals before a GPIB request is
aborted
2/94 - Intergraph Corporation 1
gpib_write(3) CLIX gpib_write(3)
eoi The GPIB End Or Identify flag
xfcnt The number of bytes transferred
xiosb A pointer to an xiosb
efn The event number associated with the transfer request
DESCRIPTION
The gpib_write() function writes data to the General Purpose Interface Bus
(GPIB) device on channel. The ldev parameter points to an array of
primary addresses corresponding to the GPIB devices to receive data.
The dbuf parameter is a pointer to the buffer to be transferred. The size
of the buffer is specified (in bytes) by dcnt.
The lcnt parameter reflects the number of devices to be initialized as
listeners before the data transfer begins. A value of 0 indicates the
GPIB devices have already been addressed to listen by a previous
gpib_write(). In this case, the write proceeds without device
initialization.
If an abort timeout is desired, timeout contains the number of 1/60 second
intervals the driver waits before aborting the request. A value of 0
disables the timeout mechanism.
If the value pointed to by eoi is nonzero, the GPIB End Or Identify (EOI)
signal is asserted during the transfer of the last data byte in the
buffer.
Upon completion of the synchronous request, the integer pointed to by
xfcnt contains the number of bytes transferred from dbuf.
The gpib_write_nw() function is the asynchronous version of gpib_write(),
providing the same capability without waiting for completion of the
request. The efn parameter is the event flag number associated with the
request. The xiosb parameter is a pointer to the xiosb structure updated
upon completion of the request (see intro(3)). The xfcnt member of the
xiosb structure indicates the number of bytes transferred from dbuf.
If a primary address is specified, the controller is put in an active
state, and the following GPIB messages are sent over the specified
channel:
UNL Unlisten
UNT Untalk
TAG Talk Address Group
2 Intergraph Corporation - 2/94
gpib_write(3) CLIX gpib_write(3)
MLA My Listen Address
The system controller is forced to the standby state, and data is written
to channel until dcnt bytes are transferred. If primary addresses are not
specified, the system controller is simply put in a standby state, and the
write proceeds as described.
RETURN VALUES
Upon successful completion of the synchronous request, a value of 0 is
returned. Otherwise, one of the following failure codes is returned.
If the asynchronous request is accepted by the XIO system, a value of 0
will be returned by the request. Otherwise, XIO_FAILURE will be returned.
Upon completion of an accepted request, the status member of the xiosb
structure will be set to either 0 if successful, or to one of the
following failure codes if unsuccessful.
ERRORS
The gpib_write() and gpib_write_nw() functions will fail if one of the
following is true:
[XIO_FAILURE]
The system does not contain the driver needed to support this
request or efn is invalid.
[GPIB_OUT_OF_RANGE]
The specified channel is beyond the maximum allowed.
[GPIB_NOT_OPEN]
The specified channel is not open.
[GPIB_NOT_OWNER]
Channel is currently open by another process.
[GPIB_CANCELED]
The current request was canceled by gpib_cancel().
[GPIB_DEVICE_INVALID]
A specified device's primary address was not correct.
[GPIB_TIMEOUT]
A timeout occurred before the request completed.
[GPIB_HARDWARE_CHECK]
A hardware error was detected during the request.
[BAD_DATA_BUFFER_ADDRESS]
Either eoi, xfcnt, tdev, or dbuf points to an invalid memory
address.
2/94 - Intergraph Corporation 3
gpib_write(3) CLIX gpib_write(3)
[BAD_DATA_BUFFER_SIZE]
Either the data transfer size dcnt or the device count lcnt is too
large.
RELATED INFORMATION
Functions: gpib_open(3), gpib_cmd(3), gpib_cancel(3), intro(3)
Files: xgpib(7)
4 Intergraph Corporation - 2/94