1 #ifndef _LINUX_LP_H 2 #define _LINUX_LP_H 3 4 /* 5 * usr/include/linux/lp.h c.1991-1992 James Wiegand 6 * many modifications copyright (C) 1992 Michael K. Johnson 7 */ 8 9 /* 10 * Per POSIX guidelines, this module reserves the LP and lp prefixes 11 * These are the lp_table[minor].flags flags... 12 */ 13 #define LP_EXIST 0x0001 14 #define LP_SELEC 0x0002 15 #define LP_BUSY 0x0004 16 #define LP_OFFL 0x0008 17 #define LP_NOPA 0x0010 18 #define LP_ERR 0x0020 19 #define LP_ABORT 0x0040 20 21 /* timeout for each character. This is relative to bus cycles -- it 22 * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you 23 * have extremely slow printing, or if the machine seems to slow down 24 * a lot when you print. If you have slow printing, increase this 25 * number and recompile, and if your system gets bogged down, decrease 26 * this number. This can be changed with the tunelp(8) command as well. 27 */ 28 29 #define LP_INIT_CHAR 1000 30 31 /* The parallel port specs apparently say that there needs to be 32 * a .5usec wait before and after the strobe. Since there are wildly 33 * different computers running linux, I can't come up with a perfect 34 * value, but since it worked well on most printers before without, 35 * I'll initialize it to 0. 36 */ 37 38 #define LP_INIT_WAIT 0 39 40 /* This is the amount of time that the driver waits for the printer to 41 * catch up when the printer's buffer appears to be filled. If you 42 * want to tune this and have a fast printer (i.e. HPIIIP), decrease 43 * this number, and if you have a slow printer, increase this number. 44 * This is in hundredths of a second, the default 2 being .05 second. 45 * Or use the tunelp(8) command, which is especially nice if you want 46 * change back and forth between character and graphics printing, which 47 * are wildly different... 48 */ 49 50 #define LP_INIT_TIME 2 51 52 /* IOCTL numbers */ 53 #define LPCHAR 0x0001 /* corresponds to LP_INIT_CHAR */ 54 #define LPTIME 0x0002 /* corresponds to LP_INIT_TIME */ 55 #define LPABORT 0x0004 /* call with TRUE arg to abort on error, 56 FALSE to retry. Default is retry. */ 57 #define LPWAIT 0x0008 /* corresponds to LP_INIT_WAIT */ 58 59 /* timeout for printk'ing a timeout, in jiffies (100ths of a second). 60 This is also used for re-checking error conditions if LP_ABORT is 61 not set. This is the default behavior. */ 62 63 #define LP_TIMEOUT 1000 64 65 #define LP_B(minor) lp_table[(minor)].base /* IO address */ 66 #define LP_F(minor) lp_table[(minor)].flags /* flags for busy, etc. */ 67 #define LP_S(minor) inb_p(LP_B((minor)) + 1) /* status port */ 68 #define LP_C(minor) (lp_table[(minor)].base + 2) /* control port */ 69 #define LP_CHAR(minor) lp_table[(minor)].chars /* busy timeout */ 70 #define LP_TIME(minor) lp_table[(minor)].time /* wait time */ 71 #define LP_WAIT(minor) lp_table[(minor)].wait /* strobe wait */ 72 73 /* 74 since we are dealing with a horribly slow device 75 I don't see the need for a queue 76 */ 77 struct lp_struct { 78 int base; 79 int flags; 80 unsigned int chars; 81 unsigned int time; 82 unsigned int wait; 83 }; 84 85 /* the BIOS manuals say there can be up to 4 lpt devices 86 * but I have not seen a board where the 4th address is listed 87 * if you have different hardware change the table below 88 * please let me know if you have different equipment 89 * if you have more than 3 printers, remember to increase LP_NO 90 */ 91 struct lp_struct lp_table[] = { 92 { 0x3bc, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, }, 93 { 0x378, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, }, 94 { 0x278, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, }, 95 }; 96 #define LP_NO 3 97 98 /* 99 * bit defines for 8255 status port 100 * base + 1 101 * accessed with LP_S(minor), which gets the byte... 102 */ 103 #define LP_PBUSY 0x80 /* active low */ 104 #define LP_PACK 0x40 /* active low */ 105 #define LP_POUTPA 0x20 106 #define LP_PSELECD 0x10 107 #define LP_PERRORP 0x08 /* active low*/ 108 109 /* 110 * defines for 8255 control port 111 * base + 2 112 * accessed with LP_C(minor) 113 */ 114 #define LP_PSELECP 0x08 115 #define LP_PINITP 0x04 /* active low */ 116 #define LP_PAUTOLF 0x02 117 #define LP_PSTROBE 0x01 118 119 /* 120 * the value written to ports to test existence. PC-style ports will 121 * return the value written. AT-style ports will return 0. so why not 122 * make them the same ? 123 */ 124 #define LP_DUMMY 0x00 125 126 /* 127 * This is the port delay time. Your mileage may vary. 128 * It is used only in the lp_init() routine. 129 */ 130 #define LP_DELAY 150000 131 132 /* 133 * function prototypes 134 */ 135 136 extern long lp_init(long); 137 138 #endif