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