diff options
Diffstat (limited to 'drivers/char/rio/rio.h')
-rw-r--r-- | drivers/char/rio/rio.h | 169 |
1 files changed, 42 insertions, 127 deletions
diff --git a/drivers/char/rio/rio.h b/drivers/char/rio/rio.h index 2d466ffe112d..b4c91871ba28 100644 --- a/drivers/char/rio/rio.h +++ b/drivers/char/rio/rio.h | |||
@@ -33,38 +33,6 @@ | |||
33 | #ifndef __rio_rio_h__ | 33 | #ifndef __rio_rio_h__ |
34 | #define __rio_rio_h__ | 34 | #define __rio_rio_h__ |
35 | 35 | ||
36 | #ifdef SCCS_LABELS | ||
37 | static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; | ||
38 | #endif | ||
39 | |||
40 | /* | ||
41 | ** 30.09.1998 ARG - | ||
42 | ** Introduced driver version and host card type strings | ||
43 | */ | ||
44 | #define RIO_DRV_STR "Specialix RIO Driver" | ||
45 | #define RIO_AT_HOST_STR "ISA" | ||
46 | #define RIO_PCI_HOST_STR "PCI" | ||
47 | |||
48 | |||
49 | /* | ||
50 | ** rio_info_store() commands (arbitary values) : | ||
51 | */ | ||
52 | #define RIO_INFO_PUT 0xA4B3C2D1 | ||
53 | #define RIO_INFO_GET 0xF1E2D3C4 | ||
54 | |||
55 | |||
56 | /* | ||
57 | ** anything that I couldn't cram in somewhere else | ||
58 | */ | ||
59 | /* | ||
60 | #ifndef RIODEBUG | ||
61 | #define debug | ||
62 | #else | ||
63 | #define debug rioprint | ||
64 | #endif | ||
65 | */ | ||
66 | |||
67 | |||
68 | /* | 36 | /* |
69 | ** Maximum numbers of things | 37 | ** Maximum numbers of things |
70 | */ | 38 | */ |
@@ -101,9 +69,8 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; | |||
101 | /* | 69 | /* |
102 | ** Flag values returned by functions | 70 | ** Flag values returned by functions |
103 | */ | 71 | */ |
72 | |||
104 | #define RIO_FAIL -1 | 73 | #define RIO_FAIL -1 |
105 | #define RIO_SUCCESS 0 | ||
106 | #define COPYFAIL -1 /* copy[in|out] failed */ | ||
107 | 74 | ||
108 | /* | 75 | /* |
109 | ** SysPort value for something that hasn't any ports | 76 | ** SysPort value for something that hasn't any ports |
@@ -142,30 +109,8 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; | |||
142 | /* | 109 | /* |
143 | ** Generally useful constants | 110 | ** Generally useful constants |
144 | */ | 111 | */ |
145 | #define HALF_A_SECOND ((HZ)>>1) | 112 | |
146 | #define A_SECOND (HZ) | 113 | #define HUNDRED_MS ((HZ/10)?(HZ/10):1) |
147 | #define HUNDRED_HZ ((HZ/100)?(HZ/100):1) | ||
148 | #define FIFTY_HZ ((HZ/50)?(HZ/50):1) | ||
149 | #define TWENTY_HZ ((HZ/20)?(HZ/20):1) | ||
150 | #define TEN_HZ ((HZ/10)?(HZ/10):1) | ||
151 | #define FIVE_HZ ((HZ/5)?(HZ/5):1) | ||
152 | #define HUNDRED_MS TEN_HZ | ||
153 | #define FIFTY_MS TWENTY_HZ | ||
154 | #define TWENTY_MS FIFTY_HZ | ||
155 | #define TEN_MS HUNDRED_HZ | ||
156 | #define TWO_SECONDS ((A_SECOND)*2) | ||
157 | #define FIVE_SECONDS ((A_SECOND)*5) | ||
158 | #define TEN_SECONDS ((A_SECOND)*10) | ||
159 | #define FIFTEEN_SECONDS ((A_SECOND)*15) | ||
160 | #define TWENTY_SECONDS ((A_SECOND)*20) | ||
161 | #define HALF_A_MINUTE (A_MINUTE>>1) | ||
162 | #define A_MINUTE (A_SECOND*60) | ||
163 | #define FIVE_MINUTES (A_MINUTE*5) | ||
164 | #define QUARTER_HOUR (A_MINUTE*15) | ||
165 | #define HALF_HOUR (A_MINUTE*30) | ||
166 | #define HOUR (A_MINUTE*60) | ||
167 | |||
168 | #define SIXTEEN_MEG 0x1000000 | ||
169 | #define ONE_MEG 0x100000 | 114 | #define ONE_MEG 0x100000 |
170 | #define SIXTY_FOUR_K 0x10000 | 115 | #define SIXTY_FOUR_K 0x10000 |
171 | 116 | ||
@@ -173,8 +118,6 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; | |||
173 | #define RIO_EISA_MEM_SIZE SIXTY_FOUR_K | 118 | #define RIO_EISA_MEM_SIZE SIXTY_FOUR_K |
174 | #define RIO_MCA_MEM_SIZE SIXTY_FOUR_K | 119 | #define RIO_MCA_MEM_SIZE SIXTY_FOUR_K |
175 | 120 | ||
176 | #define POLL_VECTOR 0x100 | ||
177 | |||
178 | #define COOK_WELL 0 | 121 | #define COOK_WELL 0 |
179 | #define COOK_MEDIUM 1 | 122 | #define COOK_MEDIUM 1 |
180 | #define COOK_RAW 2 | 123 | #define COOK_RAW 2 |
@@ -193,62 +136,19 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; | |||
193 | ** How to convert from various different device number formats: | 136 | ** How to convert from various different device number formats: |
194 | ** DEV is a dev number, as passed to open, close etc - NOT a minor | 137 | ** DEV is a dev number, as passed to open, close etc - NOT a minor |
195 | ** number! | 138 | ** number! |
196 | ** | 139 | **/ |
197 | ** Note: LynxOS only gives us 8 bits for the device minor number, | 140 | |
198 | ** so all this crap here to deal with 'modem' bits etc. is | ||
199 | ** just a load of irrelevant old bunkum! | ||
200 | ** This however does not stop us needing to define a value | ||
201 | ** for RIO_MODEMOFFSET which is required by the 'riomkdev' | ||
202 | ** utility in the New Config Utilities suite. | ||
203 | */ | ||
204 | /* 0-511: direct 512-1023: modem */ | ||
205 | #define RIO_MODEMOFFSET 0x200 /* doesn't mean anything */ | ||
206 | #define RIO_MODEM_MASK 0x1FF | 141 | #define RIO_MODEM_MASK 0x1FF |
207 | #define RIO_MODEM_BIT 0x200 | 142 | #define RIO_MODEM_BIT 0x200 |
208 | #define RIO_UNMODEM(DEV) (MINOR(DEV) & RIO_MODEM_MASK) | 143 | #define RIO_UNMODEM(DEV) (MINOR(DEV) & RIO_MODEM_MASK) |
209 | #define RIO_ISMODEM(DEV) (MINOR(DEV) & RIO_MODEM_BIT) | 144 | #define RIO_ISMODEM(DEV) (MINOR(DEV) & RIO_MODEM_BIT) |
210 | #define RIO_PORT(DEV,FIRST_MAJ) ( (MAJOR(DEV) - FIRST_MAJ) * PORTS_PER_HOST) \ | 145 | #define RIO_PORT(DEV,FIRST_MAJ) ( (MAJOR(DEV) - FIRST_MAJ) * PORTS_PER_HOST) \ |
211 | + MINOR(DEV) | 146 | + MINOR(DEV) |
212 | 147 | #define CSUM(pkt_ptr) (((u16 *)(pkt_ptr))[0] + ((u16 *)(pkt_ptr))[1] + \ | |
213 | #define splrio spltty | 148 | ((u16 *)(pkt_ptr))[2] + ((u16 *)(pkt_ptr))[3] + \ |
214 | 149 | ((u16 *)(pkt_ptr))[4] + ((u16 *)(pkt_ptr))[5] + \ | |
215 | #define RIO_IPL 5 | 150 | ((u16 *)(pkt_ptr))[6] + ((u16 *)(pkt_ptr))[7] + \ |
216 | #define RIO_PRI (PZERO+10) | 151 | ((u16 *)(pkt_ptr))[8] + ((u16 *)(pkt_ptr))[9] ) |
217 | #define RIO_CLOSE_PRI PZERO-1 /* uninterruptible sleeps for close */ | ||
218 | |||
219 | typedef struct DbInf { | ||
220 | uint Flag; | ||
221 | char Name[8]; | ||
222 | } DbInf; | ||
223 | |||
224 | #ifndef TRUE | ||
225 | #define TRUE (1==1) | ||
226 | #endif | ||
227 | #ifndef FALSE | ||
228 | #define FALSE (!TRUE) | ||
229 | #endif | ||
230 | |||
231 | #define CSUM(pkt_ptr) (((ushort *)(pkt_ptr))[0] + ((ushort *)(pkt_ptr))[1] + \ | ||
232 | ((ushort *)(pkt_ptr))[2] + ((ushort *)(pkt_ptr))[3] + \ | ||
233 | ((ushort *)(pkt_ptr))[4] + ((ushort *)(pkt_ptr))[5] + \ | ||
234 | ((ushort *)(pkt_ptr))[6] + ((ushort *)(pkt_ptr))[7] + \ | ||
235 | ((ushort *)(pkt_ptr))[8] + ((ushort *)(pkt_ptr))[9] ) | ||
236 | |||
237 | /* | ||
238 | ** This happy little macro copies SIZE bytes of data from FROM to TO | ||
239 | ** quite well. SIZE must be a constant. | ||
240 | */ | ||
241 | #define CCOPY( FROM, TO, SIZE ) { *(struct s { char data[SIZE]; } *)(TO) = *(struct s *)(FROM); } | ||
242 | |||
243 | /* | ||
244 | ** increment a buffer pointer modulo the size of the buffer... | ||
245 | */ | ||
246 | #define BUMP( P, I ) ((P) = (((P)+(I)) & RIOBufferMask)) | ||
247 | |||
248 | #define INIT_PACKET( PK, PP ) \ | ||
249 | { \ | ||
250 | *((uint *)PK) = PP->PacketInfo; \ | ||
251 | } | ||
252 | 152 | ||
253 | #define RIO_LINK_ENABLE 0x80FF /* FF is a hack, mainly for Mips, to */ | 153 | #define RIO_LINK_ENABLE 0x80FF /* FF is a hack, mainly for Mips, to */ |
254 | /* prevent a really stupid race condition. */ | 154 | /* prevent a really stupid race condition. */ |
@@ -267,27 +167,42 @@ typedef struct DbInf { | |||
267 | #define DISCONNECT 0 | 167 | #define DISCONNECT 0 |
268 | #define CONNECT 1 | 168 | #define CONNECT 1 |
269 | 169 | ||
170 | /* ------ Control Codes ------ */ | ||
270 | 171 | ||
271 | /* | 172 | #define CONTROL '^' |
272 | ** Machine types - these must NOT overlap with product codes 0-15 | 173 | #define IFOAD ( CONTROL + 1 ) |
273 | */ | 174 | #define IDENTIFY ( CONTROL + 2 ) |
274 | #define RIO_MIPS_R3230 31 | 175 | #define ZOMBIE ( CONTROL + 3 ) |
275 | #define RIO_MIPS_R4030 32 | 176 | #define UFOAD ( CONTROL + 4 ) |
177 | #define IWAIT ( CONTROL + 5 ) | ||
178 | |||
179 | #define IFOAD_MAGIC 0xF0AD /* of course */ | ||
180 | #define ZOMBIE_MAGIC (~0xDEAD) /* not dead -> zombie */ | ||
181 | #define UFOAD_MAGIC 0xD1E /* kill-your-neighbour */ | ||
182 | #define IWAIT_MAGIC 0xB1DE /* Bide your time */ | ||
183 | |||
184 | /* ------ Error Codes ------ */ | ||
185 | |||
186 | #define E_NO_ERROR ((ushort) 0) | ||
187 | |||
188 | /* ------ Free Lists ------ */ | ||
276 | 189 | ||
277 | #define RIO_IO_UNKNOWN -2 | 190 | struct rio_free_list { |
191 | u16 next; | ||
192 | u16 prev; | ||
193 | }; | ||
278 | 194 | ||
279 | #undef MODERN | 195 | /* NULL for card side linked lists */ |
280 | #define ERROR( E ) do { u.u_error = E; return OPENFAIL } while ( 0 ) | 196 | #define TPNULL ((ushort)(0x8000)) |
197 | /* We can add another packet to a transmit queue if the packet pointer pointed | ||
198 | * to by the TxAdd pointer has PKT_IN_USE clear in its address. */ | ||
199 | #define PKT_IN_USE 0x1 | ||
281 | 200 | ||
282 | /* Defines for MPX line discipline routines */ | 201 | /* ------ Topology ------ */ |
283 | 202 | ||
284 | #define DIST_LINESW_OPEN 0x01 | 203 | struct Top { |
285 | #define DIST_LINESW_CLOSE 0x02 | 204 | u8 Unit; |
286 | #define DIST_LINESW_READ 0x04 | 205 | u8 Link; |
287 | #define DIST_LINESW_WRITE 0x08 | 206 | }; |
288 | #define DIST_LINESW_IOCTL 0x10 | ||
289 | #define DIST_LINESW_INPUT 0x20 | ||
290 | #define DIST_LINESW_OUTPUT 0x40 | ||
291 | #define DIST_LINESW_MDMINT 0x80 | ||
292 | 207 | ||
293 | #endif /* __rio_h__ */ | 208 | #endif /* __rio_h__ */ |