break.c

来自「异步通讯C语言例行子程序」· C语言 代码 · 共 26 行

C
26
字号
/* A module of ASYNCx.LIB version 1.02 */

#include <dos.h>
#include "asyncdef.h"

/************************************************/
/** turn on the BREAK signal for between count **/
/** and count+1 eighteenths of a second.       **/
/************************************************/
int a_break(ASYNC *p,int count)
{unsigned long t0;
 unsigned long far *t1;
 byte lcr;
 if (p)
  {t1=(unsigned long far *)MK_FP(0x40,0x6c);
   t0=*t1;
   lcr=inportb(p->base+LCR);
   outportb(p->base+LCR,lcr | 0x40); /* turn on the BREAK signal     */
   while(*(t1)-t0<=(long)count);     /* wait for count ticks to pass */
   outportb(p->base+LCR,lcr);        /* turn off the BREAK signal    */
   return 0;
  }
 return -1;
} /* end of a_break(p,count) */

⌨️ 快捷键说明

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