home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 024 / psi110g.zip / HAPN.H < prev    next >
C/C++ Source or Header  |  1994-04-17  |  5KB  |  164 lines

  1. #ifndef _HAPN_H
  2. #define _HAPN_H
  3.   
  4. #ifndef _GLOBAL_H
  5. #include "global.h"
  6. #endif
  7.   
  8. #ifndef _MBUF_H
  9. #include "mbuf.h"
  10. #endif
  11.   
  12. #ifndef _IFACE_H
  13. #include "iface.h"
  14. #endif
  15.   
  16. #ifndef _TIMER_H
  17. #include "timer.h"
  18. #endif
  19.   
  20. /*  HAPN-1 PC plug-in card driver.
  21.  *  This card contains an Intel 8273 SDLC/HDLC Protocol Controller
  22.  *  The card is hardwired to addresses 310-31f and IRQ 2
  23.  */
  24.   
  25. #define NHAPN 1
  26. #define INTMASK 0x21        /*  PC interrupt controller (8259) */
  27.   
  28. struct hapn {
  29.     struct iface *iface;
  30.   
  31.     long rxints;            /* RX interupt count                  */
  32.     long txints;            /* TX interrupt count                 */
  33.                 /* Error counters                     */
  34.     int badint;             /* Bad interrupt type                 */
  35.     int crcerr;             /* CRC errors                         */
  36.     int aborts;             /* RX frame aborts                    */
  37.     int dmaorun;            /* DMA overun                         */
  38.     int toobig;             /* RX frame too large                 */
  39.     int rframes;            /* # of RX frames                     */
  40.     int cdloss;             /* Loss of DCD during receive         */
  41.     int rxorun;             /* Receive interrupt overun           */
  42.     int nomem;              /* insufficient memory                */
  43.     int t_urun;             /* TX underruns                       */
  44.     int ctsloss;            /* Loss of CTS (dead-man timeout)     */
  45.     int taborts;            /* TX aborts                          */
  46.     int tframes;            /* # of TX frames                     */
  47.   
  48.     struct mbuf *rcvbuf;    /* Current receive buffer             */
  49.     int16 bufsiz;           /* Maximum RX frame size              */
  50.     char *rcp;      /* RX data pointer                    */
  51.   
  52.     struct mbuf *sndq;      /* Transmit frames queue              */
  53.     int16 sndcnt;           /* Count of frames on sndq            */
  54.     struct mbuf *sndbuf;    /* Current TX frame buffer            */
  55.     int tstate;             /* Transmitter state                  */
  56. #define IDLE 0
  57. #define DEFER 1
  58. #define ACTIVE 2
  59.     struct timer defer;
  60.     int mode;               /* Channel-access mode                */
  61. #define CSMA 0
  62. #define FULLDUP 1
  63.     int16 base;             /* Base I/O address of board          */
  64.     unsigned vec;           /* Interrupt level                    */
  65.     INTERRUPT (*oldvec) __ARGS((void)); /* Previous interrupt service vector */
  66. };
  67.   
  68. extern struct hapn Hapn[];
  69.   
  70. /*  Interrupt vector handler  */
  71.   
  72. /* In hapn.c: */
  73. void haint __ARGS((int dev));
  74.   
  75. /* In hapnvec.asm: */
  76. INTERRUPT ha0vec __ARGS((void));
  77.   
  78. /*  8273 register addresses  */
  79.   
  80. #define CMD 0
  81. #define STA 0
  82. #define PAR 1
  83. #define RES 1
  84. #define RST 1
  85. #define TXI 2
  86. #define RXI 3
  87. #define TXD 4
  88. #define RXD 8
  89.   
  90. /*  8273 commands  */
  91.   
  92. #define SET_ONE     0xa4
  93. #define RST_ONE     0x64
  94. #define SET_XFER    0x97
  95. #define RST_XFER    0x57
  96. #define SET_MODE    0x91
  97. #define RST_MODE    0x51
  98. #define HDLC        0x20
  99. #define EOP     0x10
  100. #define EARLY       0x8
  101. #define BUFFERD     4
  102. #define PREFRM      2
  103. #define FLG_STM     1
  104. #define SET_SERIAL  0xa0
  105. #define RST_SERIAL  0x60
  106. #define LOOP        4
  107. #define TXC_RXC     2
  108. #define NRZI        1
  109. #define GENERAL_RX  0xc0
  110. #define SELECT_RX   0xc1
  111. #define SELECT_LRX  0xc2
  112. #define RX_DISABLE  0xc5
  113. #define TX_FRAME    0xc8
  114. #define LOOP_TX     0xca
  115. #define TX_TRANS    0xc9
  116. #define ABORT_TXF   0xcc
  117. #define ABORT_LTX   0xce
  118. #define ABORT_TXT   0xcd
  119. #define READ_A      0x22
  120. #define CD      2
  121. #define CTS     1
  122. #define READ_B      0x23
  123. #define SET_B       0xa3
  124. #define RST_B       0x63
  125. #define FLAG_D      0x20
  126. #define IRQ_ENB     8
  127. #define RTS     1
  128.   
  129. /*  Status register bits  */
  130.   
  131. #define CBSY    0x80
  132. #define CBF 0x40
  133. #define CPBF    0x20
  134. #define CRBF    0x10
  135. #define RXINT   8
  136. #define TXINT   4
  137. #define RXIRA   2
  138. #define TXIRA   1
  139.   
  140. /*  Transmit result codes  */
  141.   
  142. #define EARLY_TXI   0xc
  143. #define TX_CMPLT    0xd
  144. #define DMA_URUN    0xe
  145. #define CTS_LOSS    0xf
  146. #define ABORT_CMPLT 0x10
  147.   
  148. /*  Receive result codes  */
  149.   
  150. #define A1_MATCH    0
  151. #define A2_MATCH    1
  152. #define CRCERR      3
  153. #define ABORT_DET   4
  154. #define IDLE_DET    5
  155. #define EOP_DET     6
  156. #define SHORT_FRM   7
  157. #define DMA_OVRN    8
  158. #define MEM_OVFL    9
  159. #define CD_LOSS     0xa
  160. #define RX_ORUN     0xb
  161.   
  162. #endif  /* _HAPN_H */
  163.   
  164.