PageRenderTime 120ms CodeModel.GetById 35ms app.highlight 60ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/staging/wlags49_h2/hcfcfg.h

https://bitbucket.org/slukk/jb-tsm-kernel-4.2
C Header | 2344 lines | 1361 code | 501 blank | 482 comment | 121 complexity | a7297628c854171096a479aff05cf076 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0

Large files files are truncated, but you can click here to view the full file

   1
   2//   vim:tw=110:ts=4:
   3#ifndef HCFCFG_H
   4#define HCFCFG_H 1
   5
   6/*************************************************************************************************************
   7*
   8* FILE	 : hcfcfg.tpl // hcfcfg.h
   9*
  10* DATE   : $Date: 2004/08/05 11:47:10 $   $Revision: 1.6 $
  11* Original: 2004/04/08 15:18:16    Revision: 1.40      Tag: t20040408_01
  12* Original: 2004/04/01 15:32:55    Revision: 1.38      Tag: t7_20040401_01
  13* Original: 2004/03/10 15:39:28    Revision: 1.34      Tag: t20040310_01
  14* Original: 2004/03/03 14:10:12    Revision: 1.32      Tag: t20040304_01
  15* Original: 2004/03/02 09:27:12    Revision: 1.30      Tag: t20040302_03
  16* Original: 2004/02/24 13:00:28    Revision: 1.25      Tag: t20040224_01
  17* Original: 2004/02/18 17:13:57    Revision: 1.23      Tag: t20040219_01
  18*
  19* AUTHOR : Nico Valster
  20*
  21* DESC   : HCF Customization Macros
  22* hcfcfg.tpl list all #defines which must be specified to:
  23*   adjust the HCF functions defined in HCF.C to the characteristics of a specific environment
  24*		o maximum sizes for messages
  25*		o Endianess
  26*	Compiler specific macros
  27*		o port I/O macros
  28*		o type definitions
  29*
  30* By copying HCFCFG.TPL to HCFCFG.H and -if needed- modifying the #defines the WCI functionality can be
  31* tailored
  32*
  33* Supported environments:
  34* WVLAN_41	Miniport								NDIS 3.1
  35* WVLAN_42	Packet									Microsoft Visual C 1.5
  36* WVLAN_43	16 bits DOS ODI							Microsoft Visual C 1.5
  37* WVLAN_44	32 bits ODI (__NETWARE_386__)			WATCOM
  38* WVLAN_45	MAC_OS									MPW?, Symantec?
  39* WVLAN_46	Windows CE (_WIN32_WCE)					Microsoft ?
  40* WVLAN_47	LINUX  (__LINUX__)						GCC, discarded, based on GPL'ed HCF-light
  41* WVLAN_48	Miniport								NDIS 5
  42* WVLAN_49	LINUX  (__LINUX__)						GCC, originally based on pre-compiled HCF_library
  43* 													migrated to use the HCF sources when Lucent Technologies
  44* 													brought the HCF module under GPL
  45* WVLAN_51	Miniport USB							NDIS 5
  46* WVLAN_52	Miniport								NDIS 4
  47* WVLAN_53	VxWorks END Station driver
  48* WVLAN_54	VxWorks END Access Point driver
  49* WVLAN_81	WavePoint								BORLAND C
  50* WCITST	Inhouse test tool						Microsoft Visual C 1.5
  51* WSU		WaveLAN Station Update					Microsoft Visual C ??
  52* SCO UNIX	not yet actually used ?					?
  53* __ppc		OEM supplied							?
  54* _AM29K	OEM supplied							?
  55* ?			OEM supplied							Microtec Research 80X86 Compiler
  56*
  57**************************************************************************************************************
  58*
  59*
  60* SOFTWARE LICENSE
  61*
  62* This software is provided subject to the following terms and conditions,
  63* which you should read carefully before using the software.  Using this
  64* software indicates your acceptance of these terms and conditions.  If you do
  65* not agree with these terms and conditions, do not use the software.
  66*
  67* COPYRIGHT � 1994 - 1995	by AT&T.				All Rights Reserved
  68* COPYRIGHT � 1996 - 2000 by Lucent Technologies.	All Rights Reserved
  69* COPYRIGHT � 2001 - 2004	by Agere Systems Inc.	All Rights Reserved
  70* All rights reserved.
  71*
  72* Redistribution and use in source or binary forms, with or without
  73* modifications, are permitted provided that the following conditions are met:
  74*
  75* . Redistributions of source code must retain the above copyright notice, this
  76*    list of conditions and the following Disclaimer as comments in the code as
  77*    well as in the documentation and/or other materials provided with the
  78*    distribution.
  79*
  80* . Redistributions in binary form must reproduce the above copyright notice,
  81*    this list of conditions and the following Disclaimer in the documentation
  82*    and/or other materials provided with the distribution.
  83*
  84* . Neither the name of Agere Systems Inc. nor the names of the contributors
  85*    may be used to endorse or promote products derived from this software
  86*    without specific prior written permission.
  87*
  88* Disclaimer
  89*
  90* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  91* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
  92* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  ANY
  93* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
  94* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
  95* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  96* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  97* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  98* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
  99* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 100* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 101* DAMAGE.
 102*
 103*
 104*************************************************************************************************************/
 105
 106/*	Alignment
 107*	Some platforms can access words on odd boundaries (with possibly an performance impact), at other
 108*	platforms such an access may result in a memory access violation.
 109*	It is assumed that everywhere where the HCF casts a char pointer into a word pointer, the alignment
 110*	criteria are met. This put some restrictions on the MSF, which are assumed to be "automatically" fulfilled
 111*	at the applicable platforms
 112*	To assert this assumption, the macro HCF_ALIGN can be defined. The default value is 1, meaning byte
 113*	alignment (or no alignment), a value of 2 means word alignment, a value of 4 means double word alignment
 114*/
 115
 116/*****************************    IN_PORT_STRING_8_16  S a m p l e s *****************************************
 117
 118		// C implementation which let the processor handle the word-at-byte-boundary problem
 119#define IN_PORT_STRING_8_16( port, addr, n) while ( n-- ) 	\
 120	{ *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_8 FAR*)addr)+=2; }
 121
 122		// C implementation which handles the word-at-byte-boundary problem
 123#define IN_PORT_STRING_8_16( port, addr, n)	while ( n-- )	 \
 124	{ hcf_16 i = IN_PORT_WORD(port); *((hcf_8 FAR*)addr)++ = (hcf_8)i; *((hcf_8 FAR*)addr)++ = (hcf_8)(i>>8);}
 125
 126		// Assembler implementation
 127#define IN_PORT_STRING_8_16( port, addr, len) __asm		\
 128{														\
 129	__asm push di										\
 130	__asm push es										\
 131	__asm mov cx,len									\
 132	__asm les di,addr									\
 133	__asm mov dx,port									\
 134	__asm rep insw										\
 135	__asm pop es										\
 136	__asm pop di										\
 137}
 138
 139
 140*****************************   OUT_PORT_STRING_8_16  S a m p l e s ******************************************
 141
 142		// C implementation which let the processor handle the word-at-byte-boundary problem
 143#define OUT_PORT_STRING_8_16( port, addr, n)	while ( n-- ) \
 144	{ OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; ((hcf_8 FAR*)addr)+=2; }
 145
 146		// C implementation which handles the word-at-byte-boundary problem
 147#define OUT_PORT_STRING_8_16( port, addr, n)	while ( n-- ) \
 148	{ OUT_PORT_WORD( port, *((hcf_8 FAR*)addr) | *(((hcf_8 FAR*)addr)+1)<<8  ); (hcf_8 FAR*)addr+=2; }
 149
 150		// Assembler implementation
 151#define OUT_PORT_STRING_8_16( port, addr, len) __asm	\
 152{														\
 153	__asm push si										\
 154	__asm push ds										\
 155	__asm mov cx,len									\
 156	__asm lds si,addr									\
 157	__asm mov dx,port									\
 158	__asm rep outsw										\
 159	__asm pop ds										\
 160	__asm pop si										\
 161}
 162
 163*************************************************************************************************************/
 164
 165
 166/************************************************************************************************/
 167/******************  C O M P I L E R   S P E C I F I C   M A C R O S  ***************************/
 168/************************************************************************************************/
 169/*************************************************************************************************
 170*
 171*			!!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
 172*			!!!! Do not call these macros with parameters which introduce side effects !!!!
 173*			!!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
 174*
 175*
 176* By selecting the appropriate Macro definitions by means of modifying the "#ifdef 0/1" lines, the HCF can be
 177* adjusted for the I/O characteristics of a specific compiler
 178*
 179* If needed the macros can be modified or replaced with definitions appropriate for your personal platform.
 180* If you need to make such changes it is appreciated if you inform Agere Systems
 181* That way the changes can become part of the next release of the WCI
 182*
 183* For convenience of the MSF-programmer, all macros are allowed to modify their parameters (although some
 184* might argue that this would constitute bad coding practice). This has its implications on the HCF, e.g. as a
 185* consequence these macros should not be called with parameters which have side effects, e.g auto-increment.
 186*
 187* in the Microsoft implementation of inline assembly it is O.K. to corrupt all flags except the direction flag
 188* and to corrupt all registers except the segment registers and EDI, ESI, ESP and EBP (or their 16 bits
 189* equivalents).  Other environments may have other constraints
 190*
 191* in the Intel environment it is O.K to have a word (as a 16 bits quantity) at a byte boundary, hence
 192* IN_/OUT_PORT_STRING_8_16 can move words between PC-memory and NIC-memory with as only constraint that the
 193* words are on a word boundary in NIC-memory. This does not hold true for all conceivable environments, e.g.
 194* an Motorola 68xxx does not allow this. Probably/hopefully the boundary conditions imposed by these type of
 195* platforms prevent this case from materializing.  If this is not the case, OUT_PORT_STRING_8_16 must be coded
 196* by combining two Host memory hcf_8 values at a time to a single hcf_16 value to be passed to the NIC and
 197* IN_PORT_STRING_8_16 the single hcf_16 retrieved from the NIC must be split in two hcf_8 values to be stored
 198* in Host memory (see the sample code above)
 199*
 200*	The prototypes and functional description of the macros are:
 201*
 202*	hcf_16	IN_PORT_WORD( hcf_16 port )
 203*			Reads a word (16 bits) from the specified port
 204*
 205*	void	OUT_PORT_WORD( hcf_16 port, hcf_16 value)
 206*			Writes a word (16 bits) to the specified port
 207*
 208*	hcf_16	IN_PORT_DWORD( hcf_16 port )
 209*			Reads a dword (32 bits) from the specified port
 210*
 211*	void	OUT_PORT_DWORD( hcf_16 port, hcf_32 value)
 212*			Writes a dword (32 bits) to the specified port
 213*
 214*	void	IN_PORT_STRING_8_16( port, addr, len)
 215*			Reads len number of words (16 bits) from NIC memory via the specified port to the (FAR)
 216*			byte-pointer addr in PC-RAM
 217*			Note that len specifies the number of words, NOT the number of bytes
 218*			!!!NOTE, although len specifies the number of words, addr MUST be a char pointer NOTE!!!
 219*			See also the common notes for IN_PORT_STRING_8_16 and OUT_PORT_STRING_8_16
 220*
 221*	void	OUT_PORT_STRING_8_16( port, addr, len)
 222*			Writes len number of words (16 bits) from the (FAR) byte-pointer addr in PC-RAM via the specified
 223*			port to NIC memory
 224*			Note that len specifies the number of words, NOT the number of bytes.
 225*			!!!NOTE, although len specifies the number of words, addr MUST be a char pointer NOTE!!!
 226*
 227*			The peculiar combination of word-length and char pointers for IN_PORT_STRING_8_16 as well as
 228*			OUT_PORT_STRING_8_16 is justified by the assumption that it offers a more optimal algorithm
 229*
 230*	void	IN_PORT_STRING_32( port, addr, len)
 231*			Reads len number of double-words (32 bits) from NIC memory via the specified port to the (FAR)
 232*			double-word address addr in PC-RAM
 233*
 234*	void	OUT_PORT_STRING_32( port, addr, len)
 235*			Writes len number of double-words (32 bits) from the (FAR) double-word address addr in PC-RAM via
 236*			the specified port to NIC memory
 237*
 238*			!!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
 239*			!!!! Do not call these macros with parameters which introduce side effects !!!!
 240*			!!!!!!!!!!!!!!!!!!!!!!!!! Note to the HCF-implementor !!!!!!!!!!!!!!!!!!!!!!!!!
 241*
 242*************************************************************************************************/
 243
 244/****************************  define INT Types  ******************************/
 245typedef unsigned char			hcf_8;
 246typedef unsigned short			hcf_16;
 247typedef unsigned long			hcf_32;
 248
 249/****************************  define I/O Types  ******************************/
 250#define HCF_IO_MEM     			0x0001	// memory mapped I/O	( 0: Port I/O )
 251#define HCF_IO_32BITS   	  	0x0002 	// 32Bits support		( 0: only 16 Bits I/O)
 252
 253/****************************** #define HCF_TYPE ********************************/
 254#define HCF_TYPE_NONE			0x0000	// No type
 255#define HCF_TYPE_WPA			0x0001	// WPA support
 256#define HCF_TYPE_USB			0x0002	// reserved (USB Dongle driver support)
 257//#define HCF_TYPE_HII			0x0004	// Hermes-II, to discriminate H-I and H-II CFG_HCF_OPT_STRCT
 258#define HCF_TYPE_WARP			0x0008	// WARP F/W
 259#define HCF_TYPE_PRELOADED		0x0040	// pre-loaded F/W
 260#define HCF_TYPE_HII5			0x0080	// Hermes-2.5 H/W
 261#define HCF_TYPE_CCX			0x0100	// CKIP
 262#define HCF_TYPE_BEAGLE_HII5	0x0200	// Beagle Hermes-2.5 H/W
 263#define HCF_TYPE_TX_DELAY		0x4000	// Delayed transmission ( non-DMA only)
 264
 265/****************************** #define HCF_ASSERT ******************************/
 266#define HCF_ASSERT_NONE			0x0000	// No assert support
 267#define HCF_ASSERT_PRINTF		0x0001	// Hermes generated debug info
 268#define HCF_ASSERT_SW_SUP		0x0002	// logging via Hermes support register
 269#define HCF_ASSERT_MB			0x0004	// logging via Mailbox
 270#define HCF_ASSERT_RT_MSF_RTN	0x4000	// dynamically binding of msf_assert routine
 271#define HCF_ASSERT_LNK_MSF_RTN	0x8000	// statically binding of msf_assert routine
 272
 273/****************************** #define HCF_ENCAP *******************************/
 274#define HCF_ENC_NONE			0x0000	// No encapsulation support
 275#define HCF_ENC					0x0001	// HCF handles En-/Decapsulation
 276#define HCF_ENC_SUP				0x0002	// HCF supports MSF to handle En-/Decapsulation
 277
 278/****************************** #define HCF_EXT *********************************/
 279#define HCF_EXT_NONE			0x0000	// No expanded features
 280#define HCF_EXT_INFO_LOG		0x0001	// logging of Hermes Info frames
 281//#define HCF_EXT_INT_TX_OK		0x0002	// RESERVED!!! monitoring successful Tx message
 282#define HCF_EXT_INT_TX_EX		0x0004	// monitoring unsuccessful Tx message
 283//#define HCF_EXT_MON_MODE		0x0008	// LEGACY
 284#define HCF_EXT_TALLIES_FW		0x0010	// support for up to 32 Hermes Engineering tallies
 285#define HCF_EXT_TALLIES_HCF		0x0020	// support for up to 8 HCF Engineering tallies
 286#define HCF_EXT_NIC_ACCESS		0x0040	// direct access via Aux-ports and to Hermes registers and commands
 287#define HCF_EXT_MB				0x0080	// MailBox code expanded
 288#define HCF_EXT_IFB_STRCT 		0x0100	// MSF custom pointer in IFB
 289#define HCF_EXT_DESC_STRCT 		0x0200	// MSF custom pointer in Descriptor
 290#define HCF_EXT_TX_CONT			0x4000	// Continuous transmit test
 291#define HCF_EXT_INT_TICK		0x8000	// enables TimerTick interrupt generation
 292
 293/****************************** #define HCF_SLEEP *******************************/
 294#define HCF_DDS					0x0001	// Disconnected Deep Sleep
 295#define HCF_CDS					0x0002	// Connected Deep Sleep
 296
 297/****************************** #define HCF_TALLIES ******************************/
 298#define HCF_TALLIES_NONE		0x0000	// No tally support
 299#define HCF_TALLIES_NIC			0x0001	// Hermes Tallies accumulated in IFB
 300#define HCF_TALLIES_HCF			0x0002	// HCF Tallies accumulated in IFB
 301#define HCF_TALLIES_RESET		0x8000	// Tallies in IFB are reset when reported via hcf_get_info
 302
 303
 304/************************************************************************************************/
 305/******************************  M I N I P O R T    N D I S *************************************/
 306/************************************************************************************************/
 307
 308#if defined WVLAN_41 || defined WVLAN_48 || defined WVLAN_52 || defined _WIN32_WCE
 309
 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
 316
 317#ifdef _WIN32_WCE
 318#define HCF_IO     HCF_IO_MEM
 319#define HCF_DMA		0			// To enable DMA
 320#endif
 321
 322#if _VARIANT == 7
 323#define HCF_SLEEP HCF_CDS
 324#endif // _VARIANT == 7
 325
 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
 338
 339
 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
 347
 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
 357
 358#if !defined WVLAN_46
 359#define _PEEK
 360#endif
 361
 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
 369
 370
 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
 383
 384#define	MSF_COMPONENT_VAR			_VARIANT
 385
 386#define	T1__HCF_TYPE					(HCF_TYPE_NONE)
 387
 388#define T2__HCF_TYPE					(T1__HCF_TYPE)
 389
 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
 399
 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
 405
 406//not suitable for H-II #define HCF_CFG_STA_1_BOTTOM        	16
 407
 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
 414
 415#define HCF_TYPE						(T5__HCF_TYPE)
 416
 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
 423
 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"
 432
 433#define	MSF_COMPONENT_MAJOR_VER		TPI_MAJOR_VERSION
 434#define	MSF_COMPONENT_MINOR_VER		TPI_MINOR_VERSION
 435
 436#if !defined _APIDLL && !defined _WIN32_WCE
 437
 438__inline UCHAR NDIS_IN_BYTE( ULONG port )
 439{
 440    UCHAR value;
 441    NdisRawReadPortUchar(port , &value);
 442    return (value);
 443}
 444
 445__inline ULONG NDIS_IN_LONG( ULONG port )
 446{
 447    ULONG value;
 448    NdisRawReadPortUlong(port , &value);
 449    return (value);
 450}
 451__inline USHORT NDIS_IN_WORD( ULONG port )
 452{
 453    USHORT value;
 454    NdisRawReadPortUshort(port , &value);
 455    return (value);
 456}
 457
 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))
 462
 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)
 465
 466#define IN_PORT_STRING_32(port, addr, len)		{					\
 467	NdisRawReadPortBufferUlong(port, addr, (len));					\
 468}
 469
 470#define OUT_PORT_STRING_32(port, addr, len)	{						\
 471	NdisRawWritePortBufferUlong(port, addr, (len));					\
 472}
 473
 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));
 476
 477#endif //  _APIDLL / _WIN32_WCE
 478
 479#if defined _WIN32_WCE
 480
 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
 484
 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
 491
 492extern hcf_8  CE_IN_PORT_BYTE(hcf_32 port);
 493extern void   CE_OUT_PORT_BYTE(hcf_32 port, hcf_8 value);
 494extern hcf_16 CE_IN_PORT_WORD(hcf_32 port);
 495extern void   CE_OUT_PORT_WORD(hcf_32 port, hcf_16 value);
 496extern void   CE_IN_PORT_STRING(hcf_32 port, void *addr, hcf_16 len);
 497extern void   CE_OUT_PORT_STRING(hcf_32 port, void *addr, hcf_16 len);
 498
 499
 500#endif
 501
 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
 506
 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))
 512
 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)
 526
 527#else // !(_WIN32_WCE)
 528
 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__))))
 532
 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
 546
 547#endif // _WIN32_WCE
 548#ifndef DBGA2W
 549#define DBGA2W
 550#endif	// DBGA2W
 551
 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
 556
 557#if !defined HCF_MAX_MSG_CKIP_PADDING
 558#define HCF_MAX_MSG_CKIP_PADDING 0
 559#endif // 		HCF_MAX_MSG_CKIP_PADDING
 560
 561#if !defined	HCF_MAX_MSG
 562#define			HCF_MAX_MSG				1514
 563#endif // 		HCF_MAX_MSG
 564
 565#define			HCF_LEGACY			1	//;?nv je moet wat
 566
 567#endif //WVLAN_41 / WVLAN_48 / WVLAN_52 / _WIN32_WCE
 568
 569
 570/************************************************************************************************/
 571/****************************  P A C K E T   D R I V E R  ***************************************/
 572/**********************************  D O S   O D I  *********************************************/
 573/************************************************************************************************/
 574
 575#if defined WVLAN_42 || defined WVLAN_43
 576
 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
 580
 581//#define HCF_IO     0									//no DMA, no 32 bits
 582
 583//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 584
 585#define	HCF_EXT						HCF_EXT_MB
 586#define HCF_PROT_TIME				49					//49*10240 microseconds H/W failure protection timer
 587
 588//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 589
 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
 597
 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
 604
 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
 613
 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 ))
 616
 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	\
 629{													\
 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									\
 638}
 639
 640#define OUT_PORT_STRING_8_16( port, addr, n) __asm	\
 641{													\
 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									\
 650}
 651
 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
 657
 658#endif	// WVLAN_42 / WVLAN_43
 659
 660
 661
 662/************************************************************************************************/
 663/****************************  D O S  H - I / II  L O A D E R  **********************************/
 664/************************************************************************************************/
 665
 666#if defined H0_LDR || defined H1_LDR || defined H2_LDR || defined H5_LDR
 667
 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
 672
 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
 677
 678//#if defined H2_LDR : not needed, H-II defaults are O.K for H2_LDR
 679
 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
 684
 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
 689
 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
 694
 695#include <stdio.h>
 696#include <conio.h>
 697#if defined NDEBUG
 698#pragma intrinsic( _inp, _inpw, _outp, _outpw )
 699#endif // NDEBUG
 700
 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
 709
 710#endif	// H0_LDR / H1_LDR / H2_LDR
 711
 712
 713
 714/************************************************************************************************/
 715/****************************  H C F  D E M O  P R O G R A M  ***********************************/
 716/************************************************************************************************/
 717
 718#if defined HCF_DEMO
 719
 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
 722
 723#define HCF_ASSERT	HCF_ASSERT_LNK_MSF_RTN			//support dynamic linking of msf_assert routine
 724
 725#define HCF_ENCAP			0
 726#define HCF_INT_ON			0
 727#define HCF_TALLIES			( HCF_TALLIES_NIC | HCF_TALLIES_HCF )
 728
 729//#define	MSF_COMPONENT_ID		NO configuration management
 730
 731#include <stdio.h>
 732#include <conio.h>
 733#if defined NDEBUG
 734#pragma intrinsic( _inp, _inpw, _outp, _outpw )
 735#endif // NDEBUG
 736
 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
 745
 746#endif	// HCF_DEMO
 747
 748
 749
 750/************************************************************************************************/
 751/***********************************  M A C  O S   **********************************************/
 752/************************************************************************************************/
 753
 754#if defined WVLAN_45
 755
 756#include "Version.h"
 757
 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
 762
 763#define MAC_OS                      1
 764
 765#define HCF_BIG_ENDIAN 1       		// selects Big Endian (a.k.a. Motorola), most significant byte first
 766
 767#if defined DEBUG
 768#define HCF_ASSERT	HCF_ASSERT_MB	// logging via Mailbox
 769#endif // DEBUG
 770
 771#ifdef  __cplusplus
 772extern "C" {
 773#endif // __cplusplus
 774extern volatile unsigned char *MacIOaddr;
 775extern hcf_16 IN_PORT_WORD(hcf_16 port);
 776extern void   OUT_PORT_WORD(hcf_16 port, hcf_16 value);
 777extern void   IN_PORT_STRING_16(hcf_16 port, void *addr, hcf_16 len);
 778extern void   OUT_PORT_STRING_16(hcf_16 port, void *addr, hcf_16 len);
 779
 780#define SwapBytes(t)    (((t) >> 8) + (((t) & 0xff) << 8))
 781
 782#ifdef  __cplusplus
 783}
 784#endif // __cplusplus
 785
 786#endif  // WVLAN_45
 787
 788
 789
 790/************************************************************************************************/
 791/******************************************  L I N U X  *****************************************/
 792/************************************************************************************************/
 793
 794#ifdef WVLAN_49
 795#include <asm/io.h>
 796//#include <linux/module.h>
 797#include <wl_version.h>
 798
 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
 802
 803//#define HCF_SLEEP (HCF_CDS | HCF_DDS )
 804#define HCF_SLEEP (HCF_CDS)
 805
 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
 816
 817#ifdef ENABLE_DMA
 818#define HCF_DMA		1
 819#endif // ENABLE_DMA
 820
 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
 823
 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
 828
 829#ifndef HCF_TYPE_AP
 830#define HCF_TYPE_AP  0x0010
 831#endif
 832
 833#ifndef HCF_TYPE_STA
 834#define HCF_TYPE_STA 0x0020
 835#endif  // HCF_TYPE_STA
 836
 837/* Guarantees word alignment */
 838#define HCF_ALIGN		2
 839
 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
 845
 846#ifndef CNV_LITTLE_TO_INT
 847#define CNV_LITTLE_TO_INT   CNV_LITTLE_TO_SHORT
 848#endif
 849
 850#define	HCF_ERR_BUSY			0x06
 851
 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
 871
 872
 873
 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
 878
 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
 885
 886#endif  // HERMES25
 887
 888
 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
 895
 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
 898
 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
 902
 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
 906
 907#ifdef USE_BIG_ENDIAN
 908#define HCF_BIG_ENDIAN  1
 909#else
 910#define HCF_BIG_ENDIAN  0
 911#endif  /* USE_BIG_ENDIAN */
 912
 913/* Define the following if your system uses memory-mapped IO */
 914//#define HCF_MEM_IO
 915
 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) ))
 921
 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) )
 930
 931#define IN_PORT_DWORD(port)          IN_PORT_HCF32(port)
 932#define OUT_PORT_DWORD(port, value)  OUT_PORT_HCF32(port, value)
 933
 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)
 936
 937
 938#ifndef OUTPUTDEBUGMSG
 939#define OUTPUTDEBUGMSG(dprintf_exp)
 940#endif
 941
 942
 943#ifndef ASSERTDEBUGMSG
 944#define ASSERTDEBUGMSG(cond, dprintf_exp)
 945#endif
 946
 947#ifndef CFG_SCAN_CHANNELS_2GHZ
 948#define CFG_SCAN_CHANNELS_2GHZ 0xFCC2
 949#endif /* CFG_SCAN_CHANNELS_2GHZ */
 950
 951#define HCF_MAX_MSG 1600 //get going ;?
 952#endif	// WVLAN_49
 953
 954
 955
 956/************************************************************************************************/
 957/*********************************************  Q N X  ******************************************/
 958/************************************************************************************************/
 959
 960#if defined  __QNX__ || defined WVLAN_50
 961
 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
 966
 967#include <conio.h>
 968
 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) ))
 971/*
 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; }
 976*/
 977
 978#endif	// QNX / WVLAN_50
 979
 980
 981
 982/************************************************************************************************/
 983/*********************************************  B E O S  ****************************************/
 984/************************************************************************************************/
 985
 986#if defined  __BEOS__
 987
 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
 992
 993#include <drivers/Drivers.h>
 994#include <drivers/KernelExport.h>
 995
 996uint8 read_io_8 (int);
 997void write_io_8 (int, uint8);
 998uint16 read_io_16 (int);
 999void write_io_16 (int, uint16);
1000
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) ))
1003/*
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; }
1008*/
1009#endif	// __BEOS__
1010
1011
1012
1013/************************************************************************************************/
1014/********************************  U S B   D O N G L E  *****************************************/
1015/************************************************************************************************/
1016
1017#if defined USB
1018#include "gpif.h"
1019
1020#define	MSF_COMPONENT_MAJOR_VER		0
1021#define	MSF_COMPONENT_MINOR_VER		1
1022
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
1029 */
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++ ); }
1034
1035//#define HCF_TYPE	( HCF_TYPE_AP | HCF_TYPE_WPA )
1036#define HCF_TYPE	HCF_TYPE_WPA
1037
1038#endif	// USB
1039
1040
1041/************************************************************************************************/
1042/******************************************  FreeBSD  *******************************************/
1043/************************************************************************************************/
1044
1045#if defined __FREE_BSD__
1046
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
1051
1052#define HCF_IO 						HCF_IO_MEM		// overrule standard Port I/O with Memory mapped I/O
1053
1054#include <machine/cpufunc.h>
1055
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)))
1058
1059/*
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; }
1064*/
1065#endif	// __FREE_BSD__
1066
1067
1068
1069/************************************************************************************************/
1070/*********************************  W A V E P O I N T  ******************************************/
1071/************************************************************************************************/
1072
1073#if defined WVLAN_81	/* BORLANDC */
1074
1075#define EXTERN_C  extern	// needed because DHF uses this instead of 'extern'
1076
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
1081
1082#define HCF_PROT_TIME				49	//49*10240 microseconds H/W failure protection timer
1083
1084//#define HCF_ASSERT	HCF_ASSERT_MB	// logging via Mailbox	/* debug build only */
1085
1086#if !defined FAR
1087#define FAR  far						// segmented 16 bits mode
1088#endif // FAR
1089
1090#define IN_PORT_WORD(port)					(inport( (hcf_io)(port) ))
1091#define OUT_PORT_WORD(port, value)			(outport( (hcf_io)(port), value ))
1092
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 }
1095
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 }
1098
1099#endif // WVLAN_81
1100
1101
1102/************************************************************************************************/
1103/********************************  W A V E L A U N C H  *****************************************/
1104/************************************************************************************************/
1105
1106#if defined WVLAUNCH
1107
1108#include "DriverX.h"
1109extern HWDEVICE*	g_pDevice;
1110
1111//#define	MSF_COMPONENT_ID			0  //;? to get around browser problem
1112
1113#define IN_PORT_WORD(port)	HwInpw( g_pDevice, port )
1114#define OUT_PORT_WORD(port, value)	HwOutpw( g_pDevice, port, value )
1115
1116
1117// C implementation which let the processor handle the word-at-byte-boundary problem
1118/*
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; }
1123*/
1124#endif // WVLAUNCH
1125
1126
1127
1128/************************************************************************************************/
1129/*************************************  W C I T S T *********************************************/
1130/************************************************************************************************/
1131
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
1137
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)
1144err: 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1149
1150#define HCF_ASSERT	HCF_ASSERT_SW_SUP	// logging via Hermes support registerr
1151//#define HCF_ASSERT		HCF_ASSERT_MB		// logging via Mailbox
1152
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
1166
1167#include <stdio.h>
1168#include <conio.h>
1169#ifndef _DEBUG
1170#pragma intrinsic( _inp, _inpw, _outp, _outpw )
1171#endif // _DEBUG
1172
1173#ifdef LOG
1174extern FILE* utm_logfile;
1175hcf_16	ipw( hcf_16 port );
1176hcf_8	ipb( hcf_16 port );
1177void	opw( hcf_16 port, hcf_16 value );
1178void	opb( hcf_16 port, hcf_8 value );
1179
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
1186
1187#if 1 //ASM example
1188#define IN_PORT_STRING_16( port, addr, len) __asm		\
1189{														\
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										\
1198}
1199
1200#define OUT_PORT_STRING_16( port, addr, len) __asm		\
1201{														\
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										\
1210}
1211
1212#endif	// asm example
1213
1214#endif // __GCC__
1215
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
1222
1223#endif	// WCITST
1224
1225
1226/************************************************************************************************/
1227/*******************************  Motorola Power PC 800 family  *********************************/
1228/************************************************************************************************/
1229/* known users: LH@I
1230 */
1231
1232#if defined I_MPC8XX
1233
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
1238
1239#define HCF_HSI_VAR				1
1240
1241#define HCF_BIG_ENDIAN			1
1242#define HCF_IO 					HCF_IO_MEM		// overrule standard Port I/O with Memory mapped I/O
1243
1244#include "o_portbl.h"
1245#include "ipcmcia.h"
1246typedef o_uint8_t  hcf_8;
1247typedef o_uint16_t hcf_16;
1248typedef o_uint32_t hcf_32;
1249
1250/***************************************************************************/
1251
1252
1253#ifdef _lint
1254#else
1255asm hcf_16 IN_PORT_WORD(int port)
1256{
1257% reg port
1258    lhbrx r3,r0,port
1259    eieio
1260}
1261#endif // _lint
1262
1263
1264#ifdef _lint
1265#else
1266asm void OUT_PORT_WORD(int port, hcf_16 value)
1267{
1268% reg port, value
1269    sthbrx value,r0,port
1270    eieio
1271}
1272#endif // _lint
1273
1274/***************************************************************************/
1275
1276#define IN_PORT_STRING_16(port, addr, len)               \
1277   {                                                  \
1278      unsigned l = (len);                             \
1279      hcf_16 *d = (volatile hcf_16 *)(addr);          \
1280      while (l--)                                     \
1281      {                                               \
1282         *d++ = *(volatile hcf_16 *)(port);           \
1283         EIEIO();                                     \
1284      }                                               \
1285   }
1286
1287#define OUT_PORT_STRING_16(port, addr, len)           \
1288   {                                                  \
1289      unsigned l = (len);                             \
1290      hcf_16 *s = (volatile hcf_16 *)(addr);          \
1291      while (l--)                                     \
1292      {                                               \
1293         *(volatile hcf_16 *)(port) = *s++;           \
1294         EIEIO();                                     \
1295      }                                               \
1296   }
1297
1298#endif	// I_MPC8XX
1299
1300
1301
1302/************************************************************************************************/
1303/**********************************   Diab or High C 29K   **************************************/
1304/*********************************************…

Large files files are truncated, but you can click here to view the full file