home *** CD-ROM | disk | FTP | other *** search
/ Toolkit for DOOM / DOOMTOOL.ISO / net_doom / ser4_src.zip / SERSETUP.H < prev   
C/C++ Source or Header  |  1994-03-18  |  4KB  |  105 lines

  1. #include <conio.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <conio.h>
  6. #include <ctype.h>
  7. #include <dos.h>
  8. #include <process.h>
  9. #include <stdarg.h>
  10. #include <bios.h>
  11. #include <ctype.h>
  12.  
  13.  
  14. #define INPUT( port )        inp( port )
  15. #define OUTPUT( port, data ) (void) outp( port, data )
  16. #define CLI()                disable()
  17. #define STI()                enable()
  18.  
  19. typedef enum {false, true} boolean;
  20. typedef unsigned char byte;
  21.  
  22.  
  23. #define TRANSMIT_HOLDING_REGISTER            0x00
  24. #define RECEIVE_BUFFER_REGISTER              0x00
  25. #define INTERRUPT_ENABLE_REGISTER            0x01
  26. #define   IER_RX_DATA_READY                  0x01
  27. #define   IER_TX_HOLDING_REGISTER_EMPTY      0x02
  28. #define   IER_LINE_STATUS                    0x04
  29. #define   IER_MODEM_STATUS                   0x08
  30. #define INTERRUPT_ID_REGISTER                0x02
  31. #define   IIR_MODEM_STATUS_INTERRUPT         0x00
  32. #define   IIR_TX_HOLDING_REGISTER_INTERRUPT  0x02
  33. #define   IIR_RX_DATA_READY_INTERRUPT        0x04
  34. #define   IIR_LINE_STATUS_INTERRUPT          0x06
  35. #define FIFO_CONTROL_REGISTER                0x02
  36. #define   FCR_FIFO_ENABLE                    0x01
  37. #define   FCR_RCVR_FIFO_RESET                0x02
  38. #define   FCR_XMIT_FIFO_RESET                0x04
  39. #define   FCR_RCVR_TRIGGER_LSB               0x40
  40. #define   FCR_RCVR_TRIGGER_MSB               0x80
  41. #define   FCR_TRIGGER_01                     0x00
  42. #define   FCR_TRIGGER_04                     0x40
  43. #define   FCR_TRIGGER_08                     0x80
  44. #define   FCR_TRIGGER_14                     0xc0
  45. #define LINE_CONTROL_REGISTER                0x03
  46. #define   LCR_WORD_LENGTH_MASK               0x03
  47. #define   LCR_WORD_LENGTH_SELECT_0           0x01
  48. #define   LCR_WORD_LENGTH_SELECT_1           0x02
  49. #define   LCR_STOP_BITS                      0x04
  50. #define   LCR_PARITY_MASK                    0x38
  51. #define   LCR_PARITY_ENABLE                  0x08
  52. #define   LCR_EVEN_PARITY_SELECT             0x10
  53. #define   LCR_STICK_PARITY                   0x20
  54. #define   LCR_SET_BREAK                      0x40
  55. #define   LCR_DLAB                           0x80
  56. #define MODEM_CONTROL_REGISTER               0x04
  57. #define   MCR_DTR                            0x01
  58. #define   MCR_RTS                            0x02
  59. #define   MCR_OUT1                           0x04
  60. #define   MCR_OUT2                           0x08
  61. #define   MCR_LOOPBACK                       0x10
  62. #define LINE_STATUS_REGISTER                 0x05
  63. #define   LSR_DATA_READY                     0x01
  64. #define   LSR_OVERRUN_ERROR                  0x02
  65. #define   LSR_PARITY_ERROR                   0x04
  66. #define   LSR_FRAMING_ERROR                  0x08
  67. #define   LSR_BREAK_DETECT                   0x10
  68. #define   LSR_THRE                           0x20
  69. #define MODEM_STATUS_REGISTER                0x06
  70. #define   MSR_DELTA_CTS                      0x01
  71. #define   MSR_DELTA_DSR                      0x02
  72. #define   MSR_TERI                           0x04
  73. #define   MSR_DELTA_CD                       0x08
  74. #define   MSR_CTS                            0x10
  75. #define   MSR_DSR                            0x20
  76. #define   MSR_RI                             0x40
  77. #define   MSR_CD                             0x80
  78. #define DIVISOR_LATCH_LOW                    0x00
  79. #define DIVISOR_LATCH_HIGH                   0x01
  80.  
  81. /* QUESIZE must be a power of 2 */
  82.  
  83. #define    QUESIZE    2048
  84.  
  85. typedef struct
  86. {
  87.     int    head, tail;        // bytes are put on head and pulled from tail
  88.     int    size;
  89.     unsigned char    data[QUESIZE];
  90. } que_t;
  91.  
  92. void InitPort (void);
  93. void ShutdownPort (void);
  94.  
  95. int read_byte( void );
  96. void write_byte( unsigned char c );
  97. void write_bytes( char *buf, int count );
  98.  
  99.  
  100. void Error (char *error, ...);
  101.  
  102. void showReadStats(void);
  103. void showWriteStats(void);
  104. void showUartErrors(void);
  105.