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 #define LP_EXIST 0x0001
28 #define LP_SELEC 0x0002
29 #define LP_BUSY 0x0004
30 #define LP_OFFL 0x0008
31 #define LP_NOPA 0x0010
32 #define LP_ERR 0x0020
33
34 #define LP_TIMEOUT 200000
35
36 #define LP_B(minor) lp_table[(minor)].base
37 #define LP_F(minor) lp_table[(minor)].flags
38 #define LP_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 struct lp_struct {
45 int base;
46 int flags;
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 struct lp_struct lp_table[] = {
57 { 0x3bc, 0, },
58 { 0x378, 0, },
59 { 0x278, 0, }
60 };
61
62 #define LP_NO 3
63
64 /*
65 * bit defines for 8255 status port
66 * base + 1
67 */
68 #define LP_PBUSY 0x80 /* active low */
69 #define LP_PACK 0x40 /* active low */
70 #define LP_POUTPA 0x20
71 #define LP_PSELECD 0x10
72 #define LP_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 #define LP_PSELECP 0x08
81 #define LP_PINITP 0x04 /* active low */
82 #define LP_PAUTOLF 0x02
83 #define LP_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 #define LP_DUMMY 0x00
91
92 /*
93 * this is the port delay time. your mileage may vary
94 */
95 #define LP_DELAY 150000
96
97 /*
98 * function prototypes
99 */
100
101 extern long lp_init(long);
102
103 #endif