Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus
[linux-btrfs-devel.git] / drivers / staging / wlags49_h2 / hcfcfg.h
blob83475b1060a18c5652f057510545ed39da629878
2 // vim:tw=110:ts=4:
3 #ifndef HCFCFG_H
4 #define HCFCFG_H 1
6 /*************************************************************************************************************
8 * FILE : hcfcfg.tpl // hcfcfg.h
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
19 * AUTHOR : Nico Valster
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
30 * By copying HCFCFG.TPL to HCFCFG.H and -if needed- modifying the #defines the WCI functionality can be
31 * tailored
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
57 **************************************************************************************************************
60 * SOFTWARE LICENSE
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.
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.
72 * Redistribution and use in source or binary forms, with or without
73 * modifications, are permitted provided that the following conditions are met:
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.
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.
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.
88 * Disclaimer
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.
104 *************************************************************************************************************/
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
116 /***************************** IN_PORT_STRING_8_16 S a m p l e s *****************************************
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; }
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);}
126 // Assembler implementation
127 #define IN_PORT_STRING_8_16( port, addr, len) __asm \
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 \
140 ***************************** OUT_PORT_STRING_8_16 S a m p l e s ******************************************
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; }
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; }
150 // Assembler implementation
151 #define OUT_PORT_STRING_8_16( port, addr, len) __asm \
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 \
163 *************************************************************************************************************/
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 /*************************************************************************************************
171 * !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
172 * !!!! Do not call these macros with parameters which introduce side effects !!!!
173 * !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
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
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
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.
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
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)
200 * The prototypes and functional description of the macros are:
202 * hcf_16 IN_PORT_WORD( hcf_16 port )
203 * Reads a word (16 bits) from the specified port
205 * void OUT_PORT_WORD( hcf_16 port, hcf_16 value)
206 * Writes a word (16 bits) to the specified port
208 * hcf_16 IN_PORT_DWORD( hcf_16 port )
209 * Reads a dword (32 bits) from the specified port
211 * void OUT_PORT_DWORD( hcf_16 port, hcf_32 value)
212 * Writes a dword (32 bits) to the specified port
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
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!!!
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
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
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
238 * !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
239 * !!!! Do not call these macros with parameters which introduce side effects !!!!
240 * !!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
242 *************************************************************************************************/
244 /**************************** define INT Types ******************************/
245 typedef unsigned char hcf_8;
246 typedef unsigned short hcf_16;
247 typedef unsigned long hcf_32;
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)
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)
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
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
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
293 /****************************** #define HCF_SLEEP *******************************/
294 #define HCF_DDS 0x0001 // Disconnected Deep Sleep
295 #define HCF_CDS 0x0002 // Connected Deep Sleep
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
304 /************************************************************************************************/
305 /****************************** M I N I P O R T N D I S *************************************/
306 /************************************************************************************************/
308 #if defined WVLAN_41 || defined WVLAN_48 || defined WVLAN_52 || defined _WIN32_WCE
310 #ifndef WVLAN_46
311 #define HCF_EXT (HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS )
312 #else
313 #define HCF_EXT ( HCF_EXT_TX_CONT | HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS )
314 #endif
315 #define HCF_DLV 1 //H-I legacy, superfluous for H-II
317 #ifdef _WIN32_WCE
318 #define HCF_IO HCF_IO_MEM
319 #define HCF_DMA 0 // To enable DMA
320 #endif
322 #if _VARIANT == 7
323 #define HCF_SLEEP HCF_CDS
324 #endif // _VARIANT == 7
326 #if _VARIANT == 5 || _VARIANT == 6
327 #define _WARP
328 #define _AES
329 #define HCF_SLEEP HCF_CDS
330 #if _VARIANT == 6
331 //! #define _RSN
332 #endif // _VARIANT == 6
333 #ifndef _WIN32_WCE
334 #define HCF_IO HCF_IO_32BITS
335 #define HCF_DMA 1 // To enable DMA
336 #endif
337 #endif // _VARIANT == 5 || _VARIANT == 6
340 //HWi for migration purposes I defined a define which will be TRUE for ALL drivers
341 //Meaning that _CCX defined code which we think will get a all driver OK flag can be defined from _CCX to _CCX_OK
342 #if defined WVLAN_48 // && !defined _WIN32_WCE
343 #if _VARIANT == 4 || _VARIANT == 6
344 #define _CCX_OK 1
345 #endif // _VARIANT == 4 || _VARIANT == 6
346 #endif // WVLAN_48
348 //#if !defined WVLAN_46
349 #if defined WVLAN_48
350 #if _VARIANT == 4 || _VARIANT == 6
351 #define _CCX
352 #define HCF_MAX_MSG_CKIP_PADDING 86 //, use 86 for rx fragmentation. 28 is enuf for MIC+PPK encapsulation
353 #define HCF_MAX_MSG ( 1514 + HCF_MAX_MSG_CKIP_PADDING ) // need extra padding for CKIP (need to subtract 28 for NDIS)
354 #endif // _VARIANT == 4 || _VARIANT == 6
355 #endif // WVLAN_48
356 //#endif // WVLAN_46
358 #if !defined WVLAN_46
359 #define _PEEK
360 #endif
362 #ifndef _WIN32_WCE
363 // ASSERT already used by WinCE...
364 #ifdef ASSERT
365 #undef ASSERT
366 #define ASSERT(x) ASSERTDEBUGMSG((x), (TEXT("SIMULATE ASSERT:")))
367 #endif
368 #endif
371 #if defined WVLAN_41
372 #define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_31
373 #endif // WVLAN_41
374 #if defined WVLAN_48 && !defined _WIN32_WCE
375 #define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_50
376 #endif // WVLAN_48 / _WIN32_WCE
377 #if defined WVLAN_52 && !defined _WIN32_WCE
378 #define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_40
379 #endif // WVLAN_52 / _WIN32_WCE
380 #if defined WVLAN_46
381 #define MSF_COMPONENT_ID COMP_ID_WIN_CE
382 #endif // _WIN32_WCE
384 #define MSF_COMPONENT_VAR _VARIANT
386 #define T1__HCF_TYPE (HCF_TYPE_NONE)
388 #define T2__HCF_TYPE (T1__HCF_TYPE)
390 #ifdef _WARP
391 #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5 | HCF_TYPE_WARP )
392 #else
393 #if _VARIANT == 7
394 #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5)
395 #else // _VARIANT == 7
396 #define T3__HCF_TYPE (T2__HCF_TYPE)
397 #endif // _VARIANT == 7
398 #endif // _WARP
400 #ifdef _CCX_OK
401 #define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
402 #else
403 #define T4__HCF_TYPE (T3__HCF_TYPE)
404 #endif // _CCX_OK
406 //not suitable for H-II #define HCF_CFG_STA_1_BOTTOM 16
408 // Default WPA in ON for all drivers except for WARP driver
409 #ifdef _WARP
410 #define T5__HCF_TYPE (T4__HCF_TYPE)
411 #else // _WARP
412 #define T5__HCF_TYPE (T4__HCF_TYPE | HCF_TYPE_WPA)
413 #endif // _WARP
415 #define HCF_TYPE (T5__HCF_TYPE)
417 // This is needed to get aux_ctrl() from the HCF for WlFreezeAndDump()
418 #if (defined DBG && DBG != 0)
419 #ifndef STATIC
420 #define STATIC
421 #endif
422 #endif
424 #if !defined SOFTRONICS_CODE && !defined _APIDLL && !defined _WIN32_WCE
425 #include <ndis.h>
426 #endif // SOFTRONICS_CODE / _APIDLL / _WIN32_WCE
427 #if defined _WIN32_WCE
428 #include <windows.h>
429 #include <winnt.h>
430 #endif // _WIN32_WCE
431 #include "version.h"
433 #define MSF_COMPONENT_MAJOR_VER TPI_MAJOR_VERSION
434 #define MSF_COMPONENT_MINOR_VER TPI_MINOR_VERSION
436 #if !defined _APIDLL && !defined _WIN32_WCE
438 __inline UCHAR NDIS_IN_BYTE( ULONG port )
440 UCHAR value;
441 NdisRawReadPortUchar(port , &value);
442 return (value);
445 __inline ULONG NDIS_IN_LONG( ULONG port )
447 ULONG value;
448 NdisRawReadPortUlong(port , &value);
449 return (value);
451 __inline USHORT NDIS_IN_WORD( ULONG port )
453 USHORT value;
454 NdisRawReadPortUshort(port , &value);
455 return (value);
458 #define IN_PORT_DWORD(port) NDIS_IN_LONG( (ULONG) (port) )
459 #define IN_PORT_WORD(port) NDIS_IN_WORD( (ULONG) (port) )
460 #define OUT_PORT_DWORD(port, value) NdisRawWritePortUlong((ULONG) (port) , value)
461 #define OUT_PORT_WORD(port, value) NdisRawWritePortUshort((ULONG) (port) , (USHORT) (value))
463 #define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len)
464 #define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len)
466 #define IN_PORT_STRING_32(port, addr, len) { \
467 NdisRawReadPortBufferUlong(port, addr, (len)); \
470 #define OUT_PORT_STRING_32(port, addr, len) { \
471 NdisRawWritePortBufferUlong(port, addr, (len)); \
474 #define IN_PORT_STRING_16(port, addr, len) NdisRawReadPortBufferUshort(port, addr, (len));
475 #define OUT_PORT_STRING_16(port, addr, len) NdisRawWritePortBufferUshort(port, addr, (len));
477 #endif // _APIDLL / _WIN32_WCE
479 #if defined _WIN32_WCE
481 #define HCF_ALIGN 2
482 #define HCF_MEM_IO 1 // overrule standard Port I/O with Memory mapped I/O
483 #define HCF_PROT_TIME 49
485 #define IN_PORT_BYTE CE_IN_PORT_BYTE
486 #define OUT_PORT_BYTE CE_OUT_PORT_BYTE
487 #define IN_PORT_WORD CE_IN_PORT_WORD
488 #define OUT_PORT_WORD CE_OUT_PORT_WORD
489 #define IN_PORT_STRING_16 CE_IN_PORT_STRING
490 #define OUT_PORT_STRING_16 CE_OUT_PORT_STRING
492 extern hcf_8 CE_IN_PORT_BYTE(hcf_32 port);
493 extern void CE_OUT_PORT_BYTE(hcf_32 port, hcf_8 value);
494 extern hcf_16 CE_IN_PORT_WORD(hcf_32 port);
495 extern void CE_OUT_PORT_WORD(hcf_32 port, hcf_16 value);
496 extern void CE_IN_PORT_STRING(hcf_32 port, void *addr, hcf_16 len);
497 extern void CE_OUT_PORT_STRING(hcf_32 port, void *addr, hcf_16 len);
500 #endif
502 #if defined _DEBUG || (defined DBG && DBG != 0)
503 #define HCF_ASSERT ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN | HCF_ASSERT_PRINTF ) //0xC001
504 //#define HCF_ASSERT ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN | HCF_ASSERT_PRINTF | HCF_ASSERT_MB ) //just to test
505 #endif // _DEBUG || DBG
507 #if defined DEBUG || defined _DEBUG || (defined DBG && DBG != 0)
508 #ifdef _WIN32_WCE
509 #define DBGA2W(DBGSTR) CeConvertAnsiToUnicodeLen((char*)DBGSTR)
510 #define OUTPUTDEBUGMSG(dprintf_exp) ((void)((! ZONE_DEBUG) ? 0:ce_debug_out dprintf_exp))
511 #define ASSERTDEBUGMSG(cond, dprintf_exp) ((void)((cond) ? 0:ce_debug_out dprintf_exp))
513 #define ZONE_ERROR DEBUGZONE(0)
514 #define ZONE_WARN DEBUGZONE(1)
515 #define ZONE_FUNCTION DEBUGZONE(2)
516 #define ZONE_INIT DEBUGZONE(3)
517 #define ZONE_INTR DEBUGZONE(4)
518 #define ZONE_RCV DEBUGZONE(5)
519 #define ZONE_XMIT DEBUGZONE(6)
520 #define ZONE_ASSERT DEBUGZONE(7)
521 #define ZONE_DEBUG DEBUGZONE(8)
522 #define ZONE_OEM DEBUGZONE(9)
523 #define ZONE_HCF DEBUGZONE(10)
524 #define ZONE_PORTIO DEBUGZONE(11)
525 #define ZONE_LOGTOFILE DEBUGZONE(15)
527 #else // !(_WIN32_WCE)
529 #define OUTPUTDEBUGMSG(dprintf_exp) ((void) (DbgPrint dprintf_exp))
530 // the assertdebugmsg macro will print filename, line followed by a caller-defined text, when cond == 0
531 #define ASSERTDEBUGMSG(cond, print) ((void)((cond) ? 0: (DbgPrint("%s %s:%d - ", print, __FILE__, __LINE__))))
533 #define ZONE_ERROR 1
534 #define ZONE_WARN 1
535 #define ZONE_FUNCTION 1
536 #define ZONE_INIT 1
537 #define ZONE_INTR 1
538 #define ZONE_RCV 1
539 #define ZONE_XMIT 1
540 #define ZONE_ASSERT 1
541 #define ZONE_DEBUG 1
542 #define ZONE_OEM 1
543 #define ZONE_HCF 1
544 #define ZONE_PORTIO 1
545 #define ZONE_LOGTOFILE 1
547 #endif // _WIN32_WCE
548 #ifndef DBGA2W
549 #define DBGA2W
550 #endif // DBGA2W
552 #else // !(defined DEBUG || defined _DEBUG || (defined DBG && DBG != 0) )
553 #define OUTPUTDEBUGMSG(dprintf_exp)
554 #define ASSERTDEBUGMSG(cond, dprintf_exp)
555 #endif // DEBUG / DBG
557 #if !defined HCF_MAX_MSG_CKIP_PADDING
558 #define HCF_MAX_MSG_CKIP_PADDING 0
559 #endif // HCF_MAX_MSG_CKIP_PADDING
561 #if !defined HCF_MAX_MSG
562 #define HCF_MAX_MSG 1514
563 #endif // HCF_MAX_MSG
565 #define HCF_LEGACY 1 //;?nv je moet wat
567 #endif //WVLAN_41 / WVLAN_48 / WVLAN_52 / _WIN32_WCE
570 /************************************************************************************************/
571 /**************************** P A C K E T D R I V E R ***************************************/
572 /********************************** D O S O D I *********************************************/
573 /************************************************************************************************/
575 #if defined WVLAN_42 || defined WVLAN_43
577 #pragma warning ( disable: 4001 )
578 #define FAR __far //segmented 16 bits mode
579 #define BASED __based(__segname("_CODE")) //force all the "const" structures in the CODE segment
581 //#define HCF_IO 0 //no DMA, no 32 bits
583 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
585 #define HCF_EXT HCF_EXT_MB
586 #define HCF_PROT_TIME 49 //49*10240 microseconds H/W failure protection timer
588 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
590 /******************************** CONFIGURATION MANAGEMENT *****************************************/
591 #ifdef WVLAN_42
592 #define MSF_COMPONENT_ID COMP_ID_PACKET
593 #define MSF_COMPONENT_VAR 1
594 #define MSF_COMPONENT_MAJOR_VER 6
595 #define MSF_COMPONENT_MINOR_VER 12
596 #endif // WVLAN_42
598 #ifdef WVLAN_43
599 #define MSF_COMPONENT_ID COMP_ID_ODI_16
600 #define MSF_COMPONENT_VAR 1
601 #define MSF_COMPONENT_MAJOR_VER 6
602 #define MSF_COMPONENT_MINOR_VER 10
603 #endif // WVLAN_43
605 /************************************** INPUT / OUTPUT **********************************************/
606 #ifndef H_2_INC
607 #include <stdio.h>
608 #include <conio.h>
609 #if 1 //temorary use functions defined in hcf.c
610 #ifndef _DEBUG
611 #pragma intrinsic( _inp, _inpw, _outp, _outpw )
612 #endif // _DEBUG
614 #define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
615 #define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
617 #if 1 // C implementation which let the processor handle the word-at-byte-boundary problem
618 #define IN_PORT_STRING_8_16( port, addr, n) while (n--) \
619 { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_8 FAR*)addr)+=2; }
620 #define OUT_PORT_STRING_8_16( port, addr, n) while (n--) \
621 { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; ((hcf_8 FAR*)addr)+=2; }
622 #elif 0 // C implementation which handles the word-at-byte-boundary problem
623 #define IN_PORT_STRING_8_16( port, addr, n) while ( n-- ) \
624 { hcf_16 i = IN_PORT_WORD(port); *((hcf_8 FAR*)addr)++ = (hcf_8)i; *((hcf_8 FAR*)addr)++ = (hcf_8)(i>>8);}
625 #define OUT_PORT_STRING_8_16( port, addr, n) while ( n-- ) \
626 { OUT_PORT_WORD( port, *((hcf_8 FAR*)addr) | *(((hcf_8 FAR*)addr)+1)<<8 ); (hcf_8 FAR*)addr+=2; }
627 #else // Assembler implementation
628 #define IN_PORT_STRING_8_16( port, addr, n) __asm \
630 __asm push di \
631 __asm push es \
632 __asm mov cx,n \
633 __asm les di,addr \
634 __asm mov dx,port \
635 __asm rep insw \
636 __asm pop es \
637 __asm pop di \
640 #define OUT_PORT_STRING_8_16( port, addr, n) __asm \
642 __asm push si \
643 __asm push ds \
644 __asm mov cx,n \
645 __asm lds si,addr \
646 __asm mov dx,port \
647 __asm rep outsw \
648 __asm pop ds \
649 __asm pop si \
652 #endif // Asm or C implementation
653 #define IN_PORT_STRING_32( port, addr, n) { int n2 = 2*n; IN_PORT_STRING_8_16(port, addr, n2) }
654 #define OUT_PORT_STRING_32( port, addr, n) { int n2 = 2*n; OUT_PORT_STRING_8_16(port, addr, n2) }
655 #endif // 0 //temorary use functions defined in hcf.c
656 #endif // H_2_INC
658 #endif // WVLAN_42 / WVLAN_43
662 /************************************************************************************************/
663 /**************************** D O S H - I / II L O A D E R **********************************/
664 /************************************************************************************************/
666 #if defined H0_LDR || defined H1_LDR || defined H2_LDR || defined H5_LDR
668 #if defined H0_LDR //implies H-I
669 #define HCF_DLV 0 //H-I legacy, meaningless under H-II
670 #define HCF_DLNV 1 //H-I legacy, meaningless under H-II
671 #endif // H0_LDR
673 #if defined H1_LDR //implies H-I
674 #define HCF_DLV 1 //H-I legacy, meaningless under H-II
675 #define HCF_DLNV 0 //H-I legacy, meaningless under H-II
676 #endif // H1_LDR / H2_LDR
678 //#if defined H2_LDR : not needed, H-II defaults are O.K for H2_LDR
680 #ifdef H5_LDR
681 #define HCF_TYPE (HCF_TYPE_HII5 | HCF_TYPE_WARP )
682 //;? why does only this subset of the H_LDRs need HCF_TYPE to be defined here
683 #endif
685 #define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN //support dynamic linking of msf_assert routine
686 #define HCF_ENCAP 0
687 #define HCF_INT_ON 0
688 #define HCF_TALLIES 0
690 #define MSF_COMPONENT_ID COMP_ID_ODI_16 //;?By lack of any better
691 #define MSF_COMPONENT_VAR 1
692 #define MSF_COMPONENT_MAJOR_VER 0
693 #define MSF_COMPONENT_MINOR_VER 0
695 #include <stdio.h>
696 #include <conio.h>
697 #if defined NDEBUG
698 #pragma intrinsic( _inp, _inpw, _outp, _outpw )
699 #endif // NDEBUG
701 #if 0 //use 0 to replace I/O Macros with logging facility
702 #define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
703 #define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
704 #define IN_PORT_STRING_16( port, addr, n) \
705 while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
706 #define OUT_PORT_STRING_16( port, addr, n) \
707 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; }
708 #endif //use 0 to replace I/O Macros with logging facility
710 #endif // H0_LDR / H1_LDR / H2_LDR
714 /************************************************************************************************/
715 /**************************** H C F D E M O P R O G R A M ***********************************/
716 /************************************************************************************************/
718 #if defined HCF_DEMO
720 #define HCF_DLV 1 //;?should become the default !defaults to 1 anyway for H-II
721 //#define HCF_DLNV 0 //defaults to 0 anyway for H-II
723 #define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN //support dynamic linking of msf_assert routine
725 #define HCF_ENCAP 0
726 #define HCF_INT_ON 0
727 #define HCF_TALLIES ( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
729 //#define MSF_COMPONENT_ID NO configuration management
731 #include <stdio.h>
732 #include <conio.h>
733 #if defined NDEBUG
734 #pragma intrinsic( _inp, _inpw, _outp, _outpw )
735 #endif // NDEBUG
737 #if 0 //use 0 to replace I/O Macros with logging facility
738 #define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
739 #define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
740 #define IN_PORT_STRING_16( port, addr, n) \
741 while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
742 #define OUT_PORT_STRING_16( port, addr, n) \
743 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; }
744 #endif //use 0 to replace I/O Macros with logging facility
746 #endif // HCF_DEMO
750 /************************************************************************************************/
751 /*********************************** M A C O S **********************************************/
752 /************************************************************************************************/
754 #if defined WVLAN_45
756 #include "Version.h"
758 #define MSF_COMPONENT_ID COMP_ID_MAC_OS
759 #define MSF_COMPONENT_VAR VARIANT
760 #define MSF_COMPONENT_MAJOR_VER VERSION_MAJOR
761 #define MSF_COMPONENT_MINOR_VER VERSION_MINOR
763 #define MAC_OS 1
765 #define HCF_BIG_ENDIAN 1 // selects Big Endian (a.k.a. Motorola), most significant byte first
767 #if defined DEBUG
768 #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
769 #endif // DEBUG
771 #ifdef __cplusplus
772 extern "C" {
773 #endif // __cplusplus
774 extern volatile unsigned char *MacIOaddr;
775 extern hcf_16 IN_PORT_WORD(hcf_16 port);
776 extern void OUT_PORT_WORD(hcf_16 port, hcf_16 value);
777 extern void IN_PORT_STRING_16(hcf_16 port, void *addr, hcf_16 len);
778 extern void OUT_PORT_STRING_16(hcf_16 port, void *addr, hcf_16 len);
780 #define SwapBytes(t) (((t) >> 8) + (((t) & 0xff) << 8))
782 #ifdef __cplusplus
784 #endif // __cplusplus
786 #endif // WVLAN_45
790 /************************************************************************************************/
791 /****************************************** L I N U X *****************************************/
792 /************************************************************************************************/
794 #ifdef WVLAN_49
795 #include <asm/io.h>
796 //#include <linux/module.h>
797 #include <wl_version.h>
799 /* The following macro ensures that no symbols are exported, minimizing the chance of a symbol
800 collision in the kernel */
801 //EXPORT_NO_SYMBOLS; //;?this place seems not appropriately to me
803 //#define HCF_SLEEP (HCF_CDS | HCF_DDS )
804 #define HCF_SLEEP (HCF_CDS)
806 //#define HCF_TYPE (HCF_TYPE_HII5|HCF_TYPE_STA|HCF_TYPE_AP)
807 #ifdef HERMES25
808 #ifdef WARP
809 #define HCF_TYPE ( HCF_TYPE_WARP | HCF_TYPE_HII5 )
810 #else
811 #define HCF_TYPE HCF_TYPE_HII5
812 #endif // WARP
813 #else
814 #define HCF_TYPE HCF_TYPE_NONE
815 #endif // HERMES25
817 #ifdef ENABLE_DMA
818 #define HCF_DMA 1
819 #endif // ENABLE_DMA
821 /* We now need a switch to include support for the Mailbox and other necessary extensions */
822 #define HCF_EXT ( HCF_EXT_MB | HCF_EXT_INFO_LOG | HCF_EXT_INT_TICK )//get deepsleep exercise going
824 /* ;? The Linux MSF still uses these definitions; define it here until it's removed */
825 #ifndef HCF_TYPE_HII
826 #define HCF_TYPE_HII 0x0004
827 #endif
829 #ifndef HCF_TYPE_AP
830 #define HCF_TYPE_AP 0x0010
831 #endif
833 #ifndef HCF_TYPE_STA
834 #define HCF_TYPE_STA 0x0020
835 #endif // HCF_TYPE_STA
837 /* Guarantees word alignment */
838 #define HCF_ALIGN 2
840 /* Endian macros CNV_INT_TO_LITTLE() and CNV_LITTLE_TO_INT() were renamed to
841 CNV_SHORT_TO_LITTLE() and CNV_LITTLE_TO_SHORT() */
842 #ifndef CNV_INT_TO_LITTLE
843 #define CNV_INT_TO_LITTLE CNV_SHORT_TO_LITTLE
844 #endif
846 #ifndef CNV_LITTLE_TO_INT
847 #define CNV_LITTLE_TO_INT CNV_LITTLE_TO_SHORT
848 #endif
850 #define HCF_ERR_BUSY 0x06
852 /* UIL defines were removed from the HCF */
853 #define UIL_SUCCESS HCF_SUCCESS
854 #define UIL_ERR_TIME_OUT HCF_ERR_TIME_OUT
855 #define UIL_ERR_NO_NIC HCF_ERR_NO_NIC
856 #define UIL_ERR_LEN HCF_ERR_LEN
857 #define UIL_ERR_MIN HCF_ERR_MAX /*end of HCF errors which are passed through to UIL
858 *** ** *** ****** ***** *** ****** ******* ** *** */
859 #define UIL_ERR_IN_USE 0x44
860 #define UIL_ERR_WRONG_IFB 0x46
861 #define UIL_ERR_MAX 0x7F /*upper boundary of UIL errors without HCF-pendant
862 ***** ******** ** *** ****** ******* *** ******* */
863 #define UIL_ERR_BUSY HCF_ERR_BUSY
864 #define UIL_ERR_DIAG_1 HCF_ERR_DIAG_1
865 #define UIL_FAILURE 0xFF /* 20010705 nv this relick should be eridicated */
866 #define UIL_ERR_PIF_CONFLICT 0x40 //obsolete
867 #define UIL_ERR_INCOMP_DRV 0x41 //obsolete
868 #define UIL_ERR_DOS_CALL 0x43 //obsolete
869 #define UIL_ERR_NO_DRV 0x42 //obsolete
870 #define UIL_ERR_NSTL 0x45 //obsolete
874 #if 0 //;? #ifdef get this going LATER HERMES25
875 #define HCF_IO HCF_IO_32BITS
876 #define HCF_DMA 1
877 #define HCF_DESC_STRCT_EXT 4
879 /* Switch for BusMaster DMA support. Note that the above define includes the DMA-specific HCF
880 code in the build. This define sets the MSF to use DMA; if ENABLE_DMA is not defined, then
881 port I/O will be used in the build */
882 #ifndef BUS_PCMCIA
883 #define ENABLE_DMA
884 #endif // USE_PCMCIA
886 #endif // HERMES25
889 /* Overrule standard WaveLAN Packet Size when in DMA mode */
890 #ifdef ENABLE_DMA
891 #define HCF_MAX_PACKET_SIZE 2304
892 #else
893 #define HCF_MAX_PACKET_SIZE 1514
894 #endif // ENABLE_DMA
896 /* The following sets the component ID, as well as the versioning. See also wl_version.h */
897 #define MSF_COMPONENT_ID COMP_ID_LINUX
899 #define MSF_COMPONENT_VAR DRV_VARIANT
900 #define MSF_COMPONENT_MAJOR_VER DRV_MAJOR_VERSION
901 #define MSF_COMPONENT_MINOR_VER DRV_MINOR_VERSION
903 /* Define the following to turn on assertions in the HCF */
904 //#define HCF_ASSERT 0x8000
905 #define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN // statically binding of msf_assert routine
907 #ifdef USE_BIG_ENDIAN
908 #define HCF_BIG_ENDIAN 1
909 #else
910 #define HCF_BIG_ENDIAN 0
911 #endif /* USE_BIG_ENDIAN */
913 /* Define the following if your system uses memory-mapped IO */
914 //#define HCF_MEM_IO
916 /* The following defines the standard macros required by the HCF to move data to/from the card */
917 #define IN_PORT_BYTE(port) ((hcf_8)inb( (hcf_io)(port) ))
918 #define IN_PORT_WORD(port) ((hcf_16)inw( (hcf_io)(port) ))
919 #define OUT_PORT_BYTE(port, value) (outb( (hcf_8) (value), (hcf_io)(port) ))
920 #define OUT_PORT_WORD(port, value) (outw((hcf_16) (value), (hcf_io)(port) ))
922 #define IN_PORT_STRING_16(port, dst, n) insw((hcf_io)(port), dst, n)
923 #define OUT_PORT_STRING_16(port, src, n) outsw((hcf_io)(port), src, n)
924 //#define IN_PORT_STRINGL(port, dst, n) insl((port), (dst), (n))
925 //#define OUT_PORT_STRINGL(port, src, n) outsl((port), (src), (n))
926 #define IN_PORT_STRING_32(port, dst, n) insl((port), (dst), (n))
927 #define OUT_PORT_STRING_32(port, src, n) outsl((port), (src), (n))
928 #define IN_PORT_HCF32(port) inl( (hcf_io)(port) )
929 #define OUT_PORT_HCF32(port, value) outl((hcf_32)(value), (hcf_io)(port) )
931 #define IN_PORT_DWORD(port) IN_PORT_HCF32(port)
932 #define OUT_PORT_DWORD(port, value) OUT_PORT_HCF32(port, value)
934 #define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len)
935 #define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len)
938 #ifndef OUTPUTDEBUGMSG
939 #define OUTPUTDEBUGMSG(dprintf_exp)
940 #endif
943 #ifndef ASSERTDEBUGMSG
944 #define ASSERTDEBUGMSG(cond, dprintf_exp)
945 #endif
947 #ifndef CFG_SCAN_CHANNELS_2GHZ
948 #define CFG_SCAN_CHANNELS_2GHZ 0xFCC2
949 #endif /* CFG_SCAN_CHANNELS_2GHZ */
951 #define HCF_MAX_MSG 1600 //get going ;?
952 #endif // WVLAN_49
956 /************************************************************************************************/
957 /********************************************* Q N X ******************************************/
958 /************************************************************************************************/
960 #if defined __QNX__ || defined WVLAN_50
962 #define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ...
963 #define MSF_COMPONENT_VAR 0 //...compatibilty check to function
964 #define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more
965 #define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do
967 #include <conio.h>
969 #define IN_PORT_WORD(port) ((hcf_16)inpw( (hcf_io)(port) ))
970 #define OUT_PORT_WORD(port, value) (outpw( (hcf_io)(port), (hcf_16) (value) ))
972 #define IN_PORT_STRING_16( port, addr, n) \
973 while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
974 #define OUT_PORT_STRING_16( port, addr, n) \
975 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; }
978 #endif // QNX / WVLAN_50
982 /************************************************************************************************/
983 /********************************************* B E O S ****************************************/
984 /************************************************************************************************/
986 #if defined __BEOS__
988 #define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ...
989 #define MSF_COMPONENT_VAR 0 //...compatibilty check to function
990 #define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more
991 #define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do
993 #include <drivers/Drivers.h>
994 #include <drivers/KernelExport.h>
996 uint8 read_io_8 (int);
997 void write_io_8 (int, uint8);
998 uint16 read_io_16 (int);
999 void write_io_16 (int, uint16);
1001 #define IN_PORT_WORD(port) ((hcf_16)read_io_16( (hcf_io)(port) ))
1002 #define OUT_PORT_WORD(port, value) (write_io_16( (hcf_io)(port), (hcf_16) (value) ))
1004 #define IN_PORT_STRING_16( port, addr, n) \
1005 while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
1006 #define OUT_PORT_STRING_16( port, addr, n) \
1007 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; }
1009 #endif // __BEOS__
1013 /************************************************************************************************/
1014 /******************************** U S B D O N G L E *****************************************/
1015 /************************************************************************************************/
1017 #if defined USB
1018 #include "gpif.h"
1020 #define MSF_COMPONENT_MAJOR_VER 0
1021 #define MSF_COMPONENT_MINOR_VER 1
1023 #define IN_PORT_WORD(port) (Hermes_IO_Read( (hcf_8)(port)))
1024 #define OUT_PORT_WORD(port, value) (Hermes_IO_Write( (hcf_8)port, /*(hcf_16)*/(value) ) )
1025 /* !!!! NOTE USB supports only 16-bits I/O and no 8-bits I/O
1026 * as a consequence the IN_/OUT_PORT_STRING_16 macros use hcf_16* rather than hcf_8 pointers
1027 * to get more optimal code
1028 * therefore the pointers are incremented by 1 (which means two "bytes") rather than by 2
1030 //#define IN_PORT_STRING_16( port, addr, n) while ( n-- ) { *((hcf_16*)addr)++ = IN_PORT_WORD( port ); }
1031 //#define OUT_PORT_STRING_16( port, addr, n) while ( n-- ) { OUT_PORT_WORD( port, *((hcf_16*)addr)++ ); }
1032 #define IN_PORT_STRING_16( port, dst, n) while ( n-- ) { *dst++ = IN_PORT_WORD( port ); }
1033 #define OUT_PORT_STRING_16( port, src, n) while ( n-- ) { OUT_PORT_WORD( port, *src++ ); }
1035 //#define HCF_TYPE ( HCF_TYPE_AP | HCF_TYPE_WPA )
1036 #define HCF_TYPE HCF_TYPE_WPA
1038 #endif // USB
1041 /************************************************************************************************/
1042 /****************************************** FreeBSD *******************************************/
1043 /************************************************************************************************/
1045 #if defined __FREE_BSD__
1047 #define MSF_COMPONENT_ID COMP_ID_FreeBSD
1048 #define MSF_COMPONENT_VAR 1
1049 #define MSF_COMPONENT_MAJOR_VER 1
1050 #define MSF_COMPONENT_MINOR_VER 0
1052 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1054 #include <machine/cpufunc.h>
1056 #define IN_PORT_WORD(port) ((hcf_16)inw( (hcf_io)(port) ))
1057 #define OUT_PORT_WORD(port, value) (outw((hcf_io)(port), (hcf_16)(value)))
1060 #define IN_PORT_STRING_16( port, addr, n) \
1061 while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
1062 #define OUT_PORT_STRING_16( port, addr, n) \
1063 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; }
1065 #endif // __FREE_BSD__
1069 /************************************************************************************************/
1070 /********************************* W A V E P O I N T ******************************************/
1071 /************************************************************************************************/
1073 #if defined WVLAN_81 /* BORLANDC */
1075 #define EXTERN_C extern // needed because DHF uses this instead of 'extern'
1077 #define MSF_COMPONENT_ID COMP_ID_AP1
1078 #define MSF_COMPONENT_VAR 1
1079 #define MSF_COMPONENT_MAJOR_VER 4
1080 #define MSF_COMPONENT_MINOR_VER 0
1082 #define HCF_PROT_TIME 49 //49*10240 microseconds H/W failure protection timer
1084 //#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox /* debug build only */
1086 #if !defined FAR
1087 #define FAR far // segmented 16 bits mode
1088 #endif // FAR
1090 #define IN_PORT_WORD(port) (inport( (hcf_io)(port) ))
1091 #define OUT_PORT_WORD(port, value) (outport( (hcf_io)(port), value ))
1093 #define IN_PORT_STRING_16(port, addr, len) \
1094 asm { push di; push es; mov cx,len; les di,addr; mov dx,port; rep insw; pop es; pop di }
1096 #define OUT_PORT_STRING_16(port, addr, len) \
1097 asm { push si; push ds; mov cx,len; lds si,addr; mov dx,port; rep outsw; pop ds; pop si }
1099 #endif // WVLAN_81
1102 /************************************************************************************************/
1103 /******************************** W A V E L A U N C H *****************************************/
1104 /************************************************************************************************/
1106 #if defined WVLAUNCH
1108 #include "DriverX.h"
1109 extern HWDEVICE* g_pDevice;
1111 //#define MSF_COMPONENT_ID 0 //;? to get around browser problem
1113 #define IN_PORT_WORD(port) HwInpw( g_pDevice, port )
1114 #define OUT_PORT_WORD(port, value) HwOutpw( g_pDevice, port, value )
1117 // C implementation which let the processor handle the word-at-byte-boundary problem
1119 #define IN_PORT_STRING_16( port, addr, n) \
1120 while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
1121 #define OUT_PORT_STRING_16( port, addr, n) \
1122 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; }
1124 #endif // WVLAUNCH
1128 /************************************************************************************************/
1129 /************************************* W C I T S T *********************************************/
1130 /************************************************************************************************/
1132 #if defined WCITST
1133 #define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ...
1134 #define MSF_COMPONENT_VAR 0 //...compatibilty check to function
1135 #define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more
1136 #define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do
1138 //#define HCF_ENCAP HCF_ENC_NONE //to get going
1139 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1140 #define HCF_TYPE (HCF_TYPE_WPA | HCF_TYPE_PRELOADED) // Hermes-I for HCF6, II for HCF7
1141 #define HCF_DMA 1
1142 //#define LLB //!!!!MIC Debug Only
1143 #if defined LLB && !((HCF_TYPE) & HCF_TYPE_WPA)
1144 err: no LLB unless SSN;
1145 #endif // LLB / HCF_TYPE_WPA
1146 //#define HCF_ALIGN 2
1147 #define HCF_DLV 1 //just to change memory layout ????;?
1148 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1150 #define HCF_ASSERT HCF_ASSERT_SW_SUP // logging via Hermes support registerr
1151 //#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
1153 #if defined __GNUC__
1154 #include "stdio.h"
1155 //#include "unistd.h" //ioperm libc5
1156 #include "sys/io.h" //ioperm glibc
1157 #define extern //see IO Port Programming mini-HOWTO
1158 //#include "asm/io.h" //
1159 #define IN_PORT_WORD(port) inw( (hcf_io)(port) )
1160 #define IN_PORT_DWORD(port) inl( (hcf_io)(port) )
1161 #define OUT_PORT_WORD(port, value) outw( (hcf_io)(port), (hcf_16)(value) )
1162 #define OUT_PORT_DWORD(port, value) outl( (hcf_io)(port), (hcf_16)(value) )
1163 #else
1164 #pragma warning ( disable: 4001 )
1165 #define FAR __far // segmented 16 bits mode
1167 #include <stdio.h>
1168 #include <conio.h>
1169 #ifndef _DEBUG
1170 #pragma intrinsic( _inp, _inpw, _outp, _outpw )
1171 #endif // _DEBUG
1173 #ifdef LOG
1174 extern FILE* utm_logfile;
1175 hcf_16 ipw( hcf_16 port );
1176 hcf_8 ipb( hcf_16 port );
1177 void opw( hcf_16 port, hcf_16 value );
1178 void opb( hcf_16 port, hcf_8 value );
1180 #define IN_PORT_WORD(port) ipw( (hcf_io)(port) )
1181 #define OUT_PORT_WORD(port, value) opw( (hcf_io)(port), (hcf_16)(value) )
1182 #else // LOG
1183 #define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
1184 #define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
1185 #endif // LOG
1187 #if 1 //ASM example
1188 #define IN_PORT_STRING_16( port, addr, len) __asm \
1190 __asm push di \
1191 __asm push es \
1192 __asm mov cx,len \
1193 __asm les di,addr \
1194 __asm mov dx,port \
1195 __asm rep insw \
1196 __asm pop es \
1197 __asm pop di \
1200 #define OUT_PORT_STRING_16( port, addr, len) __asm \
1202 __asm push si \
1203 __asm push ds \
1204 __asm mov cx,len \
1205 __asm lds si,addr \
1206 __asm mov dx,port \
1207 __asm rep outsw \
1208 __asm pop ds \
1209 __asm pop si \
1212 #endif // asm example
1214 #endif // __GCC__
1216 #if ! defined IN_PORT_STRING_16
1217 #define IN_PORT_STRING_16( port, addr, n) while (n--) \
1218 { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_16 FAR*)addr)++; }
1219 #define OUT_PORT_STRING_16( port, addr, n) while (n--) \
1220 { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ); ((hcf_16 FAR*)addr)++; }
1221 #endif // IN_PORT_STRING_16
1223 #endif // WCITST
1226 /************************************************************************************************/
1227 /******************************* Motorola Power PC 800 family *********************************/
1228 /************************************************************************************************/
1229 /* known users: LH@I
1232 #if defined I_MPC8XX
1234 #define MSF_COMPONENT_VAR 0
1235 #define MSF_COMPONENT_ID 0
1236 #define MSF_COMPONENT_MAJOR_VER 1
1237 #define MSF_COMPONENT_MINOR_VER 0
1239 #define HCF_HSI_VAR 1
1241 #define HCF_BIG_ENDIAN 1
1242 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1244 #include "o_portbl.h"
1245 #include "ipcmcia.h"
1246 typedef o_uint8_t hcf_8;
1247 typedef o_uint16_t hcf_16;
1248 typedef o_uint32_t hcf_32;
1250 /***************************************************************************/
1253 #ifdef _lint
1254 #else
1255 asm hcf_16 IN_PORT_WORD(int port)
1257 % reg port
1258 lhbrx r3,r0,port
1259 eieio
1261 #endif // _lint
1264 #ifdef _lint
1265 #else
1266 asm void OUT_PORT_WORD(int port, hcf_16 value)
1268 % reg port, value
1269 sthbrx value,r0,port
1270 eieio
1272 #endif // _lint
1274 /***************************************************************************/
1276 #define IN_PORT_STRING_16(port, addr, len) \
1278 unsigned l = (len); \
1279 hcf_16 *d = (volatile hcf_16 *)(addr); \
1280 while (l--) \
1282 *d++ = *(volatile hcf_16 *)(port); \
1283 EIEIO(); \
1287 #define OUT_PORT_STRING_16(port, addr, len) \
1289 unsigned l = (len); \
1290 hcf_16 *s = (volatile hcf_16 *)(addr); \
1291 while (l--) \
1293 *(volatile hcf_16 *)(port) = *s++; \
1294 EIEIO(); \
1298 #endif // I_MPC8XX
1302 /************************************************************************************************/
1303 /********************************** Diab or High C 29K **************************************/
1304 /************************************************************************************************/
1305 /* known users: GK@C
1308 #if defined _AM29K
1310 #define MSF_COMPONENT_VAR 0
1311 #define MSF_COMPONENT_ID COMP_ID_AP1
1312 #define MSF_COMPONENT_MAJOR_VER 1
1313 #define MSF_COMPONENT_MINOR_VER 0
1315 #define HCF_BIG_ENDIAN 1
1316 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1318 #define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/
1320 #if defined __ppc
1321 #ifndef __GNUC__
1322 #define __asm__ asm
1323 #endif
1325 #if ! defined _lint
1326 #define EIEIO() __asm__(" eieio")
1327 #else
1328 #define EIEIO()
1329 #endif
1331 static hcf_16 IN_PORT_WORD(int port) {
1332 hcf_16 value = *(volatile hcf_16 *)(port); EIEIO();
1333 value = SwapBytes(value);
1334 return value;
1337 #define OUT_PORT_WORD(port, value) \
1338 { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); }
1339 #else
1340 #define IN_PORT_WORD(port) (*(volatile hcf_16 *)(port))
1341 #define OUT_PORT_WORD(port, value) (*(volatile hcf_16 *)(port) = (value))
1342 #endif // __ppc
1344 /***************************************************************************/
1346 #define IN_PORT_STRING_16( port, addr, len) { \
1347 unsigned l = (len); \
1348 hcf_16 t, *d = (volatile hcf_16 *)(addr); \
1349 while (l--) { \
1350 t = IN_PORT_WORD(port); \
1351 *d++ = SwapBytes(t); \
1355 #define OUT_PORT_STRING_16( port, addr, len) { \
1356 unsigned l = (len); \
1357 hcf_16 t, *s = (volatile hcf_16 *)(addr); \
1358 while (l--) { \
1359 t = *s++; \
1360 OUT_PORT_WORD(port, SwapBytes(t)); \
1364 #if PRODUCT == 9150
1365 #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
1366 #undef MSF_COMPONENT_ID
1367 #endif // 9150
1369 #endif // _AM29K
1373 /************************************************************************************************/
1374 /***************************************** MPC860 **********************************************/
1375 /************************************************************************************************/
1376 /* known users: RR
1379 #if defined CPU
1380 #if CPU == PPC860
1382 #define MSF_COMPONENT_VAR 0
1383 #define MSF_COMPONENT_ID 0
1384 #define MSF_COMPONENT_MAJOR_VER 1
1385 #define MSF_COMPONENT_MINOR_VER 0
1387 #define HCF_BIG_ENDIAN 1
1388 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1390 #define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/
1392 #ifndef __GNUC__
1393 #define __asm__ asm
1394 #endif
1396 #if ! defined _lint
1397 #define EIEIO() __asm__(" eieio")
1398 #else
1399 #define EIEIO()
1400 #endif
1402 static hcf_16 IN_PORT_WORD(int port) {
1403 hcf_16 value = *(volatile hcf_16 *)(port); EIEIO();
1404 value = SwapBytes(value);
1405 return value;
1406 #ifdef __GNUC__
1407 /* the following serves to avoid the compiler warnings that
1408 * IN_PORT_WORD() is not used in some files */
1409 (void)IN_PORT_WORD;
1410 #endif
1413 #define OUT_PORT_WORD(port, value) \
1414 { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); }
1416 /***************************************************************************/
1418 #define IN_PORT_STRING_16( port, addr, len) { \
1419 unsigned l = (len); \
1420 hcf_16 t; \
1421 volatile hcf_16 *d = (volatile hcf_16 *)(addr); \
1422 while (l--) { \
1423 t = IN_PORT_WORD(port); \
1424 *d++ = SwapBytes(t); \
1428 #define OUT_PORT_STRING_16( port, addr, len) { \
1429 unsigned l = (len); \
1430 hcf_16 t; \
1431 volatile hcf_16 *s = (volatile hcf_16 *)(addr); \
1432 while (l--) { \
1433 t = *s++; \
1434 OUT_PORT_WORD(port, SwapBytes(t)); \
1438 #if PRODUCT == 9150
1439 #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
1440 #undef MSF_COMPONENT_ID
1441 #endif
1443 #endif /* PPC860 */
1444 #endif /* CPU */
1448 /************************************************************************************************/
1449 /**************************** Microtec Research 80X86 Compiler *********************************/
1450 /************************************************************************************************/
1452 #if 0
1454 //#undef HCF_TYPE // Hermes-I Station F/W without SSN support
1456 #define MSF_COMPONENT_VAR 0
1457 #define MSF_COMPONENT_ID 0
1458 #define MSF_COMPONENT_MAJOR_VER 1
1459 #define MSF_COMPONENT_MINOR_VER 0
1461 extern int far inp( int );
1462 extern void far outp( int, int );
1463 extern int far inpw( int );
1464 extern void far outpw( int, int );
1466 #define IN_PORT_WORD(port) ((hcf_16)inpw( (hcf_io)(port) ))
1467 #define OUT_PORT_WORD(port, value) ((void)outpw( (hcf_io)(port), value ))
1469 #define IN_PORT_STRING_16( port, addr, len) { \
1470 unsigned l = (len); \
1471 hcf_16 *d = (hcf_16 *)(addr); \
1472 while (l--) *d++ = IN_PORT_WORD(port); \
1475 #define OUT_PORT_STRING_16( port, addr, len) { \
1476 unsigned l = (len); \
1477 hcf_16 *s = (hcf_16 *)(addr); \
1478 while (l--) OUT_PORT_WORD(port, *s++); \
1480 #endif /* Microtec 80X86 C Compiler */
1484 /************************************************************************************************/
1485 /****************************** W A V E L A N E C ********************************************/
1486 /************************************************************************************************/
1487 /* known users: KM
1490 #ifdef mc68302
1492 #define MSF_COMPONENT_ID COMP_ID_EC
1494 #include <version.h>
1496 #define MSF_COMPONENT_VAR 1
1497 #define MSF_COMPONENT_MAJOR_VER MAJOR_VERSION
1498 #define MSF_COMPONENT_MINOR_VER MINOR_VERSION
1500 #define HCF_BIG_ENDIAN 1
1501 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1503 #define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/
1505 #define PCMCIA_ADDRESS 0xc80000UL
1507 #define IN_PORT_2BYTES(port) (*(hcf_16 *)(port))
1508 #if 0
1509 static hcf_16 IN_PORT_WORD(hcf_32 port) // should be hcf_io, not hcf_32
1511 hcf_16 word = IN_PORT_2BYTES(port);
1512 return SwapBytes(word);
1514 #else
1515 static hcf_16 swap_var;
1516 #define IN_PORT_WORD(port) \
1517 (((swap_var = IN_PORT_2BYTES(port)) >> 8) + (((swap_var) & 0xff) << 8))
1518 #endif
1519 #define OUT_PORT_2BYTES(port, value) (*(hcf_16 *)(port) = (hcf_16)(value))
1520 #define OUT_PORT_WORD(port, value) OUT_PORT_2BYTES(port, SwapBytes(value))
1523 #define IN_PORT_STRING_16(port, addr, len) \
1524 while ((len)--) {*(hcf_16 *)(addr) = IN_PORT_2BYTES(port); ((cast)addr) += 2; }
1525 #define OUT_PORT_STRING_16(port, addr, len) \
1526 while ((len)--) {OUT_PORT_2BYTES((port), *(hcf_16 *)(addr)) ; ((cast)addr) += 2; }
1529 #endif /* mc68302 */
1533 /************************************************************************************************/
1534 /********************************* NGAP ***************************************/
1535 /************************************************************************************************/
1537 #if defined __VX_WORKS__ /* VxWorks */
1539 #if defined WLC_STATION
1540 //#undef HCF_TYPE /* Hermes-I Station F/W without SSN support */
1541 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
1542 #else
1543 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
1544 #endif // WLC_STATION
1546 #define HCF_YIELD (taskDelay(0) == 0)
1548 #define MSF_COMPONENT_VAR 1
1549 #define MSF_COMPONENT_MAJOR_VER 1
1550 #define MSF_COMPONENT_MINOR_VER 0
1552 // #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
1554 #if defined PC486BSP
1556 #define IN_PORT_WORD(port) (sysInWord ((hcf_io)(port)))
1557 #define OUT_PORT_WORD(port, value) (sysOutWord ((hcf_io)(port), (hcf_16) (value)))
1558 #define IN_PORT_STRING_16(port, addr, n) (sysInWordString ((hcf_io)(port), addr, n))
1559 #define OUT_PORT_STRING_16(port, addr, n) (sysOutWordString ((hcf_io)(port), addr, n))
1561 #elif defined AS2000BSP
1563 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1565 /* Define PCI stuff here. */
1566 unsigned short sysRead16( unsigned short *port );
1567 void sysWrite16( unsigned short *port, unsigned short value );
1569 #define PCI_IN_BYTE( port ) \
1570 *(unsigned char *)( port )
1572 #define PCI_IN_WORD( port ) \
1573 sysRead16( (unsigned short *)( port ) )
1575 #define PCI_OUT_BYTE( port, value ) \
1576 *(unsigned char *)( port ) = (unsigned char)( value )
1578 #define PCI_OUT_WORD( port, value ) \
1579 sysWrite16( (unsigned short *)( port ), (unsigned short)( value ) )
1581 #define IN_PORT_WORD( port ) \
1582 PCI_IN_WORD( port )
1584 #define OUT_PORT_WORD( port, value ) \
1585 PCI_OUT_WORD( port, value )
1587 #define IN_PORT_STRING_16( port, buf, len ) \
1588 do { \
1589 hcf_16 *p; \
1591 for ( p = (hcf_16 *)(buf); p < &( (hcf_16 *)(buf) )[ (int)len ]; p++ ) { \
1592 *p = PCI_IN_WORD( port ); \
1594 } while ( 0 )
1596 #define OUT_PORT_STRING_16( port, buf, len ) \
1597 do { \
1598 const hcf_16 *p; \
1600 for ( p = (const hcf_16 *)( buf ); p < &( (const hcf_16 *)(buf) )[ (int)len ]; p++ ) { \
1601 PCI_OUT_WORD( port, *p ); \
1603 } while ( 0 )
1605 #elif defined FADS860BSP /* elif defined AS2000BSP */
1607 #define HCF_BIG_ENDIAN 1
1609 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1611 #ifndef __GNUC__
1612 #define __asm__ asm
1613 #endif
1615 #if ! defined _lint
1616 #define EIEIO() __asm__(" eieio")
1617 #else
1618 #define EIEIO()
1619 #endif
1621 static hcf_16 IN_PORT_WORD(int port) {
1622 hcf_16 value = *(volatile hcf_16 *)(port); EIEIO();
1623 value = ((value & 0xff00) >> 8) + ((value & 0x00ff) << 8);
1624 /* value = CNV_LITTLE_TO_SHORT(value); */
1625 return value;
1626 #ifdef __GNUC__
1627 /* the following serves to avoid the compiler warnings that
1628 * IN_PORT_WORD() is not used in some files */
1629 (void)IN_PORT_WORD;
1630 #endif
1633 #define OUT_PORT_WORD(port, value) \
1634 { *(volatile hcf_16 *)(port) = CNV_SHORT_TO_LITTLE(value); EIEIO(); }
1636 /***********************************************************************/
1638 #define IN_PORT_STRING_16( port, addr, len) { \
1639 unsigned l = (len); \
1640 volatile hcf_16 *d = (volatile hcf_16 *)(addr); \
1641 while (l--) { \
1642 *d++ = *(volatile hcf_16 *)(port); \
1643 EIEIO(); \
1647 #define OUT_PORT_STRING_16( port, addr, len) { \
1648 unsigned l = (len); \
1649 volatile hcf_16 *s = (volatile hcf_16 *)(addr); \
1650 while (l--) { \
1651 *(volatile hcf_16 *)(port) = *s++; \
1652 EIEIO(); \
1656 #elif defined DAYTONABSP
1658 #define HCF_BIG_ENDIAN 1
1660 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1662 #ifndef __GNUC__
1663 #define __asm__ asm
1664 #endif
1666 #define IN_PORT_WORD(port) (sysOrinocoInWord((unsigned long)(port)))
1667 #define OUT_PORT_WORD(port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value)))
1669 #define IN_PORT_STRING_16(port,addr,len) (sysOrinocoInString((port), (addr), (len)))
1670 #define OUT_PORT_STRING_16(port,addr,len) (sysOrinocoOutString((port), (addr), (len)))
1672 extern unsigned char sysOrinocoInByte (unsigned long port);
1673 extern unsigned short sysOrinocoInWord (unsigned long port);
1674 extern void sysOrinocoInString (unsigned long port, void *addr, unsigned short len);
1676 extern void sysOrinocoOutByte (unsigned long port, unsigned char value);
1677 extern void sysOrinocoOutWord (unsigned long port, unsigned short value);
1678 extern void sysOrinocoOutString (unsigned long port, void *addr, unsigned short len);
1680 #elif defined ALPHA_BSP
1682 #define HCF_BIG_ENDIAN 1
1684 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1686 #ifndef __GNUC__
1687 #define __asm__ asm
1688 #endif
1690 #define IN_PORT_WORD(port) (sysOrinocoInWord((unsigned long)(port)))
1691 #define OUT_PORT_WORD(port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value)))
1693 #define IN_PORT_STRING_16(port,addr,len) (sysOrinocoInString((port), (addr), (len)))
1694 #define OUT_PORT_STRING_16(port,addr,len) (sysOrinocoOutString((port), (addr), (len)))
1696 extern unsigned char sysOrinocoInByte (unsigned long port);
1697 extern unsigned short sysOrinocoInWord (unsigned long port);
1698 extern void sysOrinocoInString (unsigned long port, void *addr, unsigned short len);
1700 extern void sysOrinocoOutByte (unsigned long port, unsigned char value);
1701 extern void sysOrinocoOutWord (unsigned long port, unsigned short value);
1702 extern void sysOrinocoOutString (unsigned long port, void *addr, unsigned short len);
1704 #else
1706 err: /* commented here */ /* "BSP is not defined..." */
1708 #endif /* else PC486BSP */
1710 #endif // __VX_WORKS__
1714 /************************************************************************************************/
1715 /****************************** VXWORKS. Motorola Sandpoint PowerPC 824X ***********************/
1716 /************************************************************************************************/
1717 #ifdef __VX_WORKS_SANDPOINT_824X__
1719 #include <vxWorks.h>
1720 #include <sysLib.h>
1721 #include <taskLib.h>
1723 #ifdef WVLAN_53
1724 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
1725 #endif /* WVLAN_53 */
1727 #ifdef WVLAN_54
1728 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
1729 #endif /* WVLAN_54 */
1731 #ifdef WVLAN_56
1732 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END
1733 #endif /* WVLAN_56 */
1735 #if !defined MSF_COMPONENT_ID
1736 #error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56"
1737 #endif
1739 #define MSF_COMPONENT_VAR 1
1741 #define HCF_EXT HCF_EXT_INFO_LOG
1742 #define HCF_SLEEP ( HCF_CDS | HCF_DDS )
1743 //#define HCF_SLEEP ( HCF_DDS )
1745 #ifndef HCF_ACT_WAKEUP
1746 #define HCF_ACT_WAKEUP 0x1D
1747 #endif // HCF_ACT_WAKEUP
1749 #if defined FATNIC | defined BEAGLE_H253
1750 #define T1__HCF_TYPE HCF_TYPE_STA
1751 #else
1752 #define T1__HCF_TYPE HCF_TYPE_AP | HCF_TYPE_STA
1753 #endif
1755 #ifdef HERMES_USB
1756 #define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB)
1757 #else // HERMES_USB
1758 #define T2__HCF_TYPE (T1__HCF_TYPE)
1759 #endif // HERMES_USB
1761 #ifdef _WARP
1762 #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5)
1763 #else // _WARP
1764 #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII)
1765 #endif // WARP
1767 #ifdef _CCX
1768 #define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
1769 #else // _WARP
1770 #define T4__HCF_TYPE (T3__HCF_TYPE)
1771 #endif // _CCX
1773 #define T5__HCF_TYPE (T4__HCF_TYPE)
1775 // Default to TYPE_AP + SSN!
1776 #define HCF_TYPE (T5__HCF_TYPE )
1780 #define MSF_COMPONENT_MAJOR_VER 2
1781 #define MSF_COMPONENT_MINOR_VER 0
1783 #define HCF_IO HCF_IO_MEM
1784 #define HCF_DMA 0
1785 #define HCF_MEM_IO 1
1786 #define HCF_BIG_ENDIAN 1
1788 //#define support_32bits 1
1790 #define IN_PORT_WORD(port) (sysInWord( (hcf_io)(port) ))
1791 #define OUT_PORT_WORD(port, value) (sysOutWord( (hcf_io)(port), (hcf_16)(value) ))
1792 #define IN_PORT_DWORD(port) (sysInLong( (hcf_io)(port) ))
1793 #define OUT_PORT_DWORD(port, value) (sysOutLong( (hcf_io)(port), (hcf_16)(value) ))
1794 #define IN_PORT_STRING_16(port, dst, n) (sysInWordString((hcf_io)(port), (hcf_16 *)dst, n))
1795 #define OUT_PORT_STRING_16(port, src, n) (sysOutWordString((hcf_io)(port), (hcf_16 *)src, n))
1797 #ifdef WVLAN_DEBUG
1798 #define DBG 1
1799 #define _DEBUG 1
1800 #endif
1802 /* we'll need to add these prints someday */
1803 #define OUTPUTDEBUGMSG(dprintf_exp)
1804 #define ASSERTDEBUGMSG(cond, dprintf_exp)
1806 #define HCF_INTERFACE_CONNECT(ifbp)
1807 #define HCF_INTERFACE_DISCONNECT(ifbp)
1808 #define HCF_ENTER_INTERFACE_FUNCT(ibfb)
1809 #define HCF_LEAVE_INTERFACE_FUNCT(ifbp)
1811 #define CNV_END_INT(w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 )
1812 #define CNV_LITTLE_TO_INT(w) CNV_END_INT(w)
1813 #define CNV_INT_TO_LITTLE(w) CNV_LITTLE_TO_INT(w)
1815 #endif /* __VX_WORKS_SANDPOINT_824X__ */
1817 /************************************************************************************************/
1818 /************************************* VXWORKS. ARM T8300 IPPhone *****************************/
1819 /************************************************************************************************/
1820 #if defined( IPT_T8300 ) || defined( IPT_T8307 )
1822 #include <vxWorks.h>
1823 #include <sysLib.h>
1824 #include <taskLib.h>
1826 #define HCF_ALIGN 4 /* default to 4 byte alignment */
1828 #define BEAGLE_H253 /* Hermes 2.5.3 build, better to be in the project file */
1829 #define OOR_DDS /* Hermes 2.5.3 build, better to be in the project file */
1830 #define FATNIC
1833 #ifdef WVLAN_53
1834 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
1835 #endif /* WVLAN_53 */
1837 #ifdef WVLAN_54
1838 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
1839 #endif /* WVLAN_54 */
1841 #ifdef WVLAN_56
1842 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END
1843 #endif /* WVLAN_56 */
1845 #if !defined MSF_COMPONENT_ID
1846 #error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56"
1847 #endif
1849 #define MSF_COMPONENT_VAR 1
1851 #define HCF_EXT HCF_EXT_INFO_LOG
1852 //#define HCF_EXT HCF_EXT_INFO_LOG | HCF_EXT_MB
1853 #define HCF_SLEEP ( HCF_CDS | HCF_DDS )
1854 //#define HCF_SLEEP ( HCF_DDS )
1856 #ifndef HCF_ACT_WAKEUP
1857 #define HCF_ACT_WAKEUP 0x1D
1858 #endif // HCF_ACT_WAKEUP
1860 #if defined FATNIC || defined BEAGLE_H253
1861 #define T1__HCF_TYPE HCF_TYPE_STA
1862 #else
1863 //#define T1__HCF_TYPE HCF_TYPE_AP | HCF_TYPE_STA
1864 #define T1__HCF_TYPE HCF_TYPE_STA /* dz, Station code only */
1865 #endif
1867 #ifdef HERMES_USB
1868 #define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB)
1869 #else // HERMES_USB
1870 #define T2__HCF_TYPE (T1__HCF_TYPE)
1871 #endif // HERMES_USB
1873 #ifdef _WARP
1874 #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5)
1875 #else // _WARP
1876 #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII)
1877 //#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII) /* dz. no WPA support at this time, test code */
1878 #endif // WARP
1880 #ifdef _CCX
1881 #define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
1882 #else // _WARP
1883 #define T4__HCF_TYPE (T3__HCF_TYPE)
1884 #endif // _CCX
1886 #define T5__HCF_TYPE (T4__HCF_TYPE)
1888 // Default to TYPE_AP + SSN!
1889 #define HCF_TYPE (T5__HCF_TYPE )
1892 #define MSF_COMPONENT_MAJOR_VER 2
1893 #define MSF_COMPONENT_MINOR_VER 0
1895 #define HCF_IO HCF_IO_MEM
1896 #define HCF_DMA 0
1897 #define HCF_MEM_IO 1
1900 /* Endian is determined by vxWorks project compile option */
1901 #if (_BYTE_ORDER == _BIG_ENDIAN)
1902 #undef HCF_LITTLE_ENDIAN
1903 #define HCF_BIG_ENDIAN 1
1904 #endif
1907 #define CNV_END(w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 )
1908 #if defined HCF_BIG_ENDIAN
1909 //******************************************** B I G E N D I A N *******************************************
1910 #define CNV_LITTLE_TO_INT(w) CNV_END(w) // endianess conversion needed
1911 #define CNV_BIG_TO_INT(w) (w) // no endianess conversion needed
1912 #else
1913 //****************************************** L I T T L E E N D I A N ****************************************
1914 #define CNV_LITTLE_TO_INT(w) (w) // no endianess conversion needed
1915 #define CNV_BIG_TO_INT(w) CNV_END(w) // endianess conversion needed
1916 #endif // HCF_BIG_ENDIAN
1918 // conversion macros which can be expressed in other macros
1919 #define CNV_INT_TO_LITTLE(w) CNV_LITTLE_TO_INT(w)
1920 #define CNV_INT_TO_BIG(w) CNV_BIG_TO_INT(w)
1924 #define IN_PORT_WORD( port ) *((volatile hcf_16 *)( port ))
1925 #define OUT_PORT_WORD( port, value ) *((volatile hcf_16 *)( port )) = ((hcf_16)( value ))
1926 //#define IN_PORT_BYTE( port ) *((volatile hcf_8 *)( port ))
1928 #define IN_PORT_STRING( port, addr, len) { \
1929 unsigned l = len; \
1930 hcf_16 *d = (hcf_16 *)(addr); \
1931 hcf_16 t; \
1932 while (l--) { \
1933 t = IN_PORT_WORD(port); \
1934 *d++ = CNV_LITTLE_TO_INT(t); \
1936 } // IN_PORT_STRING
1938 #define OUT_PORT_STRING( port, addr, len) { \
1939 unsigned l = (len); \
1940 hcf_16 *s = (hcf_16 *)(addr); \
1941 hcf_16 t; \
1942 while (l--) { \
1943 t = *s++; \
1944 t = CNV_LITTLE_TO_INT(t); \
1945 OUT_PORT_WORD(port, t); \
1947 } // OUT_PORT_STRING
1949 #define IN_PORT_STRING_16(port, dst, n) { \
1950 unsigned l = (n); \
1951 hcf_16 *d = (hcf_16 *)(dst); \
1952 while (l--) { \
1953 *d++ = IN_PORT_WORD(port); \
1955 } // IN_PORT_STRING_16
1957 #define OUT_PORT_STRING_16(port, src, n) { \
1958 hcf_16 t; \
1959 int l = (n); \
1960 hcf_16 *s = (hcf_16 *)(src); \
1961 while (l--) { \
1962 t = *s++; \
1963 OUT_PORT_WORD(port, t); \
1965 } // OUT_PORT_STRING_16
1967 /* #define HCF_YIELD (taskDelay(0) == 0) */
1971 #ifdef WVLAN_DEBUG
1972 #define DBG 1
1973 #define _DEBUG 1
1974 #endif
1976 /* we'll need to add these prints someday */
1977 #define OUTPUTDEBUGMSG(dprintf_exp)
1978 #define ASSERTDEBUGMSG(cond, dprintf_exp)
1980 #define HCF_INTERFACE_CONNECT(ifbp)
1981 #define HCF_INTERFACE_DISCONNECT(ifbp)
1982 #define HCF_ENTER_INTERFACE_FUNCT(ibfb)
1983 #define HCF_LEAVE_INTERFACE_FUNCT(ifbp)
1985 #define sysInWord(offsetAddr) IN_PORT_WORD(offsetAddr)
1986 #define sysInByte(offsetAddr) IN_PORT_BYTE(offsetAddr)
1987 #define sysOutWord(addr, value) OUT_PORT_WORD(addr, value)
1989 #endif /*IPT_T8300 */
1991 /************************************************************************************************************/
1992 /*********************************** **************************************/
1993 /************************************************************************************************************/
1994 #if ! defined HCF_ALIGN
1995 #define HCF_ALIGN 1 //default to no alignment
1996 #endif // HCF_ALIGN
1998 #if ! defined HCF_ASSERT
1999 #define HCF_ASSERT 0
2000 #endif // HCF_ASSERT
2002 #if ! defined HCF_BIG_ENDIAN
2003 #define HCF_BIG_ENDIAN 0
2004 #endif // HCF_BIG_ENDIAN
2006 #if ! defined HCF_DL_ONLY
2007 #define HCF_DL_ONLY 0
2008 #endif // HCF_DL_ONLY
2010 #if ! defined HCF_DMA
2011 #define HCF_DMA 0
2012 #endif // HCF_DMA
2014 #if ! defined HCF_ENCAP
2015 #define HCF_ENCAP HCF_ENC
2016 #endif // HCF_ENCAP
2018 #if ! defined HCF_ENTRY
2019 #define HCF_ENTRY( ifbp )
2020 #endif // HCF_ENTRY
2022 #if ! defined HCF_EXIT
2023 #define HCF_EXIT( ifbp )
2024 #endif // HCF_EXIT
2026 #if ! defined HCF_EXT
2027 #define HCF_EXT 0
2028 #endif // HCF_EXT
2030 #if ! defined HCF_INT_ON
2031 #define HCF_INT_ON 1
2032 #endif // HCF_INT_ON
2034 #if ! defined HCF_IO
2035 #define HCF_IO 0 //default 16 bits support only, port I/O
2036 #endif // HCF_IO
2038 #if ! defined HCF_LEGACY
2039 #define HCF_LEGACY 0
2040 #endif // HCF_LEGACY
2042 #if ! defined HCF_MAX_LTV
2043 #define HCF_MAX_LTV 1200 // sufficient for all known purposes
2044 #endif // HCF_MAX_LTV
2046 #if ! defined HCF_PROT_TIME
2047 #define HCF_PROT_TIME 100 // number of 10K microsec protection timer against H/W malfunction
2048 #endif // HCF_PROT_TIME
2050 #if ! defined HCF_SLEEP
2051 #define HCF_SLEEP 0
2052 #endif // HCF_SLEEP
2054 #if ! defined HCF_TALLIES
2055 #define HCF_TALLIES ( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
2056 #endif // HCF_TALLIES
2058 #if ! defined HCF_TYPE
2059 #define HCF_TYPE 0
2060 #endif // HCF_TYPE
2062 #if HCF_BIG_ENDIAN
2063 #undef HCF_BIG_ENDIAN
2064 #define HCF_BIG_ENDIAN 1 //just for convenience of generating cfg_hcf_opt
2065 #endif // HCF_BIG_ENDIAN
2067 #if HCF_DL_ONLY
2068 #undef HCF_DL_ONLY
2069 #define HCF_DL_ONLY 1 //just for convenience of generating cfg_hcf_opt
2070 #endif // HCF_DL_ONLY
2072 #if HCF_DMA
2073 #undef HCF_DMA
2074 #define HCF_DMA 1 //just for convenience of generating cfg_hcf_opt
2075 #endif // HCF_DMA
2077 #if HCF_INT_ON
2078 #undef HCF_INT_ON
2079 #define HCF_INT_ON 1 //just for convenience of generating cfg_hcf_opt
2080 #endif // HCF_INT_ON
2083 #if ! defined IN_PORT_STRING_8_16
2084 #define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len)
2085 #define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len)
2086 #endif // IN_PORT_STRING_8_16
2088 /************************************************************************************************/
2089 /********** *************/
2090 /************************************************************************************************/
2092 #if ! defined FAR
2093 #define FAR // default to flat 32-bits code
2094 #endif // FAR
2096 typedef hcf_8 FAR *wci_bufp; // segmented 16-bits or flat 32-bits pointer to 8 bits unit
2097 typedef hcf_16 FAR *wci_recordp; // segmented 16-bits or flat 32-bits pointer to 16 bits unit
2099 /* I/O Address size
2100 * Platforms which use port mapped I/O will (in general) have a 64k I/O space, conveniently expressed in a
2101 * 16-bits quantity
2102 * Platforms which use memory mapped I/O will (in general) have an I/O space much larger than 64k, and need a
2103 * 32-bits quantity to express the I/O base
2106 #if HCF_IO & HCF_IO_MEM
2107 typedef hcf_32 hcf_io;
2108 #else
2109 typedef hcf_16 hcf_io;
2110 #endif //HCF_IO
2112 #if HCF_PROT_TIME > 128
2113 #define HCF_PROT_TIME_SHFT 3
2114 #define HCF_PROT_TIME_DIV 8
2115 #elif HCF_PROT_TIME > 64
2116 #define HCF_PROT_TIME_SHFT 2
2117 #define HCF_PROT_TIME_DIV 4
2118 #elif HCF_PROT_TIME > 32
2119 #define HCF_PROT_TIME_SHFT 1
2120 #define HCF_PROT_TIME_DIV 2
2121 #else //HCF_PROT_TIME >= 19
2122 #define HCF_PROT_TIME_SHFT 0
2123 #define HCF_PROT_TIME_DIV 1
2124 #endif
2126 #define HCF_PROT_TIME_CNT (HCF_PROT_TIME / HCF_PROT_TIME_DIV)
2129 /************************************************************************************************************/
2130 /******************************************* . . . . . . . . . *********************************************/
2131 /************************************************************************************************************/
2133 /* MSF_COMPONENT_ID is used to define the CFG_IDENTITY_STRCT in HCF.C
2134 * CFG_IDENTITY_STRCT is defined in HCF.C purely based on convenience arguments.
2135 * The HCF can not have the knowledge to determine the ComponentId field of the Identity record (aka as
2136 * Version Record), therefore the MSF part of the Drivers must supply this value via the System Constant
2137 * MSF_COMPONENT_ID.
2138 * There is a set of values predefined in MDD.H (format COMP_ID_.....)
2140 * Note that taking MSF_COMPONENT_ID as a default value for DUI_COMPAT_VAR is purely an implementation
2141 * convenience, the numerical values of these two quantities have none functional relationship whatsoever.
2144 #if defined MSF_COMPONENT_ID
2146 #if ! defined DUI_COMPAT_VAR
2147 #define DUI_COMPAT_VAR MSF_COMPONENT_ID
2148 #endif // DUI_COMPAT_VAR
2150 #if ! defined DUI_COMPAT_BOT //;?this way utilities can lower as well raise the bottom
2151 #define DUI_COMPAT_BOT 8
2152 #endif // DUI_COMPAT_BOT
2154 #if ! defined DUI_COMPAT_TOP //;?this way utilities can lower as well raise the top
2155 #define DUI_COMPAT_TOP 8
2156 #endif // DUI_COMPAT_TOP
2158 #endif // MSF_COMPONENT_ID
2160 #if (HCF_TYPE) & HCF_TYPE_HII5
2162 #if ! defined HCF_HSI_VAR_5
2163 #define HCF_HSI_VAR_5
2164 #endif // HCF_HSI_VAR_5
2166 #if ! defined HCF_APF_VAR_4
2167 #define HCF_APF_VAR_4
2168 #endif // HCF_APF_VAR_4
2170 #if (HCF_TYPE) & HCF_TYPE_WARP
2171 #if ! defined HCF_STA_VAR_4
2172 #define HCF_STA_VAR_4
2173 #endif // HCF_STA_VAR_4
2174 #else
2175 #if ! defined HCF_STA_VAR_2
2176 #define HCF_STA_VAR_2
2177 #endif // HCF_STA_VAR_2
2178 #endif
2180 #if defined HCF_HSI_VAR_4
2181 err: HSI variants 4 correspond with HII;
2182 #endif // HCF_HSI_VAR_4
2184 #else
2186 #if ! defined HCF_HSI_VAR_4
2187 #define HCF_HSI_VAR_4 //Hermes-II all types (for the time being!)
2188 #endif // HCF_HSI_VAR_4
2190 #if ! defined HCF_APF_VAR_2
2191 #define HCF_APF_VAR_2
2192 #endif // HCF_APF_VAR_2
2194 #if ! defined HCF_STA_VAR_2
2195 #define HCF_STA_VAR_2
2196 #endif // HCF_STA_VAR_2
2198 #endif // HCF_TYPE_HII5
2200 #if ! defined HCF_PRI_VAR_3
2201 #define HCF_PRI_VAR_3
2202 #endif // HCF_PRI_VAR_3
2204 #if defined HCF_HSI_VAR_1 || defined HCF_HSI_VAR_2 || defined HCF_HSI_VAR_3
2205 err: HSI variants 1, 2 and 3 correspond with H-I only;
2206 #endif // HCF_HSI_VAR_1, HCF_HSI_VAR_2, HCF_HSI_VAR_3
2208 #if defined HCF_PRI_VAR_1 || defined HCF_PRI_VAR_2
2209 err: primary variants 1 and 2 correspond with H-I only;
2210 #endif // HCF_PRI_VAR_1 / HCF_PRI_VAR_2
2213 /************************************************************************************************************/
2214 /******************************************* . . . . . . . . . *********************************************/
2215 /************************************************************************************************************/
2218 /* The BASED customization macro is used to resolves the SS!=DS conflict for the Interrupt Service logic in
2219 * DOS Drivers. Due to the cumbersomeness of mixing C and assembler local BASED variables still end up in the
2220 * wrong segment. The workaround is that the HCF uses only global BASED variables or IFB-based variables.
2221 * The "BASED" construction (supposedly) only amounts to something in the small memory model.
2223 * Note that the whole BASED rigmarole is needlessly complicated because both the Microsoft Compiler and
2224 * Linker are unnecessary restrictive in what far pointer manipulation they allow
2227 #if ! defined BASED
2228 #define BASED
2229 #endif // BASED
2231 #if ! defined EXTERN_C
2232 #ifdef __cplusplus
2233 #define EXTERN_C extern "C"
2234 #else
2235 #define EXTERN_C
2236 #endif // __cplusplus
2237 #endif // EXTERN_C
2239 #if ! defined NULL
2240 #define NULL ((void *) 0)
2241 #endif // NULL
2243 #if ! defined TEXT
2244 #define TEXT(x) x
2245 #endif // TEXT
2247 #if !defined _TCHAR_DEFINED
2248 #define TCHAR char
2249 #endif // _TCHAR_DEFINED
2251 /************************************************************************************************************/
2252 /*********************** 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 ************************/
2253 /************************************************************************************************************/
2254 #if defined HCF_LITTLE_ENDIAN
2255 err: HCF_LITTLE_ENDIAN is obsolete;
2256 #endif // HCF_LITTLE_ENDIAN
2258 #if defined HCF_INT_OFF
2259 err: HCF_INT_OFF is obsolete;
2260 #endif //HCF_INT_OFF
2262 #if HCF_ALIGN != 1 && HCF_ALIGN != 2 && HCF_ALIGN != 4 && HCF_ALIGN != 8
2263 err: invalid value for HCF_ALIGN;
2264 #endif // HCF_ALIGN
2266 #if (HCF_ASSERT) & ~( HCF_ASSERT_PRINTF | HCF_ASSERT_SW_SUP | HCF_ASSERT_MB | HCF_ASSERT_RT_MSF_RTN | \
2267 HCF_ASSERT_LNK_MSF_RTN )
2268 err: invalid value for HCF_ASSERT;
2269 #endif // HCF_ASSERT
2271 #if (HCF_ASSERT) & HCF_ASSERT_MB && ! ( (HCF_EXT) & HCF_EXT_MB ) //detect potential conflict
2272 err: these macros are not used consistently;
2273 #endif // HCF_ASSERT_MB / HCF_EXT_MB
2275 #if HCF_BIG_ENDIAN != 0 && HCF_BIG_ENDIAN != 1
2276 err: invalid value for HCF_BIG_ENDIAN;
2277 #endif // HCF_BIG_ENDIAN
2279 #if HCF_DL_ONLY != 0 && HCF_DL_ONLY != 1
2280 err: invalid value for HCF_DL_ONLY;
2281 #endif // HCF_DL_ONLY
2283 #if HCF_DMA != 0 && HCF_DMA != 1
2284 err: invalid value for HCF_DMA;
2285 #endif // HCF_DMA
2287 #if (HCF_ENCAP) & ~( HCF_ENC | HCF_ENC_SUP )
2288 err: invalid value for HCF_ENCAP;
2289 #endif // HCF_ENCAP
2291 #if (HCF_EXT) & ~( HCF_EXT_INFO_LOG | HCF_EXT_INT_TX_EX | HCF_EXT_TALLIES_FW | HCF_EXT_TALLIES_HCF | \
2292 HCF_EXT_NIC_ACCESS | HCF_EXT_MB | HCF_EXT_INT_TICK | \
2293 HCF_EXT_IFB_STRCT | HCF_EXT_DESC_STRCT | HCF_EXT_TX_CONT )
2294 err: invalid value for HCF_EXT;
2295 #endif // HCF_EXT
2297 #if HCF_INT_ON != 0 && HCF_INT_ON != 1
2298 err: invalid value for HCF_INT_ON;
2299 #endif // HCF_INT_ON
2301 #if (HCF_IO) & ~( HCF_IO_MEM | HCF_IO_32BITS )
2302 err: invalid value for HCF_IO;
2303 #endif // HCF_IO
2305 #if HCF_LEGACY != 0 && HCF_LEGACY != 1
2306 err: invalid value for HCF_LEGACY;
2307 #endif // HCF_LEGACY
2309 #if HCF_MAX_LTV < 16 || HCF_MAX_LTV > 2304
2310 err: invalid value for HCF_MAX_LTV;
2311 #endif // HCF_MAX_LTV
2313 #if HCF_PROT_TIME != 0 && ( HCF_PROT_TIME < 19 || 256 < HCF_PROT_TIME )
2314 err: below minimum .08 second required by Hermes or possibly above hcf_32 capacity;
2315 #endif // HCF_PROT_TIME
2317 #if (HCF_SLEEP) & ~( HCF_CDS | HCF_DDS )
2318 err: invalid value for HCF_SLEEP;
2319 #endif // HCF_SLEEP
2321 #if (HCF_SLEEP) && ! (HCF_INT_ON)
2322 err: these macros are not used consistently;
2323 #endif // HCF_SLEEP / HCF_INT_ON
2325 #if (HCF_SLEEP) && ! ( (HCF_EXT) & HCF_EXT_INT_TICK )
2326 //;? err: these macros are not used consistently;
2327 #endif // HCF_SLEEP / HCF_EXT_INT_TICK
2329 #if (HCF_TALLIES) & ~( HCF_TALLIES_HCF | HCF_TALLIES_NIC | HCF_TALLIES_RESET ) || \
2330 (HCF_TALLIES) == HCF_TALLIES_RESET
2331 err: invalid value for HCF_TALLIES;
2332 #endif // HCF_TALLIES
2334 #if (HCF_TYPE) & ~(HCF_TYPE_WPA | HCF_TYPE_USB | HCF_TYPE_PRELOADED | HCF_TYPE_HII5 | HCF_TYPE_WARP | \
2335 HCF_TYPE_CCX /* | HCF_TYPE_TX_DELAY */ )
2336 err: invalid value for HCF_TYPE;
2337 #endif //HCF_TYPE
2339 #if (HCF_TYPE) & HCF_TYPE_WARP && (HCF_TYPE) & HCF_TYPE_WPA
2340 err: at most 1 of these macros should be defined;
2341 #endif //HCF_TYPE_WARP / HCF_TYPE_WPA
2343 #endif //HCFCFG_H