root/include/linux/lp.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #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 
  24 /* timeout for each character.  This is relative to bus cycles -- it
  25  * is the count in a busy loop.  THIS IS THE VALUE TO CHANGE if you
  26  * have extremely slow printing, or if the machine seems to slow down
  27  * a lot when you print.  If you have slow printing, increase this
  28  * number and recompile, and if your system gets bogged down, decrease
  29  * this number.  This can be changed with the tunelp(8) command as well.
  30  */
  31 
  32 #define LP_INIT_CHAR 1000
  33 
  34 /* The parallel port specs apparently say that there needs to be
  35  * a .5usec wait before and after the strobe.  Since there are wildly
  36  * different computers running linux, I can't come up with a perfect
  37  * value, but since it worked well on most printers before without,
  38  * I'll initialize it to 0.
  39  */
  40 
  41 #define LP_INIT_WAIT 0
  42 
  43 /* This is the amount of time that the driver waits for the printer to
  44  * catch up when the printer's buffer appears to be filled.  If you
  45  * want to tune this and have a fast printer (i.e. HPIIIP), decrease
  46  * this number, and if you have a slow printer, increase this number.
  47  * This is in hundredths of a second, the default 2 being .05 second.
  48  * Or use the tunelp(8) command, which is especially nice if you want
  49  * change back and forth between character and graphics printing, which
  50  * are wildly different...
  51  */
  52 
  53 #define LP_INIT_TIME 2
  54 
  55 /* IOCTL numbers */
  56 #define LPCHAR   0x0601  /* corresponds to LP_INIT_CHAR */
  57 #define LPTIME   0x0602  /* corresponds to LP_INIT_TIME */
  58 #define LPABORT  0x0604  /* call with TRUE arg to abort on error,
  59                             FALSE to retry.  Default is retry.  */
  60 #define LPSETIRQ 0x0605  /* call with new IRQ number,
  61                             or 0 for polling (no IRQ) */
  62 #define LPGETIRQ 0x0606  /* get the current IRQ number */
  63 #define LPWAIT   0x0608  /* corresponds to LP_INIT_WAIT */
  64 #define LPCAREFUL   0x0609  /* call with TRUE arg to require out-of-paper, off-
  65                             line, and error indicators good on all writes,
  66                             FALSE to ignore them.  Default is ignore. */
  67 #define LPABORTOPEN 0x060a  /* call with TRUE arg to abort open() on error,
  68                             FALSE to ignore error.  Default is ignore.  */
  69 #define LPGETSTATUS 0x060b  /* return LP_S(minor) */
  70 #define LPRESET     0x060c  /* reset printer */
  71 
  72 /* timeout for printk'ing a timeout, in jiffies (100ths of a second).
  73    This is also used for re-checking error conditions if LP_ABORT is
  74    not set.  This is the default behavior. */
  75 
  76 #define LP_TIMEOUT_INTERRUPT    (60 * HZ)
  77 #define LP_TIMEOUT_POLLED       (10 * HZ)
  78 
  79 #define LP_B(minor)     lp_table[(minor)].base          /* IO address */
  80 #define LP_F(minor)     lp_table[(minor)].flags         /* flags for busy, etc. */
  81 #define LP_S(minor)     inb_p(LP_B((minor)) + 1)        /* status port */
  82 #define LP_C(minor)     (lp_table[(minor)].base + 2)    /* control port */
  83 #define LP_CHAR(minor)  lp_table[(minor)].chars         /* busy timeout */
  84 #define LP_TIME(minor)  lp_table[(minor)].time          /* wait time */
  85 #define LP_WAIT(minor)  lp_table[(minor)].wait          /* strobe wait */
  86 #define LP_IRQ(minor)   lp_table[(minor)].irq           /* interrupt # */
  87                                                         /* 0 means polled */
  88 
  89 #define LP_BUFFER_SIZE 256
  90 
  91 struct lp_struct {
  92         int base;
  93         unsigned int irq;
  94         int flags;
  95         unsigned int chars;
  96         unsigned int time;
  97         unsigned int wait;
  98         struct wait_queue *lp_wait_q;
  99         char *lp_buffer;
 100 };
 101 
 102 /*
 103  * The following constants describe the various signals of the printer port
 104  * hardware.  Note that the hardware inverts some signals and that some
 105  * signals are active low.  An example is LP_STROBE, which must be programmed
 106  * with 1 for being active and 0 for being inactive, because the strobe signal
 107  * gets inverted, but it is also active low.
 108  */
 109 
 110 /* 
 111  * bit defines for 8255 status port
 112  * base + 1
 113  * accessed with LP_S(minor), which gets the byte...
 114  */
 115 #define LP_PBUSY        0x80  /* inverted input, active high */
 116 #define LP_PACK         0x40  /* unchanged input, active low */
 117 #define LP_POUTPA       0x20  /* unchanged input, active high */
 118 #define LP_PSELECD      0x10  /* unchanged input, active high */
 119 #define LP_PERRORP      0x08  /* unchanged input, active low */
 120 
 121 /* 
 122  * defines for 8255 control port
 123  * base + 2 
 124  * accessed with LP_C(minor)
 125  */
 126 #define LP_PINTEN       0x10
 127 #define LP_PSELECP      0x08  /* inverted output, active low */
 128 #define LP_PINITP       0x04  /* unchanged output, active low */
 129 #define LP_PAUTOLF      0x02  /* inverted output, active low */
 130 #define LP_PSTROBE      0x01  /* inverted output, active low */
 131 
 132 /* 
 133  * the value written to ports to test existence. PC-style ports will 
 134  * return the value written. AT-style ports will return 0. so why not
 135  * make them the same ? 
 136  */
 137 #define LP_DUMMY        0x00
 138 
 139 /*
 140  * This is the port delay time.  Your mileage may vary.
 141  * It is used only in the lp_init() routine.
 142  */
 143 #define LP_DELAY        150000
 144 
 145 /*
 146  * function prototypes
 147  */
 148 
 149 extern long lp_init(long);
 150 
 151 #endif

/* [previous][next][first][last][top][bottom][index][help] */