Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * usr/include/linux/lp.h c.1991-1992 James Wiegand
0004  * many modifications copyright (C) 1992 Michael K. Johnson
0005  * Interrupt support added 1993 Nigel Gamble
0006  * Removed 8255 status defines from inside __KERNEL__ Marcelo Tosatti 
0007  */
0008 #ifndef _UAPI_LINUX_LP_H
0009 #define _UAPI_LINUX_LP_H
0010 
0011 #include <linux/types.h>
0012 #include <linux/ioctl.h>
0013 
0014 /*
0015  * Per POSIX guidelines, this module reserves the LP and lp prefixes
0016  * These are the lp_table[minor].flags flags...
0017  */
0018 #define LP_EXIST 0x0001
0019 #define LP_SELEC 0x0002
0020 #define LP_BUSY  0x0004
0021 #define LP_BUSY_BIT_POS 2
0022 #define LP_OFFL  0x0008
0023 #define LP_NOPA  0x0010
0024 #define LP_ERR   0x0020
0025 #define LP_ABORT 0x0040
0026 #define LP_CAREFUL 0x0080 /* obsoleted -arca */
0027 #define LP_ABORTOPEN 0x0100
0028 
0029 #define LP_TRUST_IRQ_  0x0200 /* obsolete */
0030 #define LP_NO_REVERSE  0x0400 /* No reverse mode available. */
0031 #define LP_DATA_AVAIL  0x0800 /* Data is available. */
0032 
0033 /* 
0034  * bit defines for 8255 status port
0035  * base + 1
0036  * accessed with LP_S(minor), which gets the byte...
0037  */
0038 #define LP_PBUSY    0x80  /* inverted input, active high */
0039 #define LP_PACK     0x40  /* unchanged input, active low */
0040 #define LP_POUTPA   0x20  /* unchanged input, active high */
0041 #define LP_PSELECD  0x10  /* unchanged input, active high */
0042 #define LP_PERRORP  0x08  /* unchanged input, active low */
0043 
0044 /* timeout for each character.  This is relative to bus cycles -- it
0045  * is the count in a busy loop.  THIS IS THE VALUE TO CHANGE if you
0046  * have extremely slow printing, or if the machine seems to slow down
0047  * a lot when you print.  If you have slow printing, increase this
0048  * number and recompile, and if your system gets bogged down, decrease
0049  * this number.  This can be changed with the tunelp(8) command as well.
0050  */
0051 
0052 #define LP_INIT_CHAR 1000
0053 
0054 /* The parallel port specs apparently say that there needs to be
0055  * a .5usec wait before and after the strobe.
0056  */
0057 
0058 #define LP_INIT_WAIT 1
0059 
0060 /* This is the amount of time that the driver waits for the printer to
0061  * catch up when the printer's buffer appears to be filled.  If you
0062  * want to tune this and have a fast printer (i.e. HPIIIP), decrease
0063  * this number, and if you have a slow printer, increase this number.
0064  * This is in hundredths of a second, the default 2 being .05 second.
0065  * Or use the tunelp(8) command, which is especially nice if you want
0066  * change back and forth between character and graphics printing, which
0067  * are wildly different...
0068  */
0069 
0070 #define LP_INIT_TIME 2
0071 
0072 /* IOCTL numbers */
0073 #define LPCHAR   0x0601  /* corresponds to LP_INIT_CHAR */
0074 #define LPTIME   0x0602  /* corresponds to LP_INIT_TIME */
0075 #define LPABORT  0x0604  /* call with TRUE arg to abort on error,
0076                 FALSE to retry.  Default is retry.  */
0077 #define LPSETIRQ 0x0605  /* call with new IRQ number,
0078                 or 0 for polling (no IRQ) */
0079 #define LPGETIRQ 0x0606  /* get the current IRQ number */
0080 #define LPWAIT   0x0608  /* corresponds to LP_INIT_WAIT */
0081 /* NOTE: LPCAREFUL is obsoleted and it' s always the default right now -arca */
0082 #define LPCAREFUL   0x0609  /* call with TRUE arg to require out-of-paper, off-
0083                 line, and error indicators good on all writes,
0084                 FALSE to ignore them.  Default is ignore. */
0085 #define LPABORTOPEN 0x060a  /* call with TRUE arg to abort open() on error,
0086                 FALSE to ignore error.  Default is ignore.  */
0087 #define LPGETSTATUS 0x060b  /* return LP_S(minor) */
0088 #define LPRESET     0x060c  /* reset printer */
0089 #ifdef LP_STATS
0090 #define LPGETSTATS  0x060d  /* get statistics (struct lp_stats) */
0091 #endif
0092 #define LPGETFLAGS  0x060e  /* get status flags */
0093 #define LPSETTIMEOUT_OLD 0x060f /* set parport timeout */
0094 #define LPSETTIMEOUT_NEW \
0095     _IOW(0x6, 0xf, __s64[2]) /* set parport timeout */
0096 #if __BITS_PER_LONG == 64
0097 #define LPSETTIMEOUT LPSETTIMEOUT_OLD
0098 #else
0099 #define LPSETTIMEOUT (sizeof(time_t) > sizeof(__kernel_long_t) ? \
0100     LPSETTIMEOUT_NEW : LPSETTIMEOUT_OLD)
0101 #endif
0102 
0103 /* timeout for printk'ing a timeout, in jiffies (100ths of a second).
0104    This is also used for re-checking error conditions if LP_ABORT is
0105    not set.  This is the default behavior. */
0106 
0107 #define LP_TIMEOUT_INTERRUPT    (60 * HZ)
0108 #define LP_TIMEOUT_POLLED   (10 * HZ)
0109 
0110 
0111 #endif /* _UAPI_LINUX_LP_H */