Listing 1

/* ---------- serialc.h ---------- */
/*      Serial Interface
	written by: Charles B. Allison, ATS
	Last Change: 2-28-92 14:00          */
/* *********************************** */
/* -------- hardware defines ---------- */
#define IRQ_OFF 8 /* offset int vector of irq 0 = 8 */
#define PIC01  0x21   /* 8259 mask register    */
#define PIC00  0x20   /* 8259 command register */
#define EOI    0x20   /* end  of interrupt cmd */
#define MAX_BAUD 115200L /* maximum baud rate */
#define COM1   0x3f8  /* com1:*/
#define COM2   0x2f8  /* com2:*/
#define COM3   0x3e8  /* com3:*/
#define COM4   0x2e8  /* com4:*/
#define IRQ3 0x3    /* irq number */
#define IRQ4 0x4    /* irq number */
#define IRQ5 0x5    /* irq number */
#define BASE     base
#define TXD      BASE
#define RXD      BASE
#define DIVLSB   BASE
#define DIVMSB   (BASE+1)
#define INTEN    (BASE+1)
#define INTID    (BASE+2)
#define FIFOC    (BASE+2)
#define LINECTL  (BASE+3)
#define MODEMCTL (BASE+4)
#define LINESTAT (BASE+5)
#define MODMSTAT (BASE+6)
/* line control register base+3*/
#define DLAB 0x80 /* divisor latch enable */
/* modem control MODEMCTL base+4 */
#define LOOPS   0x10 /* should be low */
#define GPOUT2  8  /*card intrp enable? high */
#define RTS     2  /* request to send */
#define GPOUT1  4  /* oncard reset? keep low */
#define RTS     2  /* request to send */
#define DTR     1  /* data terminal ready */
/* Modem status MODMSTAT base+6 */
#define DCD  0x80  /* carrier detect input*/
#define RI   0x40  /* ring indicator input*/
#define DSR  0x20  /* data set ready inpu */
#define CTS  0x10  /* clear to send input */
#define DDCD 0x08  /* change in carrier detect*/
#define DRI  0x04  /* change in ring indicator*/
#define DDSR 0x02  /* change in data set ready */
#define DCTS 0x01  /* change in clear to send */
/* line status reg LINESTAT base+5 */
#define FRE    0x80 /* rx FIFO has error */
#define TXE    0x40 /* tx shift reg empty */
#define TBE    0x20 /* tx buffer empty */
#define BREAK  0x10 /* break detected */
#define FE_ERR 0x08 /* rx framing error */
#define PE_ERR 0x04 /* rx parity error */
#define OE_ERR 0x02 /* rx overrun error */
#define RXRDY  0x01 /* input data rdy */
typedef struct {
   char line,modem;/* register values */
   int  inbufc,outbufc,overflow;
} COM_STAT;
typedef struct {
   unsigned abase,divisor;  /*address, divisor */
   char fifo,datin,line,modem;
} COM;
typedef struct {
     char *buffer, *next_in,*next_out,*end_que;
     int buff_cnt,overflow;
	       } CQUEUE;
/* ---------- end serialc.h ------------ */

