home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / BSRC_250.LZH / COM_OS2.H < prev    next >
C/C++ Source or Header  |  1991-09-15  |  9KB  |  173 lines

  1. /*--------------------------------------------------------------------------*/
  2. /*                                                                          */
  3. /*                                                                          */
  4. /*      ------------         Bit-Bucket Software, Co.                       */
  5. /*      \ 10001101 /         Writers and Distributors of                    */
  6. /*       \ 011110 /          Freely Available<tm> Software.                 */
  7. /*        \ 1011 /                                                          */
  8. /*         ------                                                           */
  9. /*                                                                          */
  10. /*  (C) Copyright 1987-91, Bit Bucket Software Co., a Delaware Corporation. */
  11. /*                                                                          */
  12. /*                                                                          */
  13. /*            This header file was written by Peter Fitzsimmons             */
  14. /*             OS/2 Communications definitions for BinkleyTerm              */
  15. /*                                                                          */
  16. /*                                                                          */
  17. /*    For complete  details  of the licensing restrictions, please refer    */
  18. /*    to the License  agreement,  which  is published in its entirety in    */
  19. /*    the MAKEFILE and BT.C, and also contained in the file LICENSE.250.    */
  20. /*                                                                          */
  21. /*    USE  OF THIS FILE IS SUBJECT TO THE  RESTRICTIONS CONTAINED IN THE    */
  22. /*    BINKLEYTERM  LICENSING  AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF    */
  23. /*    THIS  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES,  OR IF YOU DO    */
  24. /*    NOT HAVE THESE FILES,  YOU  SHOULD  IMMEDIATELY CONTACT BIT BUCKET    */
  25. /*    SOFTWARE CO.  AT ONE OF THE  ADDRESSES  LISTED BELOW.  IN NO EVENT    */
  26. /*    SHOULD YOU  PROCEED TO USE THIS FILE  WITHOUT HAVING  ACCEPTED THE    */
  27. /*    TERMS  OF  THE  BINKLEYTERM  LICENSING  AGREEMENT,  OR  SUCH OTHER    */
  28. /*    AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO.      */
  29. /*                                                                          */
  30. /*                                                                          */
  31. /* You can contact Bit Bucket Software Co. at any one of the following      */
  32. /* addresses:                                                               */
  33. /*                                                                          */
  34. /* Bit Bucket Software Co.        FidoNet  1:104/501, 1:343/491             */
  35. /* P.O. Box 460398                AlterNet 7:491/0                          */
  36. /* Aurora, CO 80046               BBS-Net  86:2030/1                        */
  37. /*                                Internet f491.n343.z1.fidonet.org         */
  38. /*                                                                          */
  39. /* Please feel free to contact us at any time to share your comments about  */
  40. /* our software and/or licensing policies.                                  */
  41. /*                                                                          */
  42. /*--------------------------------------------------------------------------*/
  43. #define TRUE 1
  44. #define FALSE 0
  45.  
  46. typedef unsigned char bool;
  47. /*
  48. typedef unsigned char byte;
  49. typedef unsigned short word;
  50. */
  51. extern void com_putc( unsigned char c );
  52. extern unsigned com_putc_now( unsigned char c );
  53. extern void com_write(char *buf, unsigned int bytes, int carcheck);
  54. extern void com_wait(void);
  55. extern int  com_getchar(void);
  56. extern int  com_peek(void);
  57. extern int  com_char_avail(void);
  58. extern bool com_out_empty(void);
  59. extern bool com_out_full(void);
  60. extern bool com_online(void);
  61. extern void com_clear_out(void);
  62. extern void com_clear_in(void);
  63. extern void com_XON_enable(void);
  64. extern void com_XON_disable(void);
  65. extern long com_cur_baud(void );
  66. extern  int com_init(int port, char far *pipe);
  67. extern  int com_fini(void);
  68. extern  int com_set_baud(unsigned rate,char parity,int databits,int stopbits);
  69. extern  void com_DTR_on(void );
  70. extern  void com_DTR_off(void );
  71. extern  void com_break(int on);
  72.  
  73. extern  void MDM_ENABLE(unsigned rate);
  74. extern  void MDM_DISABLE(void );
  75. extern  void BUFFER_BYTE(unsigned char ch);
  76. extern  void UNBUFFER_BYTES(void );
  77. static  void zap_zbuf(void );
  78. extern unsigned Cominit(int port, int failsafe);
  79. extern int get_key(void);
  80.  
  81. /* translate binkley fossil stuff to my async package */
  82. #define CARRIER            (com_online())
  83. #define MODEM_STATUS       (com_online())
  84. #define CHAR_AVAIL()       com_char_avail()
  85. #define OUT_EMPTY()        com_out_empty()
  86. /* #define OUT_FULL()          (!com_out_empty()) */
  87. #define OUT_FULL()         (com_out_full())
  88. #define LOWER_DTR()        com_DTR_off()
  89. #define RAISE_DTR()        com_DTR_on()
  90. #define CLEAR_OUTBOUND()   com_clear_out()
  91. #define CLEAR_INBOUND()    com_clear_in()
  92. #define KEYPRESS()         kbhit()
  93. #define READKB()           get_key()
  94. #define FOSSIL_CHAR()      get_key()
  95. #define XON_ENABLE()       com_XON_enable()
  96. #define IN_XON_ENABLE()    com_XON_enable()
  97. #define XON_DISABLE()      com_XON_disable()
  98. #define _BRK_DISABLE()
  99. #define FOSSIL_WATCHDOG(x)
  100. #define SENDBYTE(c)        com_putc(c)
  101. #define MODEM_IN()         com_getchar()
  102. /* #define WRITE_ANSI(c)      putchar(c) */
  103. #define PEEKBYTE()         com_peek()
  104. #define do_break(on)       com_break(on)
  105. #define SENDCHARS(buf, size, carcheck) com_write(buf, size, carcheck)
  106. #define Com_Tx_NW(c)        com_putc_now(c)
  107.  
  108. #define real_flush(fh)     DosBufReset(fh)
  109.  
  110. /* some usefull bits */
  111. #define RLSD  0x80       /* (MSR) Received line signal detect,
  112.                   * sometimes called Carrier Detect */
  113. #define THRE 0x20        /* (LSR) Transmitter holding register empty
  114.                   * (ready for another byte) */
  115. #define DR   0x1         /* (LSR) Data ready indicator */
  116. #define OE   0x2         /* (LSR) Overrun error! We are not reading the
  117.                   * bytes fast enuf */
  118.  
  119. extern unsigned short hfComHandle;
  120. extern unsigned long WriteSem;
  121.  
  122.  
  123. #if defined(OS2_INCLUDED) && !defined(BSEDEV_INCLUDED) && !defined(ASYNC_SETBAUDRATE)
  124.  
  125. /* OS/2 Category 1 DosDevIoctl() calls */
  126. #define SERIAL          1       /* category: serial device control */
  127. #define ASYNC_SETBAUDRATE    0x0041  /* Sets baud rate                                 */
  128. #define ASYNC_SETLINECTRL    0x0042  /* Sets line characteristics for serial device    */
  129. #define ASYNC_TRANSMITIMM    0x0044  /* Transmits byte immediately                     */
  130. #define ASYNC_SETBREAKOFF    0x0045  /* Sets break off                                 */
  131. #define ASYNC_SETMODEMCTRL   0x0046  /* Sets modem control register                    */
  132. #define ASYNC_STOPTRANSMIT   0x0047  /* Stops device from transmitting                 */
  133. #define ASYNC_STARTTRANSMIT  0x0048  /* Starts a transmission                          */
  134. #define ASYNC_SETBREAKON     0x004B  /* Sets break on                                  */
  135. #define ASYNC_SETDCBINFO     0x0053  /* Sets device control block information          */
  136. #define ASYNC_GETBAUDRATE    0x0061  /* Retrieves current baud rate                    */
  137. #define ASYNC_GETLINECTRL    0x0062  /* Gets line characterstics of serial device      */
  138. #define ASYNC_GETCOMMSTATUS  0x0064  /* Retrieves communications status                */
  139. #define ASYNC_GETLINESTATUS  0x0065  /* Retrieves current line status                  */
  140. #define ASYNC_GETMODEMOUTPUT 0x0066  /* Retrieves modem-control output signals         */
  141. #define ASYNC_GETMODEMINPUT  0x0067  /* Retrieves modem control register               */
  142. #define ASYNC_GETINQUECOUNT  0x0068  /* Retrieves number of characters in input queue  */
  143. #define ASYNC_GETOUTQUECOUNT 0x0069  /* Retrieves number of characters in output q     */
  144. #define ASYNC_GETCOMMERROR   0x006D  /* Retrieves communications error                 */
  145. #define ASYNC_GETCOMMEVENT   0x0072  /* Retrieves communications event mask            */
  146. #define ASYNC_GETDCBINFO     0x0073  /* Retrieves device control block information     */
  147.  
  148. #define GENERIC         11      /* category: generic device control commands */
  149. #define FLUSHINPUT      1       /* function: flush input buffer */
  150. #define FLUSHOUTPUT     2       /* function: flush output buffer */
  151.  
  152. typedef struct _DCBINFO {
  153.     USHORT usWriteTimeout;
  154.     USHORT usReadTimeout;
  155.     BYTE   fbCtlHndShake;
  156.     BYTE   fbFlowReplace;
  157.     BYTE   fbTimeout;
  158.     BYTE   bErrorReplacementChar;
  159.     BYTE   bBreakReplacementChar;
  160.     BYTE   bXONChar;
  161.     BYTE   bXOFFChar;
  162. } DCBINFO;
  163.  
  164. typedef struct _RXQUEUE {
  165.     USHORT cch;
  166.     USHORT cb;
  167. } RXQUEUE;
  168. #else
  169.  #if !defined(BSEDEV_INCLUDED)
  170.  #define BSEDEV_INCLUDED
  171.  #endif
  172. #endif
  173.