1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * usr/include/linux/lp.h c.1991-1992 James Wiegand 4*4882a593Smuzhiyun * many modifications copyright (C) 1992 Michael K. Johnson 5*4882a593Smuzhiyun * Interrupt support added 1993 Nigel Gamble 6*4882a593Smuzhiyun * Removed 8255 status defines from inside __KERNEL__ Marcelo Tosatti 7*4882a593Smuzhiyun */ 8*4882a593Smuzhiyun #ifndef _UAPI_LINUX_LP_H 9*4882a593Smuzhiyun #define _UAPI_LINUX_LP_H 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun #include <linux/types.h> 12*4882a593Smuzhiyun #include <linux/ioctl.h> 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun /* 15*4882a593Smuzhiyun * Per POSIX guidelines, this module reserves the LP and lp prefixes 16*4882a593Smuzhiyun * These are the lp_table[minor].flags flags... 17*4882a593Smuzhiyun */ 18*4882a593Smuzhiyun #define LP_EXIST 0x0001 19*4882a593Smuzhiyun #define LP_SELEC 0x0002 20*4882a593Smuzhiyun #define LP_BUSY 0x0004 21*4882a593Smuzhiyun #define LP_BUSY_BIT_POS 2 22*4882a593Smuzhiyun #define LP_OFFL 0x0008 23*4882a593Smuzhiyun #define LP_NOPA 0x0010 24*4882a593Smuzhiyun #define LP_ERR 0x0020 25*4882a593Smuzhiyun #define LP_ABORT 0x0040 26*4882a593Smuzhiyun #define LP_CAREFUL 0x0080 /* obsoleted -arca */ 27*4882a593Smuzhiyun #define LP_ABORTOPEN 0x0100 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun #define LP_TRUST_IRQ_ 0x0200 /* obsolete */ 30*4882a593Smuzhiyun #define LP_NO_REVERSE 0x0400 /* No reverse mode available. */ 31*4882a593Smuzhiyun #define LP_DATA_AVAIL 0x0800 /* Data is available. */ 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun /* 34*4882a593Smuzhiyun * bit defines for 8255 status port 35*4882a593Smuzhiyun * base + 1 36*4882a593Smuzhiyun * accessed with LP_S(minor), which gets the byte... 37*4882a593Smuzhiyun */ 38*4882a593Smuzhiyun #define LP_PBUSY 0x80 /* inverted input, active high */ 39*4882a593Smuzhiyun #define LP_PACK 0x40 /* unchanged input, active low */ 40*4882a593Smuzhiyun #define LP_POUTPA 0x20 /* unchanged input, active high */ 41*4882a593Smuzhiyun #define LP_PSELECD 0x10 /* unchanged input, active high */ 42*4882a593Smuzhiyun #define LP_PERRORP 0x08 /* unchanged input, active low */ 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun /* timeout for each character. This is relative to bus cycles -- it 45*4882a593Smuzhiyun * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you 46*4882a593Smuzhiyun * have extremely slow printing, or if the machine seems to slow down 47*4882a593Smuzhiyun * a lot when you print. If you have slow printing, increase this 48*4882a593Smuzhiyun * number and recompile, and if your system gets bogged down, decrease 49*4882a593Smuzhiyun * this number. This can be changed with the tunelp(8) command as well. 50*4882a593Smuzhiyun */ 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun #define LP_INIT_CHAR 1000 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun /* The parallel port specs apparently say that there needs to be 55*4882a593Smuzhiyun * a .5usec wait before and after the strobe. 56*4882a593Smuzhiyun */ 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun #define LP_INIT_WAIT 1 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun /* This is the amount of time that the driver waits for the printer to 61*4882a593Smuzhiyun * catch up when the printer's buffer appears to be filled. If you 62*4882a593Smuzhiyun * want to tune this and have a fast printer (i.e. HPIIIP), decrease 63*4882a593Smuzhiyun * this number, and if you have a slow printer, increase this number. 64*4882a593Smuzhiyun * This is in hundredths of a second, the default 2 being .05 second. 65*4882a593Smuzhiyun * Or use the tunelp(8) command, which is especially nice if you want 66*4882a593Smuzhiyun * change back and forth between character and graphics printing, which 67*4882a593Smuzhiyun * are wildly different... 68*4882a593Smuzhiyun */ 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun #define LP_INIT_TIME 2 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun /* IOCTL numbers */ 73*4882a593Smuzhiyun #define LPCHAR 0x0601 /* corresponds to LP_INIT_CHAR */ 74*4882a593Smuzhiyun #define LPTIME 0x0602 /* corresponds to LP_INIT_TIME */ 75*4882a593Smuzhiyun #define LPABORT 0x0604 /* call with TRUE arg to abort on error, 76*4882a593Smuzhiyun FALSE to retry. Default is retry. */ 77*4882a593Smuzhiyun #define LPSETIRQ 0x0605 /* call with new IRQ number, 78*4882a593Smuzhiyun or 0 for polling (no IRQ) */ 79*4882a593Smuzhiyun #define LPGETIRQ 0x0606 /* get the current IRQ number */ 80*4882a593Smuzhiyun #define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */ 81*4882a593Smuzhiyun /* NOTE: LPCAREFUL is obsoleted and it' s always the default right now -arca */ 82*4882a593Smuzhiyun #define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off- 83*4882a593Smuzhiyun line, and error indicators good on all writes, 84*4882a593Smuzhiyun FALSE to ignore them. Default is ignore. */ 85*4882a593Smuzhiyun #define LPABORTOPEN 0x060a /* call with TRUE arg to abort open() on error, 86*4882a593Smuzhiyun FALSE to ignore error. Default is ignore. */ 87*4882a593Smuzhiyun #define LPGETSTATUS 0x060b /* return LP_S(minor) */ 88*4882a593Smuzhiyun #define LPRESET 0x060c /* reset printer */ 89*4882a593Smuzhiyun #ifdef LP_STATS 90*4882a593Smuzhiyun #define LPGETSTATS 0x060d /* get statistics (struct lp_stats) */ 91*4882a593Smuzhiyun #endif 92*4882a593Smuzhiyun #define LPGETFLAGS 0x060e /* get status flags */ 93*4882a593Smuzhiyun #define LPSETTIMEOUT_OLD 0x060f /* set parport timeout */ 94*4882a593Smuzhiyun #define LPSETTIMEOUT_NEW \ 95*4882a593Smuzhiyun _IOW(0x6, 0xf, __s64[2]) /* set parport timeout */ 96*4882a593Smuzhiyun #if __BITS_PER_LONG == 64 97*4882a593Smuzhiyun #define LPSETTIMEOUT LPSETTIMEOUT_OLD 98*4882a593Smuzhiyun #else 99*4882a593Smuzhiyun #define LPSETTIMEOUT (sizeof(time_t) > sizeof(__kernel_long_t) ? \ 100*4882a593Smuzhiyun LPSETTIMEOUT_NEW : LPSETTIMEOUT_OLD) 101*4882a593Smuzhiyun #endif 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun /* timeout for printk'ing a timeout, in jiffies (100ths of a second). 104*4882a593Smuzhiyun This is also used for re-checking error conditions if LP_ABORT is 105*4882a593Smuzhiyun not set. This is the default behavior. */ 106*4882a593Smuzhiyun 107*4882a593Smuzhiyun #define LP_TIMEOUT_INTERRUPT (60 * HZ) 108*4882a593Smuzhiyun #define LP_TIMEOUT_POLLED (10 * HZ) 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun 111*4882a593Smuzhiyun #endif /* _UAPI_LINUX_LP_H */ 112