1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
.\" Copyright (c) 2000-2002
.\" Diomidis D. Spinellis, Athens, Greece
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY Diomidis D. Spinellis ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Diomidis D. Spinellis BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd January 14, 2005
.Dt PBIO 4 i386
.Os
.Sh NAME
.Nm pbio
.Nd 8255 parallel peripheral interface basic
.Tn I/O
driver
.Sh SYNOPSIS
.Cd "device pbio"
.Pp
In
.Pa /boot/device.hints :
.Cd hint.pbio.0.at="isa"
.Cd hint.pbio.0.port="0x360"
.Pp
.In dev/pbio/pbioio.h
.Sh DESCRIPTION
The
.Nm
driver supports direct access to the Intel 8255A programmable
peripheral interface (PPI) chip running in mode 0 (simple
.Tn I/O ) .
Such an interface provides 24 digital
.Tn I/O
lines.
The driver is designed for performing
.Tn I/O
under program control using
peripherals such as the
.Tn Advantech
.Tn PCL-724
card, which emulates the Intel 8255A PPI in mode 0.
Other 8255A-based peripherals such as the
.Tn BMC
Messsysteme
.Tn PIO24II
card have also been reported to work.
.Pp
The PPI provides two 8-bit ports (port A and port B) and
two 4-bit ports (port C upper, port C lower).
Each port can be individually programmed for input and
(latched) output,
and appears at a different offset of the device's base
.Tn I/O
address.
.Pp
A separate register allows the configuration of ports for input
or output.
The device is so simple, that reliably probing for it when
input data arrives at its terminals is impossible;
therefore the kernel configuration has to specify the
device's base address.
The device driver provides four character devices that
correspond to the peripheral's
.Tn I/O
ports.
Opening a device for read or write automatically configures
the corresponding hardware port for input or output.
At boot time all ports are set configured for input to avoid damaging
external circuitry.
.Pp
A set of
.Xr ioctl 2
requests allow polled input and paced output to be
efficiently performed at the driver level without expensive
user/kernel context switching.
The driver can perform
.Tn I/O
in three different ways:
.Bl -tag -width ".No Differential"
.It Basic
The read or write operation returns immediately after reading
or writing the data to the port at bus speed.
.It Paced
Data is transferred from or to the port at intervals specified
by a separate
.Xr ioctl 2
call.
.It Differential
(Input only.)
Only port values that differ from the previous port value are returned.
.El
.Pp
The pacing interval is specified in
.Em Hz
unit increments.
Setting a pace of
.Ar n
seconds
will result in no more than one value being read or written every
.Ar n
seconds.
Single byte read/write operations will take at least
.Ar n
seconds to complete.
.Pp
The following
.Xr ioctl 2
calls are supported:
.Bl -tag -width ".Dv PBIO_SETIPACE"
.It Dv PBIO_SETDIFF
accepts a pointer to an integer as the third argument,
and sets the driver for differential input if the integer is non-zero.
The input pace speed determines the periodic interval the driver will use to
examine the port for a changed value.
.It Dv PBIO_GETDIFF
accepts a pointer to an integer as the third argument,
and sets the integer to the last set value for differential input.
.It Dv PBIO_SETIPACE
accepts a pointer to an integer as the third argument,
and sets the driver's input pacing speed to the value of that integer.
.It Dv PBIO_GETIPACE
accepts a pointer to an integer as the third argument,
and sets the integer to the last set value for the input pace.
.It Dv PBIO_SETOPACE
accepts a pointer to an integer as the third argument,
and sets the driver's output pacing speed to the value of that integer.
.It Dv PBIO_GETOPACE
accepts a pointer to an integer as the third argument,
and sets the integer to the last set value for the output pace.
.El
.Sh FILES
.Bl -tag -width ".Pa /dev/pbio0ch" -compact
.It Pa /dev/pbio0a
Port A (8 bit
.Tn I/O ) .
.It Pa /dev/pbio0b
Port B (8 bit
.Tn I/O ) .
.It Pa /dev/pbio0ch
Port C upper (4 bit
.Tn I/O ) .
.It Pa /dev/pbio0cl
Port C lower (4 bit
.Tn I/O ) .
.El
.Sh SEE ALSO
.Rs
.%A "Diomidis Spinellis"
.%T "The information furnace: Consolidated home control"
.%D "2003"
.%J "Personal and Ubiquitous Computing"
.%N 1
.%V 7
.%P "53-69"
.Re
.Sh HISTORY
The
.Nm
device was first used under
.Fx 4.1 .
.Sh AUTHORS
.An Diomidis D. Spinellis Aq Mt dds@aueb.gr
.Sh BUGS
One of the
.Tn PCL-724
card's inputs can optionally be wired to generate an interrupt.
This feature is not supported.
|