5 * usr/include/linux/lp.h c.1991-1992 James Wiegand 6 * many modifications copyright (C) 1992 Michael K. Johnson 7 * Interrupt support added 1993 Nigel Gamble 10 /* Magic numbers for defining port-device mappings */ 11 #define LP_PARPORT_UNSPEC -4 12 #define LP_PARPORT_AUTO -3 13 #define LP_PARPORT_OFF -2 14 #define LP_PARPORT_NONE -1 17 * Per POSIX guidelines, this module reserves the LP and lp prefixes 18 * These are the lp_table[minor].flags flags... 20 #define LP_EXIST 0x0001 21 #define LP_SELEC 0x0002 22 #define LP_BUSY 0x0004 23 #define LP_BUSY_BIT_POS 2 24 #define LP_OFFL 0x0008 25 #define LP_NOPA 0x0010 27 #define LP_ABORT 0x0040 29 #define LP_CAREFUL 0x0080 31 #define LP_ABORTOPEN 0x0100 33 /* timeout for each character. This is relative to bus cycles -- it 34 * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you 35 * have extremely slow printing, or if the machine seems to slow down 36 * a lot when you print. If you have slow printing, increase this 37 * number and recompile, and if your system gets bogged down, decrease 38 * this number. This can be changed with the tunelp(8) command as well. 41 #define LP_INIT_CHAR 1000 43 /* The parallel port specs apparently say that there needs to be 44 * a .5usec wait before and after the strobe. Since there are wildly 45 * different computers running linux, I can't come up with a perfect 46 * value so if 20 is not good for you use `tunelp /dev/lp? -w ?`. 47 * You can also set it to 0 if your printer handle that. 50 #define LP_INIT_WAIT 20 52 /* This is the amount of time that the driver waits for the printer to 53 * catch up when the printer's buffer appears to be filled. If you 54 * want to tune this and have a fast printer (i.e. HPIIIP), decrease 55 * this number, and if you have a slow printer, increase this number. 56 * This is in hundredths of a second, the default 2 being .05 second. 57 * Or use the tunelp(8) command, which is especially nice if you want 58 * change back and forth between character and graphics printing, which 59 * are wildly different... 62 #define LP_INIT_TIME 2 65 #define LPCHAR 0x0601/* corresponds to LP_INIT_CHAR */ 66 #define LPTIME 0x0602/* corresponds to LP_INIT_TIME */ 67 #define LPABORT 0x0604/* call with TRUE arg to abort on error, 68 FALSE to retry. Default is retry. */ 69 #define LPSETIRQ 0x0605/* call with new IRQ number, 70 or 0 for polling (no IRQ) */ 71 #define LPGETIRQ 0x0606/* get the current IRQ number */ 72 #define LPWAIT 0x0608/* corresponds to LP_INIT_WAIT */ 73 #ifdef LP_NEED_CAREFUL 74 #define LPCAREFUL 0x0609/* call with TRUE arg to require out-of-paper, off- 75 line, and error indicators good on all writes, 76 FALSE to ignore them. Default is ignore. */ 78 #define LPABORTOPEN 0x060a/* call with TRUE arg to abort open() on error, 79 FALSE to ignore error. Default is ignore. */ 80 #define LPGETSTATUS 0x060b/* return LP_S(minor) */ 81 #define LPRESET 0x060c/* reset printer */ 83 #define LPGETSTATS 0x060d/* get statistics (struct lp_stats) */ 85 #define LPGETFLAGS 0x060e/* get status flags */ 87 /* timeout for printk'ing a timeout, in jiffies (100ths of a second). 88 This is also used for re-checking error conditions if LP_ABORT is 89 not set. This is the default behavior. */ 91 #define LP_TIMEOUT_INTERRUPT (60 * HZ) 92 #define LP_TIMEOUT_POLLED (10 * HZ) 94 #define LP_F(minor) lp_table[(minor)].flags/* flags for busy, etc. */ 95 #define LP_CHAR(minor) lp_table[(minor)].chars/* busy timeout */ 96 #define LP_TIME(minor) lp_table[(minor)].time/* wait time */ 97 #define LP_WAIT(minor) lp_table[(minor)].wait/* strobe wait */ 98 #define LP_IRQ(minor) lp_table[(minor)].dev->port->irq/* interrupt # */ 101 #define LP_STAT(minor) lp_table[(minor)].stats/* statistics area */ 103 #define LP_BUFFER_SIZE 256 105 #define LP_BASE(x) lp_table[(x)].dev->port->base 110 unsigned long sleeps
; 112 unsigned int maxwait
; 113 unsigned int meanwait
; 119 struct pardevice
*dev
; 126 unsigned int lastcall
; 127 unsigned int runchars
; 128 struct lp_stats stats
; 130 struct wait_queue
*wait_q
; 131 unsigned int last_error
; 132 volatileunsigned int irq_detected
:1; 133 volatileunsigned int irq_missed
:1; 134 unsigned int polled
:1; 138 * The following constants describe the various signals of the printer port 139 * hardware. Note that the hardware inverts some signals and that some 140 * signals are active low. An example is LP_STROBE, which must be programmed 141 * with 1 for being active and 0 for being inactive, because the strobe signal 142 * gets inverted, but it is also active low. 146 * bit defines for 8255 status port 148 * accessed with LP_S(minor), which gets the byte... 150 #define LP_PBUSY 0x80/* inverted input, active high */ 151 #define LP_PACK 0x40/* unchanged input, active low */ 152 #define LP_POUTPA 0x20/* unchanged input, active high */ 153 #define LP_PSELECD 0x10/* unchanged input, active high */ 154 #define LP_PERRORP 0x08/* unchanged input, active low */ 157 * defines for 8255 control port 159 * accessed with LP_C(minor) 161 #define LP_PINTEN 0x10/* high to read data in or-ed with data out */ 162 #define LP_PSELECP 0x08/* inverted output, active low */ 163 #define LP_PINITP 0x04/* unchanged output, active low */ 164 #define LP_PAUTOLF 0x02/* inverted output, active low */ 165 #define LP_PSTROBE 0x01/* short high output on raising edge */ 168 * the value written to ports to test existence. PC-style ports will 169 * return the value written. AT-style ports will return 0. so why not 170 * make them the same ? 172 #define LP_DUMMY 0x00 175 * This is the port delay time, in microseconds. 176 * It is used only in the lp_init() and lp_reset() routine. 180 #define LP_POLLED(minor) (lp_table[(minor)].polled) 181 #define LP_PREEMPTED(minor) (lp_table[(minor)].dev->port->waithead != NULL) 184 * function prototypes 187 externintlp_init(void);