⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 async.h

📁 异步通讯C语言例行子程序
💻 H
字号:
///////
// Include for use with ASYNCx.LIB.
///////

////
// The following #defines should be used with a_close(), a_getmcr(),
// and a_setmcr() functions.
////
#define MCR_DTR  1  // Turns DTR on.
#define MCR_RTS  2  // Turns RTS on.
#define MCR_OUT1 4  // Makes modem inactive.
#define MCR_LOOP 16 // Puts modem into "local echo" mode.

#define PAR_NONE  0
#define PAR_ODD   1
#define PAR_EVEN  3
#define PAR_MARK  5
#define PAR_SPACE 7

#define a_icount(p) ((p)->icount)
#define a_ocount(p) ((p)->ocount)

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 0 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(int port,int baud,int par,int dbits,
              int sbits,int ibufsize,int obufsize);
int a_params(ASYNC *p,int baud,int par,int dbits,int 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,int xon,int 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);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -