Initial import from FreeBSD RELENG_4:
[dragonfly.git] / share / man / man4 / ppi.4
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: src/share/man/man4/ppi.4,v 1.4.2.7 2001/12/17 11:30:12 ru Exp $
27 .\"
28 .Dd January 2, 1998
29 .Dt PPI 4
30 .Os
31 .Sh NAME
32 .Nm ppi
33 .Nd "user-space interface to ppbus parallel 'geek' port"
34 .Sh SYNOPSIS
35 .Cd "device ppi"
36 .Pp
37 Minor numbering:  Unit numbers correspond directly to ppbus numbers.
38 .Sh DESCRIPTION
39 The
40 .Nm
41 driver provides a convenient means for user applications to manipulate the
42 state of the parallel port, enabling easy low-speed I/O operations without
43 the security problems inherent with the use of the
44 .Pa /dev/io
45 interface.
46 .Sh PROGRAMMING INTERFACE
47 .In dev/ppbus/ppi.h
48 .In dev/ppbus/ppbconf.h
49 .Pp
50 All I/O on the
51 .Nm
52 interface is performed using
53 .Fn ioctl
54 calls.  Each command takes a single
55 .Ft u_int8_t
56 argument, transferring one byte of data.  The following commands are
57 available:
58 .Bl -tag -width indent
59 .It Dv PPIGDATA , PPISDATA
60 Get and set the contents of the data register.
61 .It Dv PPIGSTATUS , PPISSTATUS
62 Get and set the contents of the status register.
63 .It Dv PPIGCTRL , PPISCTRL
64 Get and set the contents of the control register.
65 The following defines correspond to bits in this register.  Setting
66 a bit in the control register drives the corresponding output low.
67 .Bl -tag -width indent -compact
68 .It Dv STROBE
69 .It Dv AUTOFEED
70 .It Dv nINIT
71 .It Dv SELECTIN
72 .It Dv PCD
73 .El
74 .It Dv PPIGEPP , PPISEPP
75 Get and set the contents of the EPP control register.
76 .It Dv PPIGECR , PPISECR
77 Get and set the contents of the ECP control register.
78 .It Dv PPIGFIFO , PPISFIFO
79 Read and write the ECP FIFO (8-bit operations only).
80 .El
81 .Sh EXAMPLES
82 To present the value 0x5a to the data port, drive STROBE low and then high
83 again, the following code fragment can be used:
84 .Bd -literal -compact
85
86         int             fd;
87         u_int8_t        val;
88
89         val = 0x5a;
90         ioctl(fd, PPISDATA, &val);
91         ioctl(fd, PPIGCTRL, &val);
92         val |= STROBE;
93         ioctl(fd, PPISCTRL, &val);
94         val &= ~STROBE;
95         ioctl(fd, PPISCTRL, &val);
96
97 .Ed
98 .Sh BUGS
99 The inverse sense of signals is confusing.
100 .Pp
101 The
102 .Fn ioctl
103 interface is slow, and there is no way (yet) to chain multiple operations together.
104 .Pp
105 The headers required for user applications are not installed as part of the
106 standard system.