root/include/linux/lp.h

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

INCLUDED FROM


   1 /*
   2 $Header: /usr/src/linux/include/linux/lp.h,v 1.2 1992/01/21 23:59:24 james_r_wiegand Exp james_r_wiegand $
   3 */
   4 
   5 #include <errno.h>
   6 #include <linux/kernel.h>
   7 #include <linux/sched.h>
   8 #include <asm/io.h>
   9 #include <asm/segment.h>
  10 
  11 /*
  12  * usr/include/linux/lp.h c.1991-1992 James Wiegand
  13  */
  14 
  15 /*
  16  * caveat: my machine only has 1 printer @ lpt2 so lpt1 & lpt3 are 
  17  * implemented but UNTESTED
  18  */
  19 
  20 /*
  21  * Per POSIX guidelines, this module reserves the LP and lp prefixes
  22  */
  23 #define LP_EXIST 0x0001
  24 #define LP_SELEC 0x0002
  25 #define LP_BUSY  0x0004
  26 #define LP_OFFL  0x0008
  27 #define LP_NOPA  0x0010
  28 #define LP_ERR   0x0020
  29 
  30 #define LP_TIMEOUT 200000
  31 
  32 #define LP_B(minor)     lp_table[(minor)].base
  33 #define LP_F(minor)     lp_table[(minor)].flags
  34 #define LP_T(minor)     lp_table[(minor)].lp_task
  35 #define LP_S(minor)     inb(LP_B((minor)) + 1)
  36 #define LP_R(minor)     lp_table[(minor)].remainder
  37 
  38 /* 
  39 since we are dealing with a horribly slow device
  40 I don't see the need for a queue
  41 */
  42 #ifndef __LP_C__
  43         extern
  44 #endif
  45 struct lp_struct {
  46         int base;
  47         int flags;
  48         /* number of characters yet to be printed in current block */
  49         int remainder;
  50         /* needed for busy determination */
  51         int lp_task;
  52 };
  53 
  54 /* 
  55  * the BIOS manuals say there can be up to 4 lpt devices
  56  * but I have not seen a board where the 4th address is listed
  57  * if you have different hardware change the table below 
  58  * please let me know if you have different equipment
  59  * if you have more than 3 printers, remember to increase LP_NO
  60  */
  61 #ifndef __LP_C__
  62         extern
  63 #endif   
  64 struct lp_struct lp_table[] = {
  65         { 0x3bc, 0, },
  66         { 0x378, 0, },
  67         { 0x278, 0, }
  68 }; 
  69 
  70 #define LP_NO 3
  71 
  72 /* 
  73  * bit defines for 8255 status port
  74  * base + 1
  75  */
  76 #define LP_PBUSY        0x80 /* active low */
  77 #define LP_PACK         0x40 /* active low */
  78 #define LP_POUTPA       0x20
  79 #define LP_PSELECD      0x10
  80 #define LP_PERRORP      0x08 /*å active low*/
  81 #define LP_PIRQ         0x04 /* active low */
  82 
  83 /* 
  84  * defines for 8255 control port
  85  * base + 2 
  86  */
  87 #define LP_PIRQEN       0x10
  88 #define LP_PSELECP      0x08
  89 #define LP_PINITP       0x04  /* active low */
  90 #define LP_PAUTOLF      0x02
  91 #define LP_PSTROBE      0x01
  92 
  93 /* 
  94  * the value written to ports to test existence. PC-style ports will 
  95  * return the value written. AT-style ports will return 0. so why not
  96  * make them the same ? 
  97  */
  98 #define LP_DUMMY        0x00
  99 
 100 /*
 101  * this is the port delay time. your mileage may vary
 102  */
 103 #define LP_DELAY        150000
 104 
 105 /*
 106  * function prototypes
 107  */
 108 
 109 extern void lp_init(void);

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