home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / djasy10d.zip / DJASYNC.H < prev    next >
C/C++ Source or Header  |  1992-09-06  |  1KB  |  57 lines

  1. /*
  2.     djasync.h -- prototypes for async interface routines
  3.  
  4.     created by j. alan eldridge 09/04/92
  5. */    
  6.  
  7. #ifndef DJASYNC_H
  8. #define DJASYNC_H
  9.  
  10. #define COM1    0
  11. #define COM2    1    
  12.  
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16.     
  17. int     async_init(int port);
  18. int     async_tx(int port, char c);
  19. int     async_ready(int port);
  20. int     async_rx(int port);
  21. int     async_cnt(int port);
  22. int     async_overflow(int port);
  23. void    async_flush(int port);
  24.  
  25. int     kb_ready(void);
  26. int     kb_rx(void);
  27.  
  28. #ifdef __cplusplus
  29. }
  30.  
  31. class DJAsync {
  32.     private:
  33.         int ok;    
  34.         int port;
  35.     public:
  36.             DJAsync(int p = COM1)
  37.                 { ok = async_init(port = p); }
  38.         int     Ok()
  39.                     { return ok; }
  40.         int     Tx(char c)
  41.                     { return ok ? async_tx(port,c) : -1; }
  42.         int     Rx()
  43.                     { return ok ? async_rx(port) : -1; }
  44.         int     Rdy()
  45.                     { return ok ? async_ready(port) : 0; }
  46.         int     Cnt()
  47.                     { return ok ? async_cnt(port) : -1; }
  48.         int     Ovr()
  49.                     { return ok ? async_overflow(port) : 0; }
  50.         void    Flush()
  51.                     { if (ok) async_flush(port); }
  52. };
  53.  
  54. #endif
  55.     
  56. #endif
  57.