1 '\" te 2 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved 3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. 4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. 5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] 6 .TH ECPP 7D "May 13, 2017" 7 .SH NAME 8 ecpp \- IEEE 1284 compliant parallel port driver 9 .SH SYNOPSIS 10 .LP 11 .nf 12 #include <sys/types.h> 13 .fi 14 15 .LP 16 .nf 17 #include <sys/ecppio.h> 18 .fi 19 20 .LP 21 .nf 22 ecpp@unit-address 23 .fi 24 25 .SH DESCRIPTION 26 .LP 27 The \fBecpp\fR driver provides a bi-directional interface to \fIIEEE 1284\fR 28 compliant devices as well as a forward single-directional interface to 29 Centronics devices. In addition to the Centronics protocol, the \fBecpp\fR 30 driver supports the \fIIEEE 1284\fRCompatibility, Nibble, and ECP protocols. 31 \fBECPP_COMPAT_MODE\fR and \fBECPP_CENTRONICS\fR modes of operation have 32 logically identical handshaking protocols, however devices that support 33 \fBECPP_COMPAT_MODE\fR are \fIIEEE 1284\fR compliant devices. \fIIEEE 1284\fR 34 compliant devices support at least \fBECPP_COMPAT_MODE\fR and 35 \fBECPP_NIBBLE_MODE\fR. Centronics devices support only \fBECPP_CENTRONICS\fR 36 mode. 37 .sp 38 .LP 39 By default, \fBECPP_COMPAT_MODE\fR devices have a strobe handshaking pulse 40 width of 500ns. For this mode, forward data transfers are conducted by DMA. By 41 default, the strobe pulse width for \fBECPP_CENTRONICS\fR devices is two 42 microseconds. Forward transfers for these devices are managed through PIO. The 43 default characteristics for both \fBECPP_COMPAT_MODE\fR and 44 \fBECPP_CENTRONICS\fR devices may be changed through tunable variables defined 45 in \fBecpp.conf\fR. 46 .sp 47 .LP 48 The \fBecpp\fR driver is an \fIexclusive-use\fR device, meaning that if the 49 device is already open, subsequent opens fail with \fBEBUSY\fR. 50 .SS "Default Operation" 51 .LP 52 Each time the \fBecpp\fR device is opened, the device is marked as \fBEBUSY\fR 53 and the configuration variables are set to their default values. The 54 \fBwrite_timeout\fR period is set to 90 seconds. 55 .sp 56 .LP 57 The driver sets the mode variable according to the following algorithm: The 58 driver initially attempts to negotiate the link into \fBECPP_ECP_MODE\fR during 59 \fBopen\fR(2). If it fails, the driver tries to negotiate into 60 \fBECPP_NIBBLE_MODE\fR mode. If that fails, the driver operates in 61 \fBECPP_CENTRONICS\fR mode. Upon successfully opening the device, \fIIEEE 62 1284\fR compliant devices will be left idle in either reverse idle phase of 63 \fBECPP_ECP_MODE\fR or in \fBECPP_NIBBLE_MODE\fR. Subsequent calls to 64 \fBwrite\fR(2) invokes the driver to move the link into either 65 \fBECPP_COMPAT_MODE\fR or the forward phase of \fBECPP_ECP_MODE\fR. After the 66 transfer completes, the link returns to idle state. 67 .sp 68 .LP 69 The application may attempt to negotiate the device into a specific mode or set 70 the \fBwrite_timeout\fR values through the \fBECPPIOC_SETPARMS\fR 71 \fBioctl\fR(2) call. For mode negotiation to be successful, both the host 72 workstation and the peripheral must support the requested mode. 73 .SS "Tunables" 74 .LP 75 Characteristics of the \fBecpp\fR driver may be tuned by the variables 76 described in \fB/kernel/drv/ecpp.conf\fR. These variables are read by the 77 kernel during system startup. To tune the variables, edit the \fBecpp.conf\fR 78 file and invoke \fBupdate_drv\fR(1M) to have the kernel read the file again. 79 .sp 80 .LP 81 Some Centronics peripherals and certain \fIIEEE 1284\fR compatible peripherals 82 will not operate with the parallel port operating in a fast handshaking mode. 83 If printing problems occur, set "fast-centronics" and "fast-1284-compatible" to 84 "false." See \fB/kernel/drv/ecpp.conf\fR for more information. 85 .SS "Read/Write Operation" 86 .LP 87 The \fBecpp\fR driver is a full duplex STREAMS device driver. While an 88 application is writing to an \fIIEEE 1284\fR compliant device, another thread 89 may read from it. 90 .SS "Write Operation" 91 .LP 92 A \fBwrite\fR(2) operation returns the number of bytes successfully written to 93 the stream head. If a failure occurs while a Centronics device is transferring 94 data, the content of the status bits will be captured at the time of the error 95 and can be retrieved by the application program using the \fBBPPIOC_GETERR\fR 96 \fBioctl\fR(2) call. The captured status information is overwritten each time 97 an attempted transfer or a \fBBPPIOC_TESTIO\fR \fBioctl\fR(2) occurs. 98 .SS "Read Operation" 99 .LP 100 If a failure or error condition occurs during a \fBread\fR(2), the number of 101 bytes successfully read is returned (short read). When attempting to read a 102 port that has no data currently available, \fBread\fR(2) returns \fB0\fR if 103 \fBO_NDELAY\fR is set. If \fBO_NONBLOCK\fR is set, \fBread\fR(2) returns 104 \fB-1\fR and sets errno to \fBEAGAIN.\fR If \fBO_NDELAY\fR and \fBO_NONBLOCK\fR 105 are clear, \fBread\fR(2) blocks until data become available. 106 .SH IOCTLS 107 .LP 108 The \fBioctl\fR(2) calls described below are supported. Note that when 109 \fBecpp\fR is transferring data, the driver waits until the data has been sent 110 to the device before processing the \fBioctl\fR(2) call. 111 .sp 112 .LP 113 The ecpp driver supports \fBprnio\fR(7I) interfaces. 114 .LP 115 Note - 116 .sp 117 .RS 2 118 The \fBPRNIOC_RESET\fR command toggles the \fBnInit\fR signal for 2 ms, 119 followed by default negotiation. 120 .RE 121 .sp 122 .LP 123 The following \fBioctl\fR(2) calls are supported for backward compatibility and 124 are not recommended for new applications: 125 .sp 126 .ne 2 127 .na 128 \fB\fBECPPIOC_GETPARMS\fR\fR 129 .ad 130 .RS 20n 131 Get current transfer parameters. The argument is a pointer to a struct 132 \fBecpp_transfer_parms\fR. See below for a description of the elements of this 133 structure. If no parameters have been configured since the device was opened, 134 the structure will be set to its default configuration. See Default Operation 135 above for more information. 136 .RE 137 138 .sp 139 .ne 2 140 .na 141 \fB\fBECPPIOC_SETPARMS\fR\fR 142 .ad 143 .RS 20n 144 Set transfer parameters. The argument is a pointer to a struct 145 \fBecpp_transfer_parms\fR. If a parameter is out of range, \fBEINVAL\fR is 146 returned. If the peripheral or host device cannot support the requested mode, 147 \fBEPROTONOSUPPORT\fR is returned. See below for a description of 148 \fBecpp_transfer_parms\fR and its valid parameters. 149 .sp 150 The Transfer Parameters Structure is defined in <\fBsys/ecppio.h\fR>. 151 .sp 152 .in +2 153 .nf 154 struct ecpp_transfer_parms { 155 int write_timeout; 156 int mode; 157 }; 158 .fi 159 .in -2 160 161 The \fBwrite_timeout\fR field is set to the value of 162 \fBecpp-transfer-timeout\fR specified in the \fBecpp.conf\fR. The 163 \fBwrite_timeout\fR field specifies how long the driver will wait for the 164 peripheral to respond to a transfer request. The value must be greater than 165 \fB0\fR and less than \fBECPP_MAX_TIMEOUT.\fR All other values are out of 166 range. 167 .sp 168 The mode field reflects the \fIIEEE 1284\fR mode to which the parallel port is 169 currently configured. The mode may be set to one of the following values only: 170 \fBECPP_CENTRONICS\fR, \fBECPP_COMPAT_MODE\fR, \fBECPP_NIBBLE_MODE\fR, 171 \fBECPP_ECP_MODE\fR. All other values are invalid. If the requested mode is not 172 supported, \fBECPPIOC_SETPARMS\fR will return \fBEPROTONOSUPPORT\fR and the 173 mode will be set to \fBECPP_CENTRONICS\fR mode. Afterwards, the application may 174 change the mode back to the original mode with \fBECPPIOC_SETPARMS\fR. 175 .RE 176 177 .sp 178 .ne 2 179 .na 180 \fB\fBECPPIOC_GETDEVID\fR\fR 181 .ad 182 .RS 20n 183 This ioctl gets the \fIIEEE 1284\fR device ID from the peripheral in specified 184 mode. Currently, the device ID can be retrieved only in Nibble mode. A pointer 185 to the structure defined in \fB<sys/ecppsys.h>\fR must be passed as an 186 argument. 187 .sp 188 The 1284 device ID structure: 189 .sp 190 .in +2 191 .nf 192 struct ecpp_device_id { 193 int mode; /* mode to use for reading device id */ 194 int len; /* length of buffer */ 195 int rlen; /* actual length of device id string */ 196 char *addr; /* buffer address */ 197 }; 198 .fi 199 .in -2 200 201 The mode is the \fIIEEE 1284\fR mode into which the port will be negotiated to 202 retrieve device ID information. If the peripheral or host do not support the 203 mode, \fBEPROTONOSUPPORT\fR is returned. Applications should set mode to 204 \fBECPP_NIBBLE_MODE\fR. \fBlen\fR is the length of the buffer pointed to by 205 \fBaddr\fR. \fBrlen\fR is the actual length of the device ID string returned 206 from the peripheral. If the returned \fBrlen\fR is greater than \fBlen\fR, the 207 application can call \fBECPPIOC_GETDEVID\fR again with a buffer length equal or 208 greater than \fBrlen\fR. Note that the two length bytes of the \fIIEEE 1284\fR 209 device ID are not taken into account and are not returned in the user buffer. 210 .sp 211 After \fBECPPIOC_GETDEVID\fR successfully completes, the driver returns the 212 link to \fBECPP_COMPAT_MODE\fR. The application is responsible for determining 213 the previous mode the link was operating in and returning the link to that 214 mode. 215 .RE 216 217 .sp 218 .ne 2 219 .na 220 \fB\fBBPPIOC_TESTIO\fR\fR 221 .ad 222 .RS 20n 223 Tests the forward transfer readiness of a peripheral operating in Centronics or 224 Compatibility mode. 225 .sp 226 \fBTESTIO\fR determines if the peripheral is ready to receive data by checking 227 the open flags and the Centronics status signals. If the current mode of the 228 device is \fBECPP_NIBBLE_MODE\fR, the driver negotiates the link into 229 \fBECPP_COMPAT_MODE\fR, check the status signals and then return the link to 230 \fBECPP_NIBBLE_MODE\fR mode. If the current mode is \fBECPP_CENTRONICS\fR or 231 \fBECPP_COMPAT_MODE\fR, \fBTESTIO\fR examines the Centronics status signals in 232 the current mode. To receive data, the device must have the \fBnErr\fR and 233 \fBSelect\fR signals asserted and must not have the \fBPE\fR and \fBBusy\fR 234 signals asserted. If \fBecpp\fR is transferring data, \fBTESTIO\fR waits until 235 the previous data sent to the driver is delivered before executing 236 \fBTESTIO\fR. However if an error condition occurs while a \fBTESTIO\fR is 237 waiting, \fBTESTIO\fR returns immediately. If \fBTESTIO\fR determines that the 238 conditions are ok, \fB0\fR is returned. Otherwise, \fB-1\fR is returned, errno 239 is set to \fBEIO\fR and the state of the status pins is captured. The captured 240 status can be retrieved using the \fBBPPIOC_GETERR\fR \fBioctl\fR(2) call. The 241 \fBtimeout_occurred\fR and \fBbus_error\fR fields will never be set by this 242 \fBioctl\fR(2). \fBBPPIOC_TESTIO\fR and \fBBPPIOC_GETERR\fR are compatible to 243 the ioctls specified in \fBbpp\fR(7D). 244 .RE 245 246 .sp 247 .ne 2 248 .na 249 \fB\fBBPPIOC_GETERR\fR\fR 250 .ad 251 .RS 20n 252 Get last error status. The argument is a pointer to a \fBstruct 253 bpp_error_status\fR defined in \fB<sys/bpp_io.h>\fR header file. The error 254 status structure is: 255 .sp 256 .in +2 257 .nf 258 struct bpp_error_status { 259 char timeout_occurred; /* 1=timeout */ 260 char bus_error; /* not used */ 261 uchar_t pin_status; /* status of pins which 262 /* could cause error */ 263 }; 264 .fi 265 .in -2 266 267 The pin_status field indicates possible error conditions. The valid bits for 268 pin_status are: \fBBPP_ERR_ERR\fR, \fBBPP_SLCT_ERR\fR, \fBBPP_PE_ERR\fR, 269 \fBBPP_BUSY_ERR\fR. A set bit indicates that the associated pin is asserted. 270 .sp 271 This structure indicates the status of all the appropriate status bits at the 272 time of the most recent error condition during a \fBwrite\fR(2) call, or the 273 status of the bits at the most recent \fBBPPIOC_TESTIO\fR \fBioctl\fR(2)call. 274 .sp 275 \fBpin_status\fR indicates possible error conditions under 276 \fBECPP_CENTRONICS\fR or \fBECPP_COMPAT_MODE\fR. Under these modes, the state 277 of the status pins will indicate the state of the device. For instance, many 278 Centronics printers lower the \fBnErr\fR signal when a paper jam occurs. The 279 behavior of the status pins depends on the device. Additional status 280 information may be retrieved through the backchannel. 281 .sp 282 The \fBtimeout_occurred\fR value is set when a timeout occurs during 283 \fBwrite\fR(2). \fBbus_error\fR is not used in this interface. 284 .RE 285 286 .sp 287 .LP 288 The following ioctls are used to directly read and write the parallel port 289 status and control signals. If the current mode of the device is 290 \fBECPP_ECP_MODE\fR or \fBECPP_NIBBLE_MODE\fR, the driver negotiates the link 291 into \fBECPP_COMPAT_MODE\fR, gets or sets the registers and then returns the 292 link to \fBECPP_NIBBLE_MODE\fR. If the current mode is \fBECPP_CENTRONICS\fR or 293 \fBECPP_COMPAT_MODE\fR, these ioctls will get/set the register values in the 294 current mode. 295 .sp 296 .ne 2 297 .na 298 \fB\fBECPPIOC_GETREGS\fR\fR 299 .ad 300 .RS 19n 301 Read register values. The argument is a pointer to a \fBstruct ecpp_regs\fR. 302 See below for a description of this structure. 303 .RE 304 305 .sp 306 .ne 2 307 .na 308 \fB\fBECPPIOC_SETREGS\fR\fR 309 .ad 310 .RS 19n 311 Set \fBecpp\fR register values. The argument is a pointer to a \fBstruct 312 ecpp_regs\fR. See below for a description of this structure. If a parameter is 313 out of range, \fBEINVAL\fR is returned. 314 .sp 315 The Port Register Structure is defined in <\fBsys/ecppio.h\fR>. 316 .sp 317 .in +2 318 .nf 319 struct ecpp_regs { 320 uchar dsr; /* status reg */ 321 u_char dcr; /* control reg */ 322 }; 323 .fi 324 .in -2 325 326 The status register is read-only. The \fBECPPIOC_SETREGS\fR ioctl has no affect 327 on this register. Valid bit values for dsr are: \fBECPP_nERR\fR, 328 \fBECPP_SLCT\fR, \fBECPP_PE\fR, \fBECPP_nACK\fR, \fBECPP_nBUSY\fR. All other 329 bits are reserved and always return \fB1\fR. 330 .sp 331 The control register is read/write. Valid bit values for dcr are: 332 \fBECPP_STB\fR, \fBECPP_AFX\fR, \fBECPP_nINIT\fR, \fBECPP_SLCTIN\fR. All other 333 bits are reserved. Reading reserved bits always return 1. An attempt to write 334 0s into these bits results in \fBEINVAL\fR. 335 .RE 336 337 .SH DEVICE SPECIAL FILES 338 .ne 2 339 .na 340 \fB\fB/dev/lp\fIN\fR\fR\fR 341 .ad 342 .RS 19n 343 Solaris x86 only. (Backwards compatibility with former \fBlp\fR(7D) devices.) 344 .RE 345 346 .sp 347 .ne 2 348 .na 349 \fB\fB/dev/printers/\fIN\fR\fR\fR 350 .ad 351 .RS 19n 352 1284 compliant parallel port device special files appears in both namespaces. 353 .RE 354 355 .SH FILES 356 .ne 2 357 .na 358 \fB\fBkernel/drv/ecpp\fR\fR 359 .ad 360 .sp .6 361 .RS 4n 362 32-bit ELF kernel module 363 .RE 364 365 .sp 366 .ne 2 367 .na 368 \fB\fBkernel/drv/sparcv9/ecpp\fR\fR 369 .ad 370 .sp .6 371 .RS 4n 372 64-bit SPARC ELF kernel module 373 .RE 374 375 .sp 376 .ne 2 377 .na 378 \fB\fBkernel/drv/amd64/ecpp\fR\fR 379 .ad 380 .sp .6 381 .RS 4n 382 64-bit x86 ELF kernel module 383 .RE 384 385 .sp 386 .ne 2 387 .na 388 \fB\fBkernel/drv/ecpp.conf\fR\fR 389 .ad 390 .sp .6 391 .RS 4n 392 driver configuration file 393 .RE 394 395 .sp 396 .ne 2 397 .na 398 \fB\fBkernel/drv/sparcv9/ecpp.conf\fR\fR 399 .ad 400 .sp .6 401 .RS 4n 402 driver configuration file for 64-bit SPARC 403 .RE 404 405 .sp 406 .ne 2 407 .na 408 \fB\fBkernel/drv/amd64/ecpp.conf\fR\fR 409 .ad 410 .sp .6 411 .RS 4n 412 driver configuration file for 64-bit x86 413 .RE 414 415 .SH ERRORS 416 .ne 2 417 .na 418 \fB\fBEBADF\fR\fR 419 .ad 420 .RS 10n 421 The device is opened for write-only access and a read is attempted, or the 422 device is opened for read-only access and a write is attempted. 423 .RE 424 425 .sp 426 .ne 2 427 .na 428 \fB\fBEBUSY\fR\fR 429 .ad 430 .RS 10n 431 The device has been opened and another open is attempted. An attempt has been 432 made to unload the driver while one of the units is open. 433 .RE 434 435 .sp 436 .ne 2 437 .na 438 \fB\fBEINVAL\fR\fR 439 .ad 440 .RS 10n 441 A \fBECPPIOC_SETPARMS\fR \fBioctl()\fR is attempted with an out-of-range value 442 in the \fBecpp_transfer_parms\fR structure. A \fBECPPIOC_SETREGS\fR 443 \fBioctl()\fR is attempted with an invalid value in the \fBecpp_regs\fR 444 structure. An \fBioctl()\fR is attempted with an invalid value in the command 445 argument.An invalid command argument is received during \fBmodload\fR(1M) or 446 \fBmodunload\fR(1M). 447 .RE 448 449 .sp 450 .ne 2 451 .na 452 \fB\fBEIO\fR\fR 453 .ad 454 .RS 10n 455 The driver encountered a bus error when attempting an access. A read or write 456 did not complete properly, due to a peripheral error or a transfer timeout. 457 .RE 458 459 .sp 460 .ne 2 461 .na 462 \fB\fBENXIO\fR\fR 463 .ad 464 .RS 10n 465 The driver has received an open request for a unit for which the attach failed. 466 The driver has received a write request for a unit which has an active 467 peripheral error. 468 .RE 469 470 .SH ATTRIBUTES 471 .LP 472 See \fBattributes\fR(5) for descriptions of the following attributes: 473 .sp 474 475 .sp 476 .TS 477 box; 478 c | c 479 l | l . 480 ATTRIBUTE TYPE ATTRIBUTE VALUE 481 _ 482 Architecture PCI-based systems 483 _ 484 ISA-based systems (x86) 485 _ 486 Interface stability Evolving 487 .TE 488 489 .SH SEE ALSO 490 .LP 491 \fBmodload\fR(1M), \fBmodunload\fR(1M), \fBupdate_drv\fR(1M), \fBioctl\fR(2), 492 \fBopen\fR(2), \fBread\fR(2), \fBwrite\fR(2), \fBattributes\fR(5), 493 \fBbpp\fR(7D), \fBusbprn\fR(7D), \fBprnio\fR(7I), \fBstreamio\fR(7I) 494 .sp 495 .LP 496 \fIIEEE Std 1284-1994\fR 497 .SH DIAGNOSTICS 498 .ne 2 499 .na 500 \fBParallel port controller not supported\fR 501 .ad 502 .sp .6 503 .RS 4n 504 Driver does not support parallel port controller on the given host. Attach 505 failed. 506 .RE 507