phb.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. /****************************************************************************
  2. ******* *******
  3. ******* P H B H E A D E R *******
  4. ******* *******
  5. ****************************************************************************
  6. Author : Ian Nandhra, Jeremy Rolls
  7. Date :
  8. *
  9. * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. Version : 0.01
  25. Mods
  26. ----------------------------------------------------------------------------
  27. Date By Description
  28. ----------------------------------------------------------------------------
  29. ***************************************************************************/
  30. #ifndef _phb_h
  31. #define _phb_h 1
  32. #ifdef SCCS_LABELS
  33. #ifndef lint
  34. /* static char *_rio_phb_h_sccs = "@(#)phb.h 1.12"; */
  35. #endif
  36. #endif
  37. /*************************************************
  38. * Set the LIMIT values.
  39. ************************************************/
  40. #ifdef RTA
  41. #define RX_LIMIT (ushort) 3
  42. #endif
  43. #ifdef HOST
  44. #define RX_LIMIT (ushort) 1
  45. #endif
  46. /*************************************************
  47. * Handshake asserted. Deasserted by the LTT(s)
  48. ************************************************/
  49. #define PHB_HANDSHAKE_SET ((ushort) 0x001) /* Set by LRT */
  50. #define PHB_HANDSHAKE_RESET ((ushort) 0x002) /* Set by ISR / driver */
  51. #define PHB_HANDSHAKE_FLAGS (PHB_HANDSHAKE_RESET | PHB_HANDSHAKE_SET)
  52. /* Reset by ltt */
  53. /*************************************************
  54. * Maximum number of PHB's
  55. ************************************************/
  56. #if defined (HOST) || defined (INKERNEL)
  57. #define MAX_PHB ((ushort) 128) /* range 0-127 */
  58. #else
  59. #define MAX_PHB ((ushort) 8) /* range 0-7 */
  60. #endif
  61. /*************************************************
  62. * Defines for the mode fields
  63. ************************************************/
  64. #define TXPKT_INCOMPLETE 0x0001 /* Previous tx packet not completed */
  65. #define TXINTR_ENABLED 0x0002 /* Tx interrupt is enabled */
  66. #define TX_TAB3 0x0004 /* TAB3 mode */
  67. #define TX_OCRNL 0x0008 /* OCRNL mode */
  68. #define TX_ONLCR 0x0010 /* ONLCR mode */
  69. #define TX_SENDSPACES 0x0020 /* Send n spaces command needs
  70. completing */
  71. #define TX_SENDNULL 0x0040 /* Escaping NULL needs completing */
  72. #define TX_SENDLF 0x0080 /* LF -> CR LF needs completing */
  73. #define TX_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel
  74. port */
  75. #define TX_HANGOVER (TX_SENDSPACES | TX_SENDLF | TX_SENDNULL)
  76. #define TX_DTRFLOW 0x0200 /* DTR tx flow control */
  77. #define TX_DTRFLOWED 0x0400 /* DTR is low - don't allow more data
  78. into the FIFO */
  79. #define TX_DATAINFIFO 0x0800 /* There is data in the FIFO */
  80. #define TX_BUSY 0x1000 /* Data in FIFO, shift or holding regs */
  81. #define RX_SPARE 0x0001 /* SPARE */
  82. #define RXINTR_ENABLED 0x0002 /* Rx interrupt enabled */
  83. #define RX_ICRNL 0x0008 /* ICRNL mode */
  84. #define RX_INLCR 0x0010 /* INLCR mode */
  85. #define RX_IGNCR 0x0020 /* IGNCR mode */
  86. #define RX_CTSFLOW 0x0040 /* CTSFLOW enabled */
  87. #define RX_IXOFF 0x0080 /* IXOFF enabled */
  88. #define RX_CTSFLOWED 0x0100 /* CTSFLOW and CTS dropped */
  89. #define RX_IXOFFED 0x0200 /* IXOFF and xoff sent */
  90. #define RX_BUFFERED 0x0400 /* Try and pass on complete packets */
  91. #define PORT_ISOPEN 0x0001 /* Port open? */
  92. #define PORT_HUPCL 0x0002 /* Hangup on close? */
  93. #define PORT_MOPENPEND 0x0004 /* Modem open pending */
  94. #define PORT_ISPARALLEL 0x0008 /* Parallel port */
  95. #define PORT_BREAK 0x0010 /* Port on break */
  96. #define PORT_STATUSPEND 0x0020 /* Status packet pending */
  97. #define PORT_BREAKPEND 0x0040 /* Break packet pending */
  98. #define PORT_MODEMPEND 0x0080 /* Modem status packet pending */
  99. #define PORT_PARALLELBUG 0x0100 /* CD1400 LF -> CR LF bug on parallel
  100. port */
  101. #define PORT_FULLMODEM 0x0200 /* Full modem signals */
  102. #define PORT_RJ45 0x0400 /* RJ45 connector - no RI signal */
  103. #define PORT_RESTRICTED 0x0600 /* Restricted connector - no RI / DTR */
  104. #define PORT_MODEMBITS 0x0600 /* Mask for modem fields */
  105. #define PORT_WCLOSE 0x0800 /* Waiting for close */
  106. #define PORT_HANDSHAKEFIX 0x1000 /* Port has H/W flow control fix */
  107. #define PORT_WASPCLOSED 0x2000 /* Port closed with PCLOSE */
  108. #define DUMPMODE 0x4000 /* Dump RTA mem */
  109. #define READ_REG 0x8000 /* Read CD1400 register */
  110. /**************************************************************************
  111. * PHB Structure
  112. * A few words.
  113. *
  114. * Normally Packets are added to the end of the list and removed from
  115. * the start. The pointer tx_add points to a SPACE to put a Packet.
  116. * The pointer tx_remove points to the next Packet to remove
  117. *************************************************************************/
  118. #ifndef INKERNEL
  119. #define src_unit u2.s2.unit
  120. #define src_port u2.s2.port
  121. #define dest_unit u1.s1.unit
  122. #define dest_port u1.s1.port
  123. #endif
  124. #ifdef HOST
  125. #define tx_start u3.s1.tx_start_ptr_ptr
  126. #define tx_add u3.s1.tx_add_ptr_ptr
  127. #define tx_end u3.s1.tx_end_ptr_ptr
  128. #define tx_remove u3.s1.tx_remove_ptr_ptr
  129. #define rx_start u4.s1.rx_start_ptr_ptr
  130. #define rx_add u4.s1.rx_add_ptr_ptr
  131. #define rx_end u4.s1.rx_end_ptr_ptr
  132. #define rx_remove u4.s1.rx_remove_ptr_ptr
  133. #endif
  134. typedef struct PHB PHB ;
  135. struct PHB {
  136. #ifdef RTA
  137. ushort port;
  138. #endif
  139. #ifdef INKERNEL
  140. WORD source;
  141. #else
  142. union
  143. {
  144. ushort source; /* Complete source */
  145. struct
  146. {
  147. unsigned char unit; /* Source unit */
  148. unsigned char port; /* Source port */
  149. } s2;
  150. } u2;
  151. #endif
  152. WORD handshake ;
  153. WORD status ;
  154. NUMBER timeout ; /* Maximum of 1.9 seconds */
  155. WORD link ; /* Send down this link */
  156. #ifdef INKERNEL
  157. WORD destination;
  158. #else
  159. union
  160. {
  161. ushort destination; /* Complete destination */
  162. struct
  163. {
  164. unsigned char unit; /* Destination unit */
  165. unsigned char port; /* Destination port */
  166. } s1;
  167. } u1;
  168. #endif
  169. #ifdef RTA
  170. ushort tx_pkts_added;
  171. ushort tx_pkts_removed;
  172. Q_BUF_ptr tx_q_start ; /* Start of the Q list chain */
  173. short num_tx_q_bufs ; /* Number of Q buffers in the chain */
  174. PKT_ptr_ptr tx_add ; /* Add a new Packet here */
  175. Q_BUF_ptr tx_add_qb; /* Pointer to the add Q buf */
  176. PKT_ptr_ptr tx_add_st_qbb ; /* Pointer to start of the Q's buf */
  177. PKT_ptr_ptr tx_add_end_qbb ; /* Pointer to the end of the Q's buf */
  178. PKT_ptr_ptr tx_remove ; /* Remove a Packet here */
  179. Q_BUF_ptr tx_remove_qb ; /* Pointer to the remove Q buf */
  180. PKT_ptr_ptr tx_remove_st_qbb ; /* Pointer to the start of the Q buf */
  181. PKT_ptr_ptr tx_remove_end_qbb ; /* Pointer to the end of the Q buf */
  182. #endif
  183. #ifdef INKERNEL
  184. PKT_ptr_ptr tx_start ;
  185. PKT_ptr_ptr tx_end ;
  186. PKT_ptr_ptr tx_add ;
  187. PKT_ptr_ptr tx_remove ;
  188. #endif
  189. #ifdef HOST
  190. union
  191. {
  192. struct
  193. {
  194. PKT_ptr_ptr tx_start_ptr_ptr;
  195. PKT_ptr_ptr tx_end_ptr_ptr;
  196. PKT_ptr_ptr tx_add_ptr_ptr;
  197. PKT_ptr_ptr tx_remove_ptr_ptr;
  198. } s1;
  199. struct
  200. {
  201. ushort * tx_start_ptr;
  202. ushort * tx_end_ptr;
  203. ushort * tx_add_ptr;
  204. ushort * tx_remove_ptr;
  205. } s2;
  206. } u3;
  207. #endif
  208. #ifdef RTA
  209. ushort rx_pkts_added;
  210. ushort rx_pkts_removed;
  211. Q_BUF_ptr rx_q_start ; /* Start of the Q list chain */
  212. short num_rx_q_bufs ; /* Number of Q buffers in the chain */
  213. PKT_ptr_ptr rx_add ; /* Add a new Packet here */
  214. Q_BUF_ptr rx_add_qb ; /* Pointer to the add Q buf */
  215. PKT_ptr_ptr rx_add_st_qbb ; /* Pointer to start of the Q's buf */
  216. PKT_ptr_ptr rx_add_end_qbb ; /* Pointer to the end of the Q's buf */
  217. PKT_ptr_ptr rx_remove ; /* Remove a Packet here */
  218. Q_BUF_ptr rx_remove_qb ; /* Pointer to the remove Q buf */
  219. PKT_ptr_ptr rx_remove_st_qbb ; /* Pointer to the start of the Q buf */
  220. PKT_ptr_ptr rx_remove_end_qbb ; /* Pointer to the end of the Q buf */
  221. #endif
  222. #ifdef INKERNEL
  223. PKT_ptr_ptr rx_start ;
  224. PKT_ptr_ptr rx_end ;
  225. PKT_ptr_ptr rx_add ;
  226. PKT_ptr_ptr rx_remove ;
  227. #endif
  228. #ifdef HOST
  229. union
  230. {
  231. struct
  232. {
  233. PKT_ptr_ptr rx_start_ptr_ptr;
  234. PKT_ptr_ptr rx_end_ptr_ptr;
  235. PKT_ptr_ptr rx_add_ptr_ptr;
  236. PKT_ptr_ptr rx_remove_ptr_ptr;
  237. } s1;
  238. struct
  239. {
  240. ushort * rx_start_ptr;
  241. ushort * rx_end_ptr;
  242. ushort * rx_add_ptr;
  243. ushort * rx_remove_ptr;
  244. } s2;
  245. } u4;
  246. #endif
  247. #ifdef RTA /* some fields for the remotes */
  248. ushort flush_count; /* Count of write flushes */
  249. ushort txmode; /* Modes for tx */
  250. ushort rxmode; /* Modes for rx */
  251. ushort portmode; /* Generic modes */
  252. ushort column; /* TAB3 column count */
  253. ushort tx_subscript; /* (TX) Subscript into data field */
  254. ushort rx_subscript; /* (RX) Subscript into data field */
  255. PKT_ptr rx_incomplete; /* Hold an incomplete packet here */
  256. ushort modem_bits; /* Modem bits to mask */
  257. ushort lastModem; /* Modem control lines. */
  258. ushort addr; /* Address for sub commands */
  259. ushort MonitorTstate; /* TRUE if monitoring tstop */
  260. #endif
  261. } ;
  262. #endif
  263. /*********** end of file ***********/