home *** CD-ROM | disk | FTP | other *** search
- /* asiclear.c
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1985-1990 Greenleaf Software Inc. All Rights Reserved.
- *
- * int asiclear( port, option)
- * int port; - Port 0..MAX_PORT-1
- * int option; - ASIN, ASOUT, or ASINOUT
- *
- * DESCRIPTION
- * clear specified buffer of any characters, ASIN = clear
- * receive buffer, ASOUT = clear transmit buffer,
- * ASINOUT = clear transmit & receive buffers. Also sets buffer
- * empty bits and clears the alert bit, and clears receiver overflow bit.
- * Clears receiver error flag, clears modem status change flag.
- *
- * SIDE EFFECTS
- * Any character(s) in buffer(s) will be lost, alert and other flags
- * lost if set.
- *
- * RETURNS
- *
- * Value Meaning
- * ------- --------
- * ASSUCCESS (no error)
- * ASINVPORT Requested port is out of range
- * ASNOTSETUP Requested port not setup with asifirst()
- * ASINVPAR Invalid parameter
- *
- * MODIFICATIONS
- * 10-25-85 ""
- * Modified for release 2.0
- */
- #include <stdio.h>
- #include "gf.h"
- #include "asiports.h"
-
-
- int GF_CONV asiclear(port,option)
- int port,option;
- {
-
- struct PORT_TABLE *p;
-
- if((p=_aschkcnl(port))==NULL)
- return(_aserror);
- switch(option) {
- case ASINOUT:
- case ASIN:
- _ascli();
- p->rx_head=p->rx_tail=p->rx_count=0;
- p->chst_bits.rxfull=p->chst_bits.rxovflow=0;
- p->chst_bits.rxempty=1;
- p->chst_bits.alert=p->chst_bits.linerr=p->chst_bits.modchg=0;
- _assti();
- if(p->chmode_bits.is_rtscontrol&&!p->chst_bits.rtsactive)
- _asrts(p->base_8250,1,p);
- if(option==ASIN)
- break;
- case ASOUT:
- _ascli();
- p->tx_head=p->tx_tail=p->tx_count=0;
- p->chst_bits.txfull=0;
- p->chst_bits.txempty=1;
- p->chst_bits.alert=p->chst_bits.modchg=0;
- _assti();
- break;
- default:
- return(ASINVPAR);
- }
- return(ASSUCCESS);
- }
-
-