xref: /freebsd/share/man/man4/ppi.4 (revision 7f3dea244c40159a41ab22da77a434d7c5b5e85a)
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.\" $FreeBSD$
27.\"
28.Dd January 2, 1998
29.Dt PPI 4
30.Os FreeBSD
31.Sh NAME
32.Nm ppi
33.Nd
34user-space interface to ppbus parallel 'geek' port
35.Sh SYNOPSIS
36.Cd "device ppi0 at ppbus?
37.sp
38Minor numbering:  Unit numbers correspond directly to ppbus numbers.
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
48.Pp
49.Fd #include </sys/dev/ppbus/ppi.h>
50.Fd #include </sys/dev/ppbus/ppbconf.h>
51.Pp
52All I/O on the
53.Nm
54interface is performed using
55.Fn ioctl
56calls.  Each command takes a single
57.Ty u_int8_t
58argument, transferring one byte of data.  The following commands are
59available:
60.Bl -tag -width 10
61.It PPIGDATA, PPISDATA
62Get and set the contents of the data register.
63.It PPIGSTATUS, PPISSTATUS
64Get and set the contents of the status register.
65.It PPIGCTRL, PPISCTRL
66Get and set the contents of the control register.
67The following defines correspond to bits in this register.  Setting
68a bit in the control register drives the corresponding output low.
69.Bl -tag -width 10 -compact
70.It STROBE
71.It AUTOFEED
72.It nINIT
73.It SELECTIN
74.It PCD
75.El
76.It PPIGEPP, PPISEPP
77Get and set the contents of the EPP control register.
78.It PPIGECR, PPISECR
79Get and set the contents of the ECP control register.
80.It PPIGFIFO, PPISFIFO
81Read and write the ECP FIFO (8-bit operations only).
82.El
83.Sh EXAMPLES
84To present the value 0x5a to the data port, drive STROBE low and then high
85again, the following code fragment can be used:
86.Bd -literal -compact
87
88	int		fd;
89	u_int8_t	val;
90
91	val = 0x5a;
92	ioctl(fd, PPISDATA, &val);
93	ioctl(fd, PPIGCTRL, &val);
94	val |= STROBE;
95	ioctl(fd, PPISCTRL, &val);
96	val &= ~STROBE;
97	ioctl(fd, PPISCTRL, &val);
98
99.Ed
100.Sh BUGS
101The inverse sense of signals is confusing.
102.Pp
103The
104.Fn ioctl
105interface is slow, and there is no way (yet) to chain multiple operations together.
106.Pp
107The headers required for user applications are not installed as part of the
108standard system.
109