1/**************************************************************************** 2 ******* ******* 3 ******* L I N K 4 ******* ******* 5 **************************************************************************** 6 7 Author : Ian Nandhra / Jeremy Rolls 8 Date : 9 10 * 11 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. 12 * 13 * This program is free software; you can redistribute it and/or modify 14 * it under the terms of the GNU General Public License as published by 15 * the Free Software Foundation; either version 2 of the License, or 16 * (at your option) any later version. 17 * 18 * This program is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * GNU General Public License for more details. 22 * 23 * You should have received a copy of the GNU General Public License 24 * along with this program; if not, write to the Free Software 25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 26 27 Version : 0.01 28 29 30 Mods 31 ---------------------------------------------------------------------------- 32 Date By Description 33 ---------------------------------------------------------------------------- 34 35 ***************************************************************************/ 36 37#ifndef _link_h 38#define _link_h 1 39 40#ifndef lint 41#ifdef SCCS_LABELS 42/* static char *_rio_link_h_sccs = "@(#)link.h 1.15"; */ 43#endif 44#endif 45 46 47 48/************************************************* 49 * Define the Link Status stuff 50 ************************************************/ 51#define LRT_ACTIVE ((ushort) 0x01) 52#define LRT_SPARE1 ((ushort) 0x02) 53#define INTRO_RCVD ((ushort) 0x04) 54#define FORCED_DISCONNECT ((ushort) 0x08) 55#define LRT_SPARE2 ((ushort) 0x80) 56 57#define TOP_OF_RTA_RAM ((ushort) 0x7000) 58#define HOST_SERIAL_POINTER (unsigned char **) (TOP_OF_RTA_RAM - 2 * sizeof (ushort)) 59 60/* Flags for ltt_status */ 61#define WAITING_ACK (ushort) 0x0001 62#define DATA_SENT (ushort) 0x0002 63#define WAITING_RUP (ushort) 0x0004 64#define WAITING_RETRY (ushort) 0x0008 65#define WAITING_TOPOLOGY (ushort) 0x0010 66#define SEND_SYNC (ushort) 0x0020 67#define FOAD_THIS_LINK (ushort) 0x0040 68#define REQUEST_SYNC (ushort) 0x0080 69#define REMOTE_DYING (ushort) 0x0100 70#define DIE_NOW (ushort) 0x0200 71 72/* Boot request stuff */ 73#define BOOT_REQUEST ((ushort) 0) /* Request for a boot */ 74#define BOOT_ABORT ((ushort) 1) /* Abort a boot */ 75#define BOOT_SEQUENCE ((ushort) 2) /* Packet with the number of packets 76 and load address */ 77#define BOOT_COMPLETED ((ushort) 3) /* Boot completed */ 78 79/* States that a link can be in */ 80#define LINK_DISCONNECTED ((ushort) 0) /* Disconnected */ 81#define LINK_BOOT1 ((ushort) 1) /* Trying to send 1st stage boot */ 82#define LINK_BOOT2 ((ushort) 2) /* Trying to send 2nd stage boot */ 83#define LINK_BOOT2WAIT ((ushort) 3) /* Waiting for selftest results */ 84#define LINK_BOOT3 ((ushort) 4) /* Trying to send 3rd stage boots */ 85#define LINK_SYNC ((ushort) 5) /* Syncing */ 86 87#define LINK_INTRO ((ushort) 10) /* Introductory packet */ 88#define LINK_SUPPLYID ((ushort) 11) /* Trying to supply an ID */ 89#define LINK_TOPOLOGY ((ushort) 12) /* Send a topology update */ 90#define LINK_REQUESTID ((ushort) 13) /* Waiting for an ID */ 91#define LINK_CONNECTED ((ushort) 14) /* Connected */ 92 93#define LINK_INTERCONNECT ((ushort) 20) /* Subnets interconnected */ 94 95#define LINK_SPARE ((ushort) 40) 96 97/* 98** Set the default timeout for link communications. 99*/ 100#define LINKTIMEOUT (400 * MILLISECOND) 101 102/* 103** LED stuff 104*/ 105#if defined(RTA) 106#define LED_OFF ((ushort) 0) /* LED off */ 107#define LED_RED ((ushort) 1) /* LED Red */ 108#define LED_GREEN ((ushort) 2) /* LED Green */ 109#define LED_ORANGE ((ushort) 4) /* LED Orange */ 110#define LED_1TO8_OPEN ((ushort) 1) /* Port 1->8 LED on */ 111#define LED_9TO16_OPEN ((ushort) 2) /* Port 9->16 LED on */ 112#define LED_SET_COLOUR(colour) (link->led = (colour)) 113#define LED_OR_COLOUR(colour) (link->led |= (colour)) 114#define LED_TIMEOUT(time) (link->led_timeout = RioTimePlus(RioTime(),(time))) 115#else 116#define LED_SET_COLOUR(colour) 117#define LED_OR_COLOUR(colour) 118#define LED_TIMEOUT(time) 119#endif /* RTA */ 120 121struct LPB { 122 WORD link_number ; /* Link Number */ 123 Channel_ptr in_ch ; /* Link In Channel */ 124 Channel_ptr out_ch ; /* Link Out Channel */ 125#ifdef RTA 126 uchar stat_led ; /* Port open leds */ 127 uchar led ; /* True, light led! */ 128#endif 129 BYTE attached_serial[4]; /* Attached serial number */ 130 BYTE attached_host_serial[4]; 131 /* Serial number of Host who 132 booted the other end */ 133 WORD descheduled ; /* Currently Descheduled */ 134 WORD state; /* Current state */ 135 WORD send_poll ; /* Send a Poll Packet */ 136 Process_ptr ltt_p ; /* Process Descriptor */ 137 Process_ptr lrt_p ; /* Process Descriptor */ 138 WORD lrt_status ; /* Current lrt status */ 139 WORD ltt_status ; /* Current ltt status */ 140 WORD timeout ; /* Timeout value */ 141 WORD topology; /* Topology bits */ 142 WORD mon_ltt ; 143 WORD mon_lrt ; 144 WORD WaitNoBoot ; /* Secs to hold off booting */ 145 PKT_ptr add_packet_list; /* Add packets to here */ 146 PKT_ptr remove_packet_list; /* Send packets from here */ 147#ifdef RTA 148#ifdef DCIRRUS 149#define QBUFS_PER_REDIRECT (4 / PKTS_PER_BUFFER + 1) 150#else 151#define QBUFS_PER_REDIRECT (8 / PKTS_PER_BUFFER + 1) 152#endif 153 PKT_ptr_ptr rd_add ; /* Add a new Packet here */ 154 Q_BUF_ptr rd_add_qb; /* Pointer to the add Q buf */ 155 PKT_ptr_ptr rd_add_st_qbb ; /* Pointer to start of the Q's buf */ 156 PKT_ptr_ptr rd_add_end_qbb ; /* Pointer to the end of the Q's buf */ 157 PKT_ptr_ptr rd_remove ; /* Remove a Packet here */ 158 Q_BUF_ptr rd_remove_qb ; /* Pointer to the remove Q buf */ 159 PKT_ptr_ptr rd_remove_st_qbb ; /* Pointer to the start of the Q buf */ 160 PKT_ptr_ptr rd_remove_end_qbb ; /* Pointer to the end of the Q buf */ 161 ushort pkts_in_q ; /* Packets in queue */ 162#endif 163 164 Channel_ptr lrt_fail_chan ; /* Lrt's failure channel */ 165 Channel_ptr ltt_fail_chan ; /* Ltt's failure channel */ 166 167#if defined(HOST) || defined(INKERNEL) 168 /* RUP structure for HOST to driver communications */ 169 struct RUP rup ; 170#endif 171 struct RUP link_rup; /* RUP for the link (POLL, 172 topology etc.) */ 173 WORD attached_link ; /* Number of attached link */ 174 WORD csum_errors ; /* csum errors */ 175 WORD num_disconnects ; /* number of disconnects */ 176 WORD num_sync_rcvd ; /* # sync's received */ 177 WORD num_sync_rqst ; /* # sync requests */ 178 WORD num_tx ; /* Num pkts sent */ 179 WORD num_rx ; /* Num pkts received */ 180 WORD module_attached; /* Module tpyes of attached */ 181 WORD led_timeout; /* LED timeout */ 182 WORD first_port; /* First port to service */ 183 WORD last_port; /* Last port to service */ 184 } ; 185 186#endif 187 188/*********** end of file ***********/ 189