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
26 * Compiler specific macros
30 * By copying HCFCFG.TPL to HCFCFG.H and -if needed- modifying the #defines the WCI functionality can be
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 **************************************************************************************************************
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
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.
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
104 *************************************************************************************************************/
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 \
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 \
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
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
311 #define HCF_EXT (HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS )
313 #define HCF_EXT ( HCF_EXT_TX_CONT | HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS )
315 #define HCF_DLV 1 //H-I legacy, superfluous for H-II
318 #define HCF_IO HCF_IO_MEM
319 #define HCF_DMA 0 // To enable DMA
323 #define HCF_SLEEP HCF_CDS
324 #endif // _VARIANT == 7
326 #if _VARIANT == 5 || _VARIANT == 6
329 #define HCF_SLEEP HCF_CDS
332 #endif // _VARIANT == 6
334 #define HCF_IO HCF_IO_32BITS
335 #define HCF_DMA 1 // To enable DMA
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
345 #endif // _VARIANT == 4 || _VARIANT == 6
348 //#if !defined WVLAN_46
350 #if _VARIANT == 4 || _VARIANT == 6
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
358 #if !defined WVLAN_46
363 // ASSERT already used by WinCE...
366 #define ASSERT(x) ASSERTDEBUGMSG((x), (TEXT("SIMULATE ASSERT:")))
372 #define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_31
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
381 #define MSF_COMPONENT_ID COMP_ID_WIN_CE
384 #define MSF_COMPONENT_VAR _VARIANT
386 #define T1__HCF_TYPE (HCF_TYPE_NONE)
388 #define T2__HCF_TYPE (T1__HCF_TYPE)
391 #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5 | HCF_TYPE_WARP )
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
401 #define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
403 #define T4__HCF_TYPE (T3__HCF_TYPE)
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
410 #define T5__HCF_TYPE (T4__HCF_TYPE)
412 #define T5__HCF_TYPE (T4__HCF_TYPE | HCF_TYPE_WPA)
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)
424 #if !defined SOFTRONICS_CODE && !defined _APIDLL && !defined _WIN32_WCE
426 #endif // SOFTRONICS_CODE / _APIDLL / _WIN32_WCE
427 #if defined _WIN32_WCE
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
)
441 NdisRawReadPortUchar(port
, &value
);
445 __inline ULONG
NDIS_IN_LONG( ULONG port
)
448 NdisRawReadPortUlong(port
, &value
);
451 __inline USHORT
NDIS_IN_WORD( ULONG port
)
454 NdisRawReadPortUshort(port
, &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
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
);
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)
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__))))
535 #define ZONE_FUNCTION 1
540 #define ZONE_ASSERT 1
544 #define ZONE_PORTIO 1
545 #define ZONE_LOGTOFILE 1
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 *****************************************/
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
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
605 /************************************** INPUT / OUTPUT **********************************************/
610 #pragma intrinsic( _inp, _inpw, _outp, _outpw )
613 #define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
614 #define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
616 #define IN_PORT_STRING_8_16( port, addr, n) while (n--) \
617 { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_8 FAR*)addr)+=2; }
618 #define OUT_PORT_STRING_8_16( port, addr, n) while (n--) \
619 { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; ((hcf_8 FAR*)addr)+=2; }
620 #define IN_PORT_STRING_32( port, addr, n) { int n2 = 2*n; IN_PORT_STRING_8_16(port, addr, n2) }
621 #define OUT_PORT_STRING_32( port, addr, n) { int n2 = 2*n; OUT_PORT_STRING_8_16(port, addr, n2) }
624 #endif // WVLAN_42 / WVLAN_43
628 /************************************************************************************************/
629 /**************************** D O S H - I / II L O A D E R **********************************/
630 /************************************************************************************************/
632 #if defined H0_LDR || defined H1_LDR || defined H2_LDR || defined H5_LDR
634 #if defined H0_LDR //implies H-I
635 #define HCF_DLV 0 //H-I legacy, meaningless under H-II
636 #define HCF_DLNV 1 //H-I legacy, meaningless under H-II
639 #if defined H1_LDR //implies H-I
640 #define HCF_DLV 1 //H-I legacy, meaningless under H-II
641 #define HCF_DLNV 0 //H-I legacy, meaningless under H-II
642 #endif // H1_LDR / H2_LDR
644 //#if defined H2_LDR : not needed, H-II defaults are O.K for H2_LDR
647 #define HCF_TYPE (HCF_TYPE_HII5 | HCF_TYPE_WARP )
648 //;? why does only this subset of the H_LDRs need HCF_TYPE to be defined here
651 #define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN //support dynamic linking of msf_assert routine
654 #define HCF_TALLIES 0
656 #define MSF_COMPONENT_ID COMP_ID_ODI_16 //;?By lack of any better
657 #define MSF_COMPONENT_VAR 1
658 #define MSF_COMPONENT_MAJOR_VER 0
659 #define MSF_COMPONENT_MINOR_VER 0
664 #pragma intrinsic( _inp, _inpw, _outp, _outpw )
668 #endif // H0_LDR / H1_LDR / H2_LDR
672 /************************************************************************************************/
673 /**************************** H C F D E M O P R O G R A M ***********************************/
674 /************************************************************************************************/
678 #define HCF_DLV 1 //;?should become the default !defaults to 1 anyway for H-II
679 //#define HCF_DLNV 0 //defaults to 0 anyway for H-II
681 #define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN //support dynamic linking of msf_assert routine
685 #define HCF_TALLIES ( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
687 //#define MSF_COMPONENT_ID NO configuration management
692 #pragma intrinsic( _inp, _inpw, _outp, _outpw )
700 /************************************************************************************************/
701 /*********************************** M A C O S **********************************************/
702 /************************************************************************************************/
708 #define MSF_COMPONENT_ID COMP_ID_MAC_OS
709 #define MSF_COMPONENT_VAR VARIANT
710 #define MSF_COMPONENT_MAJOR_VER VERSION_MAJOR
711 #define MSF_COMPONENT_MINOR_VER VERSION_MINOR
715 #define HCF_BIG_ENDIAN 1 // selects Big Endian (a.k.a. Motorola), most significant byte first
718 #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
723 #endif // __cplusplus
724 extern volatile unsigned char *MacIOaddr
;
725 extern hcf_16
IN_PORT_WORD(hcf_16 port
);
726 extern void OUT_PORT_WORD(hcf_16 port
, hcf_16 value
);
727 extern void IN_PORT_STRING_16(hcf_16 port
, void *addr
, hcf_16 len
);
728 extern void OUT_PORT_STRING_16(hcf_16 port
, void *addr
, hcf_16 len
);
730 #define SwapBytes(t) (((t) >> 8) + (((t) & 0xff) << 8))
734 #endif // __cplusplus
740 /************************************************************************************************/
741 /****************************************** L I N U X *****************************************/
742 /************************************************************************************************/
746 //#include <linux/module.h>
747 #include <wl_version.h>
749 /* The following macro ensures that no symbols are exported, minimizing the chance of a symbol
750 collision in the kernel */
751 //EXPORT_NO_SYMBOLS; //;?this place seems not appropriately to me
753 //#define HCF_SLEEP (HCF_CDS | HCF_DDS )
754 #define HCF_SLEEP (HCF_CDS)
756 //#define HCF_TYPE (HCF_TYPE_HII5|HCF_TYPE_STA|HCF_TYPE_AP)
759 #define HCF_TYPE ( HCF_TYPE_WARP | HCF_TYPE_HII5 )
761 #define HCF_TYPE HCF_TYPE_HII5
764 #define HCF_TYPE HCF_TYPE_NONE
771 /* We now need a switch to include support for the Mailbox and other necessary extensions */
772 #define HCF_EXT ( HCF_EXT_MB | HCF_EXT_INFO_LOG | HCF_EXT_INT_TICK )//get deepsleep exercise going
774 /* ;? The Linux MSF still uses these definitions; define it here until it's removed */
776 #define HCF_TYPE_HII 0x0004
780 #define HCF_TYPE_AP 0x0010
784 #define HCF_TYPE_STA 0x0020
785 #endif // HCF_TYPE_STA
787 /* Guarantees word alignment */
790 /* Endian macros CNV_INT_TO_LITTLE() and CNV_LITTLE_TO_INT() were renamed to
791 CNV_SHORT_TO_LITTLE() and CNV_LITTLE_TO_SHORT() */
792 #ifndef CNV_INT_TO_LITTLE
793 #define CNV_INT_TO_LITTLE CNV_SHORT_TO_LITTLE
796 #ifndef CNV_LITTLE_TO_INT
797 #define CNV_LITTLE_TO_INT CNV_LITTLE_TO_SHORT
800 #define HCF_ERR_BUSY 0x06
802 /* UIL defines were removed from the HCF */
803 #define UIL_SUCCESS HCF_SUCCESS
804 #define UIL_ERR_TIME_OUT HCF_ERR_TIME_OUT
805 #define UIL_ERR_NO_NIC HCF_ERR_NO_NIC
806 #define UIL_ERR_LEN HCF_ERR_LEN
807 #define UIL_ERR_MIN HCF_ERR_MAX /*end of HCF errors which are passed through to UIL
808 *** ** *** ****** ***** *** ****** ******* ** *** */
809 #define UIL_ERR_IN_USE 0x44
810 #define UIL_ERR_WRONG_IFB 0x46
811 #define UIL_ERR_MAX 0x7F /*upper boundary of UIL errors without HCF-pendant
812 ***** ******** ** *** ****** ******* *** ******* */
813 #define UIL_ERR_BUSY HCF_ERR_BUSY
814 #define UIL_ERR_DIAG_1 HCF_ERR_DIAG_1
815 #define UIL_FAILURE 0xFF /* 20010705 nv this relick should be eridicated */
816 #define UIL_ERR_PIF_CONFLICT 0x40 //obsolete
817 #define UIL_ERR_INCOMP_DRV 0x41 //obsolete
818 #define UIL_ERR_DOS_CALL 0x43 //obsolete
819 #define UIL_ERR_NO_DRV 0x42 //obsolete
820 #define UIL_ERR_NSTL 0x45 //obsolete
826 /* Overrule standard WaveLAN Packet Size when in DMA mode */
828 #define HCF_MAX_PACKET_SIZE 2304
830 #define HCF_MAX_PACKET_SIZE 1514
833 /* The following sets the component ID, as well as the versioning. See also wl_version.h */
834 #define MSF_COMPONENT_ID COMP_ID_LINUX
836 #define MSF_COMPONENT_VAR DRV_VARIANT
837 #define MSF_COMPONENT_MAJOR_VER DRV_MAJOR_VERSION
838 #define MSF_COMPONENT_MINOR_VER DRV_MINOR_VERSION
840 /* Define the following to turn on assertions in the HCF */
841 //#define HCF_ASSERT 0x8000
842 #define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN // statically binding of msf_assert routine
844 #ifdef USE_BIG_ENDIAN
845 #define HCF_BIG_ENDIAN 1
847 #define HCF_BIG_ENDIAN 0
848 #endif /* USE_BIG_ENDIAN */
850 /* Define the following if your system uses memory-mapped IO */
853 /* The following defines the standard macros required by the HCF to move data to/from the card */
854 #define IN_PORT_BYTE(port) ((hcf_8)inb( (hcf_io)(port) ))
855 #define IN_PORT_WORD(port) ((hcf_16)inw( (hcf_io)(port) ))
856 #define OUT_PORT_BYTE(port, value) (outb( (hcf_8) (value), (hcf_io)(port) ))
857 #define OUT_PORT_WORD(port, value) (outw((hcf_16) (value), (hcf_io)(port) ))
859 #define IN_PORT_STRING_16(port, dst, n) insw((hcf_io)(port), dst, n)
860 #define OUT_PORT_STRING_16(port, src, n) outsw((hcf_io)(port), src, n)
861 //#define IN_PORT_STRINGL(port, dst, n) insl((port), (dst), (n))
862 //#define OUT_PORT_STRINGL(port, src, n) outsl((port), (src), (n))
863 #define IN_PORT_STRING_32(port, dst, n) insl((port), (dst), (n))
864 #define OUT_PORT_STRING_32(port, src, n) outsl((port), (src), (n))
865 #define IN_PORT_HCF32(port) inl( (hcf_io)(port) )
866 #define OUT_PORT_HCF32(port, value) outl((hcf_32)(value), (hcf_io)(port) )
868 #define IN_PORT_DWORD(port) IN_PORT_HCF32(port)
869 #define OUT_PORT_DWORD(port, value) OUT_PORT_HCF32(port, value)
871 #define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len)
872 #define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len)
875 #ifndef OUTPUTDEBUGMSG
876 #define OUTPUTDEBUGMSG(dprintf_exp)
880 #ifndef ASSERTDEBUGMSG
881 #define ASSERTDEBUGMSG(cond, dprintf_exp)
884 #ifndef CFG_SCAN_CHANNELS_2GHZ
885 #define CFG_SCAN_CHANNELS_2GHZ 0xFCC2
886 #endif /* CFG_SCAN_CHANNELS_2GHZ */
888 #define HCF_MAX_MSG 1600 //get going ;?
893 /************************************************************************************************/
894 /********************************************* Q N X ******************************************/
895 /************************************************************************************************/
897 #if defined __QNX__ || defined WVLAN_50
899 #define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ...
900 #define MSF_COMPONENT_VAR 0 //...compatibilty check to function
901 #define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more
902 #define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do
906 #define IN_PORT_WORD(port) ((hcf_16)inpw( (hcf_io)(port) ))
907 #define OUT_PORT_WORD(port, value) (outpw( (hcf_io)(port), (hcf_16) (value) ))
909 #define IN_PORT_STRING_16( port, addr, n) \
910 while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
911 #define OUT_PORT_STRING_16( port, addr, n) \
912 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; }
915 #endif // QNX / WVLAN_50
919 /************************************************************************************************/
920 /********************************************* B E O S ****************************************/
921 /************************************************************************************************/
925 #define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ...
926 #define MSF_COMPONENT_VAR 0 //...compatibilty check to function
927 #define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more
928 #define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do
930 #include <drivers/Drivers.h>
931 #include <drivers/KernelExport.h>
933 uint8
read_io_8 (int);
934 void write_io_8 (int, uint8
);
935 uint16
read_io_16 (int);
936 void write_io_16 (int, uint16
);
938 #define IN_PORT_WORD(port) ((hcf_16)read_io_16( (hcf_io)(port) ))
939 #define OUT_PORT_WORD(port, value) (write_io_16( (hcf_io)(port), (hcf_16) (value) ))
941 #define IN_PORT_STRING_16( port, addr, n) \
942 while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
943 #define OUT_PORT_STRING_16( port, addr, n) \
944 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; }
950 /************************************************************************************************/
951 /******************************** U S B D O N G L E *****************************************/
952 /************************************************************************************************/
957 #define MSF_COMPONENT_MAJOR_VER 0
958 #define MSF_COMPONENT_MINOR_VER 1
960 #define IN_PORT_WORD(port) (Hermes_IO_Read( (hcf_8)(port)))
961 #define OUT_PORT_WORD(port, value) (Hermes_IO_Write( (hcf_8)port, /*(hcf_16)*/(value) ) )
962 /* !!!! NOTE USB supports only 16-bits I/O and no 8-bits I/O
963 * as a consequence the IN_/OUT_PORT_STRING_16 macros use hcf_16* rather than hcf_8 pointers
964 * to get more optimal code
965 * therefore the pointers are incremented by 1 (which means two "bytes") rather than by 2
967 //#define IN_PORT_STRING_16( port, addr, n) while ( n-- ) { *((hcf_16*)addr)++ = IN_PORT_WORD( port ); }
968 //#define OUT_PORT_STRING_16( port, addr, n) while ( n-- ) { OUT_PORT_WORD( port, *((hcf_16*)addr)++ ); }
969 #define IN_PORT_STRING_16( port, dst, n) while ( n-- ) { *dst++ = IN_PORT_WORD( port ); }
970 #define OUT_PORT_STRING_16( port, src, n) while ( n-- ) { OUT_PORT_WORD( port, *src++ ); }
972 //#define HCF_TYPE ( HCF_TYPE_AP | HCF_TYPE_WPA )
973 #define HCF_TYPE HCF_TYPE_WPA
978 /************************************************************************************************/
979 /****************************************** FreeBSD *******************************************/
980 /************************************************************************************************/
982 #if defined __FREE_BSD__
984 #define MSF_COMPONENT_ID COMP_ID_FreeBSD
985 #define MSF_COMPONENT_VAR 1
986 #define MSF_COMPONENT_MAJOR_VER 1
987 #define MSF_COMPONENT_MINOR_VER 0
989 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
991 #include <machine/cpufunc.h>
993 #define IN_PORT_WORD(port) ((hcf_16)inw( (hcf_io)(port) ))
994 #define OUT_PORT_WORD(port, value) (outw((hcf_io)(port), (hcf_16)(value)))
997 #define IN_PORT_STRING_16( port, addr, n) \
998 while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
999 #define OUT_PORT_STRING_16( port, addr, n) \
1000 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; }
1002 #endif // __FREE_BSD__
1006 /************************************************************************************************/
1007 /********************************* W A V E P O I N T ******************************************/
1008 /************************************************************************************************/
1010 #if defined WVLAN_81 /* BORLANDC */
1012 #define EXTERN_C extern // needed because DHF uses this instead of 'extern'
1014 #define MSF_COMPONENT_ID COMP_ID_AP1
1015 #define MSF_COMPONENT_VAR 1
1016 #define MSF_COMPONENT_MAJOR_VER 4
1017 #define MSF_COMPONENT_MINOR_VER 0
1019 #define HCF_PROT_TIME 49 //49*10240 microseconds H/W failure protection timer
1021 //#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox /* debug build only */
1024 #define FAR far // segmented 16 bits mode
1027 #define IN_PORT_WORD(port) (inport( (hcf_io)(port) ))
1028 #define OUT_PORT_WORD(port, value) (outport( (hcf_io)(port), value ))
1030 #define IN_PORT_STRING_16(port, addr, len) \
1031 asm { push di; push es; mov cx,len; les di,addr; mov dx,port; rep insw; pop es; pop di }
1033 #define OUT_PORT_STRING_16(port, addr, len) \
1034 asm { push si; push ds; mov cx,len; lds si,addr; mov dx,port; rep outsw; pop ds; pop si }
1039 /************************************************************************************************/
1040 /******************************** W A V E L A U N C H *****************************************/
1041 /************************************************************************************************/
1043 #if defined WVLAUNCH
1045 #include "DriverX.h"
1046 extern HWDEVICE
* g_pDevice
;
1048 //#define MSF_COMPONENT_ID 0 //;? to get around browser problem
1050 #define IN_PORT_WORD(port) HwInpw( g_pDevice, port )
1051 #define OUT_PORT_WORD(port, value) HwOutpw( g_pDevice, port, value )
1054 // C implementation which let the processor handle the word-at-byte-boundary problem
1056 #define IN_PORT_STRING_16( port, addr, n) \
1057 while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; }
1058 #define OUT_PORT_STRING_16( port, addr, n) \
1059 while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; }
1065 /************************************************************************************************/
1066 /************************************* W C I T S T *********************************************/
1067 /************************************************************************************************/
1070 #define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ...
1071 #define MSF_COMPONENT_VAR 0 //...compatibilty check to function
1072 #define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more
1073 #define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do
1075 //#define HCF_ENCAP HCF_ENC_NONE //to get going
1076 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1077 #define HCF_TYPE (HCF_TYPE_WPA | HCF_TYPE_PRELOADED) // Hermes-I for HCF6, II for HCF7
1079 //#define LLB //!!!!MIC Debug Only
1080 #if defined LLB && !((HCF_TYPE) & HCF_TYPE_WPA)
1081 err
: no LLB unless SSN
;
1082 #endif // LLB / HCF_TYPE_WPA
1083 //#define HCF_ALIGN 2
1084 #define HCF_DLV 1 //just to change memory layout ????;?
1085 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1087 #define HCF_ASSERT HCF_ASSERT_SW_SUP // logging via Hermes support registerr
1088 //#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
1090 #if defined __GNUC__
1092 //#include "unistd.h" //ioperm libc5
1093 #include "sys/io.h" //ioperm glibc
1094 #define extern //see IO Port Programming mini-HOWTO
1095 //#include "asm/io.h" //
1096 #define IN_PORT_WORD(port) inw( (hcf_io)(port) )
1097 #define IN_PORT_DWORD(port) inl( (hcf_io)(port) )
1098 #define OUT_PORT_WORD(port, value) outw( (hcf_io)(port), (hcf_16)(value) )
1099 #define OUT_PORT_DWORD(port, value) outl( (hcf_io)(port), (hcf_16)(value) )
1101 #pragma warning ( disable: 4001 )
1102 #define FAR __far // segmented 16 bits mode
1107 #pragma intrinsic( _inp, _inpw, _outp, _outpw )
1111 extern FILE* utm_logfile
;
1112 hcf_16
ipw( hcf_16 port
);
1113 hcf_8
ipb( hcf_16 port
);
1114 void opw( hcf_16 port
, hcf_16 value
);
1115 void opb( hcf_16 port
, hcf_8 value
);
1117 #define IN_PORT_WORD(port) ipw( (hcf_io)(port) )
1118 #define OUT_PORT_WORD(port, value) opw( (hcf_io)(port), (hcf_16)(value) )
1120 #define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))
1121 #define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))
1124 #define IN_PORT_STRING_16( port, addr, len) __asm \
1136 #define OUT_PORT_STRING_16( port, addr, len) __asm \
1150 #if ! defined IN_PORT_STRING_16
1151 #define IN_PORT_STRING_16( port, addr, n) while (n--) \
1152 { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_16 FAR*)addr)++; }
1153 #define OUT_PORT_STRING_16( port, addr, n) while (n--) \
1154 { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ); ((hcf_16 FAR*)addr)++; }
1155 #endif // IN_PORT_STRING_16
1160 /************************************************************************************************/
1161 /******************************* Motorola Power PC 800 family *********************************/
1162 /************************************************************************************************/
1163 /* known users: LH@I
1166 #if defined I_MPC8XX
1168 #define MSF_COMPONENT_VAR 0
1169 #define MSF_COMPONENT_ID 0
1170 #define MSF_COMPONENT_MAJOR_VER 1
1171 #define MSF_COMPONENT_MINOR_VER 0
1173 #define HCF_HSI_VAR 1
1175 #define HCF_BIG_ENDIAN 1
1176 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1178 #include "o_portbl.h"
1179 #include "ipcmcia.h"
1180 typedef o_uint8_t hcf_8
;
1181 typedef o_uint16_t hcf_16
;
1182 typedef o_uint32_t hcf_32
;
1184 /***************************************************************************/
1189 asm hcf_16
IN_PORT_WORD(int port
)
1200 asm void OUT_PORT_WORD(int port
, hcf_16 value
)
1203 sthbrx value
,r0
,port
1208 /***************************************************************************/
1210 #define IN_PORT_STRING_16(port, addr, len) \
1212 unsigned l = (len); \
1213 hcf_16 *d = (volatile hcf_16 *)(addr); \
1216 *d++ = *(volatile hcf_16 *)(port); \
1221 #define OUT_PORT_STRING_16(port, addr, len) \
1223 unsigned l = (len); \
1224 hcf_16 *s = (volatile hcf_16 *)(addr); \
1227 *(volatile hcf_16 *)(port) = *s++; \
1236 /************************************************************************************************/
1237 /********************************** Diab or High C 29K **************************************/
1238 /************************************************************************************************/
1239 /* known users: GK@C
1244 #define MSF_COMPONENT_VAR 0
1245 #define MSF_COMPONENT_ID COMP_ID_AP1
1246 #define MSF_COMPONENT_MAJOR_VER 1
1247 #define MSF_COMPONENT_MINOR_VER 0
1249 #define HCF_BIG_ENDIAN 1
1250 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1252 #define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/
1260 #define EIEIO() __asm__(" eieio")
1265 static hcf_16
IN_PORT_WORD(int port
) {
1266 hcf_16 value
= *(volatile hcf_16
*)(port
); EIEIO();
1267 value
= SwapBytes(value
);
1271 #define OUT_PORT_WORD(port, value) \
1272 { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); }
1274 #define IN_PORT_WORD(port) (*(volatile hcf_16 *)(port))
1275 #define OUT_PORT_WORD(port, value) (*(volatile hcf_16 *)(port) = (value))
1278 /***************************************************************************/
1280 #define IN_PORT_STRING_16( port, addr, len) { \
1281 unsigned l = (len); \
1282 hcf_16 t, *d = (volatile hcf_16 *)(addr); \
1284 t = IN_PORT_WORD(port); \
1285 *d++ = SwapBytes(t); \
1289 #define OUT_PORT_STRING_16( port, addr, len) { \
1290 unsigned l = (len); \
1291 hcf_16 t, *s = (volatile hcf_16 *)(addr); \
1294 OUT_PORT_WORD(port, SwapBytes(t)); \
1299 #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
1300 #undef MSF_COMPONENT_ID
1307 /************************************************************************************************/
1308 /***************************************** MPC860 **********************************************/
1309 /************************************************************************************************/
1316 #define MSF_COMPONENT_VAR 0
1317 #define MSF_COMPONENT_ID 0
1318 #define MSF_COMPONENT_MAJOR_VER 1
1319 #define MSF_COMPONENT_MINOR_VER 0
1321 #define HCF_BIG_ENDIAN 1
1322 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1324 #define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/
1331 #define EIEIO() __asm__(" eieio")
1336 static hcf_16
IN_PORT_WORD(int port
) {
1337 hcf_16 value
= *(volatile hcf_16
*)(port
); EIEIO();
1338 value
= SwapBytes(value
);
1341 /* the following serves to avoid the compiler warnings that
1342 * IN_PORT_WORD() is not used in some files */
1347 #define OUT_PORT_WORD(port, value) \
1348 { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); }
1350 /***************************************************************************/
1352 #define IN_PORT_STRING_16( port, addr, len) { \
1353 unsigned l = (len); \
1355 volatile hcf_16 *d = (volatile hcf_16 *)(addr); \
1357 t = IN_PORT_WORD(port); \
1358 *d++ = SwapBytes(t); \
1362 #define OUT_PORT_STRING_16( port, addr, len) { \
1363 unsigned l = (len); \
1365 volatile hcf_16 *s = (volatile hcf_16 *)(addr); \
1368 OUT_PORT_WORD(port, SwapBytes(t)); \
1373 #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
1374 #undef MSF_COMPONENT_ID
1382 /************************************************************************************************/
1383 /**************************** Microtec Research 80X86 Compiler *********************************/
1384 /************************************************************************************************/
1389 /************************************************************************************************/
1390 /****************************** W A V E L A N E C ********************************************/
1391 /************************************************************************************************/
1397 #define MSF_COMPONENT_ID COMP_ID_EC
1399 #include <version.h>
1401 #define MSF_COMPONENT_VAR 1
1402 #define MSF_COMPONENT_MAJOR_VER MAJOR_VERSION
1403 #define MSF_COMPONENT_MINOR_VER MINOR_VERSION
1405 #define HCF_BIG_ENDIAN 1
1406 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1408 #define SwapBytes(t) /*lint -e572*/(((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/
1410 #define PCMCIA_ADDRESS 0xc80000UL
1412 #define IN_PORT_2BYTES(port) (*(hcf_16 *)(port))
1413 static hcf_16 swap_var
;
1414 #define IN_PORT_WORD(port) \
1415 (((swap_var = IN_PORT_2BYTES(port)) >> 8) + (((swap_var) & 0xff) << 8))
1416 #define OUT_PORT_2BYTES(port, value) (*(hcf_16 *)(port) = (hcf_16)(value))
1417 #define OUT_PORT_WORD(port, value) OUT_PORT_2BYTES(port, SwapBytes(value))
1420 #define IN_PORT_STRING_16(port, addr, len) \
1421 while ((len)--) {*(hcf_16 *)(addr) = IN_PORT_2BYTES(port); ((cast)addr) += 2; }
1422 #define OUT_PORT_STRING_16(port, addr, len) \
1423 while ((len)--) {OUT_PORT_2BYTES((port), *(hcf_16 *)(addr)) ; ((cast)addr) += 2; }
1426 #endif /* mc68302 */
1430 /************************************************************************************************/
1431 /********************************* NGAP ***************************************/
1432 /************************************************************************************************/
1434 #if defined __VX_WORKS__ /* VxWorks */
1436 #if defined WLC_STATION
1437 //#undef HCF_TYPE /* Hermes-I Station F/W without SSN support */
1438 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
1440 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
1441 #endif // WLC_STATION
1443 #define HCF_YIELD (taskDelay(0) == 0)
1445 #define MSF_COMPONENT_VAR 1
1446 #define MSF_COMPONENT_MAJOR_VER 1
1447 #define MSF_COMPONENT_MINOR_VER 0
1449 // #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox
1451 #if defined PC486BSP
1453 #define IN_PORT_WORD(port) (sysInWord ((hcf_io)(port)))
1454 #define OUT_PORT_WORD(port, value) (sysOutWord ((hcf_io)(port), (hcf_16) (value)))
1455 #define IN_PORT_STRING_16(port, addr, n) (sysInWordString ((hcf_io)(port), addr, n))
1456 #define OUT_PORT_STRING_16(port, addr, n) (sysOutWordString ((hcf_io)(port), addr, n))
1458 #elif defined AS2000BSP
1460 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1462 /* Define PCI stuff here. */
1463 unsigned short sysRead16( unsigned short *port
);
1464 void sysWrite16( unsigned short *port
, unsigned short value
);
1466 #define PCI_IN_BYTE( port ) \
1467 *(unsigned char *)( port )
1469 #define PCI_IN_WORD( port ) \
1470 sysRead16( (unsigned short *)( port ) )
1472 #define PCI_OUT_BYTE( port, value ) \
1473 *(unsigned char *)( port ) = (unsigned char)( value )
1475 #define PCI_OUT_WORD( port, value ) \
1476 sysWrite16( (unsigned short *)( port ), (unsigned short)( value ) )
1478 #define IN_PORT_WORD( port ) \
1481 #define OUT_PORT_WORD( port, value ) \
1482 PCI_OUT_WORD( port, value )
1484 #define IN_PORT_STRING_16( port, buf, len ) \
1488 for ( p = (hcf_16 *)(buf); p < &( (hcf_16 *)(buf) )[ (int)len ]; p++ ) { \
1489 *p = PCI_IN_WORD( port ); \
1493 #define OUT_PORT_STRING_16( port, buf, len ) \
1497 for ( p = (const hcf_16 *)( buf ); p < &( (const hcf_16 *)(buf) )[ (int)len ]; p++ ) { \
1498 PCI_OUT_WORD( port, *p ); \
1502 #elif defined FADS860BSP /* elif defined AS2000BSP */
1504 #define HCF_BIG_ENDIAN 1
1506 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1513 #define EIEIO() __asm__(" eieio")
1518 static hcf_16
IN_PORT_WORD(int port
) {
1519 hcf_16 value
= *(volatile hcf_16
*)(port
); EIEIO();
1520 value
= ((value
& 0xff00) >> 8) + ((value
& 0x00ff) << 8);
1521 /* value = CNV_LITTLE_TO_SHORT(value); */
1524 /* the following serves to avoid the compiler warnings that
1525 * IN_PORT_WORD() is not used in some files */
1530 #define OUT_PORT_WORD(port, value) \
1531 { *(volatile hcf_16 *)(port) = CNV_SHORT_TO_LITTLE(value); EIEIO(); }
1533 /***********************************************************************/
1535 #define IN_PORT_STRING_16( port, addr, len) { \
1536 unsigned l = (len); \
1537 volatile hcf_16 *d = (volatile hcf_16 *)(addr); \
1539 *d++ = *(volatile hcf_16 *)(port); \
1544 #define OUT_PORT_STRING_16( port, addr, len) { \
1545 unsigned l = (len); \
1546 volatile hcf_16 *s = (volatile hcf_16 *)(addr); \
1548 *(volatile hcf_16 *)(port) = *s++; \
1553 #elif defined DAYTONABSP
1555 #define HCF_BIG_ENDIAN 1
1557 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1563 #define IN_PORT_WORD(port) (sysOrinocoInWord((unsigned long)(port)))
1564 #define OUT_PORT_WORD(port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value)))
1566 #define IN_PORT_STRING_16(port,addr,len) (sysOrinocoInString((port), (addr), (len)))
1567 #define OUT_PORT_STRING_16(port,addr,len) (sysOrinocoOutString((port), (addr), (len)))
1569 extern unsigned char sysOrinocoInByte (unsigned long port
);
1570 extern unsigned short sysOrinocoInWord (unsigned long port
);
1571 extern void sysOrinocoInString (unsigned long port
, void *addr
, unsigned short len
);
1573 extern void sysOrinocoOutByte (unsigned long port
, unsigned char value
);
1574 extern void sysOrinocoOutWord (unsigned long port
, unsigned short value
);
1575 extern void sysOrinocoOutString (unsigned long port
, void *addr
, unsigned short len
);
1577 #elif defined ALPHA_BSP
1579 #define HCF_BIG_ENDIAN 1
1581 #define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O
1587 #define IN_PORT_WORD(port) (sysOrinocoInWord((unsigned long)(port)))
1588 #define OUT_PORT_WORD(port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value)))
1590 #define IN_PORT_STRING_16(port,addr,len) (sysOrinocoInString((port), (addr), (len)))
1591 #define OUT_PORT_STRING_16(port,addr,len) (sysOrinocoOutString((port), (addr), (len)))
1593 extern unsigned char sysOrinocoInByte (unsigned long port
);
1594 extern unsigned short sysOrinocoInWord (unsigned long port
);
1595 extern void sysOrinocoInString (unsigned long port
, void *addr
, unsigned short len
);
1597 extern void sysOrinocoOutByte (unsigned long port
, unsigned char value
);
1598 extern void sysOrinocoOutWord (unsigned long port
, unsigned short value
);
1599 extern void sysOrinocoOutString (unsigned long port
, void *addr
, unsigned short len
);
1603 err
: /* commented here */ /* "BSP is not defined..." */
1605 #endif /* else PC486BSP */
1607 #endif // __VX_WORKS__
1611 /************************************************************************************************/
1612 /****************************** VXWORKS. Motorola Sandpoint PowerPC 824X ***********************/
1613 /************************************************************************************************/
1614 #ifdef __VX_WORKS_SANDPOINT_824X__
1616 #include <vxWorks.h>
1618 #include <taskLib.h>
1621 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
1622 #endif /* WVLAN_53 */
1625 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
1626 #endif /* WVLAN_54 */
1629 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END
1630 #endif /* WVLAN_56 */
1632 #if !defined MSF_COMPONENT_ID
1633 #error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56"
1636 #define MSF_COMPONENT_VAR 1
1638 #define HCF_EXT HCF_EXT_INFO_LOG
1639 #define HCF_SLEEP ( HCF_CDS | HCF_DDS )
1640 //#define HCF_SLEEP ( HCF_DDS )
1642 #ifndef HCF_ACT_WAKEUP
1643 #define HCF_ACT_WAKEUP 0x1D
1644 #endif // HCF_ACT_WAKEUP
1646 #if defined FATNIC | defined BEAGLE_H253
1647 #define T1__HCF_TYPE HCF_TYPE_STA
1649 #define T1__HCF_TYPE HCF_TYPE_AP | HCF_TYPE_STA
1653 #define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB)
1655 #define T2__HCF_TYPE (T1__HCF_TYPE)
1656 #endif // HERMES_USB
1659 #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5)
1661 #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII)
1665 #define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
1667 #define T4__HCF_TYPE (T3__HCF_TYPE)
1670 #define T5__HCF_TYPE (T4__HCF_TYPE)
1672 // Default to TYPE_AP + SSN!
1673 #define HCF_TYPE (T5__HCF_TYPE )
1677 #define MSF_COMPONENT_MAJOR_VER 2
1678 #define MSF_COMPONENT_MINOR_VER 0
1680 #define HCF_IO HCF_IO_MEM
1682 #define HCF_MEM_IO 1
1683 #define HCF_BIG_ENDIAN 1
1685 //#define support_32bits 1
1687 #define IN_PORT_WORD(port) (sysInWord( (hcf_io)(port) ))
1688 #define OUT_PORT_WORD(port, value) (sysOutWord( (hcf_io)(port), (hcf_16)(value) ))
1689 #define IN_PORT_DWORD(port) (sysInLong( (hcf_io)(port) ))
1690 #define OUT_PORT_DWORD(port, value) (sysOutLong( (hcf_io)(port), (hcf_16)(value) ))
1691 #define IN_PORT_STRING_16(port, dst, n) (sysInWordString((hcf_io)(port), (hcf_16 *)dst, n))
1692 #define OUT_PORT_STRING_16(port, src, n) (sysOutWordString((hcf_io)(port), (hcf_16 *)src, n))
1699 /* we'll need to add these prints someday */
1700 #define OUTPUTDEBUGMSG(dprintf_exp)
1701 #define ASSERTDEBUGMSG(cond, dprintf_exp)
1703 #define HCF_INTERFACE_CONNECT(ifbp)
1704 #define HCF_INTERFACE_DISCONNECT(ifbp)
1705 #define HCF_ENTER_INTERFACE_FUNCT(ibfb)
1706 #define HCF_LEAVE_INTERFACE_FUNCT(ifbp)
1708 #define CNV_END_INT(w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 )
1709 #define CNV_LITTLE_TO_INT(w) CNV_END_INT(w)
1710 #define CNV_INT_TO_LITTLE(w) CNV_LITTLE_TO_INT(w)
1712 #endif /* __VX_WORKS_SANDPOINT_824X__ */
1714 /************************************************************************************************/
1715 /************************************* VXWORKS. ARM T8300 IPPhone *****************************/
1716 /************************************************************************************************/
1717 #if defined(IPT_T8300) || defined(IPT_T8307)
1719 #include <vxWorks.h>
1721 #include <taskLib.h>
1723 #define HCF_ALIGN 4 /* default to 4 byte alignment */
1725 #define BEAGLE_H253 /* Hermes 2.5.3 build, better to be in the project file */
1726 #define OOR_DDS /* Hermes 2.5.3 build, better to be in the project file */
1731 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA
1732 #endif /* WVLAN_53 */
1735 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP
1736 #endif /* WVLAN_54 */
1739 #define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END
1740 #endif /* WVLAN_56 */
1742 #if !defined MSF_COMPONENT_ID
1743 #error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56"
1746 #define MSF_COMPONENT_VAR 1
1748 #define HCF_EXT HCF_EXT_INFO_LOG
1749 //#define HCF_EXT HCF_EXT_INFO_LOG | HCF_EXT_MB
1750 #define HCF_SLEEP ( HCF_CDS | HCF_DDS )
1751 //#define HCF_SLEEP ( HCF_DDS )
1753 #ifndef HCF_ACT_WAKEUP
1754 #define HCF_ACT_WAKEUP 0x1D
1755 #endif // HCF_ACT_WAKEUP
1757 #if defined FATNIC || defined BEAGLE_H253
1758 #define T1__HCF_TYPE HCF_TYPE_STA
1760 //#define T1__HCF_TYPE HCF_TYPE_AP | HCF_TYPE_STA
1761 #define T1__HCF_TYPE HCF_TYPE_STA /* dz, Station code only */
1765 #define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB)
1767 #define T2__HCF_TYPE (T1__HCF_TYPE)
1768 #endif // HERMES_USB
1771 #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5)
1773 #define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII)
1774 //#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII) /* dz. no WPA support at this time, test code */
1778 #define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX)
1780 #define T4__HCF_TYPE (T3__HCF_TYPE)
1783 #define T5__HCF_TYPE (T4__HCF_TYPE)
1785 // Default to TYPE_AP + SSN!
1786 #define HCF_TYPE (T5__HCF_TYPE )
1789 #define MSF_COMPONENT_MAJOR_VER 2
1790 #define MSF_COMPONENT_MINOR_VER 0
1792 #define HCF_IO HCF_IO_MEM
1794 #define HCF_MEM_IO 1
1797 /* Endian is determined by vxWorks project compile option */
1798 #if (_BYTE_ORDER == _BIG_ENDIAN)
1799 #undef HCF_LITTLE_ENDIAN
1800 #define HCF_BIG_ENDIAN 1
1804 #define CNV_END(w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 )
1805 #if defined HCF_BIG_ENDIAN
1806 //******************************************** B I G E N D I A N *******************************************
1807 #define CNV_LITTLE_TO_INT(w) CNV_END(w) // endianess conversion needed
1808 #define CNV_BIG_TO_INT(w) (w) // no endianess conversion needed
1810 //****************************************** L I T T L E E N D I A N ****************************************
1811 #define CNV_LITTLE_TO_INT(w) (w) // no endianess conversion needed
1812 #define CNV_BIG_TO_INT(w) CNV_END(w) // endianess conversion needed
1813 #endif // HCF_BIG_ENDIAN
1815 // conversion macros which can be expressed in other macros
1816 #define CNV_INT_TO_LITTLE(w) CNV_LITTLE_TO_INT(w)
1817 #define CNV_INT_TO_BIG(w) CNV_BIG_TO_INT(w)
1821 #define IN_PORT_WORD( port ) *((volatile hcf_16 *)( port ))
1822 #define OUT_PORT_WORD( port, value ) *((volatile hcf_16 *)( port )) = ((hcf_16)( value ))
1823 //#define IN_PORT_BYTE( port ) *((volatile hcf_8 *)( port ))
1825 #define IN_PORT_STRING( port, addr, len) { \
1827 hcf_16 *d = (hcf_16 *)(addr); \
1830 t = IN_PORT_WORD(port); \
1831 *d++ = CNV_LITTLE_TO_INT(t); \
1835 #define OUT_PORT_STRING( port, addr, len) { \
1836 unsigned l = (len); \
1837 hcf_16 *s = (hcf_16 *)(addr); \
1841 t = CNV_LITTLE_TO_INT(t); \
1842 OUT_PORT_WORD(port, t); \
1844 } // OUT_PORT_STRING
1846 #define IN_PORT_STRING_16(port, dst, n) { \
1848 hcf_16 *d = (hcf_16 *)(dst); \
1850 *d++ = IN_PORT_WORD(port); \
1852 } // IN_PORT_STRING_16
1854 #define OUT_PORT_STRING_16(port, src, n) { \
1857 hcf_16 *s = (hcf_16 *)(src); \
1860 OUT_PORT_WORD(port, t); \
1862 } // OUT_PORT_STRING_16
1864 /* #define HCF_YIELD (taskDelay(0) == 0) */
1873 /* we'll need to add these prints someday */
1874 #define OUTPUTDEBUGMSG(dprintf_exp)
1875 #define ASSERTDEBUGMSG(cond, dprintf_exp)
1877 #define HCF_INTERFACE_CONNECT(ifbp)
1878 #define HCF_INTERFACE_DISCONNECT(ifbp)
1879 #define HCF_ENTER_INTERFACE_FUNCT(ibfb)
1880 #define HCF_LEAVE_INTERFACE_FUNCT(ifbp)
1882 #define sysInWord(offsetAddr) IN_PORT_WORD(offsetAddr)
1883 #define sysInByte(offsetAddr) IN_PORT_BYTE(offsetAddr)
1884 #define sysOutWord(addr, value) OUT_PORT_WORD(addr, value)
1886 #endif /*IPT_T8300 */
1888 /************************************************************************************************************/
1889 /*********************************** **************************************/
1890 /************************************************************************************************************/
1891 #if ! defined HCF_ALIGN
1892 #define HCF_ALIGN 1 //default to no alignment
1895 #if ! defined HCF_ASSERT
1896 #define HCF_ASSERT 0
1897 #endif // HCF_ASSERT
1899 #if ! defined HCF_BIG_ENDIAN
1900 #define HCF_BIG_ENDIAN 0
1901 #endif // HCF_BIG_ENDIAN
1903 #if ! defined HCF_DL_ONLY
1904 #define HCF_DL_ONLY 0
1905 #endif // HCF_DL_ONLY
1907 #if ! defined HCF_DMA
1911 #if ! defined HCF_ENCAP
1912 #define HCF_ENCAP HCF_ENC
1915 #if ! defined HCF_ENTRY
1916 #define HCF_ENTRY( ifbp )
1919 #if ! defined HCF_EXIT
1920 #define HCF_EXIT( ifbp )
1923 #if ! defined HCF_EXT
1927 #if ! defined HCF_INT_ON
1928 #define HCF_INT_ON 1
1929 #endif // HCF_INT_ON
1931 #if ! defined HCF_IO
1932 #define HCF_IO 0 //default 16 bits support only, port I/O
1935 #if ! defined HCF_LEGACY
1936 #define HCF_LEGACY 0
1937 #endif // HCF_LEGACY
1939 #if ! defined HCF_MAX_LTV
1940 #define HCF_MAX_LTV 1200 // sufficient for all known purposes
1941 #endif // HCF_MAX_LTV
1943 #if ! defined HCF_PROT_TIME
1944 #define HCF_PROT_TIME 100 // number of 10K microsec protection timer against H/W malfunction
1945 #endif // HCF_PROT_TIME
1947 #if ! defined HCF_SLEEP
1951 #if ! defined HCF_TALLIES
1952 #define HCF_TALLIES ( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
1953 #endif // HCF_TALLIES
1955 #if ! defined HCF_TYPE
1960 #undef HCF_BIG_ENDIAN
1961 #define HCF_BIG_ENDIAN 1 //just for convenience of generating cfg_hcf_opt
1962 #endif // HCF_BIG_ENDIAN
1966 #define HCF_DL_ONLY 1 //just for convenience of generating cfg_hcf_opt
1967 #endif // HCF_DL_ONLY
1971 #define HCF_DMA 1 //just for convenience of generating cfg_hcf_opt
1976 #define HCF_INT_ON 1 //just for convenience of generating cfg_hcf_opt
1977 #endif // HCF_INT_ON
1980 #if ! defined IN_PORT_STRING_8_16
1981 #define IN_PORT_STRING_8_16(port, addr, len) IN_PORT_STRING_16(port, addr, len)
1982 #define OUT_PORT_STRING_8_16(port, addr, len) OUT_PORT_STRING_16(port, addr, len)
1983 #endif // IN_PORT_STRING_8_16
1985 /************************************************************************************************/
1986 /********** *************/
1987 /************************************************************************************************/
1990 #define FAR // default to flat 32-bits code
1993 typedef hcf_8 FAR
*wci_bufp
; // segmented 16-bits or flat 32-bits pointer to 8 bits unit
1994 typedef hcf_16 FAR
*wci_recordp
; // segmented 16-bits or flat 32-bits pointer to 16 bits unit
1997 * Platforms which use port mapped I/O will (in general) have a 64k I/O space, conveniently expressed in a
1999 * Platforms which use memory mapped I/O will (in general) have an I/O space much larger than 64k, and need a
2000 * 32-bits quantity to express the I/O base
2003 #if HCF_IO & HCF_IO_MEM
2004 typedef hcf_32 hcf_io
;
2006 typedef hcf_16 hcf_io
;
2009 #if HCF_PROT_TIME > 128
2010 #define HCF_PROT_TIME_SHFT 3
2011 #define HCF_PROT_TIME_DIV 8
2012 #elif HCF_PROT_TIME > 64
2013 #define HCF_PROT_TIME_SHFT 2
2014 #define HCF_PROT_TIME_DIV 4
2015 #elif HCF_PROT_TIME > 32
2016 #define HCF_PROT_TIME_SHFT 1
2017 #define HCF_PROT_TIME_DIV 2
2018 #else //HCF_PROT_TIME >= 19
2019 #define HCF_PROT_TIME_SHFT 0
2020 #define HCF_PROT_TIME_DIV 1
2023 #define HCF_PROT_TIME_CNT (HCF_PROT_TIME / HCF_PROT_TIME_DIV)
2026 /************************************************************************************************************/
2027 /******************************************* . . . . . . . . . *********************************************/
2028 /************************************************************************************************************/
2030 /* MSF_COMPONENT_ID is used to define the CFG_IDENTITY_STRCT in HCF.C
2031 * CFG_IDENTITY_STRCT is defined in HCF.C purely based on convenience arguments.
2032 * The HCF can not have the knowledge to determine the ComponentId field of the Identity record (aka as
2033 * Version Record), therefore the MSF part of the Drivers must supply this value via the System Constant
2035 * There is a set of values predefined in MDD.H (format COMP_ID_.....)
2037 * Note that taking MSF_COMPONENT_ID as a default value for DUI_COMPAT_VAR is purely an implementation
2038 * convenience, the numerical values of these two quantities have none functional relationship whatsoever.
2041 #if defined MSF_COMPONENT_ID
2043 #if ! defined DUI_COMPAT_VAR
2044 #define DUI_COMPAT_VAR MSF_COMPONENT_ID
2045 #endif // DUI_COMPAT_VAR
2047 #if ! defined DUI_COMPAT_BOT //;?this way utilities can lower as well raise the bottom
2048 #define DUI_COMPAT_BOT 8
2049 #endif // DUI_COMPAT_BOT
2051 #if ! defined DUI_COMPAT_TOP //;?this way utilities can lower as well raise the top
2052 #define DUI_COMPAT_TOP 8
2053 #endif // DUI_COMPAT_TOP
2055 #endif // MSF_COMPONENT_ID
2057 #if (HCF_TYPE) & HCF_TYPE_HII5
2059 #if ! defined HCF_HSI_VAR_5
2060 #define HCF_HSI_VAR_5
2061 #endif // HCF_HSI_VAR_5
2063 #if ! defined HCF_APF_VAR_4
2064 #define HCF_APF_VAR_4
2065 #endif // HCF_APF_VAR_4
2067 #if (HCF_TYPE) & HCF_TYPE_WARP
2068 #if ! defined HCF_STA_VAR_4
2069 #define HCF_STA_VAR_4
2070 #endif // HCF_STA_VAR_4
2072 #if ! defined HCF_STA_VAR_2
2073 #define HCF_STA_VAR_2
2074 #endif // HCF_STA_VAR_2
2077 #if defined HCF_HSI_VAR_4
2078 err
: HSI variants
4 correspond with HII
;
2079 #endif // HCF_HSI_VAR_4
2083 #if ! defined HCF_HSI_VAR_4
2084 #define HCF_HSI_VAR_4 //Hermes-II all types (for the time being!)
2085 #endif // HCF_HSI_VAR_4
2087 #if ! defined HCF_APF_VAR_2
2088 #define HCF_APF_VAR_2
2089 #endif // HCF_APF_VAR_2
2091 #if ! defined HCF_STA_VAR_2
2092 #define HCF_STA_VAR_2
2093 #endif // HCF_STA_VAR_2
2095 #endif // HCF_TYPE_HII5
2097 #if ! defined HCF_PRI_VAR_3
2098 #define HCF_PRI_VAR_3
2099 #endif // HCF_PRI_VAR_3
2101 #if defined HCF_HSI_VAR_1 || defined HCF_HSI_VAR_2 || defined HCF_HSI_VAR_3
2102 err
: HSI variants
1, 2 and 3 correspond with H
-I only
;
2103 #endif // HCF_HSI_VAR_1, HCF_HSI_VAR_2, HCF_HSI_VAR_3
2105 #if defined HCF_PRI_VAR_1 || defined HCF_PRI_VAR_2
2106 err
: primary variants
1 and 2 correspond with H
-I only
;
2107 #endif // HCF_PRI_VAR_1 / HCF_PRI_VAR_2
2110 /************************************************************************************************************/
2111 /******************************************* . . . . . . . . . *********************************************/
2112 /************************************************************************************************************/
2120 #if ! defined EXTERN_C
2122 #define EXTERN_C extern "C"
2125 #endif // __cplusplus
2129 #define NULL ((void *) 0)
2136 #if !defined _TCHAR_DEFINED
2138 #endif // _TCHAR_DEFINED
2140 /************************************************************************************************************/
2141 /*********************** 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 ************************/
2142 /************************************************************************************************************/
2143 #if defined HCF_LITTLE_ENDIAN
2144 err
: HCF_LITTLE_ENDIAN is obsolete
;
2145 #endif // HCF_LITTLE_ENDIAN
2147 #if defined HCF_INT_OFF
2148 err
: HCF_INT_OFF is obsolete
;
2149 #endif //HCF_INT_OFF
2151 #if HCF_ALIGN != HCF_ALIGN != 2 && HCF_ALIGN != 4 && HCF_ALIGN != 8
2152 err
: invalid value
for HCF_ALIGN
;
2155 #if (HCF_ASSERT) & ~( HCF_ASSERT_PRINTF | HCF_ASSERT_SW_SUP | HCF_ASSERT_MB | \
2156 HCF_ASSERT_RT_MSF_RTN | HCF_ASSERT_LNK_MSF_RTN )
2157 err
: invalid value
for HCF_ASSERT
;
2158 #endif // HCF_ASSERT
2160 #if (HCF_ASSERT) & HCF_ASSERT_MB && ! ( (HCF_EXT) & HCF_EXT_MB ) //detect potential conflict
2161 err
: these macros are
not used consistently
;
2162 #endif // HCF_ASSERT_MB / HCF_EXT_MB
2164 #if HCF_BIG_ENDIAN != 1
2165 err
: invalid value
for HCF_BIG_ENDIAN
;
2166 #endif // HCF_BIG_ENDIAN
2168 #if HCF_DL_ONLY != 1
2169 err
: invalid value
for HCF_DL_ONLY
;
2170 #endif // HCF_DL_ONLY
2173 err
: invalid value
for HCF_DMA
;
2176 #if (HCF_ENCAP) & ~( HCF_ENC | HCF_ENC_SUP )
2177 err
: invalid value
for HCF_ENCAP
;
2180 #if (HCF_EXT) & ~( HCF_EXT_INFO_LOG | HCF_EXT_INT_TX_EX | HCF_EXT_TALLIES_FW | \
2181 HCF_EXT_TALLIES_HCF | HCF_EXT_NIC_ACCESS | HCF_EXT_MB | HCF_EXT_INT_TICK | \
2182 HCF_EXT_IFB_STRCT | HCF_EXT_DESC_STRCT | HCF_EXT_TX_CONT )
2183 err
: invalid value
for HCF_EXT
;
2187 err
: invalid value
for HCF_INT_ON
;
2188 #endif // HCF_INT_ON
2190 #if (HCF_IO) & ~( HCF_IO_MEM | HCF_IO_32BITS )
2191 err
: invalid value
for HCF_IO
;
2195 err
: invalid value
for HCF_LEGACY
;
2196 #endif // HCF_LEGACY
2198 #if HCF_MAX_LTV < 16 || HCF_MAX_LTV > 2304
2199 err
: invalid value
for HCF_MAX_LTV
;
2200 #endif // HCF_MAX_LTV
2202 #if HCF_PROT_TIME != 0 && ( HCF_PROT_TIME < 19 || 256 < HCF_PROT_TIME )
2203 err
: below minimum
.08 second required by Hermes
or possibly above hcf_32 capacity
;
2204 #endif // HCF_PROT_TIME
2206 #if (HCF_SLEEP) & ~( HCF_CDS | HCF_DDS )
2207 err
: invalid value
for HCF_SLEEP
;
2210 #if HCF_SLEEP && ! HCF_INT_ON
2211 err
: these macros are
not used consistently
;
2212 #endif // HCF_SLEEP / HCF_INT_ON
2214 #if (HCF_SLEEP) && ! ( (HCF_EXT) & HCF_EXT_INT_TICK )
2215 //;? err: these macros are not used consistently;
2216 #endif // HCF_SLEEP / HCF_EXT_INT_TICK
2218 #if (HCF_TALLIES) & ~( HCF_TALLIES_HCF | HCF_TALLIES_NIC | HCF_TALLIES_RESET ) || \
2219 (HCF_TALLIES) == HCF_TALLIES_RESET
2220 err
: invalid value
for HCF_TALLIES
;
2221 #endif // HCF_TALLIES
2223 #if (HCF_TYPE) & ~(HCF_TYPE_WPA | HCF_TYPE_USB | HCF_TYPE_PRELOADED | HCF_TYPE_HII5 | \
2224 HCF_TYPE_WARP | HCF_TYPE_CCX /* | HCF_TYPE_TX_DELAY */ )
2225 err
: invalid value
for HCF_TYPE
;
2228 #if (HCF_TYPE) & HCF_TYPE_WARP && (HCF_TYPE) & HCF_TYPE_WPA
2229 err
: at most
1 of these macros should be defined
;
2230 #endif //HCF_TYPE_WARP / HCF_TYPE_WPA