home *** CD-ROM | disk | FTP | other *** search
- /* asimstat.c
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1985-1990 Greenleaf Software Inc. All Rights Reserved.
- *
- * unsigned asimstat(port,opt)
- * int port; - Port 0..MAX_PORT-1
- * int opt; - IMMEDIATE or CUMULATIVE
- *
- * DESCRIPTION
- * This function reads the modem status of the port's 8250 or the static
- * status from the structure.
- *
- * SIDE EFFECTS
- * none
- *
- * RETURNS
- * The low-order 8 bits == 8250's modem status register (or same from struc).
- * Errors are returned in the global variable _aserror.
- *
- * _aserror =
- *
- * Value Meaning
- * ------- --------
- * ASSUCCESS Successful (no error)
- * ASINVPORT Requested port is out of range
- * ASNOTSETUP Requested port not setup with asifirst()
- * ASINVPAR Invalid parameter
- *
- * MODIFICATIONS
- *
- * 11-02-85 ""
- * Modified for release 2.0
- */
- #include <stdio.h>
- #include "gf.h"
- #include "asiports.h"
-
- unsigned GF_CONV asimstat(port,opt)
- int port,opt;
- {
- struct PORT_TABLE *p;
-
- if((p=_aschkcnl(port))==NULL)
- return(0);
- if(opt != IMMEDIATE && opt != CUMULATIVE) {
- _aserror = ASINVPAR;
- return(0);
- }
- if(opt==IMMEDIATE)
- return((unsigned)_asinb(p->base_8250+6));
- else
- return(p->modem_stat&0xff);
-
- }
-
-