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