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 #include <linux/errno.h>
   5 #include <linux/kernel.h>
   6 #include <linux/sched.h>
   7 
   8 #include <asm/io.h>
   9 #include <asm/segment.h>
  10 
  11 /*
  12  * usr/include/linux/lp.h c.1991-1992 James Wiegand
  13  * many modifications copyright (C) 1992 Michael K. Johnson
  14  */
  15 
  16 /*
  17  * Per POSIX guidelines, this module reserves the LP and lp prefixes
  18  * These are the lp_table[minor].flags flags...
  19  */
  20 #define LP_EXIST 0x0001
  21 #define LP_SELEC 0x0002
  22 #define LP_BUSY  0x0004
  23 #define LP_OFFL  0x0008
  24 #define LP_NOPA  0x0010
  25 #define LP_ERR   0x0020
  26 #define LP_ABORT 0x0040
  27 
  28 /* timeout for each character.  This is relative to bus cycles -- it
  29  * is the count in a busy loop.  THIS IS THE VALUE TO CHANGE if you
  30  * have extremely slow printing, or if the machine seems to slow down
  31  * a lot when you print.  If you have slow printing, increase this
  32  * number and recompile, and if your system gets bogged down, decrease
  33  * this number.  This can be changed with the tunelp(8) command.
  34  */
  35 
  36 #define LP_INIT_CHAR 250
  37 
  38 /* The parallel port specs apparently say that there needs to be
  39  * a .5usec wait before and after the strobe.  Since there are wildly
  40  * different computers running linux, I can't come up with a perfect
  41  * value, but since it worked well on most printers before without,
  42  * and I have seen some improvement on my computer by making it a
  43  * small number, I'll initialize it to 2.
  44  */
  45 
  46 #define LP_INIT_WAIT 2
  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 10 being .1 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 10
  59 
  60 /* IOCTL numbers */
  61 #define LPCHAR   0x0001  /* corresponds to LP_INIT_CHAR */
  62 #define LPTIME   0x0002  /* corresponds to LP_INIT_TIME */
  63 #define LPABORT  0x0004  /* call with TRUE arg to abort on error,
  64                             FALSE to retry.  Default is retry.  */
  65 #define LPWAIT   0x0008  /* corresponds to LP_INIT_WAIT */
  66 
  67 /* timeout for printk'ing a timeout, in jiffies (100ths of a second).
  68    This is also used for re-checking error conditions if LP_ABORT is
  69    not set.  This is the default behavior. */
  70 
  71 #define LP_TIMEOUT 1000
  72 
  73 #define LP_B(minor)     lp_table[(minor)].base          /* IO address */
  74 #define LP_F(minor)     lp_table[(minor)].flags         /* flags for busy, etc. */
  75 #define LP_S(minor)     inb(LP_B((minor)) + 1)          /* status port */
  76 #define LP_C(minor)     (lp_table[(minor)].base + 2)    /* control port */
  77 #define LP_CHAR(minor)  lp_table[(minor)].chars         /* busy timeout */
  78 #define LP_TIME(minor)  lp_table[(minor)].time          /* wait time */
  79 #define LP_WAIT(minor)  lp_table[(minor)].wait          /* strobe wait */
  80 
  81 /* 
  82 since we are dealing with a horribly slow device
  83 I don't see the need for a queue
  84 */
  85 struct lp_struct {
  86         int base;
  87         int flags;
  88         unsigned int chars;
  89         unsigned int time;
  90         unsigned int wait;
  91 };
  92 
  93 /* the BIOS manuals say there can be up to 4 lpt devices
  94  * but I have not seen a board where the 4th address is listed
  95  * if you have different hardware change the table below 
  96  * please let me know if you have different equipment
  97  * if you have more than 3 printers, remember to increase LP_NO
  98  */
  99 struct lp_struct lp_table[] = {
 100         { 0x3bc, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, },
 101         { 0x378, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, },
 102         { 0x278, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT, },
 103 }; 
 104 #define LP_NO 3
 105 
 106 /* 
 107  * bit defines for 8255 status port
 108  * base + 1
 109  * accessed with LP_S(minor), which gets the byte...
 110  */
 111 #define LP_PBUSY        0x80 /* active low */
 112 #define LP_PACK         0x40 /* active low */
 113 #define LP_POUTPA       0x20
 114 #define LP_PSELECD      0x10
 115 #define LP_PERRORP      0x08 /* active low*/
 116 
 117 /* 
 118  * defines for 8255 control port
 119  * base + 2 
 120  * accessed with LP_C(minor)
 121  */
 122 #define LP_PSELECP      0x08
 123 #define LP_PINITP       0x04  /* active low */
 124 #define LP_PAUTOLF      0x02
 125 #define LP_PSTROBE      0x01
 126 
 127 /* 
 128  * the value written to ports to test existence. PC-style ports will 
 129  * return the value written. AT-style ports will return 0. so why not
 130  * make them the same ? 
 131  */
 132 #define LP_DUMMY        0x00
 133 
 134 /*
 135  * This is the port delay time.  Your mileage may vary.
 136  * It is used only in the lp_init() routine.
 137  */
 138 #define LP_DELAY        150000
 139 
 140 /*
 141  * function prototypes
 142  */
 143 
 144 extern long lp_init(long);
 145 
 146 #endif

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