home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / SNIP9404.ZIP / X00API.H < prev    next >
C/C++ Source or Header  |  1994-04-03  |  8KB  |  237 lines

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