• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 //   vim:tw=110:ts=4:
3 #ifndef HCFCFG_H
4 #define HCFCFG_H 1
5 
6 /*************************************************************************************************************
7 *
8 * FILE	 : hcfcfg.tpl // hcfcfg.h
9 *
10 * DATE   : $Date: 2004/08/05 11:47:10 $   $Revision: 1.6 $
11 * Original: 2004/04/08 15:18:16    Revision: 1.40      Tag: t20040408_01
12 * Original: 2004/04/01 15:32:55    Revision: 1.38      Tag: t7_20040401_01
13 * Original: 2004/03/10 15:39:28    Revision: 1.34      Tag: t20040310_01
14 * Original: 2004/03/03 14:10:12    Revision: 1.32      Tag: t20040304_01
15 * Original: 2004/03/02 09:27:12    Revision: 1.30      Tag: t20040302_03
16 * Original: 2004/02/24 13:00:28    Revision: 1.25      Tag: t20040224_01
17 * Original: 2004/02/18 17:13:57    Revision: 1.23      Tag: t20040219_01
18 *
19 * AUTHOR : Nico Valster
20 *
21 * DESC   : HCF Customization Macros
22 * hcfcfg.tpl list all #defines which must be specified to:
23 *   adjust the HCF functions defined in HCF.C to the characteristics of a specific environment
24 *		o maximum sizes for messages
25 *		o Endianess
26 *	Compiler specific macros
27 *		o port I/O macros
28 *		o type definitions
29 *
30 * By copying HCFCFG.TPL to HCFCFG.H and -if needed- modifying the #defines the WCI functionality can be
31 * tailored
32 *
33 * Supported environments:
34 * WVLAN_41	Miniport								NDIS 3.1
35 * WVLAN_42	Packet									Microsoft Visual C 1.5
36 * WVLAN_43	16 bits DOS ODI							Microsoft Visual C 1.5
37 * WVLAN_44	32 bits ODI (__NETWARE_386__)			WATCOM
38 * WVLAN_45	MAC_OS									MPW?, Symantec?
39 * WVLAN_46	Windows CE (_WIN32_WCE)					Microsoft ?
40 * WVLAN_47	LINUX  (__LINUX__)						GCC, discarded, based on GPL'ed HCF-light
41 * WVLAN_48	Miniport								NDIS 5
42 * WVLAN_49	LINUX  (__LINUX__)						GCC, originally based on pre-compiled HCF_library
43 * 													migrated to use the HCF sources when Lucent Technologies
44 * 													brought the HCF module under GPL
45 * WVLAN_51	Miniport USB							NDIS 5
46 * WVLAN_52	Miniport								NDIS 4
47 * WVLAN_53	VxWorks END Station driver
48 * WVLAN_54	VxWorks END Access Point driver
49 * WVLAN_81	WavePoint								BORLAND C
50 * WCITST	Inhouse test tool						Microsoft Visual C 1.5
51 * WSU		WaveLAN Station Update					Microsoft Visual C ??
52 * SCO UNIX	not yet actually used ?					?
53 * __ppc		OEM supplied							?
54 * _AM29K	OEM supplied							?
55 * ?			OEM supplied							Microtec Research 80X86 Compiler
56 *
57 **************************************************************************************************************
58 *
59 *
60 * SOFTWARE LICENSE
61 *
62 * This software is provided subject to the following terms and conditions,
63 * which you should read carefully before using the software.  Using this
64 * software indicates your acceptance of these terms and conditions.  If you do
65 * not agree with these terms and conditions, do not use the software.
66 *
67 * COPYRIGHT © 1994 - 1995	by AT&T.				All Rights Reserved
68 * COPYRIGHT © 1996 - 2000 by Lucent Technologies.	All Rights Reserved
69 * COPYRIGHT © 2001 - 2004	by Agere Systems Inc.	All Rights Reserved
70 * All rights reserved.
71 *
72 * Redistribution and use in source or binary forms, with or without
73 * modifications, are permitted provided that the following conditions are met:
74 *
75 * . Redistributions of source code must retain the above copyright notice, this
76 *    list of conditions and the following Disclaimer as comments in the code as
77 *    well as in the documentation and/or other materials provided with the
78 *    distribution.
79 *
80 * . Redistributions in binary form must reproduce the above copyright notice,
81 *    this list of conditions and the following Disclaimer in the documentation
82 *    and/or other materials provided with the distribution.
83 *
84 * . Neither the name of Agere Systems Inc. nor the names of the contributors
85 *    may be used to endorse or promote products derived from this software
86 *    without specific prior written permission.
87 *
88 * Disclaimer
89 *
90 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
91 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
92 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  ANY
93 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
94 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
95 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
96 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
97 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
98 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
99 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
100 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
101 * DAMAGE.
102 *
103 *
104 *************************************************************************************************************/
105 
106 /*	Alignment
107 *	Some platforms can access words on odd boundaries (with possibly an performance impact), at other
108 *	platforms such an access may result in a memory access violation.
109 *	It is assumed that everywhere where the HCF casts a char pointer into a word pointer, the alignment
110 *	criteria are met. This put some restrictions on the MSF, which are assumed to be "automatically" fulfilled
111 *	at the applicable platforms
112 *	To assert this assumption, the macro HCF_ALIGN can be defined. The default value is 1, meaning byte
113 *	alignment (or no alignment), a value of 2 means word alignment, a value of 4 means double word alignment
114 */
115 
116 /*****************************    IN_PORT_STRING_8_16  S a m p l e s *****************************************
117 
118 		// C implementation which let the processor handle the word-at-byte-boundary problem
119 #define IN_PORT_STRING_8_16( port, addr, n) while ( n-- ) 	\
120 	{ *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_8 FAR*)addr)+=2; }
121 
122 		// C implementation which handles the word-at-byte-boundary problem
123 #define IN_PORT_STRING_8_16( port, addr, n)	while ( n-- )	 \
124 	{ hcf_16 i = IN_PORT_WORD(port); *((hcf_8 FAR*)addr)++ = (hcf_8)i; *((hcf_8 FAR*)addr)++ = (hcf_8)(i>>8);}
125 
126 		// Assembler implementation
127 #define IN_PORT_STRING_8_16( port, addr, len) __asm		\
128 {														\
129 	__asm push di										\
130 	__asm push es										\
131 	__asm mov cx,len									\
132 	__asm les di,addr									\
133 	__asm mov dx,port									\
134 	__asm rep insw										\
135 	__asm pop es										\
136 	__asm pop di										\
137 }
138 
139 
140 *****************************   OUT_PORT_STRING_8_16  S a m p l e s ******************************************
141 
142 		// C implementation which let the processor handle the word-at-byte-boundary problem
143 #define OUT_PORT_STRING_8_16( port, addr, n)	while ( n-- ) \
144 	{ OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; ((hcf_8 FAR*)addr)+=2; }
145 
146 		// C implementation which handles the word-at-byte-boundary problem
147 #define OUT_PORT_STRING_8_16( port, addr, n)	while ( n-- ) \
148 	{ OUT_PORT_WORD( port, *((hcf_8 FAR*)addr) | *(((hcf_8 FAR*)addr)+1)<<8  ); (hcf_8 FAR*)addr+=2; }
149 
150 		// Assembler implementation
151 #define OUT_PORT_STRING_8_16( port, addr, len) __asm	\
152 {														\
153 	__asm push si										\
154 	__asm push ds										\
155 	__asm mov cx,len									\
156 	__asm lds si,addr									\
157 	__asm mov dx,port									\
158 	__asm rep outsw										\
159 	__asm pop ds										\
160 	__asm pop si										\
161 }
162 
163 *************************************************************************************************************/
164 
165 
166 /************************************************************************************************/
167 /******************  C O M P I L E R   S P E C I F I C   M A C R O S  ***************************/
168 /************************************************************************************************/
169 /*************************************************************************************************
170 *
171 *			!!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
172 *			!!!! Do not call these macros with parameters which introduce side effects !!!!
173 *			!!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
174 *
175 *
176 * By selecting the appropriate Macro definitions by means of modifying the "#ifdef 0/1" lines, the HCF can be
177 * adjusted for the I/O characteristics of a specific compiler
178 *
179 * If needed the macros can be modified or replaced with definitions appropriate for your personal platform.
180 * If you need to make such changes it is appreciated if you inform Agere Systems
181 * That way the changes can become part of the next release of the WCI
182 *
183 * For convenience of the MSF-programmer, all macros are allowed to modify their parameters (although some
184 * might argue that this would constitute bad coding practice). This has its implications on the HCF, e.g. as a
185 * consequence these macros should not be called with parameters which have side effects, e.g auto-increment.
186 *
187 * in the Microsoft implementation of inline assembly it is O.K. to corrupt all flags except the direction flag
188 * and to corrupt all registers except the segment registers and EDI, ESI, ESP and EBP (or their 16 bits
189 * equivalents).  Other environments may have other constraints
190 *
191 * in the Intel environment it is O.K to have a word (as a 16 bits quantity) at a byte boundary, hence
192 * IN_/OUT_PORT_STRING_8_16 can move words between PC-memory and NIC-memory with as only constraint that the
193 * words are on a word boundary in NIC-memory. This does not hold true for all conceivable environments, e.g.
194 * an Motorola 68xxx does not allow this. Probably/hopefully the boundary conditions imposed by these type of
195 * platforms prevent this case from materializing.  If this is not the case, OUT_PORT_STRING_8_16 must be coded
196 * by combining two Host memory hcf_8 values at a time to a single hcf_16 value to be passed to the NIC and
197 * IN_PORT_STRING_8_16 the single hcf_16 retrieved from the NIC must be split in two hcf_8 values to be stored
198 * in Host memory (see the sample code above)
199 *
200 *	The prototypes and functional description of the macros are:
201 *
202 *	hcf_16	IN_PORT_WORD( hcf_16 port )
203 *			Reads a word (16 bits) from the specified port
204 *
205 *	void	OUT_PORT_WORD( hcf_16 port, hcf_16 value)
206 *			Writes a word (16 bits) to the specified port
207 *
208 *	hcf_16	IN_PORT_DWORD( hcf_16 port )
209 *			Reads a dword (32 bits) from the specified port
210 *
211 *	void	OUT_PORT_DWORD( hcf_16 port, hcf_32 value)
212 *			Writes a dword (32 bits) to the specified port
213 *
214 *	void	IN_PORT_STRING_8_16( port, addr, len)
215 *			Reads len number of words (16 bits) from NIC memory via the specified port to the (FAR)
216 *			byte-pointer addr in PC-RAM
217 *			Note that len specifies the number of words, NOT the number of bytes
218 *			!!!NOTE, although len specifies the number of words, addr MUST be a char pointer NOTE!!!
219 *			See also the common notes for IN_PORT_STRING_8_16 and OUT_PORT_STRING_8_16
220 *
221 *	void	OUT_PORT_STRING_8_16( port, addr, len)
222 *			Writes len number of words (16 bits) from the (FAR) byte-pointer addr in PC-RAM via the specified
223 *			port to NIC memory
224 *			Note that len specifies the number of words, NOT the number of bytes.
225 *			!!!NOTE, although len specifies the number of words, addr MUST be a char pointer NOTE!!!
226 *
227 *			The peculiar combination of word-length and char pointers for IN_PORT_STRING_8_16 as well as
228 *			OUT_PORT_STRING_8_16 is justified by the assumption that it offers a more optimal algorithm
229 *
230 *	void	IN_PORT_STRING_32( port, addr, len)
231 *			Reads len number of double-words (32 bits) from NIC memory via the specified port to the (FAR)
232 *			double-word address addr in PC-RAM
233 *
234 *	void	OUT_PORT_STRING_32( port, addr, len)
235 *			Writes len number of double-words (32 bits) from the (FAR) double-word address addr in PC-RAM via
236 *			the specified port to NIC memory
237 *
238 *			!!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
239 *			!!!! Do not call these macros with parameters which introduce side effects !!!!
240 *			!!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
241 *
242 *************************************************************************************************/
243 
244 /****************************  define INT Types  ******************************/
245 typedef unsigned char			hcf_8;
246 typedef unsigned short			hcf_16;
247 typedef unsigned long			hcf_32;
248 
249 /****************************  define I/O Types  ******************************/
250 #define HCF_IO_MEM     			0x0001	// memory mapped I/O	( 0: Port I/O )
251 #define HCF_IO_32BITS   	  	0x0002 	// 32Bits support		( 0: only 16 Bits I/O)
252 
253 /****************************** #define HCF_TYPE ********************************/
254 #define HCF_TYPE_NONE			0x0000	// No type
255 #define HCF_TYPE_WPA			0x0001	// WPA support
256 #define HCF_TYPE_USB			0x0002	// reserved (USB Dongle driver support)
257 //#define HCF_TYPE_HII			0x0004	// Hermes-II, to discriminate H-I and H-II CFG_HCF_OPT_STRCT
258 #define HCF_TYPE_WARP			0x0008	// WARP F/W
259 #define HCF_TYPE_PRELOADED		0x0040	// pre-loaded F/W
260 #define HCF_TYPE_HII5			0x0080	// Hermes-2.5 H/W
261 #define HCF_TYPE_CCX			0x0100	// CKIP
262 #define HCF_TYPE_BEAGLE_HII5	0x0200	// Beagle Hermes-2.5 H/W
263 #define HCF_TYPE_TX_DELAY		0x4000	// Delayed transmission ( non-DMA only)
264 
265 /****************************** #define HCF_ASSERT ******************************/
266 #define HCF_ASSERT_NONE			0x0000	// No assert support
267 #define HCF_ASSERT_PRINTF		0x0001	// Hermes generated debug info
268 #define HCF_ASSERT_SW_SUP		0x0002	// logging via Hermes support register
269 #define HCF_ASSERT_MB			0x0004	// logging via Mailbox
270 #define HCF_ASSERT_RT_MSF_RTN	0x4000	// dynamically binding of msf_assert routine
271 #define HCF_ASSERT_LNK_MSF_RTN	0x8000	// statically binding of msf_assert routine
272 
273 /****************************** #define HCF_ENCAP *******************************/
274 #define HCF_ENC_NONE			0x0000	// No encapsulation support
275 #define HCF_ENC					0x0001	// HCF handles En-/Decapsulation
276 #define HCF_ENC_SUP				0x0002	// HCF supports MSF to handle En-/Decapsulation
277 
278 /****************************** #define HCF_EXT *********************************/
279 #define HCF_EXT_NONE			0x0000	// No expanded features
280 #define HCF_EXT_INFO_LOG		0x0001	// logging of Hermes Info frames
281 //#define HCF_EXT_INT_TX_OK		0x0002	// RESERVED!!! monitoring successful Tx message
282 #define HCF_EXT_INT_TX_EX		0x0004	// monitoring unsuccessful Tx message
283 //#define HCF_EXT_MON_MODE		0x0008	// LEGACY
284 #define HCF_EXT_TALLIES_FW		0x0010	// support for up to 32 Hermes Engineering tallies
285 #define HCF_EXT_TALLIES_HCF		0x0020	// support for up to 8 HCF Engineering tallies
286 #define HCF_EXT_NIC_ACCESS		0x0040	// direct access via Aux-ports and to Hermes registers and commands
287 #define HCF_EXT_MB				0x0080	// MailBox code expanded
288 #define HCF_EXT_IFB_STRCT 		0x0100	// MSF custom pointer in IFB
289 #define HCF_EXT_DESC_STRCT 		0x0200	// MSF custom pointer in Descriptor
290 #define HCF_EXT_TX_CONT			0x4000	// Continuous transmit test
291 #define HCF_EXT_INT_TICK		0x8000	// enables TimerTick interrupt generation
292 
293 /****************************** #define HCF_SLEEP *******************************/
294 #define HCF_DDS					0x0001	// Disconnected Deep Sleep
295 #define HCF_CDS					0x0002	// Connected Deep Sleep
296 
297 /****************************** #define HCF_TALLIES ******************************/
298 #define HCF_TALLIES_NONE		0x0000	// No tally support
299 #define HCF_TALLIES_NIC			0x0001	// Hermes Tallies accumulated in IFB
300 #define HCF_TALLIES_HCF			0x0002	// HCF Tallies accumulated in IFB
301 #define HCF_TALLIES_RESET		0x8000	// Tallies in IFB are reset when reported via hcf_get_info
302 
303 /************************************************************************************************/
304 /******************************************  L I N U X  *****************************************/
305 /************************************************************************************************/
306 
307 #ifdef WVLAN_49
308 #include <asm/io.h>
309 //#include <linux/module.h>
310 #include <wl_version.h>
311 
312 /* The following macro ensures that no symbols are exported, minimizing the chance of a symbol
313    collision in the kernel */
314 //EXPORT_NO_SYMBOLS;  //;?this place seems not appropriately to me
315 
316 //#define HCF_SLEEP (HCF_CDS | HCF_DDS )
317 #define HCF_SLEEP (HCF_CDS)
318 
319 /* Note: Non-WARP firmware all support WPA. However the original Agere
320  * linux driver does not enable WPA. Enabling WPA here causes whatever
321  * preliminary WPA logic to be included, some of which may be specific
322  * to HERMESI.
323  *
324  * Various comment are clear that WARP and WPA are not compatible
325  * (which may just mean WARP does WPA in a different fashion).
326  */
327 
328 /* #define HCF_TYPE    (HCF_TYPE_HII5|HCF_TYPE_STA|HCF_TYPE_AP) */
329 #ifdef HERMES25
330 #ifdef WARP
331 #define HCF_TYPE    ( HCF_TYPE_WARP | HCF_TYPE_HII5 )
332 #else
333 #define HCF_TYPE    (HCF_TYPE_HII5 | HCF_TYPE_WPA)
334 #endif /* WARP */
335 #else
336 #define HCF_TYPE    HCF_TYPE_WPA
337 #endif /* HERMES25 */
338 
339 #ifdef ENABLE_DMA
340 #define HCF_DMA		1
341 #endif // ENABLE_DMA
342 
343 /* We now need a switch to include support for the Mailbox and other necessary extensions */
344 #define HCF_EXT ( HCF_EXT_MB | HCF_EXT_INFO_LOG | HCF_EXT_INT_TICK )//get deepsleep exercise going
345 
346 /* ;? The Linux MSF still uses these definitions; define it here until it's removed */
347 #ifndef HCF_TYPE_HII
348 #define HCF_TYPE_HII 0x0004
349 #endif
350 
351 #ifndef HCF_TYPE_AP
352 #define HCF_TYPE_AP  0x0010
353 #endif
354 
355 #ifndef HCF_TYPE_STA
356 #define HCF_TYPE_STA 0x0020
357 #endif  // HCF_TYPE_STA
358 
359 /* Guarantees word alignment */
360 #define HCF_ALIGN		2
361 
362 /* Endian macros CNV_INT_TO_LITTLE() and CNV_LITTLE_TO_INT() were renamed to
363    CNV_SHORT_TO_LITTLE() and CNV_LITTLE_TO_SHORT() */
364 #ifndef CNV_INT_TO_LITTLE
365 #define CNV_INT_TO_LITTLE   CNV_SHORT_TO_LITTLE
366 #endif
367 
368 #ifndef CNV_LITTLE_TO_INT
369 #define CNV_LITTLE_TO_INT   CNV_LITTLE_TO_SHORT
370 #endif
371 
372 #define	HCF_ERR_BUSY			0x06
373 
374 /* UIL defines were removed from the HCF */
375 #define UIL_SUCCESS					HCF_SUCCESS
376 #define UIL_ERR_TIME_OUT			HCF_ERR_TIME_OUT
377 #define UIL_ERR_NO_NIC				HCF_ERR_NO_NIC
378 #define UIL_ERR_LEN					HCF_ERR_LEN
379 #define UIL_ERR_MIN					HCF_ERR_MAX	/*end of HCF errors which are passed through to UIL
380 												  *** ** *** ****** ***** *** ****** ******* ** ***  */
381 #define UIL_ERR_IN_USE				0x44
382 #define UIL_ERR_WRONG_IFB			0x46
383 #define UIL_ERR_MAX					0x7F		/*upper boundary of UIL errors without HCF-pendant
384                                                   ***** ******** ** *** ****** ******* *** *******  */
385 #define UIL_ERR_BUSY			    HCF_ERR_BUSY
386 #define UIL_ERR_DIAG_1			    HCF_ERR_DIAG_1
387 #define UIL_FAILURE					0xFF	/* 20010705 nv this relick should be eridicated */
388 #define UIL_ERR_PIF_CONFLICT		0x40	//obsolete
389 #define UIL_ERR_INCOMP_DRV			0x41	//obsolete
390 #define UIL_ERR_DOS_CALL			0x43	//obsolete
391 #define UIL_ERR_NO_DRV				0x42	//obsolete
392 #define UIL_ERR_NSTL				0x45	//obsolete
393 
394 
395 
396 #if 0  //;? #ifdef get this going LATER HERMES25
397 #define HCF_IO              HCF_IO_32BITS
398 #define HCF_DMA             1
399 #define HCF_DESC_STRCT_EXT  4
400 
401 /* Switch for BusMaster DMA support. Note that the above define includes the DMA-specific HCF
402    code in the build. This define sets the MSF to use DMA; if ENABLE_DMA is not defined, then
403    port I/O will be used in the build */
404 #ifndef BUS_PCMCIA
405 #define ENABLE_DMA
406 #endif  // USE_PCMCIA
407 
408 #endif  // HERMES25
409 
410 
411 /* Overrule standard WaveLAN Packet Size when in DMA mode */
412 #ifdef ENABLE_DMA
413 #define HCF_MAX_PACKET_SIZE 2304
414 #else
415 #define HCF_MAX_PACKET_SIZE 1514
416 #endif  // ENABLE_DMA
417 
418 /* The following sets the component ID, as well as the versioning. See also wl_version.h */
419 #define	MSF_COMPONENT_ID	COMP_ID_LINUX
420 
421 #define	MSF_COMPONENT_VAR			DRV_VARIANT
422 #define MSF_COMPONENT_MAJOR_VER     DRV_MAJOR_VERSION
423 #define MSF_COMPONENT_MINOR_VER     DRV_MINOR_VERSION
424 
425 /* Define the following to turn on assertions in the HCF */
426 //#define HCF_ASSERT  0x8000
427 #define HCF_ASSERT			HCF_ASSERT_LNK_MSF_RTN	// statically binding of msf_assert routine
428 
429 #ifdef USE_BIG_ENDIAN
430 #define HCF_BIG_ENDIAN  1
431 #else
432 #define HCF_BIG_ENDIAN  0
433 #endif  /* USE_BIG_ENDIAN */
434 
435 /* Define the following if your system uses memory-mapped IO */
436 //#define HCF_MEM_IO
437 
438 /* The following defines the standard macros required by the HCF to move data to/from the card */
439 #define IN_PORT_BYTE(port)			((hcf_8)inb( (hcf_io)(port) ))
440 #define IN_PORT_WORD(port)			((hcf_16)inw( (hcf_io)(port) ))
441 #define OUT_PORT_BYTE(port, value)	(outb( (hcf_8) (value), (hcf_io)(port) ))
442 #define OUT_PORT_WORD(port, value)	(outw((hcf_16) (value), (hcf_io)(port) ))
443 
444 #define IN_PORT_STRING_16(port, dst, n)    insw((hcf_io)(port), dst, n)
445 #define OUT_PORT_STRING_16(port, src, n)   outsw((hcf_io)(port), src, n)
446 //#define IN_PORT_STRINGL(port, dst, n)   insl((port), (dst), (n))
447 //#define OUT_PORT_STRINGL(port, src, n)  outsl((port), (src), (n))
448 #define IN_PORT_STRING_32(port, dst, n)   insl((port), (dst), (n))
449 #define OUT_PORT_STRING_32(port, src, n)  outsl((port), (src), (n))
450 #define IN_PORT_HCF32(port)          inl( (hcf_io)(port) )
451 #define OUT_PORT_HCF32(port, value)  outl((hcf_32)(value), (hcf_io)(port) )
452 
453 #define IN_PORT_DWORD(port)          IN_PORT_HCF32(port)
454 #define OUT_PORT_DWORD(port, value)  OUT_PORT_HCF32(port, value)
455 
456 #define  IN_PORT_STRING_8_16(port, addr, len)	IN_PORT_STRING_16(port, addr, len)
457 #define  OUT_PORT_STRING_8_16(port, addr, len)	OUT_PORT_STRING_16(port, addr, len)
458 
459 #ifndef CFG_SCAN_CHANNELS_2GHZ
460 #define CFG_SCAN_CHANNELS_2GHZ 0xFCC2
461 #endif /* CFG_SCAN_CHANNELS_2GHZ */
462 
463 #define HCF_MAX_MSG 1600 //get going ;?
464 #endif	// WVLAN_49
465 
466 /************************************************************************************************************/
467 /***********************************                                   **************************************/
468 /************************************************************************************************************/
469 #if ! defined 	HCF_ALIGN
470 #define 		HCF_ALIGN			1		//default to no alignment
471 #endif // 		HCF_ALIGN
472 
473 #if ! defined 	HCF_ASSERT
474 #define 		HCF_ASSERT			0
475 #endif //		HCF_ASSERT
476 
477 #if ! defined	HCF_BIG_ENDIAN
478 #define 		HCF_BIG_ENDIAN		0
479 #endif // 		HCF_BIG_ENDIAN
480 
481 #if ! defined	HCF_DMA
482 #define 		HCF_DMA				0
483 #endif // 		HCF_DMA
484 
485 #if ! defined	HCF_ENCAP
486 #define			HCF_ENCAP			HCF_ENC
487 #endif //		HCF_ENCAP
488 
489 #if ! defined	HCF_EXT
490 #define			HCF_EXT				0
491 #endif //		HCF_EXT
492 
493 #if ! defined	HCF_INT_ON
494 #define			HCF_INT_ON			1
495 #endif //		HCF_INT_ON
496 
497 #if ! defined	HCF_IO
498 #define			HCF_IO				0		//default 16 bits support only, port I/O
499 #endif //		HCF_IO
500 
501 #if ! defined	HCF_LEGACY
502 #define			HCF_LEGACY			0
503 #endif //		HCF_LEGACY
504 
505 #if ! defined	HCF_MAX_LTV
506 #define 		HCF_MAX_LTV			1200	// sufficient for all known purposes
507 #endif //		HCF_MAX_LTV
508 
509 #if ! defined	HCF_PROT_TIME
510 #define 		HCF_PROT_TIME		100		// number of 10K microsec protection timer against H/W malfunction
511 #endif // 		HCF_PROT_TIME
512 
513 #if ! defined	HCF_SLEEP
514 #define			HCF_SLEEP			0
515 #endif //		HCF_SLEEP
516 
517 #if ! defined	HCF_TALLIES
518 #define			HCF_TALLIES			( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
519 #endif //		HCF_TALLIES
520 
521 #if ! defined 	HCF_TYPE
522 #define 		HCF_TYPE 			0
523 #endif //		HCF_TYPE
524 
525 #if				HCF_BIG_ENDIAN
526 #undef			HCF_BIG_ENDIAN
527 #define			HCF_BIG_ENDIAN		1		//just for convenience of generating cfg_hcf_opt
528 #endif //	 	HCF_BIG_ENDIAN
529 
530 #if				HCF_DMA
531 #undef			HCF_DMA
532 #define			HCF_DMA				1		//just for convenience of generating cfg_hcf_opt
533 #endif //		HCF_DMA
534 
535 #if				HCF_INT_ON
536 #undef			HCF_INT_ON
537 #define			HCF_INT_ON			1		//just for convenience of generating cfg_hcf_opt
538 #endif //		HCF_INT_ON
539 
540 
541 #if ! defined IN_PORT_STRING_8_16
542 #define  IN_PORT_STRING_8_16(port, addr, len)	IN_PORT_STRING_16(port, addr, len)
543 #define  OUT_PORT_STRING_8_16(port, addr, len)	OUT_PORT_STRING_16(port, addr, len)
544 #endif // IN_PORT_STRING_8_16
545 
546 /************************************************************************************************/
547 /**********                                                                         *************/
548 /************************************************************************************************/
549 
550 #if ! defined	FAR
551 #define 		FAR						// default to flat 32-bits code
552 #endif // 		FAR
553 
554 typedef hcf_8  FAR *wci_bufp;			// segmented 16-bits or flat 32-bits pointer to 8 bits unit
555 typedef hcf_16 FAR *wci_recordp;		// segmented 16-bits or flat 32-bits pointer to 16 bits unit
556 
557 /*	I/O Address size
558 *	Platforms which use port mapped I/O will (in general) have a 64k I/O space, conveniently expressed in a
559 *	16-bits quantity
560 *	Platforms which use memory mapped I/O will (in general) have an I/O space much larger than 64k, and need a
561 *	32-bits quantity to express the I/O base
562 */
563 
564 #if HCF_IO & HCF_IO_MEM
565 typedef hcf_32 hcf_io;
566 #else
567 typedef hcf_16 hcf_io;
568 #endif //HCF_IO
569 
570 #if 	HCF_PROT_TIME > 128
571 #define HCF_PROT_TIME_SHFT	3
572 #define HCF_PROT_TIME_DIV	8
573 #elif 	HCF_PROT_TIME > 64
574 #define HCF_PROT_TIME_SHFT	2
575 #define HCF_PROT_TIME_DIV	4
576 #elif 	HCF_PROT_TIME > 32
577 #define HCF_PROT_TIME_SHFT	1
578 #define HCF_PROT_TIME_DIV	2
579 #else //HCF_PROT_TIME >= 19
580 #define HCF_PROT_TIME_SHFT	0
581 #define HCF_PROT_TIME_DIV	1
582 #endif
583 
584 #define HCF_PROT_TIME_CNT (HCF_PROT_TIME / HCF_PROT_TIME_DIV)
585 
586 
587 /************************************************************************************************************/
588 /******************************************* . . . . . . . . .  *********************************************/
589 /************************************************************************************************************/
590 
591 /* MSF_COMPONENT_ID is used to define the CFG_IDENTITY_STRCT in HCF.C
592 * CFG_IDENTITY_STRCT is defined in HCF.C purely based on convenience arguments.
593 * The HCF can not have the knowledge to determine the ComponentId field of the Identity record (aka as
594 * Version Record), therefore the MSF part of the Drivers must supply this value via the System Constant
595 * MSF_COMPONENT_ID.
596 * There is a set of values predefined in MDD.H (format COMP_ID_.....)
597 *
598 * Note that taking MSF_COMPONENT_ID as a default value for DUI_COMPAT_VAR is purely an implementation
599 * convenience, the numerical values of these two quantities have none functional relationship whatsoever.
600 */
601 
602 #if defined	MSF_COMPONENT_ID
603 
604 #if ! defined	DUI_COMPAT_VAR
605 #define			DUI_COMPAT_VAR		MSF_COMPONENT_ID
606 #endif //		DUI_COMPAT_VAR
607 
608 #if ! defined	DUI_COMPAT_BOT		//;?this way utilities can lower as well raise the bottom
609 #define			DUI_COMPAT_BOT		8
610 #endif //		DUI_COMPAT_BOT
611 
612 #if ! defined	DUI_COMPAT_TOP		//;?this way utilities can lower as well raise the top
613 #define			DUI_COMPAT_TOP       8
614 #endif //		DUI_COMPAT_TOP
615 
616 #endif // MSF_COMPONENT_ID
617 
618 #if (HCF_TYPE) & HCF_TYPE_HII5
619 
620 #if ! defined	HCF_HSI_VAR_5
621 #define			HCF_HSI_VAR_5
622 #endif //		HCF_HSI_VAR_5
623 
624 #if ! defined	HCF_APF_VAR_4
625 #define			HCF_APF_VAR_4
626 #endif //		HCF_APF_VAR_4
627 
628 #if (HCF_TYPE) & HCF_TYPE_WARP
629 #if ! defined	HCF_STA_VAR_4
630 #define			HCF_STA_VAR_4
631 #endif //		HCF_STA_VAR_4
632 #else
633 #if ! defined	HCF_STA_VAR_2
634 #define			HCF_STA_VAR_2
635 #endif //		HCF_STA_VAR_2
636 #endif
637 
638 #if defined HCF_HSI_VAR_4
639 err: HSI variants 4 correspond with HII;
640 #endif // HCF_HSI_VAR_4
641 
642 #else
643 
644 #if ! defined	HCF_HSI_VAR_4
645 #define			HCF_HSI_VAR_4		//Hermes-II all types (for the time being!)
646 #endif //		HCF_HSI_VAR_4
647 
648 #if ! defined	HCF_APF_VAR_2
649 #define 		HCF_APF_VAR_2
650 #endif //		HCF_APF_VAR_2
651 
652 #if ! defined	HCF_STA_VAR_2
653 #define			HCF_STA_VAR_2
654 #endif //		HCF_STA_VAR_2
655 
656 #endif // HCF_TYPE_HII5
657 
658 #if ! defined	HCF_PRI_VAR_3
659 #define		HCF_PRI_VAR_3
660 #endif //		HCF_PRI_VAR_3
661 
662 #if defined HCF_HSI_VAR_1 || defined HCF_HSI_VAR_2 || defined HCF_HSI_VAR_3
663 err: HSI variants 1, 2 and 3 correspond with H-I only;
664 #endif // HCF_HSI_VAR_1, HCF_HSI_VAR_2, HCF_HSI_VAR_3
665 
666 #if defined HCF_PRI_VAR_1 || defined HCF_PRI_VAR_2
667 err: primary variants 1 and 2 correspond with H-I only;
668 #endif // HCF_PRI_VAR_1 / HCF_PRI_VAR_2
669 
670 
671 /************************************************************************************************************/
672 /******************************************* . . . . . . . . .  *********************************************/
673 /************************************************************************************************************/
674 
675 
676 /* The BASED customization macro is used to resolves the SS!=DS conflict for the Interrupt Service logic in
677  * DOS Drivers. Due to the cumbersomeness of mixing C and assembler local BASED variables still end up in the
678  * wrong segment. The workaround is that the HCF uses only global BASED variables or IFB-based variables.
679  * The "BASED" construction (supposedly) only amounts to something in the small memory model.
680  *
681  * Note that the whole BASED rigmarole is needlessly complicated because both the Microsoft Compiler and
682  * Linker are unnecessary restrictive in what far pointer manipulation they allow
683  */
684 
685 #if ! defined	BASED
686 #define 		BASED
687 #endif //		BASED
688 
689 #if ! defined	EXTERN_C
690 #ifdef __cplusplus
691 #define			EXTERN_C extern "C"
692 #else
693 #define			EXTERN_C
694 #endif // __cplusplus
695 #endif //		EXTERN_C
696 
697 #if ! defined	NULL
698 #define			NULL	((void *) 0)
699 #endif //		NULL
700 
701 #if ! defined	TEXT
702 #define			TEXT(x)	x
703 #endif //		TEXT
704 
705 /************************************************************************************************************/
706 /*********************** C O N F L I C T   D E T E C T I O N  &  R E S O L U T I O N ************************/
707 /************************************************************************************************************/
708 #if HCF_ALIGN != 1 && HCF_ALIGN != 2 && HCF_ALIGN != 4 && HCF_ALIGN != 8
709 err: invalid value for HCF_ALIGN;
710 #endif // HCF_ALIGN
711 
712 #if (HCF_ASSERT) & ~( HCF_ASSERT_PRINTF | HCF_ASSERT_SW_SUP | HCF_ASSERT_MB | HCF_ASSERT_RT_MSF_RTN | \
713 					  HCF_ASSERT_LNK_MSF_RTN )
714 err: invalid value for HCF_ASSERT;
715 #endif // HCF_ASSERT
716 
717 #if (HCF_ASSERT) & HCF_ASSERT_MB && ! ( (HCF_EXT) & HCF_EXT_MB )		//detect potential conflict
718 err: these macros are not used consistently;
719 #endif // HCF_ASSERT_MB / HCF_EXT_MB
720 
721 #if HCF_BIG_ENDIAN != 0 && HCF_BIG_ENDIAN != 1
722 err: invalid value for HCF_BIG_ENDIAN;
723 #endif // HCF_BIG_ENDIAN
724 
725 #if HCF_DMA != 0 && HCF_DMA != 1
726 err: invalid value for HCF_DMA;
727 #endif // HCF_DMA
728 
729 #if (HCF_ENCAP) & ~( HCF_ENC | HCF_ENC_SUP )
730 err: invalid value for HCF_ENCAP;
731 #endif // HCF_ENCAP
732 
733 #if (HCF_EXT) & ~( HCF_EXT_INFO_LOG | HCF_EXT_INT_TX_EX | HCF_EXT_TALLIES_FW | HCF_EXT_TALLIES_HCF	| \
734 				   HCF_EXT_NIC_ACCESS | HCF_EXT_MB | HCF_EXT_INT_TICK | \
735 				   HCF_EXT_IFB_STRCT | HCF_EXT_DESC_STRCT | HCF_EXT_TX_CONT )
736 err: invalid value for HCF_EXT;
737 #endif // HCF_EXT
738 
739 #if HCF_INT_ON != 0 && HCF_INT_ON != 1
740 err: invalid value for HCF_INT_ON;
741 #endif // HCF_INT_ON
742 
743 #if (HCF_IO) & ~( HCF_IO_MEM | HCF_IO_32BITS )
744 err: invalid value for HCF_IO;
745 #endif // HCF_IO
746 
747 #if HCF_LEGACY != 0 && HCF_LEGACY != 1
748 err: invalid value for HCF_LEGACY;
749 #endif // HCF_LEGACY
750 
751 #if HCF_MAX_LTV < 16 || HCF_MAX_LTV > 2304
752 err: invalid value for HCF_MAX_LTV;
753 #endif // HCF_MAX_LTV
754 
755 #if HCF_PROT_TIME != 0 && ( HCF_PROT_TIME < 19 || 256 < HCF_PROT_TIME )
756 err: below minimum .08 second required by Hermes or possibly above hcf_32 capacity;
757 #endif // HCF_PROT_TIME
758 
759 #if (HCF_SLEEP) & ~( HCF_CDS | HCF_DDS )
760 err: invalid value for HCF_SLEEP;
761 #endif // HCF_SLEEP
762 
763 #if (HCF_SLEEP) && ! (HCF_INT_ON)
764 err: these macros are not used consistently;
765 #endif // HCF_SLEEP / HCF_INT_ON
766 
767 #if (HCF_SLEEP) && ! ( (HCF_EXT) & HCF_EXT_INT_TICK )
768 //;? err: these macros are not used consistently;
769 #endif // HCF_SLEEP / HCF_EXT_INT_TICK
770 
771 #if (HCF_TALLIES) & ~( HCF_TALLIES_HCF | HCF_TALLIES_NIC | HCF_TALLIES_RESET ) || \
772 	(HCF_TALLIES) == HCF_TALLIES_RESET
773 err: invalid value for HCF_TALLIES;
774 #endif // HCF_TALLIES
775 
776 #if (HCF_TYPE) & ~(HCF_TYPE_WPA | HCF_TYPE_USB | HCF_TYPE_PRELOADED | HCF_TYPE_HII5 | HCF_TYPE_WARP | \
777 		HCF_TYPE_CCX /* | HCF_TYPE_TX_DELAY */ )
778 err: invalid value for HCF_TYPE;
779 #endif //HCF_TYPE
780 
781 #if (HCF_TYPE) & HCF_TYPE_WARP && (HCF_TYPE) & HCF_TYPE_WPA
782 err: at most 1 of these macros should be defined;
783 #endif //HCF_TYPE_WARP / HCF_TYPE_WPA
784 
785 #endif //HCFCFG_H
786 
787