1bcdf3adeSMike Smith.\" Copyright (c) 1997 2bcdf3adeSMike Smith.\" Michael Smith 3bcdf3adeSMike Smith.\" 4bcdf3adeSMike Smith.\" Redistribution and use in source and binary forms, with or without 5bcdf3adeSMike Smith.\" modification, are permitted provided that the following conditions 6bcdf3adeSMike Smith.\" are met: 7bcdf3adeSMike Smith.\" 1. Redistributions of source code must retain the above copyright 8bcdf3adeSMike Smith.\" notice, this list of conditions and the following disclaimer as 9bcdf3adeSMike Smith.\" the first lines of this file unmodified. 10bcdf3adeSMike Smith.\" 2. Redistributions in binary form must reproduce the above copyright 11bcdf3adeSMike Smith.\" notice, this list of conditions and the following disclaimer in the 12bcdf3adeSMike Smith.\" documentation and/or other materials provided with the distribution. 13bcdf3adeSMike Smith.\" 14bcdf3adeSMike Smith.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' 15bcdf3adeSMike Smith.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16bcdf3adeSMike Smith.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17bcdf3adeSMike Smith.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 18bcdf3adeSMike Smith.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19bcdf3adeSMike Smith.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20bcdf3adeSMike Smith.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21bcdf3adeSMike Smith.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22bcdf3adeSMike Smith.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23bcdf3adeSMike Smith.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24bcdf3adeSMike Smith.\" POSSIBILITY OF SUCH DAMAGE. 25bcdf3adeSMike Smith.\" 26bcdf3adeSMike Smith.Dd January 2, 1998 27bcdf3adeSMike Smith.Dt PPI 4 283d45e180SRuslan Ermilov.Os 29bcdf3adeSMike Smith.Sh NAME 30bcdf3adeSMike Smith.Nm ppi 31eb083802SRuslan Ermilov.Nd "user-space interface to ppbus parallel 'geek' port" 32bcdf3adeSMike Smith.Sh SYNOPSIS 336b713d58SJeroen Ruigrok van der Werven.Cd "device ppi" 34726b61abSRuslan Ermilov.Pp 355203edcdSRuslan ErmilovMinor numbering: unit numbers correspond directly to ppbus numbers. 364ddb47c4SRuslan Ermilov.Pp 374ddb47c4SRuslan Ermilov.In dev/ppbus/ppi.h 384ddb47c4SRuslan Ermilov.In dev/ppbus/ppbconf.h 39bcdf3adeSMike Smith.Sh DESCRIPTION 40bcdf3adeSMike SmithThe 41bcdf3adeSMike Smith.Nm 42bcdf3adeSMike Smithdriver provides a convenient means for user applications to manipulate the 43bcdf3adeSMike Smithstate of the parallel port, enabling easy low-speed I/O operations without 44bcdf3adeSMike Smiththe security problems inherent with the use of the 45bcdf3adeSMike Smith.Pa /dev/io 46bcdf3adeSMike Smithinterface. 47bcdf3adeSMike Smith.Sh PROGRAMMING INTERFACE 48bcdf3adeSMike SmithAll I/O on the 49bcdf3adeSMike Smith.Nm 50bcdf3adeSMike Smithinterface is performed using 51bcdf3adeSMike Smith.Fn ioctl 52b5e7e999SRuslan Ermilovcalls. 53b5e7e999SRuslan ErmilovEach command takes a single 54*6b99842aSEd Schouten.Ft uint8_t 55b5e7e999SRuslan Ermilovargument, transferring one byte of data. 56b5e7e999SRuslan ErmilovThe following commands are available: 57d0353b83SRuslan Ermilov.Bl -tag -width indent 58d0353b83SRuslan Ermilov.It Dv PPIGDATA , PPISDATA 59bcdf3adeSMike SmithGet and set the contents of the data register. 60d0353b83SRuslan Ermilov.It Dv PPIGSTATUS , PPISSTATUS 61bcdf3adeSMike SmithGet and set the contents of the status register. 62d0353b83SRuslan Ermilov.It Dv PPIGCTRL , PPISCTRL 63bcdf3adeSMike SmithGet and set the contents of the control register. 64b5e7e999SRuslan ErmilovThe following defines correspond to bits in this register. 65b5e7e999SRuslan ErmilovSetting a bit in the control register drives the corresponding output low. 66d0353b83SRuslan Ermilov.Bl -tag -width indent -compact 67d0353b83SRuslan Ermilov.It Dv STROBE 68d0353b83SRuslan Ermilov.It Dv AUTOFEED 69d0353b83SRuslan Ermilov.It Dv nINIT 70d0353b83SRuslan Ermilov.It Dv SELECTIN 71d0353b83SRuslan Ermilov.It Dv PCD 72bcdf3adeSMike Smith.El 73d0353b83SRuslan Ermilov.It Dv PPIGEPP , PPISEPP 74bcdf3adeSMike SmithGet and set the contents of the EPP control register. 75d0353b83SRuslan Ermilov.It Dv PPIGECR , PPISECR 76bcdf3adeSMike SmithGet and set the contents of the ECP control register. 77d0353b83SRuslan Ermilov.It Dv PPIGFIFO , PPISFIFO 78bcdf3adeSMike SmithRead and write the ECP FIFO (8-bit operations only). 79bcdf3adeSMike Smith.El 80bcdf3adeSMike Smith.Sh EXAMPLES 81bcdf3adeSMike SmithTo present the value 0x5a to the data port, drive STROBE low and then high 82bcdf3adeSMike Smithagain, the following code fragment can be used: 83bcdf3adeSMike Smith.Bd -literal -compact 84bcdf3adeSMike Smith 85bcdf3adeSMike Smith int fd; 86*6b99842aSEd Schouten uint8_t val; 87bcdf3adeSMike Smith 88bcdf3adeSMike Smith val = 0x5a; 89bcdf3adeSMike Smith ioctl(fd, PPISDATA, &val); 90bcdf3adeSMike Smith ioctl(fd, PPIGCTRL, &val); 91bcdf3adeSMike Smith val |= STROBE; 92bcdf3adeSMike Smith ioctl(fd, PPISCTRL, &val); 93bcdf3adeSMike Smith val &= ~STROBE; 94bcdf3adeSMike Smith ioctl(fd, PPISCTRL, &val); 95bcdf3adeSMike Smith 96bcdf3adeSMike Smith.Ed 97bcdf3adeSMike Smith.Sh BUGS 98bcdf3adeSMike SmithThe inverse sense of signals is confusing. 99bcdf3adeSMike Smith.Pp 100bcdf3adeSMike SmithThe 101bcdf3adeSMike Smith.Fn ioctl 102bcdf3adeSMike Smithinterface is slow, and there is no way (yet) to chain multiple operations together. 103bcdf3adeSMike Smith.Pp 104bcdf3adeSMike SmithThe headers required for user applications are not installed as part of the 105bcdf3adeSMike Smithstandard system. 106