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  * caveat: my machine only has 1 printer @ lpt2 so lpt1 & lpt3 are 
  18  * implemented but UNTESTED
  19  *
  20  * My machine (Michael K. Johnson) has only lpt1...  dupla caveat...
  21  */
  22 
  23 /*
  24  * Per POSIX guidelines, this module reserves the LP and lp prefixes
  25  * These are the lp_table[minor].flags flags...
  26  */
  27 #define LP_EXIST 0x0001
  28 #define LP_SELEC 0x0002
  29 #define LP_BUSY  0x0004
  30 #define LP_OFFL  0x0008
  31 #define LP_NOPA  0x0010
  32 #define LP_ERR   0x0020
  33 
  34 /* timeout for each character  (This is a good case 50 Mhz computer
  35    at a poor case 10 KBS xfer rate to the printer, as best as I can
  36    tell.)  This is in instruction cycles, kinda -- it is the count
  37    in a busy loop.  THIS IS THE VALUE TO CHANGE if you have extremely
  38    slow printing, or if the machine seems to slow down a lot when you
  39    print.  If you have slow printing, increase this number and recompile,
  40    and if your system gets bogged down, decrease this number.*/
  41 #define LP_TIME_CHAR 5000
  42 
  43 /* timeout for printk'ing a timeout, in jiffies (100ths of a second).
  44    If your printer isn't printing at least one character every five seconds,
  45    you have worse problems than a slow printer driver and lp_timeout printed
  46    every five seconds while trying to print. */
  47 #define LP_TIMEOUT 5000
  48 
  49 #define LP_B(minor)     lp_table[(minor)].base          /* IO address */
  50 #define LP_F(minor)     lp_table[(minor)].flags         /* flags for busy, etc. */
  51 #define LP_S(minor)     inb(LP_B((minor)) + 1)          /* status port */
  52 #define LP_C(minor)     (lp_table[(minor)].base + 2)    /* control port */
  53 #define LP_COUNT(minor) lp_table[(minor)].count         /* last count */
  54 #define LP_TIME(minor)  lp_table[(minor)].time          /* last time */
  55 
  56 /* 
  57 since we are dealing with a horribly slow device
  58 I don't see the need for a queue
  59 */
  60 struct lp_struct {
  61         int base;
  62         int flags;
  63         int count;
  64         int time;
  65 };
  66 
  67 /* This is the starting value for the heuristic algorithm.  If you
  68  * want to tune this and have a fast printer (i.e. HPIIIP), decrease
  69  * this number, and if you have a slow printer, increase this number.
  70  * This is not stricly necessary, as the algorithm should be able to
  71  * adapt to your printer relatively quickly.
  72  * this is in hundredths of a second, the default 50 being .5 seconds.
  73  */
  74 
  75 #define LP_INIT_TIME 50
  76 
  77 /* This is our first guess at the size of the buffer on the printer,
  78  * in characters.  I am assuming a 4K buffer because most newer printers
  79  * have larger ones, which will be adapted to.  At this time, it really
  80  * doesn't matter, as this value isn't used.
  81  */
  82 
  83 #define LP_INIT_COUNT 4096
  84 
  85 /* the BIOS manuals say there can be up to 4 lpt devices
  86  * but I have not seen a board where the 4th address is listed
  87  * if you have different hardware change the table below 
  88  * please let me know if you have different equipment
  89  * if you have more than 3 printers, remember to increase LP_NO
  90  */
  91 struct lp_struct lp_table[] = {
  92         { 0x3bc, 0, LP_INIT_COUNT, LP_INIT_TIME, },
  93         { 0x378, 0, LP_INIT_COUNT, LP_INIT_TIME, },
  94         { 0x278, 0, LP_INIT_COUNT, LP_INIT_TIME, }
  95 }; 
  96 #define LP_NO 3
  97 
  98 /* 
  99  * bit defines for 8255 status port
 100  * base + 1
 101  * accessed with LP_S(minor), which gets the byte...
 102  */
 103 #define LP_PBUSY        0x80 /* active low */
 104 #define LP_PACK         0x40 /* active low */
 105 #define LP_POUTPA       0x20
 106 #define LP_PSELECD      0x10
 107 #define LP_PERRORP      0x08 /* active low*/
 108 
 109 /* 
 110  * defines for 8255 control port
 111  * base + 2 
 112  * accessed with LP_C(minor)
 113  */
 114 #define LP_PSELECP      0x08
 115 #define LP_PINITP       0x04  /* active low */
 116 #define LP_PAUTOLF      0x02
 117 #define LP_PSTROBE      0x01
 118 
 119 /* 
 120  * the value written to ports to test existence. PC-style ports will 
 121  * return the value written. AT-style ports will return 0. so why not
 122  * make them the same ? 
 123  */
 124 #define LP_DUMMY        0x00
 125 
 126 /*
 127  * This is the port delay time.  Your mileage may vary.
 128  * It is used only in the lp_init() routine.
 129  */
 130 #define LP_DELAY        150000
 131 
 132 /*
 133  * function prototypes
 134  */
 135 
 136 extern long lp_init(long);
 137 
 138 #endif

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