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  ************************************************/
61 #define PHB_HANDSHAKE_SET      ((ushort) 0x001) /* Set by LRT */
62 
63 #define PHB_HANDSHAKE_RESET     ((ushort) 0x002) /* Set by ISR / driver */
64 
65 #define PHB_HANDSHAKE_FLAGS     (PHB_HANDSHAKE_RESET | PHB_HANDSHAKE_SET)
66                                                 /* Reset by ltt */
67 
68 
69 /*************************************************
70  * Maximum number of PHB's
71  ************************************************/
72 #if defined (HOST) || defined (INKERNEL)
73 #define MAX_PHB               ((ushort) 128)  /* range 0-127 */
74 #else
75 #define MAX_PHB               ((ushort) 8)    /* range 0-7 */
76 #endif
77 
78 /*************************************************
79  * Defines for the mode fields
80  ************************************************/
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 */
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 
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 */
109 
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 */
123 
124 #define PORT_MODEMBITS          0x0600  /* Mask for modem fields */
125 
126 #define PORT_WCLOSE             0x0800  /* Waiting for close */
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
158 typedef struct PHB PHB ;
159 struct PHB {
160 #ifdef RTA
161         ushort      port;
162 #endif
163 #ifdef INKERNEL
164         WORD      source;
165 #else
166         union
167         {
168             ushort source;              /* Complete source */
169             struct
170             {
171                 unsigned char unit;     /* Source unit */
172                 unsigned char port;     /* Source port */
173             } s2;
174         } u2;
175 #endif
176         WORD      handshake ;
177         WORD      status ;
178         NUMBER       timeout ;           /* Maximum of 1.9 seconds */
179         WORD      link ;              /* Send down this link */
180 #ifdef INKERNEL
181         WORD      destination;
182 #else
183         union
184         {
185             ushort destination;         /* Complete destination */
186             struct
187             {
188                 unsigned char unit;     /* Destination unit */
189                 unsigned char port;     /* Destination port */
190             } s1;
191         } u1;
192 #endif
193 #ifdef RTA
194         ushort      tx_pkts_added;
195         ushort      tx_pkts_removed;
196         Q_BUF_ptr   tx_q_start ;        /* Start of the Q list chain */
197         short       num_tx_q_bufs ;     /* Number of Q buffers in the chain */
198         PKT_ptr_ptr tx_add ;            /* Add a new Packet here */
199         Q_BUF_ptr   tx_add_qb;          /* Pointer to the add Q buf */
200         PKT_ptr_ptr tx_add_st_qbb ;     /* Pointer to start of the Q's buf */
201         PKT_ptr_ptr tx_add_end_qbb ;    /* Pointer to the end of the Q's buf */
202         PKT_ptr_ptr tx_remove ;         /* Remove a Packet here */
203         Q_BUF_ptr   tx_remove_qb ;      /* Pointer to the remove Q buf */
204         PKT_ptr_ptr tx_remove_st_qbb ;  /* Pointer to the start of the Q buf */
205         PKT_ptr_ptr tx_remove_end_qbb ; /* Pointer to the end of the Q buf */
206 #endif
207 #ifdef INKERNEL
208         PKT_ptr_ptr tx_start ;
209         PKT_ptr_ptr tx_end ;
210         PKT_ptr_ptr tx_add ;
211         PKT_ptr_ptr tx_remove ;
212 #endif
213 #ifdef HOST
214         union
215         {
216             struct
217             {
218                 PKT_ptr_ptr tx_start_ptr_ptr;
219                 PKT_ptr_ptr tx_end_ptr_ptr;
220                 PKT_ptr_ptr tx_add_ptr_ptr;
221                 PKT_ptr_ptr tx_remove_ptr_ptr;
222             } s1;
223             struct
224             {
225                 ushort * tx_start_ptr;
226                 ushort * tx_end_ptr;
227                 ushort * tx_add_ptr;
228                 ushort * tx_remove_ptr;
229             } s2;
230         } u3;
231 #endif
232 
233 #ifdef  RTA
234         ushort      rx_pkts_added;
235         ushort      rx_pkts_removed;
236         Q_BUF_ptr   rx_q_start ;        /* Start of the Q list chain */
237         short       num_rx_q_bufs ;     /* Number of Q buffers in the chain */
238         PKT_ptr_ptr rx_add ;            /* Add a new Packet here */
239         Q_BUF_ptr   rx_add_qb ;         /* Pointer to the add Q buf */
240         PKT_ptr_ptr rx_add_st_qbb ;     /* Pointer to start of the Q's buf */
241         PKT_ptr_ptr rx_add_end_qbb ;    /* Pointer to the end of the Q's buf */
242         PKT_ptr_ptr rx_remove ;         /* Remove a Packet here */
243         Q_BUF_ptr   rx_remove_qb ;      /* Pointer to the remove Q buf */
244         PKT_ptr_ptr rx_remove_st_qbb ;  /* Pointer to the start of the Q buf */
245         PKT_ptr_ptr rx_remove_end_qbb ; /* Pointer to the end of the Q buf */
246 #endif
247 #ifdef INKERNEL
248         PKT_ptr_ptr rx_start ;
249         PKT_ptr_ptr rx_end ;
250         PKT_ptr_ptr rx_add ;
251         PKT_ptr_ptr rx_remove ;
252 #endif
253 #ifdef HOST
254         union
255         {
256             struct
257             {
258                 PKT_ptr_ptr rx_start_ptr_ptr;
259                 PKT_ptr_ptr rx_end_ptr_ptr;
260                 PKT_ptr_ptr rx_add_ptr_ptr;
261                 PKT_ptr_ptr rx_remove_ptr_ptr;
262             } s1;
263             struct
264             {
265                 ushort * rx_start_ptr;
266                 ushort * rx_end_ptr;
267                 ushort * rx_add_ptr;
268                 ushort * rx_remove_ptr;
269             } s2;
270         } u4;
271 #endif
272 
273 #ifdef RTA                              /* some fields for the remotes */
274         ushort     flush_count;		/* Count of write flushes */
275         ushort     txmode;		/* Modes for tx */
276         ushort     rxmode;		/* Modes for rx */
277         ushort     portmode;		/* Generic modes */
278         ushort     column;		/* TAB3 column count */
279         ushort     tx_subscript;	/* (TX) Subscript into data field */
280         ushort     rx_subscript;	/* (RX) Subscript into data field */
281         PKT_ptr    rx_incomplete;	/* Hold an incomplete packet here */
282         ushort     modem_bits;		/* Modem bits to mask */
283 	ushort	   lastModem;		/* Modem control lines. */
284         ushort     addr;		/* Address for sub commands */
285         ushort     MonitorTstate;	/* TRUE if monitoring tstop */
286 #endif
287 
288         } ;
289 
290 #endif
291 
292 /*********** end of file ***********/
293 
294