Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ieee1284_wait_status(3) [debian man page]

IEEE1284_STATUS(3)						     Functions							IEEE1284_STATUS(3)

NAME
ieee1284_read_status, ieee1284_wait_status - analyse status lines SYNOPSIS
#include <ieee1284.h> int ieee1284_read_status(struct parport *port); int ieee1284_wait_status(struct parport *port, unsigned char mask, unsigned char val, struct timeval *timeout); DESCRIPTION
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: 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, }; These functions all act on the parallel port associated with port, which must be claimed. The purpose of ieee1284_wait_status is to wait until particular status lines have specified values. Its timeout parameter may be modified on return. RETURN VALUE
For ieee1284_read_status, the return value is a non-negative integer with bits set as appropriate representing the status lines. A negative result indicates an error. For ieee1284_wait_status, the return value is E1284_OK if the status lines now reflect the desired values (i.e. status & mask is val), or a negative result indicating an error. Possible error codes: E1284_NOTIMPL The port lacks the required capability. This could be due to a limitation of this version of libieee1284, or a hardware limitation. E1284_NOTAVAIL Access to the status lines is not available on this port type. E1284_TIMEDOUT The timeout has elapsed. E1284_INVALIDPORT The port parameter is invalid (for instance, perhaps the port is not claimed). NOTES
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 ieee1284_get_irq_fd. Under Linux, the conditions are that the parallel port driver knows which interrupt line to use and is using it, and that the relevant /dev/parport device node is accessible and backed by a device driver. AUTHOR
Tim Waugh <twaugh@redhat.com> Author. COPYRIGHT
Copyright (C) 2001-2003 Tim Waugh 09/18/2007 IEEE1284_STATUS(3)

Check Out this Related Man Page

IEEE1284_CONTROL(3)						     Functions						       IEEE1284_CONTROL(3)

NAME
ieee1284_read_control, ieee1284_write_control, ieee1284_frob_control, ieee1284_do_nack_handshake - manipulate control lines SYNOPSIS
#include <ieee1284.h> int ieee1284_read_control(struct parport *port); void ieee1284_write_control(struct parport *port, unsigned char ct); void ieee1284_frob_control(struct parport *port, unsigned char mask, unsigned char val); int ieee1284_do_nack_handshake(struct parport *port, unsigned char ct_before, unsigned char ct_after, struct timeval *timeout); DESCRIPTION
There are four control lines, three of which are usually inverted on PC-style ports. Where they differ, libieee1284 operates on the IEEE 1284 values, not the PC-style inverted values. The control lines are represented by the following enumeration: enum ieee1284_control_bits { C1284_NSTROBE = 0x01, C1284_NAUTOFD = 0x02, C1284_NINIT = 0x04, C1284_NSELECTIN = 0x08, /* To convert those values into PC-style register values, use this: */ C1284_INVERTED = (C1284_NSTROBE| C1284_NAUTOFD| C1284_NSELECTIN), }; These functions all act on the parallel port associated with port, which must be claimed. The current values on the control lines are available by calling ieee1284_read_control, and may be set by calling ieee1284_write_control. To adjust the values on a set of control lines, use ieee1284_frob_control. The effect of this can be expressed by: ctr = ((ctr & ~mask) ^ val); that is, the bits in mask are unset, and then those in val are inverted. The special function ieee1284_do_nack_handshake is for responding very quickly in a protocol where the peripheral sets nAck and the host must respond by setting a control line. Its operation, which relies on the host machine knowing which interrupt nAck generates, is as follows: 1. Set the control lines as indicated in ct_before. 2. Wait for nAck interrupt. If timeout elapses, return E1284_TIMEDOUT. 3. Set the control lines as indicated in ct_after. On Linux using the ppdev driver, this is performed by the device driver in the kernel, and so is faster than normally possible in a user-space library. RETURN VALUE
The return value of ieee1284_read_control, if non-negative, is a number representing the value on the control lines. Possible error codes for ieee1284_read_control: E1284_NOTAVAIL The control lines of this port are not accessible by the application. E1284_INVALIDPORT The port parameter is invalid (for instance, perhaps it is not claimed). Possible error codes for ieee1284_do_nack_handshake: E1284_OK The handshake was successful. E1284_NOTAVAIL This operation is not available on this port type or system. This could be because port interrupts are not available, or because the underlying device driver does not support the operation. E1284_INVALIDPORT The port parameter is invalid (for instance, perhaps it is not claimed). AUTHOR
Tim Waugh <twaugh@redhat.com> Author. COPYRIGHT
Copyright (C) 2001-2003 Tim Waugh 09/18/2007 IEEE1284_CONTROL(3)
Man Page