home *** CD-ROM | disk | FTP | other *** search
- /* asicheck.c
- *
- * The Greenleaf Comm Library
- *
- * Copyright (C) 1985-1990 Greenleaf Software Inc. All Rights Reserved.
- *
- * int asicheck( port,condition,control )
- * int port; - Port 0..MAX_PORT-1
- * int condition; - Condition to modify
- * int control; - ON/OFF
- *
- * DESCRIPTION
- *
- * Setup to ignore or change behavior on certain conditions.
- * Returns one of the following values:
- *
- * Condition Default What is controlled
- *
- * ALERT_FLAG_STOPS_RX_AND_TX:
- *
- * OFF Alert flag does not halt sending/receiving if OFF
- *
- * ON Alert flag prevents sending or receiving if ON
- *
- * CTS_LOW_STOPS_TX_INTERRUPTS:
- *
- * OFF Clear to Send does not halt sending if OFF
- *
- * ON CTS will prevent sending characters when it is
- * low and this has been turned on.
- *
- * DSR_LOW_DISCARDS_RX_DATA:
- *
- * OFF Data Set Ready is ignored if OFF
- *
- * ON DSR will prevent receiving characters when it is
- * low and this has been turned ON
- *
- * CD_LOW_DISCARDS_RX_DATA:
- *
- * OFF Carrier Detect is ignored if OFF
- *
- * ON CD will prevent receiving characters when it is
- * low and this has been turned ON
- *
- * MODEM_STATUS_CHANGES_SET_ALERT:
- *
- * OFF Modem status changes do not affect the alert flag
- * if OFF.
- *
- * ON Any modem status change will set the alert flag
- * if this is set ON.
- *
- * LINE_STATUS_ERRORS_SET_ALERT:
- *
- * OFF Any receiver errors have no effect on the alert
- * flag if this is set off.
- *
- * ON Any receive error condition will set the alert
- * flag if this is set ON.
- *
- * The following values can be returned from this function.
- *
- * Value Meaning
- * ------- --------
- * ASSUCCESS Successful (no error)
- * ASINVPORT Requested port is out of range
- * ASNOTSETUP Requested port not setup with asifirst()
- * ASINVPAR Invalid parameter
- *
- * SIDE EFFECTS
- * If successful bits in the chmode_bits will be modified.
- *
- * MODIFICATIONS
- * 11-09-85 ""
- * Modified for release 2.0
- *
- * 20-FEB-1987 08:56:50.80
- * Renamed function asiignor() to asicheck().
- * 26-MAY-1988 09:20:24.28
- * break; statement missing in case IGCD: version 2.20, SAR# 110
- */
- #include <stdio.h>
- #include "gf.h"
- #include "asiports.h"
-
-
- int GF_CONV asicheck( port,condition,control )
- int port,condition,control;
- {
-
- struct PORT_TABLE *p;
-
- if((p=_aschkcnl(port))==NULL)
- return(_aserror);
- if(control != ON && control != OFF)
- return(ASINVPAR);
-
- switch(condition) {
-
- case ALERT_FLAG_STOPS_RX_AND_TX :
- if(control==OFF) {
- p->chmode_bits.alert_flag_stops_rx_and_tx=0;
- if(p->chst_bits.txwalert) {
- p->chst_bits.txwalert=0;
- _asiprime(p);
- }
- } else
- p->chmode_bits.alert_flag_stops_rx_and_tx=1;
- break;
-
- case CTS_LOW_STOPS_TX_INTERRUPTS :
- if(control==OFF) {
- p->chmode_bits.cts_low_holds_tx_interrupts=0;
- if(p->chst_bits.txwcts) {
- p->chst_bits.txwcts=0;
- _asiprime(p);
- }
- } else
- p->chmode_bits.cts_low_holds_tx_interrupts=1;
- break;
-
- case DSR_LOW_DISCARDS_RX_DATA :
- if(control==OFF)
- p->chmode_bits.dsr_low_discards_rx_data=0;
- else
- p->chmode_bits.dsr_low_discards_rx_data=1;
- break;
-
- case CD_LOW_DISCARDS_RX_DATA :
- if(control==OFF)
- p->chmode_bits.cd_low_discards_rx_data=0;
- else
- p->chmode_bits.cd_low_discards_rx_data=1;
- break;
-
- case MODEM_STATUS_CHANGES_SET_ALERT :
- if(control==OFF) {
- p->chmode_bits.modem_status_changes_set_alert = 0;
- if(p->chst_bits.alert &&
- p->chst_bits.modchg &&
- p->chmode_bits.alert_flag_stops_rx_and_tx)
- _asiprime(p);
- } else
- p->chmode_bits.modem_status_changes_set_alert = 1;
- break;
-
- case LINE_STATUS_ERRORS_SET_ALERT :
- if(control==OFF) {
- p->chmode_bits.line_errors_set_alert = 0;
- if(p->chst_bits.alert &&
- p->chst_bits.linerr &&
- p->chmode_bits.alert_flag_stops_rx_and_tx)
- _asiprime(p);
- } else
- p->chmode_bits.line_errors_set_alert = 1;
- break;
-
- default: return(ASINVPAR);
- }
- return(ASSUCCESS);
- }
-
- /* For compatibility, asiignore() just calls asicheck()
- */
- int GF_CONV asiignore(port,condition,control)
- int port,condition,control;
- {
- return(asicheck(port,condition,control));
- }
-