Fork me on GitHub

root/include/fiwix/lp.h

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

INCLUDED FROM


   1 /*
   2  * fiwix/include/fiwix/lp.h
   3  *
   4  * Copyright 2018, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #ifndef _FIWIX_LP_H
   9 #define _FIWIX_LP_H
  10 
  11 #include <fiwix/fs.h>
  12 
  13 #define LP_MAJOR        6       /* major number for /dev/lp[n] */
  14 #define LP_MINORS       1
  15 
  16 /*#define LP0_ADDR      0x3BC */
  17 #define LP0_ADDR        0x378
  18 /*#define LP2_ADDR      0x278 */
  19 
  20 #define LP_STAT_ERR     0x08    /* printer error */
  21 #define LP_STAT_SEL     0x10    /* select in */
  22 #define LP_STAT_PE      0x20    /* paper empty or no paper */
  23 #define LP_STAT_ACK     0x40    /* ack */
  24 #define LP_STAT_BUS     0x80    /* printer busy */
  25 
  26 #define LP_CTRL_STR     0x01    /* strobe */
  27 #define LP_CTRL_AUT     0x02    /* auto line feed */
  28 #define LP_CTRL_INI     0x04    /* initialize printer (reset) */
  29 #define LP_CTRL_SEL     0x08    /* select printer */
  30 #define LP_CTRL_IRQ     0x10    /* enable IRQ */
  31 #define LP_CTRL_BID     0x20    /* bidireccional (on PS/2 ports) */
  32 
  33 #define LP_RDY_RETR     100     /* retries before timeout */
  34 
  35 struct lp {
  36         int data;       /* data port address */
  37         int stat;       /* status port address */
  38         int ctrl;       /* control port address */
  39         char flags;     /* flags */
  40 };
  41 
  42 int lp_open(struct inode *, struct fd *);
  43 int lp_close(struct inode *, struct fd *);
  44 int lp_write(struct inode *, struct fd *, const char *, __size_t);
  45 
  46 void lp_init(void);
  47 
  48 #endif /* _FIWIX_LP_H */

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