📄 wvlan_hcfcfg.h
字号:
/* This file is part of the Hardware Control Functions Light (HCF-light) library to control the Lucent Technologies WaveLAN/IEEE Network I/F Card. The HCF is the implementation of the Wireless Connection I/F (WCI). The HCF-light files are a subset of the HCF files. The complete set offers a number of additional facilities, e.g. firmware download, Etherner-II encapsulation, additional diagnostic facilities, ASSERT logic to support debugging, 802.11 support, Configuration Management. This complete set is explicitely not in the Public Domain but can be made available under certain restriction. (see the pointer below for support) The HCF-light files are free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. At the time of this writing, you can request for support at: betasupport@wavelan.com Documentation is expected to be available in the week of 8 Februari 1999*/#include <asm/byteorder.h>#ifndef HCFCFG_H #define HCFCFG_H 1/**************************************************************************************************************** FILE : hcfcfg.tpl // hcfcfg.h **************************** 2.0 ********************************************** DATE : 2001/03/01 00:59:03 1.4** AUTHOR : Nico Valster** DESC : HCF Customization Macros***************************************************************************************************************** COPYRIGHT (c) 1994, 1995 by AT&T. All Rights Reserved.* COPYRIGHT (c) 1996, 1997, 1998 by Lucent Technologies. All Rights Reserved.****************************************************************************************************************** hcfcfg.tpl list all #defines which must be specified to:* I: adjust the HCF functions defined in HCF.CPP to the characteristics of a specific environment* o maximum sizes for messages and notification frames, persistent configuration storage* o Endianess** II: Compiler specific macros* o port I/O macros* o type definitions** III: Environment specific ASSERT macro** IV: Compiler specific ** V: ;? specific *** By copying HCFCFG.TPL to HCFCFG.H and -if needed- modifying the #defines the WCI functionality can be * tailored* T O D O : A D D A R E C I P E T O D O T H I S***************************************************************************************************************//****************************************************************************wvlan_hcfcfg.h,vRevision 1.4 2001/03/01 00:59:03 root*** empty log message ***Revision 1.3 2000/12/13 22:58:23 root*** empty log message ***Revision 1.2 2000/01/06 23:30:52 root*** empty log message *** * * Rev 1.0 02 Feb 1999 14:32:32 NVALST * Initial revision.Revision 1.2 1999/02/01 21:01:41 nico*** empty log message ***Revision 1.1 1999/01/30 19:24:39 nicoInitial revisionRevision 1.1 1999/01/30 19:07:57 nicoInitial revision * * Rev 1.110 29 Jan 1999 15:52:44 NVALST * intermediate, maybe working but seems to need two times to load in * light-version * * Rev 1.109 29 Jan 1999 12:50:26 NVALST * intermediate * * Rev 1.108 28 Jan 1999 14:43:24 NVALST * intermediate, once more correction of loop in hcf_service_nic + download * passed to Marc * * Rev 1.107 27 Jan 1999 13:53:24 NVALST * intermediate, once more correction of loop in hcf_service_nic * * Rev 1.106 26 Jan 1999 16:42:46 NVALST * intermediate, corrected loop in hcf_service_nic (which was as result of a * walkthrough, changed from a bug without consequences into one with consequences * * Rev 1.105 25 Jan 1999 14:24:48 NVALST * intermediate, hopefully suitable for release * * Rev 1.104 22 Jan 1999 16:59:34 NVALST * intermediate, minor corrections + some HCF-L stuff * * Rev 1.103 15 Jan 1999 15:14:46 NVALST * intermediate, deposited as HCF2.10 * *************************************************************************************************//****************************************************************************** CHANGE HISTORY* 960702 - NV Original Entry - derived from HCF 2.12*************************************************************************************************//* * * * * * * * * * * * * * * * * * * * * * * I * * * * * * * * * * * * * * * * * * * * * * *//* Endianess * Default: HCF_LITTLE_ENDIAN * Little Endian (a.k.a. Intel), least significant byte first * Big Endian (a.k.a. Motorola), most significant byte first * * If neither HCF_LITTLE_ENDIAN nor HCF_BIG_ENDIAN, the defintion of the following macros must be supplied * by the MSF programmer: * o CNV_LITTLE_TO_INT(w) interprets the 16-bits input value as Little Endian, returns an hcf_16 * o CNV_BIG_TO_INT(w) interprets the 16-bits input value as Big Endian, returns an hcf_16 * o CNV_INT_TO_BIG_NP(addr) converts in place the 16-bit value addressed by a near pointer from hcf_16 * to Big Endian * o CNV_LITTLE_TO_INT_NP(addr) converts in place the 16-bit value addressed by a near pointer from * Little endian to hcf_16 * * At a number of places in the HCF code, the CNV_INT_TO_BIG_NP macro is used. While it does have the desired * effect on all platforms, it's naming is misleading, so revisit all places where these CNV macros are used * to assure the right name is used at the right place. * Hint: introduce CNV_HOST_TO_NETWORK names if appropriate * */#ifdef __BIG_ENDIAN#define HCF_BIG_ENDIAN // selects Big Endian (a.k.a. Motorola), most significant byte first#else#define HCF_LITTLE_ENDIAN // selects Little Endian (a.k.a. Intel), least significant byte first#endif/* I/O Address size * Platforms which use port mapped I/O will (in general) have a 64k I/O space, conveniently expressed in * a 16-bits quantity * Platforms which use memory mapped I/O will (in general) have an I/O space much larger than 64k, * and need a 32-bits quantity to express the I/O base * To accomodate this the macros HCF_PORT_IO and HCF_MEM_IO are available. Exactly 1 of these must be * defined. If HCF_PORT_IO is defined, the HCF will use an hcf_16 to express I/O base and store in the * IFB. If HCF_MEM_IO, an hcf_32 is used for this purpose. The default is HCF_PORT_IO */#define HCF_PORT_IO//#define HCF_MEM_IO/* Alignment * Some platforms can access words on odd boundaries (with possibly an performance impact), at other * platforms such an access may result in a memory access violation. * It is assumed that everywhere where the HCF casts a char pointer into a word pointer, the * alignment criteria are met. This put some restrictions on the MSF, which are assumed to be * "automatically" fullfilled at the applicable platforms * To assert this assumption, the macro HCF_ALIGN can be defined. The default vaslue is 0, meaning no * alignment, a value of 2 means word alignment, other values are invalid *//* * * * * * * * * * * * * * * * * * * * * * * II * * * * * * * * * * * * * * * * * * * * * * *//************************************************************************************************//****************** C O M P I L E R S P E C I F I C M A C R O S ***************************//************************************************************************************************//*************************************************************************************************** The platforms supported by this version are:* - Microsoft Visual C 1.5 (16 bits platform)* - Microsoft Visual C 2.0 (32 bits platform)* - Watcom C/C++ 9.5* - SCO UNIX** In this version of hcfiocfg.tpl all macros except the MSVC 1.5 versions are either dependent on* compiler/environment supplied macros (e.g. _MSC_VER or "def-ed out"** By selecting the appropriate Macro definitions by means of modifying the* "#ifdef 0/1" lines, the HCF can be adjusted for the I/O chararcteristics of* a specific compiler** If needed the macros can be modified or replaced with definitions appropriate* for your personal platform* If you need to make such changes it is appreciated if you inform Lucent Technologies WCND Utrecht* That way the changes can become part of the next release of the WCI*** The prototypes and functional description of the macros are:** hcf_8 IN_PORT_BYTE( hcf_16 port)* Reads a byte (8 bits) from the specified port** hcf_16 IN_PORT_WORD( hcf_16 port)* Reads a word (16 bits) from the specified port** void OUT_PORT_BYTE( hcf_16 port, hcf_8 value)* Writes a byte (8 bits) to the specified port** void OUT_PORT_WORD( hcf_16 port, hcf_16 value)* Writes a word (16 bits) to the specified port** void IN_PORT_STRING( port, dest, len)* Reads len number of words from the specified port to the (FAR) address dest in PC-RAM* Note that len specifies the number of words, NOT the number of bytes* !!!NOTE, although len specifies the number of words, dest MUST be a char pointer NOTE!!!* See also the common notes for IN_PORT_STRING and OUT_PORT_STRING** void OUT_PORT_STRING( port, src, len)* Writes len number of words from the (FAR) address src in PC-RAM to the specified port* Note that len specifies the number of words, NOT the number of bytes.* !!!NOTE, although len specifies the number of words, src MUST be a char pointer NOTE!!!** The peculiar combination of word-length and char pointers for IN_PORT_STRING as well as* OUT_PORT_STRING is justified by the assumption that it offers a more optimal algorithm** Note to the HCF-implementor:* Due to the passing of the parameters to compiler specific blabla.........* do not use "expressions" as parameters, e.g. don't use "ifbp->IFB_IOBase + HREG_AUX_DATA" but* assign this to a temporary variable.*** NOTE!! For convenience of the MSF-programmer, all {IN|OUT}_PORT_{BYTE|WORD|STRING} macros are allowed to * modify their parameters (although some might argue that this would constitute bad coding* practice). This has its implications on the HCF, e.g. as a consequence these macros should not* be called with parameters which have side effects, e.g auto-increment.** NOTE!! in the Micosoft implementation of inline assembly it is O.K. to corrupt all flags except* the direction flag and to corrupt all registers except the segment registers and EDI, ESI, * ESP and EBP (or their 16 bits equivalents).* Other environments may have other constraints** NOTE!! in the Intel environment it is O.K to have a word (as a 16 bits quantity) at a byte boundary, * hence IN_/OUT_PORT_STRING can move words between PC-memory and NIC-memory with as only* constraint that the words are on a word boundary in NIC-memory. This does not hold true* for all conceivalble environments, e.g. an Motorola 68xxx does not allow this, in other* words whenever there is a move from address in 2*n in one memory type to address 2*m+1 in the* other type, the current templates for IN_/OUT_PORT_STRING are unsuitable. Probably the* boundary conditions imposed by these type of platforms prevent this case from materializing**************************************************************************************************//************************************************************************************************//**************************** N E T W A R E 3 8 6 *******************************************//************************************************************************************************/#if defined __NETWARE_386__ /* WATCOM */#define MSF_COMPONENT_ID COMP_ID_ODI_32#define HCF_STA //station characteristics#include <conio.h>//#define CNV_LITTLE_TO_INT(x) (x) // No endianess conversion neededtypedef unsigned char hcf_8;typedef unsigned short hcf_16;typedef unsigned long hcf_32;#define FAR // flat 32-bits code#define BASED #define IN_PORT_BYTE(port) ((hcf_8)inp( (hcf_io)(port) )) //;?leave out cast to hcf_8;?#define IN_PORT_WORD(port) (inpw( (hcf_io)(port) ))#define OUT_PORT_BYTE(port, value) (outp( (hcf_io)(port), value ))#define OUT_PORT_WORD(port, value) (outpw( (hcf_io)(port), value ))#define IN_PORT_STRING( prt, dst, n) while ( n-- ) { *(hcf_16 FAR*)dst = IN_PORT_WORD( prt ); dst += 2; }#define OUT_PORT_STRING( prt, src, n) while ( n-- ) { OUT_PORT_WORD( prt, *(hcf_16 FAR*)src ) ; src += 2; }#endif // __NETWARE_386__// Note:// Visual C++ 1.5 : _MSC_VER == 800// Visual C++ 4.0 : _MSC_VER == 1000// Visual C++ 4.2 : _MSC_VER == 1020/************************************************************************************************//**************************** P A C K E T D R I V E R ***************************************//********************************** D O S O D I *********************************************//************************************************************************************************/#if defined WVLAN_42 || defined WVLAN_43|| defined WVLAN43L#pragma warning ( disable: 4001 ) #define HCF_STA //station characteristics#if defined WVLAN_43#define MSF_COMPONENT_ID COMP_ID_ODI_16#define MSF_COMPONENT_VAR 1#define MSF_COMPONENT_MAJOR_VER 1#define MSF_COMPONENT_MINOR_VER 4#elif defined WVLAN_42#define MSF_COMPONENT_ID COMP_ID_PACKET#define MSF_COMPONENT_VAR 1#define MSF_COMPONENT_MAJOR_VER 1#define MSF_COMPONENT_MINOR_VER 24#elif defined WVLAN43L#define HCF_MAX_CONFIG 0#define MSF_COMPONENT_MAJOR_VER 0#define MSF_COMPONENT_MINOR_VER 1#endif //WVLAN_xx #define FAR __far // segmented 16 bits mode#if defined _M_I86TM#define BASED __based(__segname("_CODE"))#else#define BASED #endif // _M_I86TMtypedef unsigned char hcf_8;typedef unsigned short hcf_16;typedef unsigned long hcf_32;#include <stdio.h>#include <conio.h>//#ifndef _DEBUG #pragma intrinsic( _inp, _inpw, _outp, _outpw )//#endif // _DEBUG#define IN_PORT_BYTE(port) ((hcf_8)_inp( (hcf_io)(port) ))#define IN_PORT_WORD(port) ((hcf_16)_inpw( (hcf_io)(port) ))#define OUT_PORT_BYTE(port, value) ((void)_outp( (hcf_io)(port), value ))#define OUT_PORT_WORD(port, value) ((void)_outpw( (hcf_io)(port), value ))#if defined HCF_STRICT#define IN_PORT_STRING( prt, dst, n) { ips( prt, dst, n); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -