home *** CD-ROM | disk | FTP | other *** search
/ Deathday Collection / dday.bin / serial / sersrc / sersetup.h < prev    next >
C/C++ Source or Header  |  1994-02-01  |  4KB  |  101 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.  
  20. typedef enum {false, true} boolean;
  21. typedef unsigned char byte;
  22.  
  23.  
  24. #define TRANSMIT_HOLDING_REGISTER            0x00
  25. #define RECEIVE_BUFFER_REGISTER              0x00
  26. #define INTERRUPT_ENABLE_REGISTER            0x01
  27. #define   IER_RX_DATA_READY                  0x01
  28. #define   IER_TX_HOLDING_REGISTER_EMPTY      0x02
  29. #define   IER_LINE_STATUS                    0x04
  30. #define   IER_MODEM_STATUS                   0x08
  31. #define INTERRUPT_ID_REGISTER                0x02
  32. #define   IIR_MODEM_STATUS_INTERRUPT         0x00
  33. #define   IIR_TX_HOLDING_REGISTER_INTERRUPT  0x02
  34. #define   IIR_RX_DATA_READY_INTERRUPT        0x04
  35. #define   IIR_LINE_STATUS_INTERRUPT          0x06
  36. #define FIFO_CONTROL_REGISTER                0x02
  37. #define   FCR_FIFO_ENABLE                    0x01
  38. #define   FCR_RCVR_FIFO_RESET                0x02
  39. #define   FCR_XMIT_FIFO_RESET                0x04
  40. #define   FCR_RCVR_TRIGGER_LSB               0x40
  41. #define   FCR_RCVR_TRIGGER_MSB               0x80
  42. #define   FCR_TRIGGER_01                     0x00
  43. #define   FCR_TRIGGER_04                     0x40
  44. #define   FCR_TRIGGER_08                     0x80
  45. #define   FCR_TRIGGER_14                     0xc0
  46. #define LINE_CONTROL_REGISTER                0x03
  47. #define   LCR_WORD_LENGTH_MASK               0x03
  48. #define   LCR_WORD_LENGTH_SELECT_0           0x01
  49. #define   LCR_WORD_LENGTH_SELECT_1           0x02
  50. #define   LCR_STOP_BITS                      0x04
  51. #define   LCR_PARITY_MASK                    0x38
  52. #define   LCR_PARITY_ENABLE                  0x08
  53. #define   LCR_EVEN_PARITY_SELECT             0x10
  54. #define   LCR_STICK_PARITY                   0x20
  55. #define   LCR_SET_BREAK                      0x40
  56. #define   LCR_DLAB                           0x80
  57. #define MODEM_CONTROL_REGISTER               0x04
  58. #define   MCR_DTR                            0x01
  59. #define   MCR_RTS                            0x02
  60. #define   MCR_OUT1                           0x04
  61. #define   MCR_OUT2                           0x08
  62. #define   MCR_LOOPBACK                       0x10
  63. #define LINE_STATUS_REGISTER                 0x05
  64. #define   LSR_DATA_READY                     0x01
  65. #define   LSR_OVERRUN_ERROR                  0x02
  66. #define   LSR_PARITY_ERROR                   0x04
  67. #define   LSR_FRAMING_ERROR                  0x08
  68. #define   LSR_BREAK_DETECT                   0x10
  69. #define   LSR_THRE                           0x20
  70. #define MODEM_STATUS_REGISTER                0x06
  71. #define   MSR_DELTA_CTS                      0x01
  72. #define   MSR_DELTA_DSR                      0x02
  73. #define   MSR_TERI                           0x04
  74. #define   MSR_DELTA_CD                       0x08
  75. #define   MSR_CTS                            0x10
  76. #define   MSR_DSR                            0x20
  77. #define   MSR_RI                             0x40
  78. #define   MSR_CD                             0x80
  79. #define DIVISOR_LATCH_LOW                    0x00
  80. #define DIVISOR_LATCH_HIGH                   0x01
  81.  
  82.  
  83.  
  84. #define    QUESIZE    2048
  85.  
  86. typedef struct
  87. {
  88.     long    head, tail;        // bytes are put on head and pulled from tail
  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( int c );
  97.  
  98.  
  99. void Error (char *error, ...);
  100.  
  101.