1 /* 2 $Header: /usr/src/linux/include/linux/lp.h,v 1.2 1992/01/21 23:59:24 james_r_wiegand Exp james_r_wiegand $ 3 */ 4
5 #include <errno.h>
6 #include <linux/kernel.h>
7 #include <linux/sched.h>
8 #include <asm/io.h>
9 #include <asm/segment.h>
10
11 /* 12 * usr/include/linux/lp.h c.1991-1992 James Wiegand 13 */ 14
15 /* 16 * caveat: my machine only has 1 printer @ lpt2 so lpt1 & lpt3 are 17 * implemented but UNTESTED 18 */ 19
20 /* 21 * Per POSIX guidelines, this module reserves the LP and lp prefixes 22 */ 23 #defineLP_EXIST 0x0001
24 #defineLP_SELEC 0x0002
25 #defineLP_BUSY 0x0004
26 #define LP_OFFL 0x0008
27 #defineLP_NOPA 0x0010
28 #defineLP_ERR 0x0020
29
30 #defineLP_TIMEOUT 200000
31
32 #defineLP_B(minor) lp_table[(minor)].base 33 #defineLP_F(minor) lp_table[(minor)].flags 34 #defineLP_T(minor) lp_table[(minor)].lp_task 35 #defineLP_S(minor) inb(LP_B((minor)) + 1)
36 #defineLP_R(minor) lp_table[(minor)].remainder 37
38 /* 39 since we are dealing with a horribly slow device 40 I don't see the need for a queue 41 */ 42 #ifndef__LP_C__ 43 extern 44 #endif 45 structlp_struct{ 46 intbase;
47 intflags;
48 /* number of characters yet to be printed in current block */ 49 intremainder;
50 /* needed for busy determination */ 51 intlp_task;
52 };
53
54 /* 55 * the BIOS manuals say there can be up to 4 lpt devices 56 * but I have not seen a board where the 4th address is listed 57 * if you have different hardware change the table below 58 * please let me know if you have different equipment 59 * if you have more than 3 printers, remember to increase LP_NO 60 */ 61 #ifndef__LP_C__ 62 extern 63 #endif 64 structlp_structlp_table[] = { 65 { 0x3bc, 0, },
66 { 0x378, 0, },
67 { 0x278, 0, } 68 };
69
70 #defineLP_NO 3
71
72 /* 73 * bit defines for 8255 status port 74 * base + 1 75 */ 76 #defineLP_PBUSY 0x80 /* active low */ 77 #define LP_PACK 0x40 /* active low */ 78 #defineLP_POUTPA 0x20
79 #defineLP_PSELECD 0x10
80 #defineLP_PERRORP 0x08 /*å active low*/ 81 #define LP_PIRQ 0x04 /* active low */ 82
83 /* 84 * defines for 8255 control port 85 * base + 2 86 */ 87 #define LP_PIRQEN 0x10
88 #defineLP_PSELECP 0x08
89 #defineLP_PINITP 0x04 /* active low */ 90 #define LP_PAUTOLF 0x02
91 #defineLP_PSTROBE 0x01
92
93 /* 94 * the value written to ports to test existence. PC-style ports will 95 * return the value written. AT-style ports will return 0. so why not 96 * make them the same ? 97 */ 98 #defineLP_DUMMY 0x00
99
100 /* 101 * this is the port delay time. your mileage may vary 102 */ 103 #defineLP_DELAY 150000
104
105 /* 106 * function prototypes 107 */ 108
109 externvoidlp_init(void);