www.pudn.com > ASYNC13.rar > ASYNCDEF.H


/* Included in the modules of ASYNCx.LIB version 1.10 */ 
 
/* This file contains information that should be included 
   in each module of each ASYNCx.LIB file.                */ 
#define DATA  0 /* data register                     */ 
#define BAUDL 0 /* baud rate divisor (LSB)           */ 
#define IER   1 /* Interrupt Enable Register         */ 
#define BAUDH 1 /* baud rate divisor (MSB)           */ 
#define IIR   2 /* Interrupt Identification Register */ 
#define LCR   3 /* Line Control Register             */ 
#define MCR   4 /* Modem Control Register            */ 
#define LSR   5 /* Line Status Register              */ 
#define MSR   6 /* Modem Status Register             */ 
 
#define XON  0x11 
#define XOFF 0x13 
 
#define a_icount(p) ((p)->icount) 
#define a_ocount(p) ((p)->ocount) 
 
typedef unsigned char byte; 
typedef unsigned word; 
 
typedef struct 
 {unsigned      base;      /* base address of async port                      */ 
  unsigned char *ibuf;     /* points to buffer for incomming data             */ 
  unsigned char *ibufend;  /* points 1 byte past end of input buffer          */ 
  unsigned char *ibufhead; /* next available byte in input buffer             */ 
  unsigned char *ibuftail; /* next byte to be read from input buffer          */ 
  unsigned      icount;    /* number of characters in the buffer              */ 
  unsigned char *obuf;     /* points to buffer for outgoing data              */ 
  unsigned char *obufend;  /* points 1 byte past end of output buffer         */ 
  unsigned char *obufhead; /* next available unsigned char in output buffer   */ 
  unsigned char *obuftail; /* next byte to be put into output buffer          */ 
  unsigned      ocount;    /* number of characters in the output buffer       */ 
  unsigned      xon;       /* either 0 or the level at which to send an XON   */ 
  unsigned      xoff;      /* either -1 or the level at which to send an XOFF */ 
  unsigned char lookx;     /* TRUE iff we must recognize xon/xoff             */ 
  unsigned char sentxoff;  /* TRUE iff an XOFF has been sent.                 */ 
  unsigned char recvxoff;  /* TRUE iff we received an XOFF.                   */ 
 } ASYNC; 
 
/*************************/ 
/** function prototypes **/ 
/*************************/ 
int a_break(ASYNC *p,int count); 
ASYNC *a_close(ASYNC *p,int fc); 
int a_eof(ASYNC *p,int t); 
int a_getc(ASYNC *p); 
char *a_gets(char *s,int n,ASYNC *p,int t); 
int a_getlcr(ASYNC *p); 
int a_getlsr(ASYNC *p); 
int a_getmcr(ASYNC *p); 
int a_getmsr(ASYNC *p); 
int a_iflush(ASYNC *p); 
int a_oflush(ASYNC *p); 
ASYNC *a_open(word port,word baud,word par,word dbits, 
              word sbits,word ibufsize,word obufsize); 
int a_params(ASYNC *p,word baud,word par,word dbits,word sbits); 
int a_portno(ASYNC *p); 
int a_printf(ASYNC *p,char *format,...); 
int a_putc(int c,ASYNC *p); 
int a_puts(char *s,ASYNC *p); 
int a_read(void *buf,int size,int n,ASYNC *p,int t); 
void a_setlcr(ASYNC *p,int newval); 
void a_setmcr(ASYNC *p,int newval); 
int a_setxonoff(ASYNC *p,word xon,word xoff); 
int a_ungetc(int c,ASYNC *p); 
int a_waitfor(ASYNC *port,char *s,int t,int mode); 
int a_waitquiet(ASYNC *port,int t,int max,int mode); 
int a_write(void *buf,int size,int n,ASYNC *p);