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