home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / MAXMAILP.ZIP / FOSLIB.H < prev    next >
C/C++ Source or Header  |  1989-05-21  |  8KB  |  193 lines

  1. /*@H************************ < library header  > ****************************
  2. *                                                                           *
  3. *   FOSLIB   : foslib.h     (FOSSIL rev level 5 calling functions)          *
  4. *                                                                           *
  5. *   Author   : Donald J. Gloistein                                          *
  6. *                                                                           *
  7. *   Source, Documentation, Object Code:                                     *
  8. *   (c) Copyright 1989 Donald Gloistein, all rights reserved.               *
  9. *                                                                           *
  10. *   Compiled code may be used in your library, and linked to your programs  *
  11. *   BUT, the source code nor a library based on the compiled modules may be *
  12. *   commercially distributed. This is not shareware, no donation is         *
  13. *   expected. But I do retain rights to the source.                         *
  14. *                                                                           *
  15. *   See FOSLIBHL.C and READ.ME for implementation notes.                    *
  16. *************************************************************************@H*/
  17.  
  18. /*@R************************< Revision History >*****************************
  19. *                                                                           *
  20. *   version -- date -- init ---Notes----------------------                  *
  21. *    1.00    05-13-89  DjG  first draft                                     *
  22. *    1.01    05-15-89  DjG  Some bugs with constants not having the h       *
  23. *                           corrected return from C call in baud setting    *
  24. *                           Added fos_bbs_init() function. Changed init     *
  25. *                           logic and parameters to include ctl-c flag      *
  26. *    1.02              DjG  Brought it upto speed for opus!comm 5.2+ and    *
  27. *                           x00.sys 1.11d+                                  *
  28. *    2.00    05-19-89  DjG  Finalized function names, added high level      *
  29. *                           fos_deinit() function.                          *
  30. *    2.00a   05-21-89  DjG  Corrected foslibll.asm, function 0F, to set     *
  31. *                           flow control. The high nibble needed to be set  *
  32. *                           to all ones for compatibility.                  *
  33. *************************************************************************@R*/
  34.  
  35.  
  36. /* serial port initializers.  One and only one constant from each of the
  37.  * following four groups - character size, stop bit, parity, and baud rate -
  38.  * must be specified in the initialization byte.
  39.  * parameter passed to fos_set_baud is the oring of the initializers.
  40.  */
  41.  
  42. /* character size initializers */
  43.  
  44. #define _FOS_CHR7       2   /* 7 bits characters */
  45. #define _FOS_CHR8       3   /* 8 bits characters */
  46.  
  47. /* stop bit values - on or off */
  48.  
  49. #define _FOS_STOP1      0   /* 1 stop bit */
  50. #define _FOS_STOP2      4   /* 2 stop bits */
  51.  
  52. /*  parity initializers */
  53.  
  54. #define _FOS_NOPARITY       0   /* no parity */
  55. #define _FOS_ODDPARITY      8   /* odd parity */
  56. #define _FOS_EVENPARITY     24  /* even parity */
  57.  
  58. /*  baud rate initializers */
  59.  
  60. #define _FOS_19200           0   /* 19200 baud */
  61. #define _FOS_38400          32   /* 38400 baud */
  62. #define _FOS_300            64   /* 300 baud */
  63. #define _FOS_600            96   /* 600 baud */
  64. #define _FOS_1200          128   /* 1200 baud */
  65. #define _FOS_2400          160   /* 2400 baud */
  66. #define _FOS_4800          192   /* 4800 baud */
  67. #define _FOS_9600          224   /* 9600 baud */
  68.  
  69.  
  70. /* the following is the settings for opus/fido defaults. Or with baud rate */
  71.  
  72. #define _FIDO (_FOS_NOPARITY|_FOS_STOP1|_FOS_CHR8)
  73.  
  74. /* various fossil errors you may wish to check for after init. */
  75.  
  76. #define NOFOS 1           /* FOSSIL not locatated */
  77. #define NO1B  2           /* function 1B is not supported */
  78. #define NO5   3           /* FOSSIL less than level 5 */
  79. #define INITFAIL 4        /* Low level init function failed */
  80.  
  81. /* defines for the flow control function */
  82. /* the functions are enabled by ORing the _FOS_xxON values */
  83. /* if the function is called without the bit enabled, then the
  84.     given flow control is disabled. */
  85. /* the OFF values are really not needed, but if it makes it easier to use
  86.     when you write the function, then it is there.*/
  87.  
  88. #define _FOS_TXXON  0x01
  89. #define _FOS_TXXOFF 0x00
  90. #define _FOS_TXCTSON 0x02
  91. #define _FOS_TXCTSOFF 0x0
  92. #define _FOS_DSRON   0x04     /* not implemented in fossil yet */
  93. #define _FOS_DSROFF  0x00     /* not implemented in fossil yet */
  94. #define _FOS_RXXON   0x08
  95. #define _FOS_RXXOFF  0x00
  96.  
  97. /* defines for control c/k checking and driver transmitter */
  98. /* this is for function 10h of the fossil specs */
  99.  
  100. #define _FOS_CHECKCK 0x01
  101. #define _FOS_NOCHECKCK 0x00
  102. #define _FOS_TRANSMITON 0x00
  103. #define _FOS_TRANSMITOFF 0x02
  104.  
  105. #define _FOS_INSTIMERCHAIN 0x0001
  106. #define _FOS_DELTIMERCHAIN 0x0000
  107.  
  108. #define FOSSILID 0x1954
  109. #define FOSNOPORT 0x00FF
  110. #ifndef TRUE
  111. #define TRUE 1
  112. #define FALSE 0
  113. #endif
  114. struct FOSSTAT {
  115.     int strsiz;
  116.     char majver;
  117.     char minver;
  118.     char far *ident;
  119.     int ibsize;
  120.     int ifree;
  121.     int obufr;
  122.     int ofree;
  123.     char swidth;
  124.     char sheight;
  125.     unsigned char baud;
  126. };
  127.  
  128. extern struct FOSSTAT near fos_curr_stat ;
  129. extern int near fos_port;
  130. extern unsigned int near fos_baud;
  131. extern int near fos_cd;           /* TRUE if carrier is detected */
  132. extern unsigned char near fos_maxfunct;
  133. extern char near fos_ctlk_flag;   /* default location when ^C/^K is checked */
  134. extern int near fos_ticks_per_sec;
  135. extern int near fos_mille_per_tick;
  136. extern char near fos_mode;
  137. extern int fos_errno;              /* which ever segment for memory model */
  138. extern int fos_nerr;               /* number of error messages in list */
  139. extern char *fos_errlst[];
  140.  
  141. /* proto types */
  142. /* fossil low level functions */
  143. /* these are the primatives done in assembler. The ones starting with
  144.     underscore (_fos) should be called with care. Calling them directly
  145.     may defeat the library's logic or variable structures.
  146.     Read the source code.
  147.     Done this way to increase throughput and avoid the overhead of 1-2
  148.     extra function calls per character, etc.
  149. */
  150. unsigned int _fos_set_baud(unsigned int);
  151. unsigned int fos_txcw(unsigned char);
  152. unsigned char fos_rxcw(void);
  153. unsigned int fos_modem_stat(void);
  154. unsigned int _fos_init_driver(int,char far *);
  155. void _fos_deinit_driver(int);
  156. int fos_timer_tick(void);
  157. int _fos_driver_info(struct FOSSTAT far *);
  158. void fos_toggle_dtr(int);
  159. unsigned int fos_inkeych(void);   /* tests both keyboard and rx line */
  160. unsigned int fos_inkeykbd(void);  /* tests only keyboard */
  161. unsigned int fos_inkeyrx(void);  /* tests only rx line  */
  162. void fos_flush_obuf(void);
  163. void fos_purge_obuf(void);
  164. void fos_purge_ibuf(void);
  165. int fos_txcnw(unsigned char);
  166. unsigned int fos_peekrx(void);
  167. unsigned int fos_peekkbd(void);
  168. unsigned int fos_kbdw(void);
  169. void fos_flowctl(unsigned int);
  170. int fos_cltck(unsigned int);
  171. void fos_setcurs(int,int);
  172. unsigned int fos_getcurs(void);
  173. void fos_txstrw(char *);
  174. void fos_ansistrout(char *);
  175. void fos_ansichout(char);
  176. void fos_biosstrout(char *);
  177. void fos_bioschout(char);
  178. void fos_watchdog(int);
  179. void fos_reboot(int);
  180. int fos_instimchn(int,void (far *)(void));
  181. unsigned int fos_readbl(unsigned int, char far *);
  182. unsigned int fos_writebl(unsigned int, char far *);
  183. void fos_break(int);
  184.  
  185. /* fossil high level language functions */
  186. unsigned int fos_isthere(void);
  187. unsigned int fos_init(int,int,char far *);
  188. void fos_stat(void);
  189. void fos_perror(char *);
  190. unsigned int fos_set_baud(unsigned int);
  191. unsigned int fos_bbs_init(int, unsigned int,char far *);
  192. void fos_deinit(int);
  193.