link.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /****************************************************************************
  2. ******* *******
  3. ******* L I N K
  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 _link_h
  31. #define _link_h 1
  32. #ifndef lint
  33. #ifdef SCCS_LABELS
  34. /* static char *_rio_link_h_sccs = "@(#)link.h 1.15"; */
  35. #endif
  36. #endif
  37. /*************************************************
  38. * Define the Link Status stuff
  39. ************************************************/
  40. #define LRT_ACTIVE ((ushort) 0x01)
  41. #define LRT_SPARE1 ((ushort) 0x02)
  42. #define INTRO_RCVD ((ushort) 0x04)
  43. #define FORCED_DISCONNECT ((ushort) 0x08)
  44. #define LRT_SPARE2 ((ushort) 0x80)
  45. #define TOP_OF_RTA_RAM ((ushort) 0x7000)
  46. #define HOST_SERIAL_POINTER (unsigned char **) (TOP_OF_RTA_RAM - 2 * sizeof (ushort))
  47. /* Flags for ltt_status */
  48. #define WAITING_ACK (ushort) 0x0001
  49. #define DATA_SENT (ushort) 0x0002
  50. #define WAITING_RUP (ushort) 0x0004
  51. #define WAITING_RETRY (ushort) 0x0008
  52. #define WAITING_TOPOLOGY (ushort) 0x0010
  53. #define SEND_SYNC (ushort) 0x0020
  54. #define FOAD_THIS_LINK (ushort) 0x0040
  55. #define REQUEST_SYNC (ushort) 0x0080
  56. #define REMOTE_DYING (ushort) 0x0100
  57. #define DIE_NOW (ushort) 0x0200
  58. /* Boot request stuff */
  59. #define BOOT_REQUEST ((ushort) 0) /* Request for a boot */
  60. #define BOOT_ABORT ((ushort) 1) /* Abort a boot */
  61. #define BOOT_SEQUENCE ((ushort) 2) /* Packet with the number of packets
  62. and load address */
  63. #define BOOT_COMPLETED ((ushort) 3) /* Boot completed */
  64. /* States that a link can be in */
  65. #define LINK_DISCONNECTED ((ushort) 0) /* Disconnected */
  66. #define LINK_BOOT1 ((ushort) 1) /* Trying to send 1st stage boot */
  67. #define LINK_BOOT2 ((ushort) 2) /* Trying to send 2nd stage boot */
  68. #define LINK_BOOT2WAIT ((ushort) 3) /* Waiting for selftest results */
  69. #define LINK_BOOT3 ((ushort) 4) /* Trying to send 3rd stage boots */
  70. #define LINK_SYNC ((ushort) 5) /* Syncing */
  71. #define LINK_INTRO ((ushort) 10) /* Introductory packet */
  72. #define LINK_SUPPLYID ((ushort) 11) /* Trying to supply an ID */
  73. #define LINK_TOPOLOGY ((ushort) 12) /* Send a topology update */
  74. #define LINK_REQUESTID ((ushort) 13) /* Waiting for an ID */
  75. #define LINK_CONNECTED ((ushort) 14) /* Connected */
  76. #define LINK_INTERCONNECT ((ushort) 20) /* Subnets interconnected */
  77. #define LINK_SPARE ((ushort) 40)
  78. /*
  79. ** Set the default timeout for link communications.
  80. */
  81. #define LINKTIMEOUT (400 * MILLISECOND)
  82. /*
  83. ** LED stuff
  84. */
  85. #if defined(RTA)
  86. #define LED_OFF ((ushort) 0) /* LED off */
  87. #define LED_RED ((ushort) 1) /* LED Red */
  88. #define LED_GREEN ((ushort) 2) /* LED Green */
  89. #define LED_ORANGE ((ushort) 4) /* LED Orange */
  90. #define LED_1TO8_OPEN ((ushort) 1) /* Port 1->8 LED on */
  91. #define LED_9TO16_OPEN ((ushort) 2) /* Port 9->16 LED on */
  92. #define LED_SET_COLOUR(colour) (link->led = (colour))
  93. #define LED_OR_COLOUR(colour) (link->led |= (colour))
  94. #define LED_TIMEOUT(time) (link->led_timeout = RioTimePlus(RioTime(),(time)))
  95. #else
  96. #define LED_SET_COLOUR(colour)
  97. #define LED_OR_COLOUR(colour)
  98. #define LED_TIMEOUT(time)
  99. #endif /* RTA */
  100. struct LPB {
  101. WORD link_number ; /* Link Number */
  102. Channel_ptr in_ch ; /* Link In Channel */
  103. Channel_ptr out_ch ; /* Link Out Channel */
  104. #ifdef RTA
  105. uchar stat_led ; /* Port open leds */
  106. uchar led ; /* True, light led! */
  107. #endif
  108. BYTE attached_serial[4]; /* Attached serial number */
  109. BYTE attached_host_serial[4];
  110. /* Serial number of Host who
  111. booted the other end */
  112. WORD descheduled ; /* Currently Descheduled */
  113. WORD state; /* Current state */
  114. WORD send_poll ; /* Send a Poll Packet */
  115. Process_ptr ltt_p ; /* Process Descriptor */
  116. Process_ptr lrt_p ; /* Process Descriptor */
  117. WORD lrt_status ; /* Current lrt status */
  118. WORD ltt_status ; /* Current ltt status */
  119. WORD timeout ; /* Timeout value */
  120. WORD topology; /* Topology bits */
  121. WORD mon_ltt ;
  122. WORD mon_lrt ;
  123. WORD WaitNoBoot ; /* Secs to hold off booting */
  124. PKT_ptr add_packet_list; /* Add packets to here */
  125. PKT_ptr remove_packet_list; /* Send packets from here */
  126. #ifdef RTA
  127. #ifdef DCIRRUS
  128. #define QBUFS_PER_REDIRECT (4 / PKTS_PER_BUFFER + 1)
  129. #else
  130. #define QBUFS_PER_REDIRECT (8 / PKTS_PER_BUFFER + 1)
  131. #endif
  132. PKT_ptr_ptr rd_add ; /* Add a new Packet here */
  133. Q_BUF_ptr rd_add_qb; /* Pointer to the add Q buf */
  134. PKT_ptr_ptr rd_add_st_qbb ; /* Pointer to start of the Q's buf */
  135. PKT_ptr_ptr rd_add_end_qbb ; /* Pointer to the end of the Q's buf */
  136. PKT_ptr_ptr rd_remove ; /* Remove a Packet here */
  137. Q_BUF_ptr rd_remove_qb ; /* Pointer to the remove Q buf */
  138. PKT_ptr_ptr rd_remove_st_qbb ; /* Pointer to the start of the Q buf */
  139. PKT_ptr_ptr rd_remove_end_qbb ; /* Pointer to the end of the Q buf */
  140. ushort pkts_in_q ; /* Packets in queue */
  141. #endif
  142. Channel_ptr lrt_fail_chan ; /* Lrt's failure channel */
  143. Channel_ptr ltt_fail_chan ; /* Ltt's failure channel */
  144. #if defined (HOST) || defined (INKERNEL)
  145. /* RUP structure for HOST to driver communications */
  146. struct RUP rup ;
  147. #endif
  148. struct RUP link_rup; /* RUP for the link (POLL,
  149. topology etc.) */
  150. WORD attached_link ; /* Number of attached link */
  151. WORD csum_errors ; /* csum errors */
  152. WORD num_disconnects ; /* number of disconnects */
  153. WORD num_sync_rcvd ; /* # sync's received */
  154. WORD num_sync_rqst ; /* # sync requests */
  155. WORD num_tx ; /* Num pkts sent */
  156. WORD num_rx ; /* Num pkts received */
  157. WORD module_attached; /* Module tpyes of attached */
  158. WORD led_timeout; /* LED timeout */
  159. WORD first_port; /* First port to service */
  160. WORD last_port; /* Last port to service */
  161. } ;
  162. #endif
  163. /*********** end of file ***********/