home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-1.ZIP / GCOMM / ASIMSTAT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-14  |  1.4 KB  |  58 lines

  1. /* asimstat.c
  2. *
  3. * The Greenleaf Comm Library
  4. *
  5. * Copyright (C) 1985-1990 Greenleaf Software Inc.  All Rights Reserved.
  6. *
  7. *  unsigned asimstat(port,opt)
  8. *  int port;            - Port 0..MAX_PORT-1
  9. *  int opt;             - IMMEDIATE or CUMULATIVE
  10. *
  11. * DESCRIPTION
  12. *  This function reads the modem status of the port's 8250 or the static
  13. *  status from the structure.
  14. *
  15. * SIDE EFFECTS
  16. *  none
  17. *
  18. * RETURNS
  19. *  The low-order 8 bits == 8250's modem status register (or same from struc).
  20. *  Errors are returned in the global variable _aserror.
  21. *
  22. *       _aserror =
  23. *
  24. *       Value           Meaning
  25. *     -------          --------
  26. *       ASSUCCESS       Successful (no error)
  27. *       ASINVPORT       Requested port is out of range
  28. *       ASNOTSETUP      Requested port not setup with asifirst()
  29. *       ASINVPAR        Invalid parameter
  30. *
  31. * MODIFICATIONS
  32. *
  33. *  11-02-85     ""
  34. *               Modified for release 2.0
  35. */
  36. #include <stdio.h>
  37. #include "gf.h"
  38. #include "asiports.h"
  39.  
  40. unsigned GF_CONV asimstat(port,opt)
  41. int port,opt;
  42. {
  43.         struct PORT_TABLE *p;
  44.  
  45.         if((p=_aschkcnl(port))==NULL)
  46.                 return(0);
  47.         if(opt != IMMEDIATE && opt != CUMULATIVE) {
  48.                 _aserror = ASINVPAR;
  49.                 return(0);
  50.         }
  51.         if(opt==IMMEDIATE)
  52.                 return((unsigned)_asinb(p->base_8250+6));
  53.         else
  54.                 return(p->modem_stat&0xff);
  55.  
  56. }
  57.  
  58.