1 |
1633 |
jcastillo |
#ifndef _LINUX_LP_H
|
2 |
|
|
#define _LINUX_LP_H
|
3 |
|
|
|
4 |
|
|
/*
|
5 |
|
|
* split in two parts by Joerg Dorchain
|
6 |
|
|
* usr/include/linux/lp.h modified for Amiga by Michael Rausch
|
7 |
|
|
* modified for Atari by Andreas Schwab
|
8 |
|
|
* bug fixed by Jes Sorensen 18/8-94:
|
9 |
|
|
* It was not possible to compile the kernel only for Atari or Amiga.
|
10 |
|
|
*
|
11 |
|
|
* linux i386 version c.1991-1992 James Wiegand
|
12 |
|
|
* many modifications copyright (C) 1992 Michael K. Johnson
|
13 |
|
|
* Interrupt support added 1993 Nigel Gamble
|
14 |
|
|
*/
|
15 |
|
|
|
16 |
|
|
#include <linux/autoconf.h>
|
17 |
|
|
#include <asm/bootinfo.h>
|
18 |
|
|
|
19 |
|
|
/*
|
20 |
|
|
* Per POSIX guidelines, this module reserves the LP and lp prefixes
|
21 |
|
|
* These are the lp_table[minor].flags flags...
|
22 |
|
|
*/
|
23 |
|
|
#define LP_EXIST 0x0001
|
24 |
|
|
#define LP_BUSY 0x0004
|
25 |
|
|
#define LP_ABORT 0x0040
|
26 |
|
|
#define LP_CAREFUL 0x0080
|
27 |
|
|
#define LP_ABORTOPEN 0x0100
|
28 |
|
|
|
29 |
|
|
/* timeout for each character. This is relative to bus cycles -- it
|
30 |
|
|
* is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you
|
31 |
|
|
* have extremely slow printing, or if the machine seems to slow down
|
32 |
|
|
* a lot when you print. If you have slow printing, increase this
|
33 |
|
|
* number and recompile, and if your system gets bogged down, decrease
|
34 |
|
|
* this number. This can be changed with the tunelp(8) command as well.
|
35 |
|
|
*/
|
36 |
|
|
|
37 |
|
|
#define LP_INIT_CHAR 1000
|
38 |
|
|
|
39 |
|
|
/* The parallel port specs apparently say that there needs to be
|
40 |
|
|
* a .5usec wait before and after the strobe. Since there are wildly
|
41 |
|
|
* different computers running linux, I can't come up with a perfect
|
42 |
|
|
* value, but since it worked well on most printers before without,
|
43 |
|
|
* I'll initialize it to 0.
|
44 |
|
|
*/
|
45 |
|
|
|
46 |
|
|
#define LP_INIT_WAIT 0
|
47 |
|
|
|
48 |
|
|
/* This is the amount of time that the driver waits for the printer to
|
49 |
|
|
* catch up when the printer's buffer appears to be filled. If you
|
50 |
|
|
* want to tune this and have a fast printer (i.e. HPIIIP), decrease
|
51 |
|
|
* this number, and if you have a slow printer, increase this number.
|
52 |
|
|
* This is in hundredths of a second, the default 2 being .05 second.
|
53 |
|
|
* Or use the tunelp(8) command, which is especially nice if you want
|
54 |
|
|
* change back and forth between character and graphics printing, which
|
55 |
|
|
* are wildly different...
|
56 |
|
|
*/
|
57 |
|
|
|
58 |
|
|
#define LP_INIT_TIME 40
|
59 |
|
|
|
60 |
|
|
/* IOCTL numbers */
|
61 |
|
|
#define LPCHAR 0x0601 /* corresponds to LP_INIT_CHAR */
|
62 |
|
|
#define LPTIME 0x0602 /* corresponds to LP_INIT_TIME */
|
63 |
|
|
#define LPABORT 0x0604 /* call with TRUE arg to abort on error,
|
64 |
|
|
FALSE to retry. Default is retry. */
|
65 |
|
|
#define LPSETIRQ 0x0605 /* call with new IRQ number,
|
66 |
|
|
or 0 for polling (no IRQ) */
|
67 |
|
|
#define LPGETIRQ 0x0606 /* get the current IRQ number */
|
68 |
|
|
#define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */
|
69 |
|
|
#define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off-
|
70 |
|
|
line, and error indicators good on all writes,
|
71 |
|
|
FALSE to ignore them. Default is ignore. */
|
72 |
|
|
#define LPABORTOPEN 0x060a /* call with TRUE arg to abort open() on error,
|
73 |
|
|
FALSE to ignore error. Default is ignore. */
|
74 |
|
|
#define LPGETSTATUS 0x060b /* return LP_S(minor) */
|
75 |
|
|
#define LPRESET 0x060c /* reset printer */
|
76 |
|
|
|
77 |
|
|
/* timeout for printk'ing a timeout, in jiffies (100ths of a second).
|
78 |
|
|
This is also used for re-checking error conditions if LP_ABORT is
|
79 |
|
|
not set. This is the default behavior. */
|
80 |
|
|
|
81 |
|
|
#define LP_TIMEOUT_INTERRUPT (60 * HZ)
|
82 |
|
|
#define LP_TIMEOUT_POLLED (10 * HZ)
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
#define LP_BUFFER_SIZE 1024 /*256*/
|
86 |
|
|
|
87 |
|
|
struct lp_struct {
|
88 |
|
|
char *name;
|
89 |
|
|
unsigned int irq;
|
90 |
|
|
void (*lp_out)(int,int); /*output char function*/
|
91 |
|
|
int (*lp_is_busy)(int);
|
92 |
|
|
int (*lp_has_pout)(int);
|
93 |
|
|
int (*lp_is_online)(int);
|
94 |
|
|
int (*lp_my_interrupt)(int);
|
95 |
|
|
int flags; /*for BUSY... */
|
96 |
|
|
unsigned int chars; /*busy timeout */
|
97 |
|
|
unsigned int time; /*wait time */
|
98 |
|
|
unsigned int wait;
|
99 |
|
|
struct wait_queue *lp_wait_q; /*strobe wait */
|
100 |
|
|
char lp_buffer[LP_BUFFER_SIZE];
|
101 |
|
|
int do_print;
|
102 |
|
|
unsigned long copy_size,bytes_written;
|
103 |
|
|
};
|
104 |
|
|
|
105 |
|
|
extern struct lp_struct lp_table[];
|
106 |
|
|
|
107 |
|
|
extern int lp_init(void);
|
108 |
|
|
|
109 |
|
|
#endif
|