home *** CD-ROM | disk | FTP | other *** search
- /* asibstat.c
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1985-1990 Greenleaf Software Inc. All Rights Reserved.
- *
- * unsigned asibstat(port)
- * int port; -Port 0..MAX_PORT-1
- *
- * DESCRIPTION
- * This function returns the current value of the chst_bits (port
- * status bits) in the PORT_TABLE structure for the specified
- * port.
- *
- * SIDE EFFECTS
- * none
- *
- * RETURNS
- *
- * 8 bits buffer status - See manual for details.
- *
- * Because it is not possible to differentiate between an error and the
- * status bits returned in the high order byte of the return value it is
- * necessary to return any errors in the global variable _aserror.
- *
- * _aserror =
- *
- * Value Meaning
- * ------- --------
- * ASSUCCESS Success (no error)
- * ASINVPORT Requested port is out of range
- * ASNOTSETUP Requested port not setup with asifirst()
- *
- * MODIFICATIONS
- *
- * 11-02-85 ""
- * Modified for release 2.0
- * 12-30-85 Replaced literals with CONSTANTS from asiports.h
- *
- */
- #include <stdio.h>
- #include "gf.h"
- #include "asiports.h"
-
- unsigned GF_CONV asibstat(port)
- int port;
- {
-
- struct PORT_TABLE * GF_CONV _aschkcnl(),*p;
- unsigned retval=0;
-
- if((p=_aschkcnl(port))==NULL)
- return(0);
- if(p->chst_bits.alert)
- retval|=ALERT;
- if(p->chst_bits.rxempty)
- retval|=RXEMPTY;
- if(p->chst_bits.rxfull)
- retval|=RXFULL;
- if(p->chst_bits.rxovflow)
- retval|=RXOVFLOW;
- if(p->chst_bits.txempty)
- retval|=TXEMPTY;
- if(p->chst_bits.txfull)
- retval|=TXFULL;
- if(p->chst_bits.linerr)
- retval|=LINERR;
- if(p->chst_bits.modchg)
- retval|=MODCHG;
- return(retval);
- }
-