.\"Generated by db2man.xsl. Don't modify this, modify the source.
.de Sh \" Subsection
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Ip \" List item
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.TH "IEEE1284_STATUS" 3 "" "" ""
.SH NAME
ieee1284_read_status, ieee1284_wait_status \- analyse status lines
.SH "SYNOPSIS"
.ad l
.hy 0

#include <ieee1284\&.h>
.sp
.HP 26
int\ \fBieee1284_read_status\fR\ (struct\ parport\ *\fIport\fR);
.HP 26
int\ \fBieee1284_wait_status\fR\ (struct\ parport\ *\fIport\fR, unsigned\ char\ \fImask\fR, unsigned\ char\ \fIval\fR, struct\ timeval\ *\fItimeout\fR);
.ad
.hy

.SH "DESCRIPTION"

.PP
There are five status lines, one of which is usually inverted on PC\-style ports\&. Where they differ, libieee1284 operates on the IEEE 1284 values, not the PC\-style inverted values\&. The status lines are represented by the following enumeration:

.nf
enum ieee1284_status_bits
{
  S1284_NFAULT = 0x08,
  S1284_SELECT = 0x10,
  S1284_PERROR = 0x20,
  S1284_NACK   = 0x40,
  S1284_BUSY   = 0x80,
  /* To convert those values into PC\-style register values, use this: */
  S1284_INVERTED = S1284_BUSY,
};
.fi

.PP
These functions all act on the parallel port associated with \fIport\fR, which must be claimed\&.

.PP
The purpose of \fBieee1284_wait_status\fR is to wait until particular status lines have specified values\&. Its \fItimeout\fR parameter may be modified on return\&.

.SH "RETURN VALUE"

.PP
For \fBieee1284_read_status\fR, the return value is a non\-negative integer with bits set as appropriate representing the status lines\&. A negative result indicates an error\&.

.PP
For \fBieee1284_wait_status\fR, the return value is \fBE1284_OK\fR if the status lines now reflect the desired values (i\&.e\&. status & \fImask\fR is \fIval\fR), or a negative result indicating an error\&.

.PP
Possible error codes:

.TP
\fBE1284_NOTIMPL\fR
The \fIport\fR lacks the required capability\&. This could be due to a limitation of this version of libieee1284, or a hardware limitation\&.

.TP
\fBE1284_NOTAVAIL\fR
Access to the status lines is not available on this port type\&.

.TP
\fBE1284_TIMEDOUT\fR
The \fItimeout\fR has elapsed\&.

.TP
\fBE1284_INVALIDPORT\fR
The \fIport\fR parameter is invalid (for instance, perhaps the \fIport\fR is not claimed)\&.

.SH "NOTES"

.PP
The nAck pin is often able to trigger interrupts on the host machine\&. With operating system help these interrupts may be visible to the application via the file descriptor returned by \fBieee1284_get_irq_fd\fR\&.

.PP
Under Linux, the conditions are that the parallel port driver knows which interrupt line to use and is using it, and that the relevant \fI/dev/parport\fR device node is accessible and backed by a device driver\&.

.SH AUTHOR
Tim Waugh <twaugh@redhat\&.com>.
