OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [lp.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _LINUX_LP_H
2
#define _LINUX_LP_H
3
 
4
/*
5
 * usr/include/linux/lp.h c.1991-1992 James Wiegand
6
 * many modifications copyright (C) 1992 Michael K. Johnson
7
 * Interrupt support added 1993 Nigel Gamble
8
 */
9
 
10
/*
11
 * Per POSIX guidelines, this module reserves the LP and lp prefixes
12
 * These are the lp_table[minor].flags flags...
13
 */
14
#define LP_EXIST 0x0001
15
#define LP_SELEC 0x0002
16
#define LP_BUSY  0x0004
17
#define LP_OFFL  0x0008
18
#define LP_NOPA  0x0010
19
#define LP_ERR   0x0020
20
#define LP_ABORT 0x0040
21
#define LP_CAREFUL 0x0080
22
#define LP_ABORTOPEN 0x0100
23
#define LP_STRICT 0x0200
24
 
25
/* timeout for each character.  This is relative to bus cycles -- it
26
 * is the count in a busy loop.  THIS IS THE VALUE TO CHANGE if you
27
 * have extremely slow printing, or if the machine seems to slow down
28
 * a lot when you print.  If you have slow printing, increase this
29
 * number and recompile, and if your system gets bogged down, decrease
30
 * this number.  This can be changed with the tunelp(8) command as well.
31
 */
32
 
33
#define LP_INIT_CHAR 1000
34
 
35
/* The parallel port specs apparently say that there needs to be
36
 * a .5usec wait before and after the strobe.  Since there are wildly
37
 * different computers running linux, I can't come up with a perfect
38
 * value, but since it worked well on most printers before without,
39
 * I'll initialize it to 0.
40
 */
41
 
42
#define LP_INIT_WAIT 0
43
 
44
/* This is the amount of time that the driver waits for the printer to
45
 * catch up when the printer's buffer appears to be filled.  If you
46
 * want to tune this and have a fast printer (i.e. HPIIIP), decrease
47
 * this number, and if you have a slow printer, increase this number.
48
 * This is in hundredths of a second, the default 2 being .05 second.
49
 * Or use the tunelp(8) command, which is especially nice if you want
50
 * change back and forth between character and graphics printing, which
51
 * are wildly different...
52
 */
53
 
54
#define LP_INIT_TIME 2
55
 
56
/* IOCTL numbers */
57
#define LPCHAR   0x0601  /* corresponds to LP_INIT_CHAR */
58
#define LPTIME   0x0602  /* corresponds to LP_INIT_TIME */
59
#define LPABORT  0x0604  /* call with TRUE arg to abort on error,
60
                            FALSE to retry.  Default is retry.  */
61
#define LPSETIRQ 0x0605  /* call with new IRQ number,
62
                            or 0 for polling (no IRQ) */
63
#define LPGETIRQ 0x0606  /* get the current IRQ number */
64
#define LPWAIT   0x0608  /* corresponds to LP_INIT_WAIT */
65
#define LPCAREFUL   0x0609  /* call with TRUE arg to require out-of-paper, off-
66
                            line, and error indicators good on all writes,
67
                            FALSE to ignore them.  Default is ignore. */
68
#define LPABORTOPEN 0x060a  /* call with TRUE arg to abort open() on error,
69
                            FALSE to ignore error.  Default is ignore.  */
70
#define LPGETSTATUS 0x060b  /* return LP_S(minor) */
71
#define LPRESET     0x060c  /* reset printer */
72
#define LPGETSTATS  0x060d  /* get statistics (struct lp_stats) */
73
#define LPGETFLAGS  0x060e  /* get status flags */
74
#define LPSTRICT    0x060f  /* enable/disable strict compliance */
75
 
76
/* timeout for printk'ing a timeout, in jiffies (100ths of a second).
77
   This is also used for re-checking error conditions if LP_ABORT is
78
   not set.  This is the default behavior. */
79
 
80
#define LP_TIMEOUT_INTERRUPT    (60 * HZ)
81
#define LP_TIMEOUT_POLLED       (10 * HZ)
82
 
83
#define LP_B(minor)     lp_table[(minor)].base          /* IO address */
84
#define LP_F(minor)     lp_table[(minor)].flags         /* flags for busy, etc. */
85
#define LP_S(minor)     inb_p(LP_B((minor)) + 1)        /* status port */
86
#define LP_C(minor)     (lp_table[(minor)].base + 2)    /* control port */
87
#define LP_CHAR(minor)  lp_table[(minor)].chars         /* busy timeout */
88
#define LP_TIME(minor)  lp_table[(minor)].time          /* wait time */
89
#define LP_WAIT(minor)  lp_table[(minor)].wait          /* strobe wait */
90
#define LP_IRQ(minor)   lp_table[(minor)].irq           /* interrupt # */
91
                                                        /* 0 means polled */
92
#define LP_STAT(minor)  lp_table[(minor)].stats         /* statistics area */
93
 
94
#define LP_BUFFER_SIZE 256
95
 
96
struct lp_stats {
97
        unsigned long chars;
98
        unsigned long sleeps;
99
        unsigned int maxrun;
100
        unsigned int maxwait;
101
        unsigned int meanwait;
102
        unsigned int mdev;
103
};
104
 
105
struct lp_struct {
106
        int base;
107
        unsigned int irq;
108
        int flags;
109
        unsigned int chars;
110
        unsigned int time;
111
        unsigned int wait;
112
        struct wait_queue *lp_wait_q;
113
        char *lp_buffer;
114
        unsigned int lastcall;
115
        unsigned int runchars;
116
        unsigned int waittime;
117
        struct lp_stats stats;
118
};
119
 
120
/*
121
 * The following constants describe the various signals of the printer port
122
 * hardware.  Note that the hardware inverts some signals and that some
123
 * signals are active low.  An example is LP_STROBE, which must be programmed
124
 * with 1 for being active and 0 for being inactive, because the strobe signal
125
 * gets inverted, but it is also active low.
126
 */
127
 
128
/*
129
 * bit defines for 8255 status port
130
 * base + 1
131
 * accessed with LP_S(minor), which gets the byte...
132
 */
133
#define LP_PBUSY        0x80  /* inverted input, active high */
134
#define LP_PACK         0x40  /* unchanged input, active low */
135
#define LP_POUTPA       0x20  /* unchanged input, active high */
136
#define LP_PSELECD      0x10  /* unchanged input, active high */
137
#define LP_PERRORP      0x08  /* unchanged input, active low */
138
 
139
/*
140
 * defines for 8255 control port
141
 * base + 2
142
 * accessed with LP_C(minor)
143
 */
144
#define LP_PINTEN       0x10  /* high to read data in or-ed with data out */
145
#define LP_PSELECP      0x08  /* inverted output, active low */
146
#define LP_PINITP       0x04  /* unchanged output, active low */
147
#define LP_PAUTOLF      0x02  /* inverted output, active low */
148
#define LP_PSTROBE      0x01  /* short high output on raising edge */
149
 
150
/*
151
 * the value written to ports to test existence. PC-style ports will
152
 * return the value written. AT-style ports will return 0. so why not
153
 * make them the same ?
154
 */
155
#define LP_DUMMY        0x00
156
 
157
/*
158
 * This is the port delay time, in microseconds.
159
 * It is used only in the lp_init() and lp_reset() routine.
160
 */
161
#define LP_DELAY        50
162
 
163
/*
164
 * function prototypes
165
 */
166
 
167
extern int lp_init(void);
168
 
169
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.