1*e2be04c7SGreg 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 <[email protected]> 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 <[email protected]>, 03/01/2001 16607ca46eSDavid Howells */ 17607ca46eSDavid Howells 18607ca46eSDavid Howells #define PP_IOCTL 'p' 19607ca46eSDavid Howells 20607ca46eSDavid Howells /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ 21607ca46eSDavid Howells #define PPSETMODE _IOW(PP_IOCTL, 0x80, int) 22607ca46eSDavid Howells 23607ca46eSDavid Howells /* Read status */ 24607ca46eSDavid Howells #define PPRSTATUS _IOR(PP_IOCTL, 0x81, unsigned char) 25607ca46eSDavid Howells #define PPWSTATUS OBSOLETE__IOW(PP_IOCTL, 0x82, unsigned char) 26607ca46eSDavid Howells 27607ca46eSDavid Howells /* Read/write control */ 28607ca46eSDavid Howells #define PPRCONTROL _IOR(PP_IOCTL, 0x83, unsigned char) 29607ca46eSDavid Howells #define PPWCONTROL _IOW(PP_IOCTL, 0x84, unsigned char) 30607ca46eSDavid Howells 31607ca46eSDavid Howells struct ppdev_frob_struct { 32607ca46eSDavid Howells unsigned char mask; 33607ca46eSDavid Howells unsigned char val; 34607ca46eSDavid Howells }; 35607ca46eSDavid Howells #define PPFCONTROL _IOW(PP_IOCTL, 0x8e, struct ppdev_frob_struct) 36607ca46eSDavid Howells 37607ca46eSDavid Howells /* Read/write data */ 38607ca46eSDavid Howells #define PPRDATA _IOR(PP_IOCTL, 0x85, unsigned char) 39607ca46eSDavid Howells #define PPWDATA _IOW(PP_IOCTL, 0x86, unsigned char) 40607ca46eSDavid Howells 41607ca46eSDavid Howells /* Read/write econtrol (not used) */ 42607ca46eSDavid Howells #define PPRECONTROL OBSOLETE__IOR(PP_IOCTL, 0x87, unsigned char) 43607ca46eSDavid Howells #define PPWECONTROL OBSOLETE__IOW(PP_IOCTL, 0x88, unsigned char) 44607ca46eSDavid Howells 45607ca46eSDavid Howells /* Read/write FIFO (not used) */ 46607ca46eSDavid Howells #define PPRFIFO OBSOLETE__IOR(PP_IOCTL, 0x89, unsigned char) 47607ca46eSDavid Howells #define PPWFIFO OBSOLETE__IOW(PP_IOCTL, 0x8a, unsigned char) 48607ca46eSDavid Howells 49607ca46eSDavid Howells /* Claim the port to start using it */ 50607ca46eSDavid Howells #define PPCLAIM _IO(PP_IOCTL, 0x8b) 51607ca46eSDavid Howells 52607ca46eSDavid Howells /* Release the port when you aren't using it */ 53607ca46eSDavid Howells #define PPRELEASE _IO(PP_IOCTL, 0x8c) 54607ca46eSDavid Howells 55607ca46eSDavid Howells /* Yield the port (release it if another driver is waiting, 56607ca46eSDavid Howells * then reclaim) */ 57607ca46eSDavid Howells #define PPYIELD _IO(PP_IOCTL, 0x8d) 58607ca46eSDavid Howells 59607ca46eSDavid Howells /* Register device exclusively (must be before PPCLAIM). */ 60607ca46eSDavid Howells #define PPEXCL _IO(PP_IOCTL, 0x8f) 61607ca46eSDavid Howells 62607ca46eSDavid Howells /* Data line direction: non-zero for input mode. */ 63607ca46eSDavid Howells #define PPDATADIR _IOW(PP_IOCTL, 0x90, int) 64607ca46eSDavid Howells 65607ca46eSDavid Howells /* Negotiate a particular IEEE 1284 mode. */ 66607ca46eSDavid Howells #define PPNEGOT _IOW(PP_IOCTL, 0x91, int) 67607ca46eSDavid Howells 68607ca46eSDavid Howells /* Set control lines when an interrupt occurs. */ 69607ca46eSDavid Howells #define PPWCTLONIRQ _IOW(PP_IOCTL, 0x92, unsigned char) 70607ca46eSDavid Howells 71607ca46eSDavid Howells /* Clear (and return) interrupt count. */ 72607ca46eSDavid Howells #define PPCLRIRQ _IOR(PP_IOCTL, 0x93, int) 73607ca46eSDavid Howells 74607ca46eSDavid Howells /* Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE) */ 75607ca46eSDavid Howells #define PPSETPHASE _IOW(PP_IOCTL, 0x94, int) 76607ca46eSDavid Howells 77607ca46eSDavid Howells /* Set and get port timeout (struct timeval's) */ 78607ca46eSDavid Howells #define PPGETTIME _IOR(PP_IOCTL, 0x95, struct timeval) 79607ca46eSDavid Howells #define PPSETTIME _IOW(PP_IOCTL, 0x96, struct timeval) 80607ca46eSDavid Howells 81607ca46eSDavid Howells /* Get available modes (what the hardware can do) */ 82607ca46eSDavid Howells #define PPGETMODES _IOR(PP_IOCTL, 0x97, unsigned int) 83607ca46eSDavid Howells 84607ca46eSDavid Howells /* Get the current mode and phaze */ 85607ca46eSDavid Howells #define PPGETMODE _IOR(PP_IOCTL, 0x98, int) 86607ca46eSDavid Howells #define PPGETPHASE _IOR(PP_IOCTL, 0x99, int) 87607ca46eSDavid Howells 88607ca46eSDavid Howells /* get/set flags */ 89607ca46eSDavid Howells #define PPGETFLAGS _IOR(PP_IOCTL, 0x9a, int) 90607ca46eSDavid Howells #define PPSETFLAGS _IOW(PP_IOCTL, 0x9b, int) 91607ca46eSDavid Howells 92607ca46eSDavid Howells /* flags visible to the world */ 93607ca46eSDavid Howells #define PP_FASTWRITE (1<<2) 94607ca46eSDavid Howells #define PP_FASTREAD (1<<3) 95607ca46eSDavid Howells #define PP_W91284PIC (1<<4) 96607ca46eSDavid Howells 97607ca46eSDavid Howells /* only masks user-visible flags */ 98607ca46eSDavid Howells #define PP_FLAGMASK (PP_FASTWRITE | PP_FASTREAD | PP_W91284PIC) 99607ca46eSDavid Howells 100607ca46eSDavid Howells 101