pltdata(3) CLIX pltdata(3)
NAME
plt_data, plt_data_nw - Writes data to the parallel port
LIBRARY
Intergraph Device Library (libix.a)
SYNOPSIS
#include <sys/types.h>
#include <sys/immu.h>
#include <sys/pop.h>
#include <sys/xio/xio.h>
#include <sys/xio/xerr.h>
int plt_data(
int interface ,
char *dbuf ,
int dcnt ,
int count ,
int ctrl ,
int timeout ,
int nctrl ,
int pulse ,
int speed );
int plt_data_nw(
int interface ,
char *dbuf ,
int dcnt ,
int count ,
int ctrl ,
int timeout ,
int nctrl ,
int pulse ,
int speed ,
struct xiosb *xiosb ,
int efn );
PARAMETERS
interface Represents an interface type. This value defines the signal
mapping for the target device, which must be one of the types
defined in <sys/pop.h>: CENTRONICS, VERSATEC, or
INTERGRAPH_DIFF.
2/94 - Intergraph Corporation 1
pltdata(3) CLIX pltdata(3)
dbuf Points to the data buffer.
dcnt Specifies the number of bytes transferred to the parallel
port.
count Specifies the number of bytes to transfer before a control
word is sent.
2 Intergraph Corporation - 2/94
pltdata(3) CLIX pltdata(3)
ctrl Specifies the 16-bit control word sent to the target device
after count bytes are sent. Bits 0-7 are data, and bits 8-15
correspond to the control mask:
______________________________________________________________
| 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 |
|_____|_______|_______|_______|_______|_______|_______|_______|
| NOT | RESET| RFFED| REOTR| RLTER| CLEAR| PICLK| PRINT|
| USED| H | H | H | H | H | H | H |
|_____|_______|_______|_______|_______|_______|_______|_______|
timeout Specifies the number of 1/60 second intervals to wait for the
device to become ready before aborting the request. This
value is limited to 32767.
nctrl Specifies the control word sent with each data byte
transferred from the data buffer. The format of nctrl is the
same as ctrl (shown in the figure above).
pulse Indicates whether bit 8 of the control mask (PRINT H) is
toggled as a control bit or interpreted as a data bit. If
pulse is nonzero, the bit is toggled as a control bit.
speed This parameter is not currently implemented.
xiosb Points to an xiosb structure updated upon completion of an
asynchronous request. The xfcnt member of the structure is
not used.
efn Specifies the event flag number associated with an
asynchronous request.
DESCRIPTION
The plt_data() function writes data to a target parallel device by means
of the parallel port. When the target becomes ready, a byte in the buffer
pointed to by dbuf is sent along with the control signals specified by
nctrl until dcnt bytes are sent. The ctrl parameter is sent to the target
device after each series of count bytes is sent. It is possible for the
target device to never become ready; thus, a timeout parameter is
provided. The pulse parameter indicates whether bit 8 (PRINT H) is
toggled as a control bit ot interpreted as a data bit.
The plt_data_nw() function is the asynchronous version of plt_data(),
providing the same capability without waiting for completion of the
request. The efn and xiosb parameters are necessary to support
asynchronous requests. (See intro(3) for information on asynchronous
requests.)
EXAMPLES
2/94 - Intergraph Corporation 3
pltdata(3) CLIX pltdata(3)
To write a 1K buffer to a Versatec-type device, strobing PICLK H with each
byte, and RLTER H after each series of 32 bytes:
void exit(), perror();
if (plt_data(VERSATEC, buf, 1024, 32, 0x800, 600, 0x200, 0, 0) !=NULL) {
perror("plt_data");
exit(2);
}
RETURN VALUES
Upon successful completion of the synchronous request, a value of 0 is
returned. If the request was not accepted by the XIO system, XIO_FAILURE
is returned. If the request was not accepted by the driver, either
XIO_DEVICE_FULL, BAD_DATA_BUFFER_ADDRESS, BAD-DATA_BUFFER_SIZE, or
PAGE_LOCK_FAILED is returned. Upon completion of the request, if the
target device did not accept all of the data, a negative status is
returned and bits 0-2 reflect the state of the status signals from the
target device.
If the asynchronous request is accepted by the XIO system, a value of 0 is
returned. Otherwise, XIO_FAILURE is returned. If the request completes
without error, the status member of the xiosb structure is set to 0. If
the driver did not accept the request, either XIO_DEVICE_FULL,
BAD_DATA_BUFFER_ADDRESS, BAD_DATA_BUFFER_SIZE, or PAGE_LOCK_FAILED is
returned in the status member. If the target device did not accept all of
the data, a negative status is returned in the status member and bits 0-2
reflect the state of the status signals from the target device.
ERRORS
The plt_data() and plt_data_nw() functions 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.
[XIO_DEVICE_FULL]
Another process is currently using the parallel port or the device
queue is full. The current limit of queue slots is 10.
[BAD_DATA_BUFFER_ADDRESS]
The data buffer points to a invalid memory address.
[BAD_DATA_BUFFER_SIZE]
The size of the data buffer is invalid.
[PAGE_LOCK_FAILED]
The request is larger than the current available physical memory.
4 Intergraph Corporation - 2/94
pltdata(3) CLIX pltdata(3)
The request should be broken up into smaller sizes.
[XIO_DEVICE_FULL]
The driver cannot accept any more requests until one completes.
The current limit is 5.
RELATED INFORMATION
Functions: plt_ctrl(3), intro(3)
Files: xplot(7)
2/94 - Intergraph Corporation 5