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 / ASILSTAT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-14  |  1.4 KB  |  57 lines

  1. /* asilstat.c
  2. *
  3. * The Greenleaf Comm Library
  4. *
  5. * Copyright (C) 1985-1990 Greenleaf Software Inc.  All Rights Reserved.
  6. *
  7. *  unsigned asilstat(port,opt)
  8. *  int port;            - Port 0..MAX_PORT-1
  9. *  int opt;             - IMMEDIATE or CUMULATIVE
  10. *
  11. * DESCRIPTION
  12. *  This function reads the line status of the port's 8250 or gets static
  13. *  line status from the internal structure.
  14. *
  15. * SIDE EFFECTS
  16. *  none
  17. *
  18. * RETURNS
  19. *  The low-order 8 bits == 8250's line 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. *  11-02-85     ""
  33. *               Modified for release 2.0
  34. */
  35. #include <stdio.h>
  36. #include "gf.h"
  37. #include "asiports.h"
  38.  
  39. unsigned GF_CONV asilstat(port,opt)
  40. int port,opt;
  41. {
  42.         struct PORT_TABLE *p;
  43.  
  44.         if((p=_aschkcnl(port))==NULL)
  45.                 return(0);
  46.         if(opt != IMMEDIATE && opt != CUMULATIVE) {
  47.                 _aserror = ASINVPAR;
  48.                 return(0);
  49.         }
  50.         if(opt==IMMEDIATE)
  51.                 return((unsigned)_asinb(p->base_8250+5));
  52.         else
  53.                 return(p->line_stat&0xff);
  54.  
  55. }
  56.  
  57.