Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lp.h
Go to the documentation of this file.
1 /*
2  * usr/include/linux/lp.h c.1991-1992 James Wiegand
3  * many modifications copyright (C) 1992 Michael K. Johnson
4  * Interrupt support added 1993 Nigel Gamble
5  * Removed 8255 status defines from inside __KERNEL__ Marcelo Tosatti
6  */
7 #ifndef _LINUX_LP_H
8 #define _LINUX_LP_H
9 
10 
11 #include <linux/wait.h>
12 #include <linux/mutex.h>
13 #include <uapi/linux/lp.h>
14 
15 /* Magic numbers for defining port-device mappings */
16 #define LP_PARPORT_UNSPEC -4
17 #define LP_PARPORT_AUTO -3
18 #define LP_PARPORT_OFF -2
19 #define LP_PARPORT_NONE -1
20 
21 #define LP_F(minor) lp_table[(minor)].flags /* flags for busy, etc. */
22 #define LP_CHAR(minor) lp_table[(minor)].chars /* busy timeout */
23 #define LP_TIME(minor) lp_table[(minor)].time /* wait time */
24 #define LP_WAIT(minor) lp_table[(minor)].wait /* strobe wait */
25 #define LP_IRQ(minor) lp_table[(minor)].dev->port->irq /* interrupt # */
26  /* PARPORT_IRQ_NONE means polled */
27 #ifdef LP_STATS
28 #define LP_STAT(minor) lp_table[(minor)].stats /* statistics area */
29 #endif
30 #define LP_BUFFER_SIZE PAGE_SIZE
31 
32 #define LP_BASE(x) lp_table[(x)].dev->port->base
33 
34 #ifdef LP_STATS
35 struct lp_stats {
36  unsigned long chars;
37  unsigned long sleeps;
38  unsigned int maxrun;
39  unsigned int maxwait;
40  unsigned int meanwait;
41  unsigned int mdev;
42 };
43 #endif
44 
45 struct lp_struct {
46  struct pardevice *dev;
47  unsigned long flags;
48  unsigned int chars;
49  unsigned int time;
50  unsigned int wait;
51  char *lp_buffer;
52 #ifdef LP_STATS
53  unsigned int lastcall;
54  unsigned int runchars;
55  struct lp_stats stats;
56 #endif
58  unsigned int last_error;
59  struct mutex port_mutex;
61  long timeout;
62  unsigned int best_mode;
63  unsigned int current_mode;
64  unsigned long bits;
65 };
66 
67 /*
68  * The following constants describe the various signals of the printer port
69  * hardware. Note that the hardware inverts some signals and that some
70  * signals are active low. An example is LP_STROBE, which must be programmed
71  * with 1 for being active and 0 for being inactive, because the strobe signal
72  * gets inverted, but it is also active low.
73  */
74 
75 
76 /*
77  * defines for 8255 control port
78  * base + 2
79  * accessed with LP_C(minor)
80  */
81 #define LP_PINTEN 0x10 /* high to read data in or-ed with data out */
82 #define LP_PSELECP 0x08 /* inverted output, active low */
83 #define LP_PINITP 0x04 /* unchanged output, active low */
84 #define LP_PAUTOLF 0x02 /* inverted output, active low */
85 #define LP_PSTROBE 0x01 /* short high output on raising edge */
86 
87 /*
88  * the value written to ports to test existence. PC-style ports will
89  * return the value written. AT-style ports will return 0. so why not
90  * make them the same ?
91  */
92 #define LP_DUMMY 0x00
93 
94 /*
95  * This is the port delay time, in microseconds.
96  * It is used only in the lp_init() and lp_reset() routine.
97  */
98 #define LP_DELAY 50
99 
100 #endif