1085a2b40SWarner Losh.\" Copyright (c) 2000-2002 2085a2b40SWarner Losh.\" Diomidis D. Spinellis, Athens, Greece 3085a2b40SWarner Losh.\" All rights reserved. 4085a2b40SWarner Losh.\" 5085a2b40SWarner Losh.\" Redistribution and use in source and binary forms, with or without 6085a2b40SWarner Losh.\" modification, are permitted provided that the following conditions 7085a2b40SWarner Losh.\" are met: 8085a2b40SWarner Losh.\" 1. Redistributions of source code must retain the above copyright 9085a2b40SWarner Losh.\" notice, this list of conditions and the following disclaimer as 10085a2b40SWarner Losh.\" the first lines of this file unmodified. 11085a2b40SWarner Losh.\" 2. Redistributions in binary form must reproduce the above copyright 12085a2b40SWarner Losh.\" notice, this list of conditions and the following disclaimer in the 13085a2b40SWarner Losh.\" documentation and/or other materials provided with the distribution. 14085a2b40SWarner Losh.\" 15085a2b40SWarner Losh.\" THIS SOFTWARE IS PROVIDED BY Diomidis D. Spinellis ``AS IS'' AND ANY 16085a2b40SWarner Losh.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17085a2b40SWarner Losh.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18085a2b40SWarner Losh.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Diomidis D. Spinellis BE 19085a2b40SWarner Losh.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20085a2b40SWarner Losh.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21085a2b40SWarner Losh.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 22085a2b40SWarner Losh.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 23085a2b40SWarner Losh.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 24085a2b40SWarner Losh.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 25085a2b40SWarner Losh.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26085a2b40SWarner Losh.\" 276901ba93SDiomidis Spinellis.Dd January 14, 2005 28085a2b40SWarner Losh.Dt PBIO 4 i386 29085a2b40SWarner Losh.Os 30085a2b40SWarner Losh.Sh NAME 31085a2b40SWarner Losh.Nm pbio 32085a2b40SWarner Losh.Nd 8255 parallel peripheral interface basic 33085a2b40SWarner Losh.Tn I/O 34085a2b40SWarner Loshdriver 35085a2b40SWarner Losh.Sh SYNOPSIS 368de5fd36SRuslan Ermilov.Cd "device pbio" 378de5fd36SRuslan Ermilov.Pp 388de5fd36SRuslan ErmilovIn 398de5fd36SRuslan Ermilov.Pa /boot/device.hints : 408de5fd36SRuslan Ermilov.Cd hint.pbio.0.at="isa" 418de5fd36SRuslan Ermilov.Cd hint.pbio.0.port="0x360" 428de5fd36SRuslan Ermilov.Pp 436901ba93SDiomidis Spinellis.In dev/pbio/pbioio.h 44085a2b40SWarner Losh.Sh DESCRIPTION 45085a2b40SWarner LoshThe 468de5fd36SRuslan Ermilov.Nm 47085a2b40SWarner Loshdriver supports direct access to the Intel 8255A programmable 48085a2b40SWarner Loshperipheral interface (PPI) chip running in mode 0 (simple 49085a2b40SWarner Losh.Tn I/O ) . 50085a2b40SWarner LoshSuch an interface provides 24 digital 51085a2b40SWarner Losh.Tn I/O 52085a2b40SWarner Loshlines. 53085a2b40SWarner LoshThe driver is designed for performing 54085a2b40SWarner Losh.Tn I/O 55085a2b40SWarner Loshunder program control using 56085a2b40SWarner Loshperipherals such as the 57085a2b40SWarner Losh.Tn Advantech 58085a2b40SWarner Losh.Tn PCL-724 59085a2b40SWarner Loshcard, which emulates the Intel 8255A PPI in mode 0. 60085a2b40SWarner LoshOther 8255A-based peripherals such as the 61085a2b40SWarner Losh.Tn BMC 62085a2b40SWarner LoshMesssysteme 63085a2b40SWarner Losh.Tn PIO24II 64085a2b40SWarner Loshcard have also been reported to work. 65085a2b40SWarner Losh.Pp 66085a2b40SWarner LoshThe PPI provides two 8-bit ports (port A and port B) and 67085a2b40SWarner Loshtwo 4-bit ports (port C upper, port C lower). 68085a2b40SWarner LoshEach port can be individually programmed for input and 69085a2b40SWarner Losh(latched) output, 70085a2b40SWarner Loshand appears at a different offset of the device's base 71085a2b40SWarner Losh.Tn I/O 72085a2b40SWarner Loshaddress. 73085a2b40SWarner Losh.Pp 74085a2b40SWarner LoshA separate register allows the configuration of ports for input 75085a2b40SWarner Loshor output. 76085a2b40SWarner LoshThe device is so simple, that reliably probing for it when 77085a2b40SWarner Loshinput data arrives at its terminals is impossible; 78085a2b40SWarner Loshtherefore the kernel configuration has to specify the 79085a2b40SWarner Loshdevice's base address. 80085a2b40SWarner LoshThe device driver provides four character devices that 81085a2b40SWarner Loshcorrespond to the peripheral's 82085a2b40SWarner Losh.Tn I/O 83085a2b40SWarner Loshports. 848de5fd36SRuslan ErmilovOpening a device for read or write automatically configures 85085a2b40SWarner Loshthe corresponding hardware port for input or output. 86085a2b40SWarner LoshAt boot time all ports are set configured for input to avoid damaging 87085a2b40SWarner Loshexternal circuitry. 88085a2b40SWarner Losh.Pp 89085a2b40SWarner LoshA set of 90085a2b40SWarner Losh.Xr ioctl 2 91085a2b40SWarner Loshrequests allow polled input and paced output to be 92085a2b40SWarner Loshefficiently performed at the driver level without expensive 93085a2b40SWarner Loshuser/kernel context switching. 94085a2b40SWarner LoshThe driver can perform 95085a2b40SWarner Losh.Tn I/O 96085a2b40SWarner Loshin three different ways: 978de5fd36SRuslan Ermilov.Bl -tag -width ".No Differential" 98085a2b40SWarner Losh.It Basic 99085a2b40SWarner LoshThe read or write operation returns immediately after reading 100085a2b40SWarner Loshor writing the data to the port at bus speed. 101085a2b40SWarner Losh.It Paced 102085a2b40SWarner LoshData is transferred from or to the port at intervals specified 103085a2b40SWarner Loshby a separate 104085a2b40SWarner Losh.Xr ioctl 2 105085a2b40SWarner Loshcall. 106085a2b40SWarner Losh.It Differential 107085a2b40SWarner Losh(Input only.) 108085a2b40SWarner LoshOnly port values that differ from the previous port value are returned. 109085a2b40SWarner Losh.El 110085a2b40SWarner Losh.Pp 111085a2b40SWarner LoshThe pacing interval is specified in 112085a2b40SWarner Losh.Em Hz 113085a2b40SWarner Loshunit increments. 114085a2b40SWarner LoshSetting a pace of 1158de5fd36SRuslan Ermilov.Ar n 116085a2b40SWarner Loshseconds 117085a2b40SWarner Loshwill result in no more than one value being read or written every 1188de5fd36SRuslan Ermilov.Ar n 119085a2b40SWarner Loshseconds. 1206fb9b618SGiorgos KeramidasSingle byte read/write operations will take at least 1218de5fd36SRuslan Ermilov.Ar n 122085a2b40SWarner Loshseconds to complete. 123085a2b40SWarner Losh.Pp 124085a2b40SWarner LoshThe following 125085a2b40SWarner Losh.Xr ioctl 2 126085a2b40SWarner Loshcalls are supported: 1278de5fd36SRuslan Ermilov.Bl -tag -width ".Dv PBIO_SETIPACE" 128085a2b40SWarner Losh.It Dv PBIO_SETDIFF 129085a2b40SWarner Loshaccepts a pointer to an integer as the third argument, 130085a2b40SWarner Loshand sets the driver for differential input if the integer is non-zero. 131085a2b40SWarner LoshThe input pace speed determines the periodic interval the driver will use to 132085a2b40SWarner Loshexamine the port for a changed value. 133085a2b40SWarner Losh.It Dv PBIO_GETDIFF 134085a2b40SWarner Loshaccepts a pointer to an integer as the third argument, 135085a2b40SWarner Loshand sets the integer to the last set value for differential input. 136085a2b40SWarner Losh.It Dv PBIO_SETIPACE 137085a2b40SWarner Loshaccepts a pointer to an integer as the third argument, 138085a2b40SWarner Loshand sets the driver's input pacing speed to the value of that integer. 139085a2b40SWarner Losh.It Dv PBIO_GETIPACE 140085a2b40SWarner Loshaccepts a pointer to an integer as the third argument, 141085a2b40SWarner Loshand sets the integer to the last set value for the input pace. 142085a2b40SWarner Losh.It Dv PBIO_SETOPACE 143085a2b40SWarner Loshaccepts a pointer to an integer as the third argument, 144085a2b40SWarner Loshand sets the driver's output pacing speed to the value of that integer. 145085a2b40SWarner Losh.It Dv PBIO_GETOPACE 146085a2b40SWarner Loshaccepts a pointer to an integer as the third argument, 147085a2b40SWarner Loshand sets the integer to the last set value for the output pace. 148085a2b40SWarner Losh.El 149085a2b40SWarner Losh.Sh FILES 1508de5fd36SRuslan Ermilov.Bl -tag -width ".Pa /dev/pbio0ch" -compact 151085a2b40SWarner Losh.It Pa /dev/pbio0a 152085a2b40SWarner LoshPort A (8 bit 153085a2b40SWarner Losh.Tn I/O ) . 154085a2b40SWarner Losh.It Pa /dev/pbio0b 155085a2b40SWarner LoshPort B (8 bit 156085a2b40SWarner Losh.Tn I/O ) . 157085a2b40SWarner Losh.It Pa /dev/pbio0ch 158085a2b40SWarner LoshPort C upper (4 bit 159085a2b40SWarner Losh.Tn I/O ) . 160085a2b40SWarner Losh.It Pa /dev/pbio0cl 161085a2b40SWarner LoshPort C lower (4 bit 162085a2b40SWarner Losh.Tn I/O ) . 163085a2b40SWarner Losh.El 164085a2b40SWarner Losh.Sh SEE ALSO 165085a2b40SWarner Losh.Rs 166085a2b40SWarner Losh.%A "Diomidis Spinellis" 167085a2b40SWarner Losh.%T "The information furnace: Consolidated home control" 168085a2b40SWarner Losh.%D "2003" 169085a2b40SWarner Losh.%J "Personal and Ubiquitous Computing" 170085a2b40SWarner Losh.%N 1 171085a2b40SWarner Losh.%V 7 172085a2b40SWarner Losh.%P "53-69" 173085a2b40SWarner Losh.Re 174085a2b40SWarner Losh.Sh HISTORY 175085a2b40SWarner LoshThe 176085a2b40SWarner Losh.Nm 177085a2b40SWarner Loshdevice was first used under 178085a2b40SWarner Losh.Fx 4.1 . 1798de5fd36SRuslan Ermilov.Sh AUTHORS 180*6c899950SBaptiste Daroussin.An Diomidis D. Spinellis Aq Mt dds@aueb.gr 181085a2b40SWarner Losh.Sh BUGS 182085a2b40SWarner LoshOne of the 183085a2b40SWarner Losh.Tn PCL-724 184085a2b40SWarner Loshcard's inputs can optionally be wired to generate an interrupt. 185085a2b40SWarner LoshThis feature is not supported. 186