home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / X00API.H < prev    next >
C/C++ Source or Header  |  1997-07-05  |  8KB  |  250 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4.  *  X00API.H - X00 FOSSIL driver HLLAPI
  5.  *
  6.  *   Created by R.F. Pels.
  7.  *   modified by Bob Stout
  8.  *   Placed in the public domain by R.F. Pels.
  9.  */
  10.  
  11. #ifndef __X00API_H                        /*  Prevent double inclusion  */
  12. #define __X00API_H
  13.  
  14. /*  FOSSIL specifics */
  15.  
  16. #define X00_VECTOR          0x14
  17. #define X00_IDOFFSET        6
  18.  
  19. #if defined(__TURBOC__) || defined(__POWERC)
  20.  #define _far far
  21. #endif
  22.  
  23. /*  FOSSIL function request codes */
  24.  
  25. #define SET_BAUDRATE        0x0000
  26. #define TX_CHAR             0x0100
  27. #define RX_CHAR             0x0200
  28. #define STATUS              0x0300
  29. #define INITIALIZE          0x0400
  30. #define DEINITIALIZE        0x0500
  31. #define RAISE_DTR           0x0601
  32. #define LOWER_DTR           0x0600
  33. #define GET_SYS_INFO        0x0700
  34. #define FLUSH_OUTPUT        0x0800
  35. #define PURGE_OUTPUT        0x0900
  36. #define PURGE_INPUT         0x0A00
  37. #define TX_CHAR_NOWAIT      0x0B00
  38. #define PEEK_AHEAD_INPUT    0x0C00
  39. #define PEEK_AHEAD_KBD      0x0D00
  40. #define READ_KBD            0x0E00
  41. #define FLOW_CONTROL        0x0F00
  42. #define CTLC_CTLK_CHECK     0x1000
  43. #define SET_CUP             0x1100
  44. #define GET_CUP             0x1200
  45. #define WRITE_ANSI_CHAR     0x1300
  46. #define ENABLE_WATCHDOG     0x1401
  47. #define DISABLE_WATCHDOG    0x1400
  48. #define WRITE_BIOS_CHAR     0x1500
  49. #define INSERT_TICK_FUNC    0x1601
  50. #define DELETE_TICK_FUNC    0x1600
  51. #define BOOT_MACHINE        0x1700
  52. #define READ_BLOCK          0x1800
  53. #define WRITE_BLOCK         0x1900
  54. #define START_BREAK_SIGNAL  0x1A01
  55. #define STOP_BREAK_SIGNAL   0x1A00
  56. #define GET_DRIVER_INFO     0x1B00
  57. #define INSTALL_APPENDAGE   0x7e00
  58. #define REMOVE_APPENDAGE    0x7f00
  59.  
  60. /* port numbers and variable type of portnumber in calls */
  61.  
  62. #define PORTCOM1            0
  63. #define PORTCOM2            1
  64. #define PORTCOM3            2
  65. #define PORTCOM4            3
  66. #define PORTCOM5            4
  67. #define PORTCOM6            5
  68. #define PORTCOM7            6
  69. #define PORTCOM8            7
  70. #define PORTSPECIAL         0x00ff
  71.  
  72. typedef unsigned int PORT;
  73.  
  74. /* defines components of baud settings call */
  75.  
  76. #define BAUD300             0x40
  77. #define BAUD600             0x60
  78. #define BAUD1200            0x80
  79. #define BAUD2400            0xa0
  80. #define BAUD4800            0xc0
  81. #define BAUD9600            0xe0
  82. #define BAUD19200           0x00
  83. #define BAUD38400           0x20
  84. #define PARITYNONE          0x00
  85. #define PARITYODD           0x08
  86. #define PARITYNONEALT       0x10
  87. #define PARITYEVEN          0x18
  88. #define STOP1BIT            0x00
  89. #define STOP2BIT            0x04
  90. #define WORD5BIT            0x00
  91. #define WORD6BIT            0x01
  92. #define WORD7BIT            0x02
  93. #define WORD8BIT            0x03
  94. #define FIDOSETTING         PARITYNONE | STOP1BIT | WORD8BIT
  95. #define OPUSSETTING         PARITYNONE | STOP1BIT | WORD8BIT
  96. #define SEADOGSETTING       PARITYNONE | STOP1BIT | WORD8BIT
  97.  
  98. /* Error numbers */
  99.  
  100. #define X00_OK              0
  101. #define X00_NOT_HERE        100
  102. #define X00_CHAR_NOT_SENT   101
  103. #define X00_NO_INPUT        0xffff
  104. #define X00_NO_KEY          0xffff
  105. #define X00_INS_TICK        104
  106. #define X00_DEL_TICK        105
  107. #define X00_INS_APP         106
  108. #define X00_REM_APP         107
  109. #define X00_DTR_HIGH        108
  110. #define X00_DTR_LOW         109
  111.  
  112.  
  113. /* FOSSIL initcall result type */
  114.  
  115. #define X00_PRESENT         0x1954
  116.  
  117. typedef struct {
  118.         unsigned int result;
  119.         unsigned char max_function;
  120.         unsigned char revision;
  121.         } FOSSILINIT;
  122.  
  123. /* FOSSIL status return type: all fields are 1 if condition exists */
  124.  
  125. typedef union {
  126.         struct STATUSBITS {
  127.             unsigned                   : 3;
  128.             unsigned alwayshigh        : 1;
  129.             unsigned                   : 3;
  130.             unsigned carrier_detect    : 1;
  131.             unsigned chars_in_input    : 1;
  132.             unsigned input_overrun     : 1;
  133.             unsigned                   : 3;
  134.             unsigned output_not_full   : 1;
  135.             unsigned output_empty      : 1;
  136.             unsigned                   : 1;
  137.             } statusbits;
  138.       unsigned int statusword;
  139.       } FOSSILSTATUS;
  140.  
  141. /* FOSSIL info type */
  142.  
  143. typedef struct {
  144.         unsigned int  size;
  145.         unsigned char version;
  146.         unsigned char revision;
  147.         unsigned int  ofs_fossil_id;
  148.         unsigned int  seg_fossil_id;
  149.         unsigned int  input_size;
  150.         unsigned int  input_avail;
  151.         unsigned int  output_size;
  152.         unsigned int  output_avail;
  153.         unsigned char screen_width;
  154.         unsigned char screen_height;
  155.         unsigned char baud_rate_mask;
  156.         } FOSSILINFO;
  157.  
  158. /* FOSSIL system info type */
  159.  
  160. typedef struct {
  161.         unsigned char tick_number;
  162.         unsigned char ticks_per_second;
  163.         unsigned int  approx_ms_per_tick;
  164.         } FOSSILSYSINFO;
  165.  
  166. /* FOSSIL flow control type */
  167.  
  168. typedef union {
  169.         struct FLOWBITS {
  170.             unsigned  xonxoff         : 1;
  171.             unsigned  ctsrts          : 1;
  172.             unsigned  remote_xonxoff  : 1;
  173.             unsigned                  : 5;
  174.             } flowbits;
  175.       unsigned char flowword;
  176.       } FOSSILFLOWCTRL;
  177.  
  178. /* FOSSIL checks control type */
  179.  
  180. #define X00_CTLCK           0x0001
  181. #define X00_NO_CTLCK        0x0000
  182.  
  183. typedef union {
  184.         struct CHECKBITS {
  185.             unsigned  ctlc_ctlk         : 1;
  186.             unsigned  stop_transmitter  : 1;
  187.             unsigned                    : 6;
  188.             } checkbits;
  189.       unsigned char checkword;
  190.       } FOSSILCTLCCTLK;
  191.  
  192. /* Macros to use with x00_boot_machine() */
  193.  
  194. #define COLDBOOT        0
  195. #define WARMBOOT        1
  196.  
  197. /* Macros to use with x00_read_kbd() */
  198.  
  199. #define ISFNKEY(x)      (((x) & 0x00FF) == 0)
  200. #define FNKEYCODE(x)    ((x) >> 8)
  201.  
  202. #if defined(__cplusplus) && __cplusplus
  203.  extern "C" {
  204. #endif
  205.  
  206. unsigned int  x00_detect(void);
  207. FOSSILSTATUS  x00_set(unsigned char set, PORT port);
  208. FOSSILSTATUS  x00_tx_char(unsigned char c, PORT port);
  209. unsigned char x00_rx_char(PORT port);
  210. FOSSILSTATUS  x00_status(PORT port);
  211. FOSSILINIT    x00_init(PORT port, unsigned char _far *ctlc_flagbyte);
  212. void          x00_deinit(PORT port);
  213. unsigned int  x00_raise_dtr(PORT port);
  214. unsigned int  x00_lower_dtr(PORT port);
  215. FOSSILSYSINFO x00_sysinfo(void);
  216. void          x00_flush_output(PORT port);
  217. void          x00_purge_output(PORT port);
  218. void          x00_purge_input(PORT port);
  219. unsigned int  x00_tx_char_nowait(unsigned char c, PORT port);
  220. unsigned int  x00_peek_ahead_input(PORT port);
  221. unsigned int  x00_peek_ahead_kbd(void);
  222. unsigned int  x00_read_kbd(void);
  223. void          x00_flow_control(FOSSILFLOWCTRL f, PORT port);
  224. unsigned int  x00_ctlc_ctlk_check(FOSSILCTLCCTLK c, PORT port);
  225. void          x00_set_cup(unsigned char row, unsigned char col);
  226. void          x00_get_cup(unsigned char *row, unsigned char *col);
  227. void          x00_write_ANSI_char(unsigned char c);
  228. void          x00_enable_watchdog(PORT port);
  229. void          x00_disable_watchdog(PORT port);
  230. void          x00_write_BIOS_char(unsigned char c);
  231. unsigned int  x00_insert_tick_func(void (_far *tickfunc)());
  232. unsigned int  x00_delete_tick_func(void (_far *tickfunc)());
  233. void          x00_boot_machine(unsigned int boottype);
  234. unsigned int  x00_read_block(unsigned int count, void _far *buf, PORT port);
  235. unsigned int  x00_write_block(unsigned int count, void _far *buf,
  236. PORT port);
  237. void          x00_start_break_signal(PORT port);
  238. void          x00_stop_break_signal(PORT port);
  239. unsigned int  x00_get_driverinfo(void _far *buf, PORT port);
  240. unsigned int  x00_install_appendage(unsigned char appcode,
  241.                   void (_far *appfunc)());
  242. unsigned int  x00_remove_appendage(unsigned char appcode,
  243.                   void (_far *appfunc)());
  244.  
  245. #if defined(__cplusplus) && __cplusplus
  246.  }
  247. #endif
  248.  
  249. #endif /* __X00API_H */
  250.