xref: /linux/include/uapi/linux/ppdev.h (revision 976e3645923bdd2fe7893aae33fd7a21098bfb28)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2607ca46eSDavid Howells /*
3607ca46eSDavid Howells  * linux/include/linux/ppdev.h
4607ca46eSDavid Howells  *
5607ca46eSDavid Howells  * User-space parallel port device driver (header file).
6607ca46eSDavid Howells  *
7607ca46eSDavid Howells  * Copyright (C) 1998-9 Tim Waugh <tim@cyberelk.demon.co.uk>
8607ca46eSDavid Howells  *
9607ca46eSDavid Howells  * This program is free software; you can redistribute it and/or
10607ca46eSDavid Howells  * modify it under the terms of the GNU General Public License
11607ca46eSDavid Howells  * as published by the Free Software Foundation; either version
12607ca46eSDavid Howells  * 2 of the License, or (at your option) any later version.
13607ca46eSDavid Howells  *
14607ca46eSDavid Howells  * Added PPGETTIME/PPSETTIME, Fred Barnes, 1999
15607ca46eSDavid Howells  * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001
16607ca46eSDavid Howells  */
17607ca46eSDavid Howells 
18*509ce4c8SMasahiro Yamada #ifndef _UAPI_LINUX_PPDEV_H
19*509ce4c8SMasahiro Yamada #define _UAPI_LINUX_PPDEV_H
20*509ce4c8SMasahiro Yamada 
21607ca46eSDavid Howells #define PP_IOCTL	'p'
22607ca46eSDavid Howells 
23607ca46eSDavid Howells /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */
24607ca46eSDavid Howells #define PPSETMODE	_IOW(PP_IOCTL, 0x80, int)
25607ca46eSDavid Howells 
26607ca46eSDavid Howells /* Read status */
27607ca46eSDavid Howells #define PPRSTATUS	_IOR(PP_IOCTL, 0x81, unsigned char)
28607ca46eSDavid Howells #define PPWSTATUS	OBSOLETE__IOW(PP_IOCTL, 0x82, unsigned char)
29607ca46eSDavid Howells 
30607ca46eSDavid Howells /* Read/write control */
31607ca46eSDavid Howells #define PPRCONTROL	_IOR(PP_IOCTL, 0x83, unsigned char)
32607ca46eSDavid Howells #define PPWCONTROL	_IOW(PP_IOCTL, 0x84, unsigned char)
33607ca46eSDavid Howells 
34607ca46eSDavid Howells struct ppdev_frob_struct {
35607ca46eSDavid Howells 	unsigned char mask;
36607ca46eSDavid Howells 	unsigned char val;
37607ca46eSDavid Howells };
38607ca46eSDavid Howells #define PPFCONTROL      _IOW(PP_IOCTL, 0x8e, struct ppdev_frob_struct)
39607ca46eSDavid Howells 
40607ca46eSDavid Howells /* Read/write data */
41607ca46eSDavid Howells #define PPRDATA		_IOR(PP_IOCTL, 0x85, unsigned char)
42607ca46eSDavid Howells #define PPWDATA		_IOW(PP_IOCTL, 0x86, unsigned char)
43607ca46eSDavid Howells 
44607ca46eSDavid Howells /* Read/write econtrol (not used) */
45607ca46eSDavid Howells #define PPRECONTROL	OBSOLETE__IOR(PP_IOCTL, 0x87, unsigned char)
46607ca46eSDavid Howells #define PPWECONTROL	OBSOLETE__IOW(PP_IOCTL, 0x88, unsigned char)
47607ca46eSDavid Howells 
48607ca46eSDavid Howells /* Read/write FIFO (not used) */
49607ca46eSDavid Howells #define PPRFIFO		OBSOLETE__IOR(PP_IOCTL, 0x89, unsigned char)
50607ca46eSDavid Howells #define PPWFIFO		OBSOLETE__IOW(PP_IOCTL, 0x8a, unsigned char)
51607ca46eSDavid Howells 
52607ca46eSDavid Howells /* Claim the port to start using it */
53607ca46eSDavid Howells #define PPCLAIM		_IO(PP_IOCTL, 0x8b)
54607ca46eSDavid Howells 
55607ca46eSDavid Howells /* Release the port when you aren't using it */
56607ca46eSDavid Howells #define PPRELEASE	_IO(PP_IOCTL, 0x8c)
57607ca46eSDavid Howells 
58607ca46eSDavid Howells /* Yield the port (release it if another driver is waiting,
59607ca46eSDavid Howells  * then reclaim) */
60607ca46eSDavid Howells #define PPYIELD		_IO(PP_IOCTL, 0x8d)
61607ca46eSDavid Howells 
62607ca46eSDavid Howells /* Register device exclusively (must be before PPCLAIM). */
63607ca46eSDavid Howells #define PPEXCL		_IO(PP_IOCTL, 0x8f)
64607ca46eSDavid Howells 
65607ca46eSDavid Howells /* Data line direction: non-zero for input mode. */
66607ca46eSDavid Howells #define PPDATADIR	_IOW(PP_IOCTL, 0x90, int)
67607ca46eSDavid Howells 
68607ca46eSDavid Howells /* Negotiate a particular IEEE 1284 mode. */
69607ca46eSDavid Howells #define PPNEGOT		_IOW(PP_IOCTL, 0x91, int)
70607ca46eSDavid Howells 
71607ca46eSDavid Howells /* Set control lines when an interrupt occurs. */
72607ca46eSDavid Howells #define PPWCTLONIRQ	_IOW(PP_IOCTL, 0x92, unsigned char)
73607ca46eSDavid Howells 
74607ca46eSDavid Howells /* Clear (and return) interrupt count. */
75607ca46eSDavid Howells #define PPCLRIRQ	_IOR(PP_IOCTL, 0x93, int)
76607ca46eSDavid Howells 
77607ca46eSDavid Howells /* Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE) */
78607ca46eSDavid Howells #define PPSETPHASE	_IOW(PP_IOCTL, 0x94, int)
79607ca46eSDavid Howells 
80607ca46eSDavid Howells /* Set and get port timeout (struct timeval's) */
81607ca46eSDavid Howells #define PPGETTIME	_IOR(PP_IOCTL, 0x95, struct timeval)
82607ca46eSDavid Howells #define PPSETTIME	_IOW(PP_IOCTL, 0x96, struct timeval)
83607ca46eSDavid Howells 
84607ca46eSDavid Howells /* Get available modes (what the hardware can do) */
85607ca46eSDavid Howells #define PPGETMODES	_IOR(PP_IOCTL, 0x97, unsigned int)
86607ca46eSDavid Howells 
87607ca46eSDavid Howells /* Get the current mode and phaze */
88607ca46eSDavid Howells #define PPGETMODE	_IOR(PP_IOCTL, 0x98, int)
89607ca46eSDavid Howells #define PPGETPHASE	_IOR(PP_IOCTL, 0x99, int)
90607ca46eSDavid Howells 
91607ca46eSDavid Howells /* get/set flags */
92607ca46eSDavid Howells #define PPGETFLAGS	_IOR(PP_IOCTL, 0x9a, int)
93607ca46eSDavid Howells #define PPSETFLAGS	_IOW(PP_IOCTL, 0x9b, int)
94607ca46eSDavid Howells 
95607ca46eSDavid Howells /* flags visible to the world */
96607ca46eSDavid Howells #define PP_FASTWRITE	(1<<2)
97607ca46eSDavid Howells #define PP_FASTREAD	(1<<3)
98607ca46eSDavid Howells #define PP_W91284PIC	(1<<4)
99607ca46eSDavid Howells 
100607ca46eSDavid Howells /* only masks user-visible flags */
101607ca46eSDavid Howells #define PP_FLAGMASK	(PP_FASTWRITE | PP_FASTREAD | PP_W91284PIC)
102607ca46eSDavid Howells 
103*509ce4c8SMasahiro Yamada #endif /* _UAPI_LINUX_PPDEV_H */
104