1IEEE1284_CONTROL(3)                Functions               IEEE1284_CONTROL(3)
2
3
4

NAME

6       ieee1284_read_control, ieee1284_write_control, ieee1284_frob_control,
7       ieee1284_do_nack_handshake - manipulate control lines
8

SYNOPSIS

10       #include <ieee1284.h>
11
12       int ieee1284_read_control(struct parport *port);
13
14       void ieee1284_write_control(struct parport *port, unsigned char ct);
15
16       void ieee1284_frob_control(struct parport *port, unsigned char mask,
17                                  unsigned char val);
18
19       int ieee1284_do_nack_handshake(struct parport *port,
20                                      unsigned char ct_before,
21                                      unsigned char ct_after,
22                                      struct timeval *timeout);
23

DESCRIPTION

25       There are four control lines, three of which are usually inverted on
26       PC-style ports. Where they differ, libieee1284 operates on the IEEE
27       1284 values, not the PC-style inverted values. The control lines are
28       represented by the following enumeration:
29
30           enum ieee1284_control_bits
31           {
32             C1284_NSTROBE   = 0x01,
33             C1284_NAUTOFD   = 0x02,
34             C1284_NINIT     = 0x04,
35             C1284_NSELECTIN = 0x08,
36             /* To convert those values into PC-style register values, use this: */
37             C1284_INVERTED = (C1284_NSTROBE|
38                               C1284_NAUTOFD|
39                               C1284_NSELECTIN),
40           };
41
42       These functions all act on the parallel port associated with port,
43       which must be claimed.
44
45       The current values on the control lines are available by calling
46       ieee1284_read_control, and may be set by calling
47       ieee1284_write_control.
48
49       To adjust the values on a set of control lines, use
50       ieee1284_frob_control. The effect of this can be expressed by: ctr =
51       ((ctr & ~mask) ^ val); that is, the bits in mask are unset, and then
52       those in val are inverted.
53
54       The special function ieee1284_do_nack_handshake is for responding very
55       quickly in a protocol where the peripheral sets nAck and the host must
56       respond by setting a control line. Its operation, which relies on the
57       host machine knowing which interrupt nAck generates, is as follows:
58
59        1. Set the control lines as indicated in ct_before.
60
61        2. Wait for nAck interrupt. If timeout elapses, return E1284_TIMEDOUT.
62
63        3. Set the control lines as indicated in ct_after.
64
65       On Linux using the ppdev driver, this is performed by the device driver
66       in the kernel, and so is faster than normally possible in a user-space
67       library.
68

RETURN VALUE

70       The return value of ieee1284_read_control, if non-negative, is a number
71       representing the value on the control lines.
72
73       Possible error codes for ieee1284_read_control:
74
75       E1284_NOTAVAIL
76           The control lines of this port are not accessible by the
77           application.
78
79       E1284_INVALIDPORT
80           The port parameter is invalid (for instance, perhaps it is not
81           claimed).
82
83       Possible error codes for ieee1284_do_nack_handshake:
84
85       E1284_OK
86           The handshake was successful.
87
88       E1284_NOTAVAIL
89           This operation is not available on this port type or system. This
90           could be because port interrupts are not available, or because the
91           underlying device driver does not support the operation.
92
93       E1284_INVALIDPORT
94           The port parameter is invalid (for instance, perhaps it is not
95           claimed).
96

AUTHOR

98       Tim Waugh <twaugh@redhat.com>
99           Author.
100
102       Copyright © 2001-2003 Tim Waugh
103
104
105
106[FIXME: source]                   07/20/2023               IEEE1284_CONTROL(3)
Impressum