1bpp(7D)                             Devices                            bpp(7D)
2
3
4

NAME

6       bpp - bi-directional parallel port driver
7

SYNOPSIS

9       SUNW,bpp@slot,offset:bppn
10
11

DESCRIPTION

13       The  bpp  driver provides a general-purpose bi-directional interface to
14       parallel devices. It supports a variety of output (printer)  and  input
15       (scanner)  devices, using programmable timing relationships between the
16       various handshake signals.
17

APPLICATION PROGRAMMING INTERFACE

19       The bpp driver is an  exclusive-use device. If the device  has  already
20       been opened, subsequent opens fail with  EBUSY.
21
22   Default Operation
23       Each  time  the   bpp  device  is  opened, the default configuration is
24       BPP_ACK_BUSY_HS for read handshake, BPP_ACK_HS for write  handshake,  1
25       microsecond  for  all setup times and strobe widths, and 60 seconds for
26       both timeouts. This configuration (in the write mode) drives many  com‐
27       mon  personal  computer  parallel  printers with Centronics-type inter‐
28       faces. The application should use the  BPPIOC_SETPARMS ioctl request to
29       configure  the bpp for the particular device which is attached, if nec‐
30       essary.
31
32   Write Operation
33       If a failure or error condition occurs during a write(2), the number of
34       bytes  successfully  written is returned (short write). Note that errno
35       will not be set. The contents of certain status bits will  be  captured
36       at  the time of the error, and can be retrieved by the application pro‐
37       gram, using the BPPIOC_GETERR ioctl request. Subsequent write(2)  calls
38       may  fail  with  the  system error  ENXIO if the error condition is not
39       rectified. The captured status information  will  be  overwritten  each
40       time an attempted transfer or a BPPIOC_TESTIO ioctl request occurs.
41
42   Read Operations
43       If  a failure or error condition occurs during a read(2), the number of
44       bytes successfully read is returned (short read). Note that errno  will
45       not be set. The contents of certain status bits will be captured at the
46       time of the error, and can be retrieved by the application,  using  the
47       BPPIOC_GETERR  ioctl  request.  Subsequent  read(2) calls may fail with
48       ENXIO if the error condition is not rectified.  The  captured  register
49       information  will  be  overwritten each time an attempted transfer or a
50       BPPIOC_TESTIO ioctl request.
51
52
53       If the  read_handshake element  of  the   bpp_transfer_parms  structure
54       (see  below)  is  set  to BPP_CLEAR_MEM or BPP_SET_MEM, zeroes or ones,
55       respectively, are written into the user buffer.
56
57   Read/Write Operation
58       When the driver is opened for reading and writing, it is  assumed  that
59       scanning will take place, as scanners are the only devices supported by
60       this mode. Most scanners require that the  SLCT_IN or AFX pin be set to
61       tell  the  scanner  the direction of the transfer. The  AFX line is set
62       when the  read_handshake element of the bpp_transfer_parms structure is
63       set  to BPP_HSCAN_HS, otherwise the SLCT_IN pin is set. Normally, scan‐
64       ning starts by writing a command to the scanner, at which time the  pin
65       is set.  When the scan data is read back, the pin is reset.
66

IOCTLS

68       The following  ioctl requests are supported:
69
70       BPPIOC_SETPARMS      Set transfer parameters.
71
72                            The argument is a pointer to a  bpp_transfer_parms
73                            structure. See below for a description of the ele‐
74                            ments  of this structure. If a parameter is out of
75                            range, EINVAL is returned.
76
77
78       BPPIOC_GETPARMS      Get current transfer parameters.
79
80                            The argument is a pointer to a  bpp_transfer_parms
81                            structure. See below for a description of the ele‐
82                            ments of this structure.  If  no  parameters  have
83                            been  configured  since the device was opened, the
84                            contents of the structure will be the default con‐
85                            ditions  of  the parameters (see Default Operation
86                            above).
87
88
89       BPPIOC_SETOUTPINS    Set output pin values.
90
91                            The argument is a pointer to  a   bpp_pins  struc‐
92                            ture.  See below for a description of the elements
93                            of this structure. If a parameter is out of range,
94                            EINVAL is returned.
95
96
97       BPPIOC_GETOUTPINS    Read  output pin values. The argument is a pointer
98                            to a  bpp_pins structure. See below for a descrip‐
99                            tion of the elements of this structure.
100
101
102       BPPIOC_GETERR        Get last error status.
103
104                            The  argument  is  a pointer to a bpp_error_status
105                            structure. See below for a description of the ele‐
106                            ments  of this structure. This structure indicates
107                            the status of all the appropriate  status bits  at
108                            the time of the most recent error condition during
109                            a read(2) or write(2) call, or the status  of  the
110                            bits  at  the  most  recent   BPPIOC_TESTIO  ioctl
111                            request. Note:  The bits in the   pin_status  ele‐
112                            ment   indicate  whether  the  associated  pin  is
113                            active, not the actual polarity.  The  application
114                            can  check  transfer  readiness without attempting
115                            another transfer using the   BPPIOC_TESTIO  ioctl.
116                            Note:   The  timeout_occurred and bus_error fields
117                            will never be set  by  the   BPPIOC_TESTIO  ioctl,
118                            only by an actual failed transfer.
119
120
121       BPPIOC_TESTIO        Test transfer readiness.
122
123                            This  command  checks  to  see  if a read or write
124                            transfer would succeed based on pin status, opened
125                            mode, and handshake selected. If a handshake would
126                            succeed,  0 is returned. If a transfer would fail,
127                            -1  is  returned, and errno is set to EIO, and the
128                            error status information is captured. The captured
129                            status  can  be  retrieved using the BPPIOC_GETERR
130                            ioctl call.  Note that  the  timeout_occurred  and
131                            bus_error fields will never be set by this ioctl.
132
133
134   Transfer Parameters Structure
135       This structure is defined in  <sys/bpp_io.h>.
136
137         struct bpp_transfer_parms {
138             enum  handshake_t
139                  read_handshake;      /* parallel port read handshake mode */
140             int  read_setup_time;    /* DSS register - in nanoseconds */
141             int  read_strobe_width;  /* DSW register - in nanoseconds */
142             int  read_timeout;       /*
143                                       * wait this many seconds
144                                       * before aborting a transfer
145                                      */
146             enum  handshake_t
147                  write_handshake;      /* parallel port write handshake mode */
148             int  write_setup_time;    /* DSS register - in nanoseconds */
149             int  write_strobe_width;  /* DSW register - in nanoseconds */
150             int  write_timeout;       /*
151                                        * wait this many seconds
152                                        * before aborting a transfer
153                                       */
154         };
155         /* Values for read_handshake and write_handshake fields */
156             enum  handshake_t {
157                 BPP_NO_HS,            /* no handshake pins */
158                 BPP_ACK_HS,           /* handshake controlled by ACK line */
159                 BPP_BUSY_HS,          /* handshake controlled by BSY line */
160                 BPP_ACK_BUSY_HS,      /*
161                                        * handshake controlled by ACK and BSY lines
162                                        * read_handshake only!
163                                       */
164                 BPP_XSCAN_HS,         /* xerox scanner mode,
165                                        * read_handshake only!
166                                           */
167                 BPP_HSCAN_HS,         /*
168                                        * HP scanjet scanner mode
169                                        * read_handshake only!
170                                       */
171                 BPP_CLEAR_MEM,        /* write 0's to memory,
172                                        * read_handshake only!
173                                       */
174                 BPP_SET_MEM,          /* write 1's to memory,
175                                        * read_handshake only!
176                                       */
177              /* The following handshakes are RESERVED. Do not use. */
178                 BPP_VPRINT_HS,        /* valid only in read/write mode */
179                 BPP_VPLOT_HS          /* valid only in read/write mode */
180         };
181
182
183
184       The  read_setup_time field controls the time between dstrb falling edge
185       to bsy rising edge if the  read_handshake field is set to BPP_NO_HS  or
186       BPP_ACK_HS. It controls the time between dstrb falling edge to ack ris‐
187       ing  edge  if  the  read_handshake  field  is  set  to   BPP_ACK_HS  or
188       BPP_ACK_BUSY_HS. It controls the time between ack falling edge to dstrb
189       rising edge if the read_handshake field is set to BPP_XSCAN_HS.
190
191
192       The  read_strobe_width field controls the time between ack rising  edge
193       and ack falling edge if the read_handshake field is set to BPP_NO_HS or
194       BPP_ACK_BUSY_HS. It controls the time  between  dstrb  rising  edge  to
195       dstrb falling edge if the read_handshake field is set to  BPP_XSCAN_HS.
196
197
198       The  values allowed for the write_handshake field are duplicates of the
199       definitions for the read_handshake field. Note that some of these hand‐
200       shake definitions are only valid in one mode or the other.
201
202
203       The   write_setup_time  field  controls  the time between data valid to
204       dstrb rising edge for all values of the  write_handshake field.
205
206
207       The  write_strobe_width field controls the time  between  dstrb  rising
208       edge  and dstrb falling edge if the write_handshake field is not set to
209       BPP_VPRINT_HS or BPP_VPLOT_HS. It controls  the  minimum  time  between
210       dstrb rising edge to dstrb falling edge if the write_handshake field is
211       set to  BPP_VPRINT_HS or BPP_VPLOT_HS.
212
213   Transfer Pins Structure
214       This structure is defined in <sys/bpp_io.h>.
215
216         struct  bpp_pins {
217             uchar_t  output_reg_pins;  /* pins in P_OR register */
218             uchar_t  input_reg_pins;   /* pins in P_IR register */
219         };
220
221         /* Values for output_reg_pins field */
222         #define BPP_SLCTIN_PIN  0x01  /* Select in pin */
223         #define BPP_AFX_PIN     0x02  /* Auto feed pin */
224         #define BPP_INIT_PIN    0x04  /* Initialize pin */
225         #define BPP_V1_PIN      0x08  /* reserved pin 1 */
226         #define BPP_V2_PI       0x10  /* reserved pin 2 */
227         #define BPP_V3_PIN      0x20  /* reserved pin 3 */
228         #define BPP_ERR_PIN     0x01  /* Error pin */
229         #define BPP_SLCT_PIN    0x02  /* Select pin */
230         #define BPP_PE_PIN      0x04  /* Paper empty pin */
231
232
233   Error Pins Structure
234       This structure is defined in the include file <sys/bpp_io.h>.
235
236         struct bpp_error_status {
237              char timeout_occurred;   /* 1 if a timeout occurred */
238              char bus_error;     /* 1 if an SBus bus error */
239              uchar_t pin_status; /*
240                         * status of pins which could
241                         * cause an error
242                         */
243         };
244         /* Values for pin_status field */
245         #define BPP_ERR_ERR    0x01   /* Error pin active */
246         #define BPP_SLCT_ERR   0x02   /* Select pin active */
247         #define BPP_PE_ERR     0x04   /* Paper empty pin active */
248         #define BPP_SLCTIN_ERR 0x10   /* Select in pin active  */
249         #define BPP_BUSY_ERR   0x40   /* Busy pin active */
250
251

ERRORS

253       EBADF     The device is opened for write-only  access  and  a  read  is
254                 attempted, or the device is opened for read-only access and a
255                 write is attempted.
256
257
258       EBUSY     The device has been opened and another open is attempted.  An
259                 attempt  has  been made to unload the driver while one of the
260                 units is open.
261
262
263       EINVAL    A BPPIOC_SETPARMS ioctl is attempted with  an  out  of  range
264                 value  in the bpp_transfer_parms structure. A  BPPIOC_SETOUT‐
265                 PINS ioctl is attempted with an invalid  value  in  the  pins
266                 structure.  An   ioctl  is attempted with an invalid value in
267                 the command argument. An invalid command argument is received
268                 during modload(1M) or modunload(1M).
269
270
271       EIO       The  driver  encountered an SBus bus error when attempting an
272                 access.
273
274                 A read or write does not complete properly, due to a  periph‐
275                 eral error or a transfer timeout.
276
277                 A  BPPIOC_TESTIO  ioctl  call  is attempted while a condition
278                 exists which would prevent a transfer (such as  a  peripheral
279                 error).
280
281
282       ENXIO     The driver has received an open request for a  unit for which
283                 the attach failed. The driver has received a  read  or  write
284                 request  for  a  unit number greater than the number of units
285                 available. The driver has received a write request for a unit
286                 which has an active peripheral error.
287
288

FILES

290       /dev/bppn    bi-directional parallel port devices
291
292

SEE ALSO

294       ioctl(2), read(2), write(2), sbus(4)
295
296
297
298SunOS 5.11                        22 Aug 1994                          bpp(7D)
Impressum