wlags49_h2: Various cleanups
cover wlags49_h2: Various cleanups
Do some cleanup to try make it clearer what is actually done in the configuration for HII and HII.5. Concentrate on hcf.c, which is where most of the interesting logic is.
Verified be recompiling and confirming there are no changes to the binary (except line offsets from calls to mdd_assert).
Patches are against v3.0
I made the bulk of these changes a while back, to see if I could figure out what an orinoco based driver would need to do. Interest petered out, so I've simply rebased and build checked in case this helps anyone.
David Kilroy (13):
staging: wlags49_h2: Remove non-linux configurations
staging: wlags49_h2: Reindent hcfdef.h
staging: wlags49_h2: Fix macro termination
staging: wlags49_h2: Reindent hcf.c
staging: wlags49_h2: Remove HCF_DL_ONLY
staging: wlags49_h2: Simplify HCF_ENCAP usage
staging: wlags49_h2: Remove some unused defines
staging: wlags49_h2: Remove references to SSN
staging: wlags49_h2: Remove MUL/DIV_BY_2
staging: wlags49_h2: Remove CKIP support from hcf
staging: wlags49_h2: Remove HCF_EXT_MB from code.
staging: wlags49_h2: Reformat TX_CNTL comment
staging: wlags49_h2: Remove continuous tx test
drivers/staging/wlags49_h2/hcf.c | 6434 +++++++++++++++++------------------ drivers/staging/wlags49_h2/hcf.h | 10 - drivers/staging/wlags49_h2/hcfcfg.h | 1567 --------- drivers/staging/wlags49_h2/hcfdef.h | 857 +++--- drivers/staging/wlags49_h2/mdd.h | 34 +- 5 files changed, 3568 insertions(+), 5334 deletions(-)
Signature · 1 line
1.7.4.1
PATCH 1/13 staging: wlags49_h2: Remove non-linux configurations
For now just remove from hcfcfg.h, we will slowly remove the unused configurations as we go
--- drivers/staging/wlags49_h2/hcfcfg.h | 1524 ----------------------------------- 1 files changed, 0 insertions(+), 1524 deletions(-)
drivers/staging/wlags49_h2/hcfcfg.h +0 -1524
@@ -300,493 +300,6 @@ typedef unsigned long hcf_32;#define HCF_TALLIES_HCF 0x0002 // HCF Tallies accumulated in IFB#define HCF_TALLIES_RESET 0x8000 // Tallies in IFB are reset when reported via hcf_get_info - -/************************************************************************************************/ -/****************************** M I N I P O R T N D I S *************************************/ -/************************************************************************************************/ - -#if definedWVLAN_41 || definedWVLAN_48 || definedWVLAN_52 || defined _WIN32_WCE - -#ifndef WVLAN_46 -#define HCF_EXT (HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS ) -#else -#define HCF_EXT ( HCF_EXT_TX_CONT | HCF_EXT_INFO_LOG | HCF_EXT_MB | HCF_EXT_NIC_ACCESS ) -#endif -#define HCF_DLV 1 //H-I legacy, superfluous for H-II - -#ifdef _WIN32_WCE -#define HCF_IO HCF_IO_MEM -#define HCF_DMA 0 // To enable DMA -#endif - -#if _VARIANT ==7 -#define HCF_SLEEP HCF_CDS -#endif // _VARIANT == 7 - -#if _VARIANT ==5 || _VARIANT ==6 -#define _WARP -#define _AES -#define HCF_SLEEP HCF_CDS -#if _VARIANT ==6 -//! #define _RSN -#endif // _VARIANT == 6 -#ifndef _WIN32_WCE -#define HCF_IO HCF_IO_32BITS -#define HCF_DMA 1 // To enable DMA -#endif -#endif // _VARIANT == 5 || _VARIANT == 6 - - -//HWi for migration purposes I defined a define which will be TRUE for ALL drivers -//Meaning that _CCX defined code which we think will get a all driver OK flag can be defined from _CCX to _CCX_OK -#if definedWVLAN_48 // && !defined _WIN32_WCE -#if _VARIANT ==4 || _VARIANT ==6 -#define _CCX_OK 1 -#endif // _VARIANT == 4 || _VARIANT == 6 -#endif // WVLAN_48 - -//#if !defined WVLAN_46 -#if definedWVLAN_48 -#if _VARIANT ==4 || _VARIANT ==6 -#define _CCX -#define HCF_MAX_MSG_CKIP_PADDING 86 //, use 86 for rx fragmentation. 28 is enuf for MIC+PPK encapsulation -#define HCF_MAX_MSG ( 1514 + HCF_MAX_MSG_CKIP_PADDING ) // need extra padding for CKIP (need to subtract 28 for NDIS) -#endif // _VARIANT == 4 || _VARIANT == 6 -#endif // WVLAN_48 -//#endif // WVLAN_46 - -#if !definedWVLAN_46 -#define _PEEK -#endif - -#ifndef _WIN32_WCE -// ASSERT already used by WinCE... -#ifdef ASSERT -#undef ASSERT -#define ASSERT (x) ASSERTDEBUGMSG((x), (TEXT("SIMULATE ASSERT:"))) -#endif -#endif - - -#if definedWVLAN_41 -#define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_31 -#endif // WVLAN_41 -#if definedWVLAN_48 && !defined _WIN32_WCE -#define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_50 -#endif // WVLAN_48 / _WIN32_WCE -#if definedWVLAN_52 && !defined _WIN32_WCE -#define MSF_COMPONENT_ID COMP_ID_MINIPORT_NDIS_40 -#endif // WVLAN_52 / _WIN32_WCE -#if definedWVLAN_46 -#define MSF_COMPONENT_ID COMP_ID_WIN_CE -#endif // _WIN32_WCE - -#define MSF_COMPONENT_VAR _VARIANT - -#define T1__HCF_TYPE (HCF_TYPE_NONE) - -#define T2__HCF_TYPE (T1__HCF_TYPE) - -#ifdef _WARP -#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5 | HCF_TYPE_WARP ) -#else -#if _VARIANT ==7 -#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5) -#else // _VARIANT == 7 -#define T3__HCF_TYPE (T2__HCF_TYPE) -#endif // _VARIANT == 7 -#endif // _WARP - -#ifdef _CCX_OK -#define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX) -#else -#define T4__HCF_TYPE (T3__HCF_TYPE) -#endif // _CCX_OK - -//not suitable for H-II #define HCF_CFG_STA_1_BOTTOM 16 - -// Default WPA in ON for all drivers except for WARP driver -#ifdef _WARP -#define T5__HCF_TYPE (T4__HCF_TYPE) -#else // _WARP -#define T5__HCF_TYPE (T4__HCF_TYPE | HCF_TYPE_WPA) -#endif // _WARP - -#define HCF_TYPE (T5__HCF_TYPE) - -// This is needed to get aux_ctrl() from the HCF for WlFreezeAndDump() -#if (definedDBG &&DBG !=0 ) -#ifndef STATIC -#define STATIC -#endif -#endif - -#if !definedSOFTRONICS_CODE && !defined _APIDLL && !defined _WIN32_WCE -#include <ndis.h> -#endif // SOFTRONICS_CODE / _APIDLL / _WIN32_WCE -#if defined _WIN32_WCE -#include <windows.h> -#include <winnt.h> -#endif // _WIN32_WCE -#include "version.h" - -#define MSF_COMPONENT_MAJOR_VER TPI_MAJOR_VERSION -#define MSF_COMPONENT_MINOR_VER TPI_MINOR_VERSION - -#if !defined _APIDLL && !defined _WIN32_WCE - -__inlineUCHAR NDIS_IN_BYTE (ULONG port ) -{ -UCHAR value; -NdisRawReadPortUchar (port , &value); -return (value); -} - -__inlineULONG NDIS_IN_LONG (ULONG port ) -{ -ULONG value; -NdisRawReadPortUlong (port , &value); -return (value); -} -__inlineUSHORT NDIS_IN_WORD (ULONG port ) -{ -USHORT value; -NdisRawReadPortUshort (port , &value); -return (value); -} - -#define IN_PORT_DWORD (port) NDIS_IN_LONG( (ULONG) (port) ) -#define IN_PORT_WORD (port) NDIS_IN_WORD( (ULONG) (port) ) -#define OUT_PORT_DWORD (port, value) NdisRawWritePortUlong((ULONG) (port) , value) -#define OUT_PORT_WORD (port, value) NdisRawWritePortUshort((ULONG) (port) , (USHORT) (value)) - -#define IN_PORT_STRING_8_16 (port, addr, len) IN_PORT_STRING_16(port, addr, len) -#define OUT_PORT_STRING_8_16 (port, addr, len) OUT_PORT_STRING_16(port, addr, len) - -#define IN_PORT_STRING_32 (port, addr, len) { \ - NdisRawReadPortBufferUlong(port, addr, (len)); \ -} - -#define OUT_PORT_STRING_32 (port, addr, len) { \ - NdisRawWritePortBufferUlong(port, addr, (len)); \ -} - -#define IN_PORT_STRING_16 (port, addr, len) NdisRawReadPortBufferUshort(port, addr, (len)); -#define OUT_PORT_STRING_16 (port, addr, len) NdisRawWritePortBufferUshort(port, addr, (len)); - -#endif // _APIDLL / _WIN32_WCE - -#if defined _WIN32_WCE - -#define HCF_ALIGN 2 -#define HCF_MEM_IO 1 // overrule standard Port I/O with Memory mapped I/O -#define HCF_PROT_TIME 49 - -#define IN_PORT_BYTE CE_IN_PORT_BYTE -#define OUT_PORT_BYTE CE_OUT_PORT_BYTE -#define IN_PORT_WORD CE_IN_PORT_WORD -#define OUT_PORT_WORD CE_OUT_PORT_WORD -#define IN_PORT_STRING_16 CE_IN_PORT_STRING -#define OUT_PORT_STRING_16 CE_OUT_PORT_STRING - -extern hcf_8 CE_IN_PORT_BYTE (hcf_32 port); -extern void CE_OUT_PORT_BYTE (hcf_32 port,hcf_8 value); -extern hcf_16 CE_IN_PORT_WORD (hcf_32 port); -extern void CE_OUT_PORT_WORD (hcf_32 port,hcf_16 value); -extern void CE_IN_PORT_STRING (hcf_32 port,void *addr,hcf_16 len); -extern void CE_OUT_PORT_STRING (hcf_32 port,void *addr,hcf_16 len); - - -#endif - -#if defined _DEBUG || (definedDBG &&DBG !=0 ) -#define HCF_ASSERT ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN | HCF_ASSERT_PRINTF ) //0xC001 -//#define HCF_ASSERT ( HCF_ASSERT_LNK_MSF_RTN | HCF_ASSERT_RT_MSF_RTN | HCF_ASSERT_PRINTF | HCF_ASSERT_MB ) //just to test -#endif // _DEBUG || DBG - -#if definedDEBUG || defined _DEBUG || (definedDBG &&DBG !=0 ) -#ifdef _WIN32_WCE -#define DBGA2W (DBGSTR ) CeConvertAnsiToUnicodeLen((char*)DBGSTR) -#define OUTPUTDEBUGMSG (dprintf_exp) ((void)((! ZONE_DEBUG) ? 0:ce_debug_out dprintf_exp)) -#define ASSERTDEBUGMSG (cond, dprintf_exp) ((void)((cond) ? 0:ce_debug_out dprintf_exp)) - -#define ZONE_ERROR DEBUGZONE(0) -#define ZONE_WARN DEBUGZONE(1) -#define ZONE_FUNCTION DEBUGZONE(2) -#define ZONE_INIT DEBUGZONE(3) -#define ZONE_INTR DEBUGZONE(4) -#define ZONE_RCV DEBUGZONE(5) -#define ZONE_XMIT DEBUGZONE(6) -#define ZONE_ASSERT DEBUGZONE(7) -#define ZONE_DEBUG DEBUGZONE(8) -#define ZONE_OEM DEBUGZONE(9) -#define ZONE_HCF DEBUGZONE(10) -#define ZONE_PORTIO DEBUGZONE(11) -#define ZONE_LOGTOFILE DEBUGZONE(15) - -#else // !(_WIN32_WCE) - -#define OUTPUTDEBUGMSG (dprintf_exp) ((void) (DbgPrint dprintf_exp)) -// the assertdebugmsg macro will print filename, line followed by a caller-defined text, when cond == 0 -#define ASSERTDEBUGMSG (cond, print) ((void)((cond) ? 0: (DbgPrint("%s %s:%d - ", print, __FILE__, __LINE__)))) - -#define ZONE_ERROR 1 -#define ZONE_WARN 1 -#define ZONE_FUNCTION 1 -#define ZONE_INIT 1 -#define ZONE_INTR 1 -#define ZONE_RCV 1 -#define ZONE_XMIT 1 -#define ZONE_ASSERT 1 -#define ZONE_DEBUG 1 -#define ZONE_OEM 1 -#define ZONE_HCF 1 -#define ZONE_PORTIO 1 -#define ZONE_LOGTOFILE 1 - -#endif // _WIN32_WCE -#ifndef DBGA2W -#define DBGA2W -#endif // DBGA2W - -#else // !(defined DEBUG || defined _DEBUG || (defined DBG && DBG != 0) ) -#define OUTPUTDEBUGMSG (dprintf_exp) -#define ASSERTDEBUGMSG (cond, dprintf_exp) -#endif // DEBUG / DBG - -#if !definedHCF_MAX_MSG_CKIP_PADDING -#define HCF_MAX_MSG_CKIP_PADDING 0 -#endif // HCF_MAX_MSG_CKIP_PADDING - -#if !definedHCF_MAX_MSG -#define HCF_MAX_MSG 1514 -#endif // HCF_MAX_MSG - -#define HCF_LEGACY 1 //;?nv je moet wat - -#endif //WVLAN_41 / WVLAN_48 / WVLAN_52 / _WIN32_WCE - - -/************************************************************************************************/ -/**************************** P A C K E T D R I V E R ***************************************/ -/********************************** D O S O D I *********************************************/ -/************************************************************************************************/ - -#if definedWVLAN_42 || definedWVLAN_43 - -#pragma warning ( disable: 4001 ) -#define FAR __far //segmented 16 bits mode -#define BASED __based(__segname("_CODE")) //force all the "const" structures in the CODE segment - -//#define HCF_IO 0 //no DMA, no 32 bits - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -#define HCF_EXT HCF_EXT_MB -#define HCF_PROT_TIME 49 //49*10240 microseconds H/W failure protection timer - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -/******************************** CONFIGURATION MANAGEMENT *****************************************/ -#ifdef WVLAN_42 -#define MSF_COMPONENT_ID COMP_ID_PACKET -#define MSF_COMPONENT_VAR 1 -#define MSF_COMPONENT_MAJOR_VER 6 -#define MSF_COMPONENT_MINOR_VER 12 -#endif // WVLAN_42 - -#ifdef WVLAN_43 -#define MSF_COMPONENT_ID COMP_ID_ODI_16 -#define MSF_COMPONENT_VAR 1 -#define MSF_COMPONENT_MAJOR_VER 6 -#define MSF_COMPONENT_MINOR_VER 10 -#endif // WVLAN_43 - -/************************************** INPUT / OUTPUT **********************************************/ -#ifndef H_2_INC -#include <stdio.h> -#include <conio.h> -#if 1 //temorary use functions defined in hcf.c -#ifndef _DEBUG -#pragma intrinsic( _inp, _inpw, _outp, _outpw ) -#endif // _DEBUG - -#define IN_PORT_WORD (port) ((hcf_16)_inpw( (hcf_io)(port) )) -#define OUT_PORT_WORD (port, value) ((void)_outpw( (hcf_io)(port), value )) - -#if 1 // C implementation which let the processor handle the word-at-byte-boundary problem -#define IN_PORT_STRING_8_16 ( port, addr, n) while (n--) \ - { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_8 FAR*)addr)+=2; } -#define OUT_PORT_STRING_8_16 ( port, addr, n) while (n--) \ - { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; ((hcf_8 FAR*)addr)+=2; } -#elif 0 // C implementation which handles the word-at-byte-boundary problem -#define IN_PORT_STRING_8_16 ( port, addr, n) while ( n-- ) \ - { hcf_16 i = IN_PORT_WORD(port); *((hcf_8 FAR*)addr)++ = (hcf_8)i; *((hcf_8 FAR*)addr)++ = (hcf_8)(i>>8);} -#define OUT_PORT_STRING_8_16 ( port, addr, n) while ( n-- ) \ - { OUT_PORT_WORD( port, *((hcf_8 FAR*)addr) | *(((hcf_8 FAR*)addr)+1)<<8 ); (hcf_8 FAR*)addr+=2; } -#else // Assembler implementation -#define IN_PORT_STRING_8_16 ( port, addr, n) __asm \ -{ \ - __asm push di \ - __asm push es \ - __asm mov cx,n \ - __asm les di,addr \ - __asm mov dx,port \ - __asm rep insw \ - __asm pop es \ - __asm pop di \ -} - -#define OUT_PORT_STRING_8_16 ( port, addr, n) __asm \ -{ \ - __asm push si \ - __asm push ds \ - __asm mov cx,n \ - __asm lds si,addr \ - __asm mov dx,port \ - __asm rep outsw \ - __asm pop ds \ - __asm pop si \ -} - -#endif // Asm or C implementation -#define IN_PORT_STRING_32 ( port, addr, n) { int n2 = 2*n; IN_PORT_STRING_8_16(port, addr, n2) } -#define OUT_PORT_STRING_32 ( port, addr, n) { int n2 = 2*n; OUT_PORT_STRING_8_16(port, addr, n2) } -#endif // 0 //temorary use functions defined in hcf.c -#endif // H_2_INC - -#endif // WVLAN_42 / WVLAN_43 - - - -/************************************************************************************************/ -/**************************** D O S H - I / II L O A D E R **********************************/ -/************************************************************************************************/ - -#if definedH0_LDR || definedH1_LDR || definedH2_LDR || definedH5_LDR - -#if definedH0_LDR //implies H-I -#define HCF_DLV 0 //H-I legacy, meaningless under H-II -#define HCF_DLNV 1 //H-I legacy, meaningless under H-II -#endif // H0_LDR - -#if definedH1_LDR //implies H-I -#define HCF_DLV 1 //H-I legacy, meaningless under H-II -#define HCF_DLNV 0 //H-I legacy, meaningless under H-II -#endif // H1_LDR / H2_LDR - -//#if defined H2_LDR : not needed, H-II defaults are O.K for H2_LDR - -#ifdef H5_LDR -#define HCF_TYPE (HCF_TYPE_HII5 | HCF_TYPE_WARP ) -//;? why does only this subset of the H_LDRs need HCF_TYPE to be defined here -#endif - -#define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN //support dynamic linking of msf_assert routine -#define HCF_ENCAP 0 -#define HCF_INT_ON 0 -#define HCF_TALLIES 0 - -#define MSF_COMPONENT_ID COMP_ID_ODI_16 //;?By lack of any better -#define MSF_COMPONENT_VAR 1 -#define MSF_COMPONENT_MAJOR_VER 0 -#define MSF_COMPONENT_MINOR_VER 0 - -#include <stdio.h> -#include <conio.h> -#if definedNDEBUG -#pragma intrinsic( _inp, _inpw, _outp, _outpw ) -#endif // NDEBUG - -#if 0 //use 0 to replace I/O Macros with logging facility -#define IN_PORT_WORD (port) ((hcf_16)_inpw( (hcf_io)(port) )) -#define OUT_PORT_WORD (port, value) ((void)_outpw( (hcf_io)(port), value )) -#define IN_PORT_STRING_16 ( port, addr, n) \ - while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } -#define OUT_PORT_STRING_16 ( port, addr, n) \ - while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; } -#endif //use 0 to replace I/O Macros with logging facility - -#endif // H0_LDR / H1_LDR / H2_LDR - - - -/************************************************************************************************/ -/**************************** H C F D E M O P R O G R A M ***********************************/ -/************************************************************************************************/ - -#if definedHCF_DEMO - -#define HCF_DLV 1 //;?should become the default !defaults to 1 anyway for H-II -//#define HCF_DLNV 0 //defaults to 0 anyway for H-II - -#define HCF_ASSERT HCF_ASSERT_LNK_MSF_RTN //support dynamic linking of msf_assert routine - -#define HCF_ENCAP 0 -#define HCF_INT_ON 0 -#define HCF_TALLIES ( HCF_TALLIES_NIC | HCF_TALLIES_HCF ) - -//#define MSF_COMPONENT_ID NO configuration management - -#include <stdio.h> -#include <conio.h> -#if definedNDEBUG -#pragma intrinsic( _inp, _inpw, _outp, _outpw ) -#endif // NDEBUG - -#if 0 //use 0 to replace I/O Macros with logging facility -#define IN_PORT_WORD (port) ((hcf_16)_inpw( (hcf_io)(port) )) -#define OUT_PORT_WORD (port, value) ((void)_outpw( (hcf_io)(port), value )) -#define IN_PORT_STRING_16 ( port, addr, n) \ - while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } -#define OUT_PORT_STRING_16 ( port, addr, n) \ - while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; } -#endif //use 0 to replace I/O Macros with logging facility - -#endif // HCF_DEMO - - - -/************************************************************************************************/ -/*********************************** M A C O S **********************************************/ -/************************************************************************************************/ - -#if definedWVLAN_45 - -#include "Version.h" - -#define MSF_COMPONENT_ID COMP_ID_MAC_OS -#define MSF_COMPONENT_VAR VARIANT -#define MSF_COMPONENT_MAJOR_VER VERSION_MAJOR -#define MSF_COMPONENT_MINOR_VER VERSION_MINOR - -#define MAC_OS 1 - -#define HCF_BIG_ENDIAN 1 // selects Big Endian (a.k.a. Motorola), most significant byte first - -#if definedDEBUG -#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox -#endif // DEBUG - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus -extern volatile unsigned char *MacIOaddr; -extern hcf_16 IN_PORT_WORD (hcf_16 port); -extern void OUT_PORT_WORD (hcf_16 port,hcf_16 value); -extern void IN_PORT_STRING_16 (hcf_16 port,void *addr,hcf_16 len); -extern void OUT_PORT_STRING_16 (hcf_16 port,void *addr,hcf_16 len); - -#define SwapBytes (t) (((t) >> 8) + (((t) & 0xff) << 8)) - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // WVLAN_45 - - -/************************************************************************************************/ /****************************************** L I N U X *****************************************/ /************************************************************************************************/
@@ -951,1043 +464,6 @@ extern void OUT_PORT_STRING_16(hcf_16 port, void *addr, hcf_16 len);#define HCF_MAX_MSG 1600 //get going ;?#endif // WVLAN_49 - - -/************************************************************************************************/ -/********************************************* Q N X ******************************************/ -/************************************************************************************************/ - -#if defined __QNX__ || definedWVLAN_50 - -#define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ... -#define MSF_COMPONENT_VAR 0 //...compatibilty check to function -#define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more -#define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do - -#include <conio.h> - -#define IN_PORT_WORD (port) ((hcf_16)inpw( (hcf_io)(port) )) -#define OUT_PORT_WORD (port, value) (outpw( (hcf_io)(port), (hcf_16) (value) )) -/* -#define IN_PORT_STRING_16( port, addr, n) \ -while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } -#define OUT_PORT_STRING_16( port, addr, n) \ -while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; } -*/ - -#endif // QNX / WVLAN_50 - - - -/************************************************************************************************/ -/********************************************* B E O S ****************************************/ -/************************************************************************************************/ - -#if defined __BEOS__ - -#define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ... -#define MSF_COMPONENT_VAR 0 //...compatibilty check to function -#define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more -#define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do - -#include <drivers/Drivers.h> -#include <drivers/KernelExport.h> - -uint8 read_io_8 (int ); -void write_io_8 (int ,uint8 ); -uint16 read_io_16 (int ); -void write_io_16 (int ,uint16 ); - -#define IN_PORT_WORD (port) ((hcf_16)read_io_16( (hcf_io)(port) )) -#define OUT_PORT_WORD (port, value) (write_io_16( (hcf_io)(port), (hcf_16) (value) )) -/* -#define IN_PORT_STRING_16( port, addr, n) \ -while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } -#define OUT_PORT_STRING_16( port, addr, n) \ -while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; } -*/ -#endif // __BEOS__ - - - -/************************************************************************************************/ -/******************************** U S B D O N G L E *****************************************/ -/************************************************************************************************/ - -#if definedUSB -#include "gpif.h" - -#define MSF_COMPONENT_MAJOR_VER 0 -#define MSF_COMPONENT_MINOR_VER 1 - -#define IN_PORT_WORD (port) (Hermes_IO_Read( (hcf_8)(port))) -#define OUT_PORT_WORD(port, value) (Hermes_IO_Write( (hcf_8)port, /*(hcf_16)*/(value) ) ) -/* !!!! NOTE USB supports only 16-bits I/O and no 8-bits I/O -* as a consequence the IN_/OUT_PORT_STRING_16 macros use hcf_16* rather than hcf_8 pointers -* to get more optimal code -* therefore the pointers are incremented by 1 (which means two "bytes") rather than by 2 -*/ -//#define IN_PORT_STRING_16( port, addr, n) while ( n-- ) { *((hcf_16*)addr)++ = IN_PORT_WORD( port ); } -//#define OUT_PORT_STRING_16( port, addr, n) while ( n-- ) { OUT_PORT_WORD( port, *((hcf_16*)addr)++ ); } -#define IN_PORT_STRING_16 ( port, dst, n) while ( n-- ) { *dst++ = IN_PORT_WORD( port ); } -#define OUT_PORT_STRING_16 ( port, src, n) while ( n-- ) { OUT_PORT_WORD( port, *src++ ); } - -//#define HCF_TYPE ( HCF_TYPE_AP | HCF_TYPE_WPA ) -#define HCF_TYPE HCF_TYPE_WPA - -#endif // USB - - -/************************************************************************************************/ -/****************************************** FreeBSD *******************************************/ -/************************************************************************************************/ - -#if defined __FREE_BSD__ - -#define MSF_COMPONENT_ID COMP_ID_FreeBSD -#define MSF_COMPONENT_VAR 1 -#define MSF_COMPONENT_MAJOR_VER 1 -#define MSF_COMPONENT_MINOR_VER 0 - -#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O - -#include <machine/cpufunc.h> - -#define IN_PORT_WORD (port) ((hcf_16)inw( (hcf_io)(port) )) -#define OUT_PORT_WORD (port, value) (outw((hcf_io)(port), (hcf_16)(value))) - -/* -#define IN_PORT_STRING_16( port, addr, n) \ -while ( n-- ) { *(hcf_16*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } -#define OUT_PORT_STRING_16( port, addr, n) \ -while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16*)addr ) ; (cast)addr += 2; } -*/ -#endif // __FREE_BSD__ - - - -/************************************************************************************************/ -/********************************* W A V E P O I N T ******************************************/ -/************************************************************************************************/ - -#if definedWVLAN_81 /* BORLANDC */ - -#define EXTERN_C extern // needed because DHF uses this instead of 'extern' - -#define MSF_COMPONENT_ID COMP_ID_AP1 -#define MSF_COMPONENT_VAR 1 -#define MSF_COMPONENT_MAJOR_VER 4 -#define MSF_COMPONENT_MINOR_VER 0 - -#define HCF_PROT_TIME 49 //49*10240 microseconds H/W failure protection timer - -//#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox /* debug build only */ - -#if !definedFAR -#define FAR far // segmented 16 bits mode -#endif // FAR - -#define IN_PORT_WORD (port) (inport( (hcf_io)(port) )) -#define OUT_PORT_WORD (port, value) (outport( (hcf_io)(port), value )) - -#define IN_PORT_STRING_16 (port, addr, len) \ - asm { push di; push es; mov cx,len; les di,addr; mov dx,port; rep insw; pop es; pop di } - -#define OUT_PORT_STRING_16 (port, addr, len) \ - asm { push si; push ds; mov cx,len; lds si,addr; mov dx,port; rep outsw; pop ds; pop si } - -#endif // WVLAN_81 - - -/************************************************************************************************/ -/******************************** W A V E L A U N C H *****************************************/ -/************************************************************************************************/ - -#if definedWVLAUNCH - -#include "DriverX.h" -extern HWDEVICE * g_pDevice; - -//#define MSF_COMPONENT_ID 0 //;? to get around browser problem - -#define IN_PORT_WORD (port) HwInpw( g_pDevice, port ) -#define OUT_PORT_WORD (port, value) HwOutpw( g_pDevice, port, value ) - - -// C implementation which let the processor handle the word-at-byte-boundary problem -/* -#define IN_PORT_STRING_16( port, addr, n) \ -while ( n-- ) { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); (cast)addr += 2; } -#define OUT_PORT_STRING_16( port, addr, n) \ -while ( n-- ) { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ) ; (cast)addr += 2; } -*/ -#endif // WVLAUNCH - - - -/************************************************************************************************/ -/************************************* W C I T S T *********************************************/ -/************************************************************************************************/ - -#if definedWCITST -#define MSF_COMPONENT_ID 0 //Although there is no DUI support, we need this to get ... -#define MSF_COMPONENT_VAR 0 //...compatibilty check to function -#define MSF_COMPONENT_MAJOR_VER 0 //...;?this is worth looking into to make this a more -#define MSF_COMPONENT_MINOR_VER 0 //..."defined" I/F so OEMers can figure out what to do - -//#define HCF_ENCAP HCF_ENC_NONE //to get going -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#define HCF_TYPE (HCF_TYPE_WPA | HCF_TYPE_PRELOADED) // Hermes-I for HCF6, II for HCF7 -#define HCF_DMA 1 -//#define LLB //!!!!MIC Debug Only -#if definedLLB && !((HCF_TYPE ) &HCF_TYPE_WPA ) -err: no LLB unless SSN; -#endif // LLB / HCF_TYPE_WPA -//#define HCF_ALIGN 2 -#define HCF_DLV 1 //just to change memory layout ????;? -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To ease testing the different options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -#define HCF_ASSERT HCF_ASSERT_SW_SUP // logging via Hermes support registerr -//#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox - -#if defined __GNUC__ -#include "stdio.h" -//#include "unistd.h" //ioperm libc5 -#include "sys/io.h" //ioperm glibc -#define extern//see IO Port Programming mini-HOWTO -//#include "asm/io.h" // -#define IN_PORT_WORD (port) inw( (hcf_io)(port) ) -#define IN_PORT_DWORD (port) inl( (hcf_io)(port) ) -#define OUT_PORT_WORD (port, value) outw( (hcf_io)(port), (hcf_16)(value) ) -#define OUT_PORT_DWORD (port, value) outl( (hcf_io)(port), (hcf_16)(value) ) -#else -#pragma warning ( disable: 4001 ) -#define FAR __far // segmented 16 bits mode - -#include <stdio.h> -#include <conio.h> -#ifndef _DEBUG -#pragma intrinsic( _inp, _inpw, _outp, _outpw ) -#endif // _DEBUG - -#ifdef LOG -extern FILE * utm_logfile; -hcf_16 ipw (hcf_16 port ); -hcf_8 ipb (hcf_16 port ); -void opw (hcf_16 port,hcf_16 value ); -void opb (hcf_16 port,hcf_8 value ); - -#define IN_PORT_WORD (port) ipw( (hcf_io)(port) ) -#define OUT_PORT_WORD (port, value) opw( (hcf_io)(port), (hcf_16)(value) ) -#else // LOG -#define IN_PORT_WORD (port) ((hcf_16)_inpw( (hcf_io)(port) )) -#define OUT_PORT_WORD (port, value) ((void)_outpw( (hcf_io)(port), value )) -#endif // LOG - -#if 1 //ASM example -#define IN_PORT_STRING_16 ( port, addr, len) __asm \ -{ \ - __asm push di \ - __asm push es \ - __asm mov cx,len \ - __asm les di,addr \ - __asm mov dx,port \ - __asm rep insw \ - __asm pop es \ - __asm pop di \ -} - -#define OUT_PORT_STRING_16 ( port, addr, len) __asm \ -{ \ - __asm push si \ - __asm push ds \ - __asm mov cx,len \ - __asm lds si,addr \ - __asm mov dx,port \ - __asm rep outsw \ - __asm pop ds \ - __asm pop si \ -} - -#endif // asm example - -#endif // __GCC__ - -#if ! definedIN_PORT_STRING_16 -#define IN_PORT_STRING_16 ( port, addr, n) while (n--) \ - { *(hcf_16 FAR*)addr = IN_PORT_WORD( port ); ((hcf_16 FAR*)addr)++; } -#define OUT_PORT_STRING_16 ( port, addr, n) while (n--) \ - { OUT_PORT_WORD( port, *(hcf_16 FAR*)addr ); ((hcf_16 FAR*)addr)++; } -#endif // IN_PORT_STRING_16 - -#endif // WCITST - - -/************************************************************************************************/ -/******************************* Motorola Power PC 800 family *********************************/ -/************************************************************************************************/ -/* known users: LH@I -*/ - -#if definedI_MPC8XX - -#define MSF_COMPONENT_VAR 0 -#define MSF_COMPONENT_ID 0 -#define MSF_COMPONENT_MAJOR_VER 1 -#define MSF_COMPONENT_MINOR_VER 0 - -#define HCF_HSI_VAR 1 - -#define HCF_BIG_ENDIAN 1 -#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O - -#include "o_portbl.h" -#include "ipcmcia.h" -typedef o_uint8_t hcf_8 ; -typedef o_uint16_t hcf_16 ; -typedef o_uint32_t hcf_32 ; - -/***************************************************************************/ - - -#ifdef _lint -#else -asm hcf_16 IN_PORT_WORD(int port) -{ -% reg port - lhbrx r3,r0,port - eieio -} -#endif // _lint - - -#ifdef _lint -#else -asm void OUT_PORT_WORD(int port, hcf_16 value) -{ -% reg port, value - sthbrx value,r0,port - eieio -} -#endif // _lint - -/***************************************************************************/ - -#define IN_PORT_STRING_16 (port, addr, len) \ - { \ - unsigned l = (len); \ - hcf_16 *d = (volatile hcf_16 *)(addr); \ - while (l--) \ - { \ - *d++ = *(volatile hcf_16 *)(port); \ - EIEIO(); \ - } \ - } - -#define OUT_PORT_STRING_16 (port, addr, len) \ - { \ - unsigned l = (len); \ - hcf_16 *s = (volatile hcf_16 *)(addr); \ - while (l--) \ - { \ - *(volatile hcf_16 *)(port) = *s++; \ - EIEIO(); \ - } \ - } - -#endif // I_MPC8XX - - - -/************************************************************************************************/ -/********************************** Diab or High C 29K **************************************/ -/************************************************************************************************/ -/* known users: GK@C -*/ - -#if defined _AM29K - -#define MSF_COMPONENT_VAR 0 -#define MSF_COMPONENT_ID COMP_ID_AP1 -#define MSF_COMPONENT_MAJOR_VER 1 -#define MSF_COMPONENT_MINOR_VER 0 - -#define HCF_BIG_ENDIAN 1 -#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O - -#define SwapBytes (t)/*lint -e572*/ (((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/ - -#if defined __ppc -#ifndef __GNUC__ -#define __asm__ asm -#endif - -#if ! defined _lint -#define EIEIO () __asm__(" eieio") -#else -#define EIEIO () -#endif - -static hcf_16 IN_PORT_WORD (int port) { -hcf_16 value = *(volatile hcf_16 *)(port);EIEIO (); - value =SwapBytes (value); -return value; - } - -#define OUT_PORT_WORD (port, value) \ - { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); } -#else -#define IN_PORT_WORD (port) (*(volatile hcf_16 *)(port)) -#define OUT_PORT_WORD (port, value) (*(volatile hcf_16 *)(port) = (value)) -#endif // __ppc - -/***************************************************************************/ - -#define IN_PORT_STRING_16 ( port, addr, len) { \ - unsigned l = (len); \ - hcf_16 t, *d = (volatile hcf_16 *)(addr); \ - while (l--) { \ - t = IN_PORT_WORD(port); \ - *d++ = SwapBytes(t); \ - } \ - } - -#define OUT_PORT_STRING_16 ( port, addr, len) { \ - unsigned l = (len); \ - hcf_16 t, *s = (volatile hcf_16 *)(addr); \ - while (l--) { \ - t = *s++; \ - OUT_PORT_WORD(port, SwapBytes(t)); \ - } \ - } - -#if PRODUCT ==9150 -#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox -#undef MSF_COMPONENT_ID -#endif // 9150 - -#endif // _AM29K - - - -/************************************************************************************************/ -/***************************************** MPC860 **********************************************/ -/************************************************************************************************/ -/* known users: RR -*/ - -#if definedCPU -#if CPU ==PPC860 - -#define MSF_COMPONENT_VAR 0 -#define MSF_COMPONENT_ID 0 -#define MSF_COMPONENT_MAJOR_VER 1 -#define MSF_COMPONENT_MINOR_VER 0 - -#define HCF_BIG_ENDIAN 1 -#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O - -#define SwapBytes (t)/*lint -e572*/ (((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/ - -#ifndef __GNUC__ -#define __asm__ asm -#endif - -#if ! defined _lint -#define EIEIO () __asm__(" eieio") -#else -#define EIEIO () -#endif - -static hcf_16 IN_PORT_WORD (int port) { -hcf_16 value = *(volatile hcf_16 *)(port);EIEIO (); - value =SwapBytes (value); -return value; -#ifdef __GNUC__ -/* the following serves to avoid the compiler warnings that -* IN_PORT_WORD() is not used in some files */ - (void )IN_PORT_WORD ; -#endif -} - -#define OUT_PORT_WORD (port, value) \ - { *(volatile hcf_16 *)(port) = SwapBytes(value); EIEIO(); } - -/***************************************************************************/ - -#define IN_PORT_STRING_16 ( port, addr, len) { \ - unsigned l = (len); \ - hcf_16 t; \ - volatile hcf_16 *d = (volatile hcf_16 *)(addr); \ - while (l--) { \ - t = IN_PORT_WORD(port); \ - *d++ = SwapBytes(t); \ - } \ - } - -#define OUT_PORT_STRING_16 ( port, addr, len) { \ - unsigned l = (len); \ - hcf_16 t; \ - volatile hcf_16 *s = (volatile hcf_16 *)(addr); \ - while (l--) { \ - t = *s++; \ - OUT_PORT_WORD(port, SwapBytes(t)); \ - } \ - } - -#if PRODUCT ==9150 -#define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox -#undef MSF_COMPONENT_ID -#endif - -#endif /* PPC860 */ -#endif /* CPU */ - - - -/************************************************************************************************/ -/**************************** Microtec Research 80X86 Compiler *********************************/ -/************************************************************************************************/ - -#if 0 - -//#undef HCF_TYPE // Hermes-I Station F/W without SSN support - -#define MSF_COMPONENT_VAR 0 -#define MSF_COMPONENT_ID 0 -#define MSF_COMPONENT_MAJOR_VER 1 -#define MSF_COMPONENT_MINOR_VER 0 - -extern int far inp( int ); -extern void far outp( int, int ); -extern int far inpw( int ); -extern void far outpw( int, int ); - -#define IN_PORT_WORD (port) ((hcf_16)inpw( (hcf_io)(port) )) -#define OUT_PORT_WORD (port, value) ((void)outpw( (hcf_io)(port), value )) - -#define IN_PORT_STRING_16 ( port, addr, len) { \ - unsigned l = (len); \ - hcf_16 *d = (hcf_16 *)(addr); \ - while (l--) *d++ = IN_PORT_WORD(port); \ - } - -#define OUT_PORT_STRING_16 ( port, addr, len) { \ - unsigned l = (len); \ - hcf_16 *s = (hcf_16 *)(addr); \ - while (l--) OUT_PORT_WORD(port, *s++); \ - } -#endif /* Microtec 80X86 C Compiler */ - - - -/************************************************************************************************/ -/****************************** W A V E L A N E C ********************************************/ -/************************************************************************************************/ -/* known users: KM -*/ - -#ifdef mc68302 - -#define MSF_COMPONENT_ID COMP_ID_EC - -#include <version.h> - -#define MSF_COMPONENT_VAR 1 -#define MSF_COMPONENT_MAJOR_VER MAJOR_VERSION -#define MSF_COMPONENT_MINOR_VER MINOR_VERSION - -#define HCF_BIG_ENDIAN 1 -#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O - -#define SwapBytes (t)/*lint -e572*/ (((t) >> 8) + (((t) & 0xff) << 8))/*lint +e572*/ - -#define PCMCIA_ADDRESS 0xc80000UL - -#define IN_PORT_2BYTES (port) (*(hcf_16 *)(port)) -#if 0 -static hcf_16 IN_PORT_WORD (hcf_32 port)// should be hcf_io, not hcf_32 -{ -hcf_16 word =IN_PORT_2BYTES (port); -return SwapBytes (word); -} -#else -static hcf_16 swap_var; -#define IN_PORT_WORD (port) \ - (((swap_var = IN_PORT_2BYTES(port)) >> 8) + (((swap_var) & 0xff) << 8)) -#endif -#define OUT_PORT_2BYTES (port, value) (*(hcf_16 *)(port) = (hcf_16)(value)) -#define OUT_PORT_WORD (port, value) OUT_PORT_2BYTES(port, SwapBytes(value)) - -/* -#define IN_PORT_STRING_16(port, addr, len) \ -while ((len)--) {*(hcf_16 *)(addr) = IN_PORT_2BYTES(port); ((cast)addr) += 2; } -#define OUT_PORT_STRING_16(port, addr, len) \ -while ((len)--) {OUT_PORT_2BYTES((port), *(hcf_16 *)(addr)) ; ((cast)addr) += 2; } -*/ - -#endif /* mc68302 */ - - - -/************************************************************************************************/ -/********************************* NGAP ***************************************/ -/************************************************************************************************/ - -#if defined __VX_WORKS__/* VxWorks */ - -#if definedWLC_STATION -//#undef HCF_TYPE /* Hermes-I Station F/W without SSN support */ -#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA -#else -#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP -#endif // WLC_STATION - -#define HCF_YIELD (taskDelay(0) == 0) - -#define MSF_COMPONENT_VAR 1 -#define MSF_COMPONENT_MAJOR_VER 1 -#define MSF_COMPONENT_MINOR_VER 0 - -// #define HCF_ASSERT HCF_ASSERT_MB // logging via Mailbox - -#if definedPC486BSP - -#define IN_PORT_WORD (port) (sysInWord ((hcf_io)(port))) -#define OUT_PORT_WORD (port, value) (sysOutWord ((hcf_io)(port), (hcf_16) (value))) -#define IN_PORT_STRING_16 (port, addr, n) (sysInWordString ((hcf_io)(port), addr, n)) -#define OUT_PORT_STRING_16 (port, addr, n) (sysOutWordString ((hcf_io)(port), addr, n)) - -#elif definedAS2000BSP - -#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O - -/* Define PCI stuff here. */ -unsigned short sysRead16 (unsigned short *port ); -void sysWrite16 (unsigned short *port,unsigned short value ); - -#define PCI_IN_BYTE ( port ) \ - *(unsigned char *)( port ) - -#define PCI_IN_WORD ( port ) \ - sysRead16( (unsigned short *)( port ) ) - -#define PCI_OUT_BYTE ( port, value ) \ - *(unsigned char *)( port ) = (unsigned char)( value ) - -#define PCI_OUT_WORD ( port, value ) \ - sysWrite16( (unsigned short *)( port ), (unsigned short)( value ) ) - -#define IN_PORT_WORD ( port ) \ - PCI_IN_WORD( port ) - -#define OUT_PORT_WORD ( port, value ) \ - PCI_OUT_WORD( port, value ) - -#define IN_PORT_STRING_16 ( port, buf, len ) \ - do { \ - hcf_16 *p; \ - \ - for ( p = (hcf_16 *)(buf); p < &( (hcf_16 *)(buf) )[ (int)len ]; p++ ) { \ - *p = PCI_IN_WORD( port ); \ - } \ - } while ( 0 ) - -#define OUT_PORT_STRING_16 ( port, buf, len ) \ - do { \ - const hcf_16 *p; \ - \ - for ( p = (const hcf_16 *)( buf ); p < &( (const hcf_16 *)(buf) )[ (int)len ]; p++ ) { \ - PCI_OUT_WORD( port, *p ); \ - } \ - } while ( 0 ) - -#elif definedFADS860BSP /* elif defined AS2000BSP */ - -#define HCF_BIG_ENDIAN 1 - -#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O - -#ifndef __GNUC__ -#define __asm__ asm -#endif - -#if ! defined _lint -#define EIEIO () __asm__(" eieio") -#else -#define EIEIO () -#endif - -static hcf_16 IN_PORT_WORD (int port) { -hcf_16 value = *(volatile hcf_16 *)(port);EIEIO (); - value = ((value &0xff00 ) >>8 ) + ((value &0x00ff ) <<8 ); -/* value = CNV_LITTLE_TO_SHORT(value); */ -return value; -#ifdef __GNUC__ -/* the following serves to avoid the compiler warnings that -* IN_PORT_WORD() is not used in some files */ - (void )IN_PORT_WORD ; -#endif -} - -#define OUT_PORT_WORD (port, value) \ - { *(volatile hcf_16 *)(port) = CNV_SHORT_TO_LITTLE(value); EIEIO(); } - -/***********************************************************************/ - -#define IN_PORT_STRING_16 ( port, addr, len) { \ - unsigned l = (len); \ - volatile hcf_16 *d = (volatile hcf_16 *)(addr); \ - while (l--) { \ - *d++ = *(volatile hcf_16 *)(port); \ - EIEIO(); \ - } \ - } - -#define OUT_PORT_STRING_16 ( port, addr, len) { \ - unsigned l = (len); \ - volatile hcf_16 *s = (volatile hcf_16 *)(addr); \ - while (l--) { \ - *(volatile hcf_16 *)(port) = *s++; \ - EIEIO(); \ - } \ - } - -#elif definedDAYTONABSP - -#define HCF_BIG_ENDIAN 1 - -#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O - -#ifndef __GNUC__ -#define __asm__ asm -#endif - -#define IN_PORT_WORD (port) (sysOrinocoInWord((unsigned long)(port))) -#define OUT_PORT_WORD (port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value))) - -#define IN_PORT_STRING_16 (port,addr,len) (sysOrinocoInString((port), (addr), (len))) -#define OUT_PORT_STRING_16 (port,addr,len) (sysOrinocoOutString((port), (addr), (len))) - -extern unsigned char sysOrinocoInByte (unsigned long port); -extern unsigned short sysOrinocoInWord (unsigned long port); -extern void sysOrinocoInString (unsigned long port,void *addr,unsigned short len); - -extern void sysOrinocoOutByte (unsigned long port,unsigned char value); -extern void sysOrinocoOutWord (unsigned long port,unsigned short value); -extern void sysOrinocoOutString (unsigned long port,void *addr,unsigned short len); - -#elif definedALPHA_BSP - -#define HCF_BIG_ENDIAN 1 - -#define HCF_IO HCF_IO_MEM // overrule standard Port I/O with Memory mapped I/O - -#ifndef __GNUC__ -#define __asm__ asm -#endif - -#define IN_PORT_WORD (port) (sysOrinocoInWord((unsigned long)(port))) -#define OUT_PORT_WORD (port,value) (sysOrinocoOutWord((unsigned long)(port), (unsigned short)(value))) - -#define IN_PORT_STRING_16 (port,addr,len) (sysOrinocoInString((port), (addr), (len))) -#define OUT_PORT_STRING_16 (port,addr,len) (sysOrinocoOutString((port), (addr), (len))) - -extern unsigned char sysOrinocoInByte (unsigned long port); -extern unsigned short sysOrinocoInWord (unsigned long port); -extern void sysOrinocoInString (unsigned long port,void *addr,unsigned short len); - -extern void sysOrinocoOutByte (unsigned long port,unsigned char value); -extern void sysOrinocoOutWord (unsigned long port,unsigned short value); -extern void sysOrinocoOutString (unsigned long port,void *addr,unsigned short len); - -#else - -err: /* commented here */ /* "BSP is not defined..." */ - -#endif /* else PC486BSP */ - -#endif // __VX_WORKS__ - - - -/************************************************************************************************/ -/****************************** VXWORKS. Motorola Sandpoint PowerPC 824X ***********************/ -/************************************************************************************************/ -#ifdef __VX_WORKS_SANDPOINT_824X__ - -#include <vxWorks.h> -#include <sysLib.h> -#include <taskLib.h> - -#ifdef WVLAN_53 -#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA -#endif /* WVLAN_53 */ - -#ifdef WVLAN_54 -#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP -#endif /* WVLAN_54 */ - -#ifdef WVLAN_56 -#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END -#endif /* WVLAN_56 */ - -#if !definedMSF_COMPONENT_ID -#error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56" -#endif - -#define MSF_COMPONENT_VAR 1 - -#define HCF_EXT HCF_EXT_INFO_LOG -#define HCF_SLEEP ( HCF_CDS | HCF_DDS ) -//#define HCF_SLEEP ( HCF_DDS ) - -#ifndef HCF_ACT_WAKEUP -#define HCF_ACT_WAKEUP 0x1D -#endif // HCF_ACT_WAKEUP - -#if definedFATNIC | definedBEAGLE_H253 -#define T1__HCF_TYPE HCF_TYPE_STA -#else -#define T1__HCF_TYPE HCF_TYPE_AP | HCF_TYPE_STA -#endif - -#ifdef HERMES_USB -#define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB) -#else // HERMES_USB -#define T2__HCF_TYPE (T1__HCF_TYPE) -#endif // HERMES_USB - -#ifdef _WARP -#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5) -#else // _WARP -#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII) -#endif // WARP - -#ifdef _CCX -#define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX) -#else // _WARP -#define T4__HCF_TYPE (T3__HCF_TYPE) -#endif // _CCX - -#define T5__HCF_TYPE (T4__HCF_TYPE) - -// Default to TYPE_AP + SSN! -#define HCF_TYPE (T5__HCF_TYPE ) - - - -#define MSF_COMPONENT_MAJOR_VER 2 -#define MSF_COMPONENT_MINOR_VER 0 - -#define HCF_IO HCF_IO_MEM -#define HCF_DMA 0 -#define HCF_MEM_IO 1 -#define HCF_BIG_ENDIAN 1 - -//#define support_32bits 1 - -#define IN_PORT_WORD (port) (sysInWord( (hcf_io)(port) )) -#define OUT_PORT_WORD (port, value) (sysOutWord( (hcf_io)(port), (hcf_16)(value) )) -#define IN_PORT_DWORD (port) (sysInLong( (hcf_io)(port) )) -#define OUT_PORT_DWORD (port, value) (sysOutLong( (hcf_io)(port), (hcf_16)(value) )) -#define IN_PORT_STRING_16 (port, dst, n) (sysInWordString((hcf_io)(port), (hcf_16 *)dst, n)) -#define OUT_PORT_STRING_16 (port, src, n) (sysOutWordString((hcf_io)(port), (hcf_16 *)src, n)) - -#ifdef WVLAN_DEBUG -#define DBG 1 -#define _DEBUG 1 -#endif - -/* we'll need to add these prints someday */ -#define OUTPUTDEBUGMSG (dprintf_exp) -#define ASSERTDEBUGMSG (cond, dprintf_exp) - -#define HCF_INTERFACE_CONNECT (ifbp) -#define HCF_INTERFACE_DISCONNECT (ifbp) -#define HCF_ENTER_INTERFACE_FUNCT (ibfb) -#define HCF_LEAVE_INTERFACE_FUNCT (ifbp) - -#define CNV_END_INT (w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 ) -#define CNV_LITTLE_TO_INT (w) CNV_END_INT(w) -#define CNV_INT_TO_LITTLE (w) CNV_LITTLE_TO_INT(w) - -#endif /* __VX_WORKS_SANDPOINT_824X__ */ - -/************************************************************************************************/ -/************************************* VXWORKS. ARM T8300 IPPhone *****************************/ -/************************************************************************************************/ -#if defined(IPT_T8300 ) || defined(IPT_T8307 ) - -#include <vxWorks.h> -#include <sysLib.h> -#include <taskLib.h> - -#define HCF_ALIGN 4/* default to 4 byte alignment */ - -#define BEAGLE_H253 /* Hermes 2.5.3 build, better to be in the project file */ -#define OOR_DDS /* Hermes 2.5.3 build, better to be in the project file */ -#define FATNIC - - -#ifdef WVLAN_53 -#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDSTA -#endif /* WVLAN_53 */ - -#ifdef WVLAN_54 -#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_ENDAP -#endif /* WVLAN_54 */ - -#ifdef WVLAN_56 -#define MSF_COMPONENT_ID COMP_ID_VX_WORKS_END -#endif /* WVLAN_56 */ - -#if !definedMSF_COMPONENT_ID -#error "you must define an MSF component ID: WVLAN_53, WVLAN_54, WVLAN_56" -#endif - -#define MSF_COMPONENT_VAR 1 - -#define HCF_EXT HCF_EXT_INFO_LOG -//#define HCF_EXT HCF_EXT_INFO_LOG | HCF_EXT_MB -#define HCF_SLEEP ( HCF_CDS | HCF_DDS ) -//#define HCF_SLEEP ( HCF_DDS ) - -#ifndef HCF_ACT_WAKEUP -#define HCF_ACT_WAKEUP 0x1D -#endif // HCF_ACT_WAKEUP - -#if definedFATNIC || definedBEAGLE_H253 -#define T1__HCF_TYPE HCF_TYPE_STA -#else -//#define T1__HCF_TYPE HCF_TYPE_AP | HCF_TYPE_STA -#define T1__HCF_TYPE HCF_TYPE_STA/* dz, Station code only */ -#endif - -#ifdef HERMES_USB -#define T2__HCF_TYPE (T1__HCF_TYPE | HCF_TYPE_USB) -#else // HERMES_USB -#define T2__HCF_TYPE (T1__HCF_TYPE) -#endif // HERMES_USB - -#ifdef _WARP -#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII5) -#else // _WARP -#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_WPA | HCF_TYPE_HII) -//#define T3__HCF_TYPE (T2__HCF_TYPE | HCF_TYPE_HII) /* dz. no WPA support at this time, test code */ -#endif // WARP - -#ifdef _CCX -#define T4__HCF_TYPE (T3__HCF_TYPE | HCF_TYPE_CCX) -#else // _WARP -#define T4__HCF_TYPE (T3__HCF_TYPE) -#endif // _CCX - -#define T5__HCF_TYPE (T4__HCF_TYPE) - -// Default to TYPE_AP + SSN! -#define HCF_TYPE (T5__HCF_TYPE ) - - -#define MSF_COMPONENT_MAJOR_VER 2 -#define MSF_COMPONENT_MINOR_VER 0 - -#define HCF_IO HCF_IO_MEM -#define HCF_DMA 0 -#define HCF_MEM_IO 1 - - -/* Endian is determined by vxWorks project compile option */ -#if (_BYTE_ORDER == _BIG_ENDIAN) -#undef HCF_LITTLE_ENDIAN -#define HCF_BIG_ENDIAN 1 -#endif - - -#define CNV_END (w) ( ((hcf_16)(w) & 0x00FF) << 8 | ((hcf_16)(w) & 0xFF00) >> 8 ) -#if definedHCF_BIG_ENDIAN -//******************************************** B I G E N D I A N ******************************************* -#define CNV_LITTLE_TO_INT (w) CNV_END(w) // endianess conversion needed -#define CNV_BIG_TO_INT (w) (w) // no endianess conversion needed -#else -//****************************************** L I T T L E E N D I A N **************************************** -#define CNV_LITTLE_TO_INT (w) (w) // no endianess conversion needed -#define CNV_BIG_TO_INT (w) CNV_END(w) // endianess conversion needed -#endif // HCF_BIG_ENDIAN - -// conversion macros which can be expressed in other macros -#define CNV_INT_TO_LITTLE (w) CNV_LITTLE_TO_INT(w) -#define CNV_INT_TO_BIG (w) CNV_BIG_TO_INT(w) - - - -#define IN_PORT_WORD ( port ) *((volatile hcf_16 *)( port )) -#define OUT_PORT_WORD ( port, value ) *((volatile hcf_16 *)( port )) = ((hcf_16)( value )) -//#define IN_PORT_BYTE( port ) *((volatile hcf_8 *)( port )) - -#define IN_PORT_STRING ( port, addr, len) { \ - unsigned l = len; \ - hcf_16 *d = (hcf_16 *)(addr); \ - hcf_16 t; \ - while (l--) { \ - t = IN_PORT_WORD(port); \ - *d++ = CNV_LITTLE_TO_INT(t); \ - } \ -} // IN_PORT_STRING - -#define OUT_PORT_STRING ( port, addr, len) { \ - unsigned l = (len); \ - hcf_16 *s = (hcf_16 *)(addr); \ - hcf_16 t; \ - while (l--) { \ - t = *s++; \ - t = CNV_LITTLE_TO_INT(t); \ - OUT_PORT_WORD(port, t); \ - } \ -} // OUT_PORT_STRING - -#define IN_PORT_STRING_16 (port, dst, n) { \ - unsigned l = (n); \ - hcf_16 *d = (hcf_16 *)(dst); \ - while (l--) { \ - *d++ = IN_PORT_WORD(port); \ - } \ -} // IN_PORT_STRING_16 - -#define OUT_PORT_STRING_16 (port, src, n) { \ - hcf_16 t; \ - int l = (n); \ - hcf_16 *s = (hcf_16 *)(src); \ - while (l--) { \ - t = *s++; \ - OUT_PORT_WORD(port, t); \ - } \ -} // OUT_PORT_STRING_16 - -/* #define HCF_YIELD (taskDelay(0) == 0) */ - - - -#ifdef WVLAN_DEBUG -#define DBG 1 -#define _DEBUG 1 -#endif - -/* we'll need to add these prints someday */ -#define OUTPUTDEBUGMSG (dprintf_exp) -#define ASSERTDEBUGMSG (cond, dprintf_exp) - -#define HCF_INTERFACE_CONNECT (ifbp) -#define HCF_INTERFACE_DISCONNECT (ifbp) -#define HCF_ENTER_INTERFACE_FUNCT (ibfb) -#define HCF_LEAVE_INTERFACE_FUNCT (ifbp) - -#define sysInWord (offsetAddr) IN_PORT_WORD(offsetAddr) -#define sysInByte (offsetAddr) IN_PORT_BYTE(offsetAddr) -#define sysOutWord (addr, value) OUT_PORT_WORD(addr, value) - -#endif /*IPT_T8300 */ -/************************************************************************************************************/ /*********************************** **************************************/ /************************************************************************************************************/
Signature · 1 line
1.7.4.1
PATCH 2/13 staging: wlags49_h2: Reindent hcfdef.h
In reply to David KilroyUntabified with tab-width set to 4. Reindented with linux style.
Also remove BITN macros.
--- drivers/staging/wlags49_h2/hcfdef.h | 817 +++++++++++++++++------------------ 1 files changed, 390 insertions(+), 427 deletions(-)
drivers/staging/wlags49_h2/hcfdef.h +390 -427
@@ -1,286 +1,249 @@ - -// vim:tw=110:ts=4: #ifndef HCFDEFC_H #define HCFDEFC_H 1/************************************************************************************************* -* -* FILE : HCFDEF.H -* -* DATE : $Date: 2004/08/05 11:47:10 $ $Revision: 1.8 $ -* Original: 2004/05/28 14:05:35 Revision: 1.59 Tag: hcf7_t20040602_01 -* Original: 2004/05/13 15:31:45 Revision: 1.53 Tag: hcf7_t7_20040513_01 -* Original: 2004/04/15 09:24:42 Revision: 1.44 Tag: hcf7_t7_20040415_01 -* Original: 2004/04/13 14:22:45 Revision: 1.43 Tag: t7_20040413_01 -* Original: 2004/04/01 15:32:55 Revision: 1.40 Tag: t7_20040401_01 -* Original: 2004/03/10 15:39:28 Revision: 1.36 Tag: t20040310_01 -* Original: 2004/03/03 14:10:12 Revision: 1.34 Tag: t20040304_01 -* Original: 2004/03/02 09:27:12 Revision: 1.32 Tag: t20040302_03 -* Original: 2004/02/24 13:00:29 Revision: 1.29 Tag: t20040224_01 -* Original: 2004/02/18 17:13:57 Revision: 1.26 Tag: t20040219_01 -* -* AUTHOR : Nico Valster -* -* SPECIFICATION: ........... -* -* DESC : Definitions and Prototypes for HCF only -* -************************************************************************************************** -* -* -* SOFTWARE LICENSE -* -* This software is provided subject to the following terms and conditions, -* which you should read carefully before using the software. Using this -* software indicates your acceptance of these terms and conditions. If you do -* not agree with these terms and conditions, do not use the software. -* -* COPYRIGHT � 1994 - 1995 by AT&T. All Rights Reserved -* COPYRIGHT � 1996 - 2000 by Lucent Technologies. All Rights Reserved -* COPYRIGHT � 2001 - 2004 by Agere Systems Inc. All Rights Reserved -* All rights reserved. -* -* Redistribution and use in source or binary forms, with or without -* modifications, are permitted provided that the following conditions are met: -* -* . Redistributions of source code must retain the above copyright notice, this -* list of conditions and the following Disclaimer as comments in the code as -* well as in the documentation and/or other materials provided with the -* distribution. -* -* . Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following Disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* . Neither the name of Agere Systems Inc. nor the names of the contributors -* may be used to endorse or promote products derived from this software -* without specific prior written permission. -* -* Disclaimer -* -* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF -* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY -* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN -* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -* DAMAGE. -* -* -*************************************************************************************************/ +* +* FILE : HCFDEF.H +* +* DATE : $Date: 2004/08/05 11:47:10 $ $Revision: 1.8 $ +* Original: 2004/05/28 14:05:35 Revision: 1.59 Tag: hcf7_t20040602_01 +* Original: 2004/05/13 15:31:45 Revision: 1.53 Tag: hcf7_t7_20040513_01 +* Original: 2004/04/15 09:24:42 Revision: 1.44 Tag: hcf7_t7_20040415_01 +* Original: 2004/04/13 14:22:45 Revision: 1.43 Tag: t7_20040413_01 +* Original: 2004/04/01 15:32:55 Revision: 1.40 Tag: t7_20040401_01 +* Original: 2004/03/10 15:39:28 Revision: 1.36 Tag: t20040310_01 +* Original: 2004/03/03 14:10:12 Revision: 1.34 Tag: t20040304_01 +* Original: 2004/03/02 09:27:12 Revision: 1.32 Tag: t20040302_03 +* Original: 2004/02/24 13:00:29 Revision: 1.29 Tag: t20040224_01 +* Original: 2004/02/18 17:13:57 Revision: 1.26 Tag: t20040219_01 +* +* AUTHOR : Nico Valster +* +* SPECIFICATION: ........... +* +* DESC : Definitions and Prototypes for HCF only +* +************************************************************************************************** +* +* +* SOFTWARE LICENSE +* +* This software is provided subject to the following terms and conditions, +* which you should read carefully before using the software. Using this +* software indicates your acceptance of these terms and conditions. If you do +* not agree with these terms and conditions, do not use the software. +* +* COPYRIGHT � 1994 - 1995 by AT&T. All Rights Reserved +* COPYRIGHT � 1996 - 2000 by Lucent Technologies. All Rights Reserved +* COPYRIGHT � 2001 - 2004 by Agere Systems Inc. All Rights Reserved +* All rights reserved. +* +* Redistribution and use in source or binary forms, with or without +* modifications, are permitted provided that the following conditions are met: +* +* . Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following Disclaimer as comments in the code as +* well as in the documentation and/or other materials provided with the +* distribution. +* +* . Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following Disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* . Neither the name of Agere Systems Inc. nor the names of the contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* Disclaimer +* +* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY +* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN +* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +* DAMAGE. +* +* +*************************************************************************************************/ /************************************************************************************************/ /********************************* P R E F I X E S ********************************************/ /************************************************************************************************/ -//IFB_ Interface Block -//HCMD_ Hermes Command -//HFS_ Hermes (Transmit/Receive) Frame Structure -//HREG_ Hermes Register +//IFB_ Interface Block +//HCMD_ Hermes Command +//HFS_ Hermes (Transmit/Receive) Frame Structure +//HREG_ Hermes Register /*************************************************************************************************/ -#if 0 // -#define BIT0 0x0001 -#define BIT1 0x0002 -#define BIT2 0x0004 -#define BIT3 0x0008 -#define BIT4 0x0010 -#define BIT5 0x0020 -#define BIT6 0x0040 -#define BIT7 0x0080 -#define BIT8 0x0100 -#define BIT9 0x0200 -#define BIT10 0x0400 -#define BIT11 0x0800 -#define BIT12 0x1000 -#define BIT13 0x2000 -#define BIT14 0x4000 -#define BIT15 0x8000 -#define BIT16 0x00010000 -#define BIT17 0x00020000 -#define BIT18 0x00040000 -#define BIT19 0x00080000 -#define BIT20 0x00100000 -#define BIT21 0x00200000 -#define BIT22 0x00400000 -#define BIT23 0x00800000 -#define BIT24 0x01000000 -#define BIT25 0x02000000 -#define BIT26 0x04000000 -#define BIT27 0x08000000 -#define BIT28 0x10000000 -#define BIT29 0x20000000 -#define BIT30 0x40000000 -#define BIT31 0x80000000 -#endif // 0 -/************************************************************************************************/ /********************************* GENERAL EQUATES **********************************************/ /************************************************************************************************/ -#define HCF_MAGIC 0x7D37 // "}7" Handle validation +#define HCF_MAGIC 0x7D37 // "}7" Handle validation -#define PLUG_DATA_OFFSET 0x00000800 //needed by some test tool on top of H-II NDIS driver +#define PLUG_DATA_OFFSET 0x00000800 //needed by some test tool on top of H-II NDIS driver -#define INI_TICK_INI 0x00040000L +#define INI_TICK_INI 0x00040000L -#define IO_IN 0 //hcfio_in_string -#define IO_OUT 1 //hcfio_out_string +#define IO_IN 0 //hcfio_in_string +#define IO_OUT 1 //hcfio_out_string//DO_ASSERT, create an artificial FALSE to force an ASSERT without the nasty compiler warning -#define DO_ASSERT ( assert_ifbp->IFB_Magic != HCF_MAGIC && assert_ifbp->IFB_Magic == HCF_MAGIC ) -#define NT_ASSERT 0x0000 //, NEVER_TESTED -#define NEVER_TESTED MERGE_2( 0xEFFE, 0xFEEF ) -#define SE_ASSERT 0x5EFF/* Side Effect, HCFASSERT invokation which are only called for the -* side effect and which should never trigger */ -#define DHF_FILE_NAME_OFFSET 10000 //to distinguish DHF from HCF asserts by means of line number -#define MMD_FILE_NAME_OFFSET 20000 //to distinguish MMD from HCF asserts by means of line number +#define DO_ASSERT ( assert_ifbp->IFB_Magic != HCF_MAGIC && assert_ifbp->IFB_Magic == HCF_MAGIC ) +#define NT_ASSERT 0x0000 //, NEVER_TESTED +#define NEVER_TESTED MERGE_2( 0xEFFE, 0xFEEF ) +#define SE_ASSERT 0x5EFF/* Side Effect, HCFASSERT invokation which are only called for the +* side effect and which should never trigger */ +#define DHF_FILE_NAME_OFFSET 10000 //to distinguish DHF from HCF asserts by means of line number +#define MMD_FILE_NAME_OFFSET 20000 //to distinguish MMD from HCF asserts by means of line number// trace codes used to // 1: profile execution times via HCF_TRACE and HCF_TRACE_VALUE // 2: hierarchical flow information via HCFLOGENTRY / HCFLOGEXIT -//#define HCF_TRACE_CONNECT useless -//#define HCF_TRACE_DISCONNECT useless -#define HCF_TRACE_ACTION 0x0000 // 0x0001 -#define HCF_TRACE_CNTL 0x0001 // 0x0002 -#define HCF_TRACE_DMA_RX_GET 0x0002 // 0x0004 -#define HCF_TRACE_DMA_RX_PUT 0x0003 // 0x0008 -#define HCF_TRACE_DMA_TX_GET 0x0004 // 0x0010 -#define HCF_TRACE_DMA_TX_PUT 0x0005 // 0x0020 -#define HCF_TRACE_GET_INFO 0x0006 // 0x0040 -#define HCF_TRACE_PUT_INFO 0x0007 // 0x0080 -#define HCF_TRACE_RCV_MSG 0x0008 // 0x0100 -#define HCF_TRACE_SEND_MSG 0x0009 // 0x0200 -#define HCF_TRACE_SERVICE_NIC 0x000A // 0x0400 +//#define HCF_TRACE_CONNECT useless +//#define HCF_TRACE_DISCONNECT useless +#define HCF_TRACE_ACTION 0x0000 // 0x0001 +#define HCF_TRACE_CNTL 0x0001 // 0x0002 +#define HCF_TRACE_DMA_RX_GET 0x0002 // 0x0004 +#define HCF_TRACE_DMA_RX_PUT 0x0003 // 0x0008 +#define HCF_TRACE_DMA_TX_GET 0x0004 // 0x0010 +#define HCF_TRACE_DMA_TX_PUT 0x0005 // 0x0020 +#define HCF_TRACE_GET_INFO 0x0006 // 0x0040 +#define HCF_TRACE_PUT_INFO 0x0007 // 0x0080 +#define HCF_TRACE_RCV_MSG 0x0008 // 0x0100 +#define HCF_TRACE_SEND_MSG 0x0009 // 0x0200 +#define HCF_TRACE_SERVICE_NIC 0x000A // 0x0400// #define HCF_TRACE_ 0x000C // 0x1000 // #define HCF_TRACE_ 0x000D // 0x2000 // #define HCF_TRACE_ 0x000E // 0x4000 // #define HCF_TRACE_ 0x000F // 0x8000 -// ============================================ HCF_TRACE_... codes below 0x0010 are asserted on re-entry -#define HCF_TRACE_ACTION_KLUDGE 0x0010/* once you start introducing kludges there is no end to it -* this is an escape to do not assert on re-entrancy problem caused -* by HCF_ACT_INT_FORCE_ON used to get Microsofts NDIS drivers going -*/ -#define HCF_TRACE_STRIO 0x0020 -#define HCF_TRACE_ALLOC 0X0021 -#define HCF_TRACE_DL 0X0023 -#define HCF_TRACE_ISR_INFO 0X0024 -#define HCF_TRACE_CALIBRATE 0x0026 - -#define HCF_TRACE_CMD_CPL 0x0040 -#define HCF_TRACE_CMD_EXE 0x0041 -#define HCF_TRACE_GET_FID 0x0042 -#define HCF_TRACE_GET_FRAG 0x0043 -#define HCF_TRACE_INIT 0x0044 -#define HCF_TRACE_PUT_FRAG 0x0045 -#define HCF_TRACE_SETUP_BAP 0x0046 - -#define HCF_TRACE_EXIT 0x8000 // Keil C warns "long constant truncated to int" - -//#define BAP_0 HREG_DATA_0 //Used by DMA controller to access NIC RAM -#define BAP_1 HREG_DATA_1 //Used by HCF to access NIC RAM +// ============================================ HCF_TRACE_... codes below 0x0010 are asserted on re-entry +#define HCF_TRACE_ACTION_KLUDGE 0x0010/* once you start introducing kludges there is no end to it +* this is an escape to do not assert on re-entrancy problem caused +* by HCF_ACT_INT_FORCE_ON used to get Microsofts NDIS drivers going +*/ +#define HCF_TRACE_STRIO 0x0020 +#define HCF_TRACE_ALLOC 0X0021 +#define HCF_TRACE_DL 0X0023 +#define HCF_TRACE_ISR_INFO 0X0024 +#define HCF_TRACE_CALIBRATE 0x0026 + +#define HCF_TRACE_CMD_CPL 0x0040 +#define HCF_TRACE_CMD_EXE 0x0041 +#define HCF_TRACE_GET_FID 0x0042 +#define HCF_TRACE_GET_FRAG 0x0043 +#define HCF_TRACE_INIT 0x0044 +#define HCF_TRACE_PUT_FRAG 0x0045 +#define HCF_TRACE_SETUP_BAP 0x0046 + +#define HCF_TRACE_EXIT 0x8000 // Keil C warns "long constant truncated to int" + +//#define BAP_0 HREG_DATA_0 //Used by DMA controller to access NIC RAM +#define BAP_1 HREG_DATA_1 //Used by HCF to access NIC RAM//************************* Hermes Receive/Transmit Frame Structures //HFS_STAT //see MMD.H for HFS_STAT_ERR -#define HFS_STAT_MSG_TYPE 0xE000 //Hermes reported Message Type -#define HFS_STAT_MIC_KEY_ID 0x1800 //MIC key used (if any) -#define HFS_STAT_1042 0x2000 //RFC1042 Encoded -#define HFS_STAT_TUNNEL 0x4000 //Bridge-Tunnel Encoded -#define HFS_STAT_WMP_MSG 0x6000 //WaveLAN-II Management Protocol Frame +#define HFS_STAT_MSG_TYPE 0xE000 //Hermes reported Message Type +#define HFS_STAT_MIC_KEY_ID 0x1800 //MIC key used (if any) +#define HFS_STAT_1042 0x2000 //RFC1042 Encoded +#define HFS_STAT_TUNNEL 0x4000 //Bridge-Tunnel Encoded +#define HFS_STAT_WMP_MSG 0x6000 //WaveLAN-II Management Protocol Frame#if (HCF_TYPE ) &HCF_TYPE_WPA -#define HFS_STAT_MIC 0x0010 //Frame contains MIC //;? re-instate when F/W ready +#define HFS_STAT_MIC 0x0010 //Frame contains MIC //;? re-instate when F/W ready#endif //************************* Hermes Register Offsets and Command bits -#define HREG_IO_RANGE 0x80 //I/O Range used by Hermes +#define HREG_IO_RANGE 0x80 //I/O Range used by Hermes//************************* Command/Status -#define HREG_CMD 0x00 // -#define HCMD_CMD_CODE 0x3F -#define HREG_PARAM_0 0x02 // -#define HREG_PARAM_1 0x04 // -#define HREG_PARAM_2 0x06 // -#define HREG_STAT 0x08 // -#define HREG_STAT_CMD_CODE 0x003F // -#define HREG_STAT_DIAG_ERR 0x0100 -#define HREG_STAT_INQUIRE_ERR 0x0500 -#define HREG_STAT_CMD_RESULT 0x7F00 // -#define HREG_RESP_0 0x0A // -#define HREG_RESP_1 0x0C // -#define HREG_RESP_2 0x0E // +#define HREG_CMD 0x00 // +#define HCMD_CMD_CODE 0x3F +#define HREG_PARAM_0 0x02 // +#define HREG_PARAM_1 0x04 // +#define HREG_PARAM_2 0x06 // +#define HREG_STAT 0x08 // +#define HREG_STAT_CMD_CODE 0x003F // +#define HREG_STAT_DIAG_ERR 0x0100 +#define HREG_STAT_INQUIRE_ERR 0x0500 +#define HREG_STAT_CMD_RESULT 0x7F00 // +#define HREG_RESP_0 0x0A // +#define HREG_RESP_1 0x0C // +#define HREG_RESP_2 0x0E ////************************* FID Management -#define HREG_INFO_FID 0x10 // -#define HREG_RX_FID 0x20 // -#define HREG_ALLOC_FID 0x22 // -#define HREG_TX_COMPL_FID 0x24 // +#define HREG_INFO_FID 0x10 // +#define HREG_RX_FID 0x20 // +#define HREG_ALLOC_FID 0x22 // +#define HREG_TX_COMPL_FID 0x24 ////************************* BAP //20031030 HWi Inserted this again because the dongle code uses this (GPIF.C) -//#define HREG_SELECT_0 0x18 // -//#define HREG_OFFSET_0 0x1C // -//#define HREG_DATA_0 0x36 // +//#define HREG_SELECT_0 0x18 // +//#define HREG_OFFSET_0 0x1C // +//#define HREG_DATA_0 0x36 // -//#define HREG_OFFSET_BUSY 0x8000 // use HCMD_BUSY -#define HREG_OFFSET_ERR 0x4000 // -//rsrvd #define HREG_OFFSET_DATA_OFFSET 0x0FFF // +//#define HREG_OFFSET_BUSY 0x8000 // use HCMD_BUSY +#define HREG_OFFSET_ERR 0x4000 // +//rsrvd #define HREG_OFFSET_DATA_OFFSET 0x0FFF // -#define HREG_SELECT_1 0x1A // -#define HREG_OFFSET_1 0x1E // -#define HREG_DATA_1 0x38 // +#define HREG_SELECT_1 0x1A // +#define HREG_OFFSET_1 0x1E // +#define HREG_DATA_1 0x38 ////************************* Event -#define HREG_EV_STAT 0x30 // -#define HREG_INT_EN 0x32 // -#define HREG_EV_ACK 0x34 // +#define HREG_EV_STAT 0x30 // +#define HREG_INT_EN 0x32 // +#define HREG_EV_ACK 0x34 // -#define HREG_EV_TICK 0x8000 //Auxiliary Timer Tick -//#define HREG_EV_RES 0x4000 //H-I only: H/W error (Wait Time-out) -#define HREG_EV_INFO_DROP 0x2000 //WMAC did not have sufficient RAM to build Unsollicited Frame +#define HREG_EV_TICK 0x8000 //Auxiliary Timer Tick +//#define HREG_EV_RES 0x4000 //H-I only: H/W error (Wait Time-out) +#define HREG_EV_INFO_DROP 0x2000 //WMAC did not have sufficient RAM to build Unsollicited Frame#if (HCF_TYPE ) &HCF_TYPE_HII5 -#define HREG_EV_ACK_REG_READY 0x0000 +#define HREG_EV_ACK_REG_READY 0x0000#else -#define HREG_EV_ACK_REG_READY 0x1000 //Workaround Kludge bit for H-II (not H-II.5) +#define HREG_EV_ACK_REG_READY 0x1000 //Workaround Kludge bit for H-II (not H-II.5)#endif // HCF_TYPE_HII5 #if (HCF_SLEEP ) & (HCF_CDS |HCF_DDS ) -#define HREG_EV_SLEEP_REQ 0x0800 +#define HREG_EV_SLEEP_REQ 0x0800#else -#define HREG_EV_SLEEP_REQ 0x0000 +#define HREG_EV_SLEEP_REQ 0x0000#endif // HCF_CDS / HCF_DDS #if HCF_DMA -//#define HREG_EV_LPESC 0x0400 // firmware sets this bit and clears it, not for host usage. -#define HREG_EV_RDMAD 0x0200 // rx frame in host memory -#define HREG_EV_TDMAD 0x0100 // tx frame in host memory processed -//#define HREG_EV_RXDMA 0x0040 // firmware kicks off DMA engine (bit is not for host usage) -//#define HREG_EV_TXDMA 0x0020 // firmware kicks off DMA engine (bit is not for host usage) -#define HREG_EV_FW_DMA 0x0460 // firmware / DMA engine I/F (bits are not for host usage) +//#define HREG_EV_LPESC 0x0400 // firmware sets this bit and clears it, not for host usage. +#define HREG_EV_RDMAD 0x0200 // rx frame in host memory +#define HREG_EV_TDMAD 0x0100 // tx frame in host memory processed +//#define HREG_EV_RXDMA 0x0040 // firmware kicks off DMA engine (bit is not for host usage) +//#define HREG_EV_TXDMA 0x0020 // firmware kicks off DMA engine (bit is not for host usage) +#define HREG_EV_FW_DMA 0x0460 // firmware / DMA engine I/F (bits are not for host usage)#else -#define HREG_EV_FW_DMA 0x0000 +#define HREG_EV_FW_DMA 0x0000#endif // HCF_DMA -#define HREG_EV_INFO 0x0080 // Asynchronous Information Frame -#define HREG_EV_CMD 0x0010 // Command completed, Status and Response available -#define HREG_EV_ALLOC 0x0008 // Asynchronous part of Allocation/Reclaim completed -#define HREG_EV_TX_EXC 0x0004 // Asynchronous Transmission unsuccessful completed -#define HREG_EV_TX 0x0002 // Asynchronous Transmission successful completed -#define HREG_EV_RX 0x0001 // Asynchronous Receive Frame - -#define HREG_EV_TX_EXT ( (HCF_EXT) & (HCF_EXT_INT_TX_EX | HCF_EXT_INT_TICK ) ) -/* HREG_EV_TX_EXT := 0x0000 or HREG_EV_TX_EXC and/or HREG_EV_TICK -* could be extended with HREG_EV_TX */ +#define HREG_EV_INFO 0x0080 // Asynchronous Information Frame +#define HREG_EV_CMD 0x0010 // Command completed, Status and Response available +#define HREG_EV_ALLOC 0x0008 // Asynchronous part of Allocation/Reclaim completed +#define HREG_EV_TX_EXC 0x0004 // Asynchronous Transmission unsuccessful completed +#define HREG_EV_TX 0x0002 // Asynchronous Transmission successful completed +#define HREG_EV_RX 0x0001 // Asynchronous Receive Frame + +#define HREG_EV_TX_EXT ( (HCF_EXT) & (HCF_EXT_INT_TX_EX | HCF_EXT_INT_TICK ) ) +/* HREG_EV_TX_EXT := 0x0000 or HREG_EV_TX_EXC and/or HREG_EV_TICK +* could be extended with HREG_EV_TX */ #if HCF_EXT_INT_TX_EX !=HREG_EV_TX_EXC err: these values should match;#endif // HCF_EXT_INT_TX_EX / HREG_EV_TX_EXC
@@ -290,97 +253,97 @@ err: these values should match;#endif // HCF_EXT_INT_TICK / HREG_EV_TICK //************************* Host Software -#define HREG_SW_0 0x28 // -#define HREG_SW_1 0x2A // -#define HREG_SW_2 0x2C // -//rsrvd #define HREG_SW_3 0x2E // +#define HREG_SW_0 0x28 // +#define HREG_SW_1 0x2A // +#define HREG_SW_2 0x2C // +//rsrvd #define HREG_SW_3 0x2E // //************************* Control and Auxiliary Port -#define HREG_IO 0x12 -#define HREG_IO_SRESET 0x0001 -#define HREG_IO_WAKEUP_ASYNC 0x0002 -#define HREG_IO_WOKEN_UP 0x0004 -#define HREG_CNTL 0x14 // -//#define HREG_CNTL_WAKEUP_SYNC 0x0001 -#define HREG_CNTL_AUX_ENA_STAT 0xC000 -#define HREG_CNTL_AUX_DIS_STAT 0x0000 -#define HREG_CNTL_AUX_ENA_CNTL 0x8000 -#define HREG_CNTL_AUX_DIS_CNTL 0x4000 -#define HREG_CNTL_AUX_DSD 0x2000 -#define HREG_CNTL_AUX_ENA (HREG_CNTL_AUX_ENA_CNTL | HREG_CNTL_AUX_DIS_CNTL ) -#define HREG_SPARE 0x16 // -#define HREG_AUX_PAGE 0x3A // -#define HREG_AUX_OFFSET 0x3C // -#define HREG_AUX_DATA 0x3E // +#define HREG_IO 0x12 +#define HREG_IO_SRESET 0x0001 +#define HREG_IO_WAKEUP_ASYNC 0x0002 +#define HREG_IO_WOKEN_UP 0x0004 +#define HREG_CNTL 0x14 // +//#define HREG_CNTL_WAKEUP_SYNC 0x0001 +#define HREG_CNTL_AUX_ENA_STAT 0xC000 +#define HREG_CNTL_AUX_DIS_STAT 0x0000 +#define HREG_CNTL_AUX_ENA_CNTL 0x8000 +#define HREG_CNTL_AUX_DIS_CNTL 0x4000 +#define HREG_CNTL_AUX_DSD 0x2000 +#define HREG_CNTL_AUX_ENA (HREG_CNTL_AUX_ENA_CNTL | HREG_CNTL_AUX_DIS_CNTL ) +#define HREG_SPARE 0x16 // +#define HREG_AUX_PAGE 0x3A // +#define HREG_AUX_OFFSET 0x3C // +#define HREG_AUX_DATA 0x3E //#if HCF_DMA //************************* DMA (bus mastering) -// Be careful to use these registers only at a genuine 32 bits NIC -// On 16 bits NICs, these addresses are mapped into the range 0x00 through 0x3F with all consequences -// thereof, e.g. HREG_DMA_CTRL register maps to HREG_CMD. -#define HREG_DMA_CTRL 0x0040 -#define HREG_TXDMA_PTR32 0x0044 -#define HREG_TXDMA_PRIO_PTR32 0x0048 -#define HREG_TXDMA_HIPRIO_PTR32 0x004C -#define HREG_RXDMA_PTR32 0x0050 -#define HREG_CARDDETECT_1 0x007C // contains 7D37 -#define HREG_CARDDETECT_2 0x007E // contains 7DE7 -#define HREG_FREETIMER 0x0058 -#define HREG_DMA_RX_CNT 0x0026 +// Be careful to use these registers only at a genuine 32 bits NIC +// On 16 bits NICs, these addresses are mapped into the range 0x00 through 0x3F with all consequences +// thereof, e.g. HREG_DMA_CTRL register maps to HREG_CMD. +#define HREG_DMA_CTRL 0x0040 +#define HREG_TXDMA_PTR32 0x0044 +#define HREG_TXDMA_PRIO_PTR32 0x0048 +#define HREG_TXDMA_HIPRIO_PTR32 0x004C +#define HREG_RXDMA_PTR32 0x0050 +#define HREG_CARDDETECT_1 0x007C // contains 7D37 +#define HREG_CARDDETECT_2 0x007E // contains 7DE7 +#define HREG_FREETIMER 0x0058 +#define HREG_DMA_RX_CNT 0x0026/****************************************************************************** -* Defines for the bits in the DmaControl register (@40h) -******************************************************************************/ -#define HREG_DMA_CTRL_RXHWEN 0x80000000 // high word enable bit -#define HREG_DMA_CTRL_RXRESET 0x40000000 // tx dma init bit -#define HREG_DMA_CTRL_RXBAP1 BIT29 -#define HREG_DMA_CTRL_RX_STALLED BIT28 -#define HREG_DMA_CTRL_RXAUTOACK_DMADONE BIT27 // no host involvement req. for TDMADONE event -#define HREG_DMA_CTRL_RXAUTOACK_INFO BIT26 // no host involvement req. for alloc event -#define HREG_DMA_CTRL_RXAUTOACK_DMAEN 0x02000000 // no host involvement req. for TxDMAen event -#define HREG_DMA_CTRL_RXAUTOACK_RX 0x01000000 // no host involvement req. for tx event -#define HREG_DMA_CTRL_RX_BUSY BIT23 // read only bit -//#define HREG_DMA_CTRL_RX_RBUFCONT_PLAIN 0 // bits 21..20 -//#define HREG_DMA_CTRL_RX_MODE_PLAIN_DMA 0 // mode 0 -#define HREG_DMA_CTRL_RX_MODE_SINGLE_PACKET 0x00010000 // mode 1 -#define HREG_DMA_CTRL_RX_MODE_MULTI_PACKET 0x00020000 // mode 2 -//#define HREG_DMA_CTRL_RX_MODE_DISABLE (0x00020000|0x00010000) // disable tx dma engine -#define HREG_DMA_CTRL_TXHWEN 0x8000 // low word enable bit -#define HREG_DMA_CTRL_TXRESET 0x4000 // rx dma init bit -#define HREG_DMA_CTRL_TXBAP1 BIT13 -#define HREG_DMA_CTRL_TXAUTOACK_DMADONE BIT11 // no host involvement req. for RxDMADONE event -#define HREG_DMA_CTRL_TXAUTOACK_DMAEN 0x00000400 // no host involvement req. for RxDMAen event -#define HREG_DMA_CTRL_TXAUTOACK_DMAALLOC 0x00000200 // no host involvement req. for info event -#define HREG_DMA_CTRL_TXAUTOACK_TX 0x00000100 // no host involvement req. for rx event -#define HREG_DMA_CTRL_TX_BUSY BIT7 // read only bit -//#define HREG_DMA_CTRL_TX_TBUFCONT_PLAIN 0 // bits 6..5 -//#define HREG_DMA_CTRL_TX_MODE_PLAIN_DMA 0 // mode 0 -#define HREG_DMA_CTRL_TX_MODE_SINGLE_PACKET BIT0 // mode 1 -#define HREG_DMA_CTRL_TX_MODE_MULTI_PACKET 0x00000002 // mode 2 -//#define HREG_DMA_CTRL_TX_MODE_DISABLE (0x00000001|0x00000002) // disable tx dma engine +* Defines for the bits in the DmaControl register (@40h) +******************************************************************************/ +#define HREG_DMA_CTRL_RXHWEN 0x80000000 // high word enable bit +#define HREG_DMA_CTRL_RXRESET 0x40000000 // tx dma init bit +#define HREG_DMA_CTRL_RXBAP1 BIT29 +#define HREG_DMA_CTRL_RX_STALLED BIT28 +#define HREG_DMA_CTRL_RXAUTOACK_DMADONE BIT27 // no host involvement req. for TDMADONE event +#define HREG_DMA_CTRL_RXAUTOACK_INFO BIT26 // no host involvement req. for alloc event +#define HREG_DMA_CTRL_RXAUTOACK_DMAEN 0x02000000 // no host involvement req. for TxDMAen event +#define HREG_DMA_CTRL_RXAUTOACK_RX 0x01000000 // no host involvement req. for tx event +#define HREG_DMA_CTRL_RX_BUSY BIT23 // read only bit +//#define HREG_DMA_CTRL_RX_RBUFCONT_PLAIN 0 // bits 21..20 +//#define HREG_DMA_CTRL_RX_MODE_PLAIN_DMA 0 // mode 0 +#define HREG_DMA_CTRL_RX_MODE_SINGLE_PACKET 0x00010000 // mode 1 +#define HREG_DMA_CTRL_RX_MODE_MULTI_PACKET 0x00020000 // mode 2 +//#define HREG_DMA_CTRL_RX_MODE_DISABLE (0x00020000|0x00010000) // disable tx dma engine +#define HREG_DMA_CTRL_TXHWEN 0x8000 // low word enable bit +#define HREG_DMA_CTRL_TXRESET 0x4000 // rx dma init bit +#define HREG_DMA_CTRL_TXBAP1 BIT13 +#define HREG_DMA_CTRL_TXAUTOACK_DMADONE BIT11 // no host involvement req. for RxDMADONE event +#define HREG_DMA_CTRL_TXAUTOACK_DMAEN 0x00000400 // no host involvement req. for RxDMAen event +#define HREG_DMA_CTRL_TXAUTOACK_DMAALLOC 0x00000200 // no host involvement req. for info event +#define HREG_DMA_CTRL_TXAUTOACK_TX 0x00000100 // no host involvement req. for rx event +#define HREG_DMA_CTRL_TX_BUSY BIT7 // read only bit +//#define HREG_DMA_CTRL_TX_TBUFCONT_PLAIN 0 // bits 6..5 +//#define HREG_DMA_CTRL_TX_MODE_PLAIN_DMA 0 // mode 0 +#define HREG_DMA_CTRL_TX_MODE_SINGLE_PACKET BIT0 // mode 1 +#define HREG_DMA_CTRL_TX_MODE_MULTI_PACKET 0x00000002 // mode 2 +//#define HREG_DMA_CTRL_TX_MODE_DISABLE (0x00000001|0x00000002) // disable tx dma engine //configuration DWORD to configure DMA for mode2 operation, using BAP0 as the DMA BAP. #define DMA_CTRLSTAT_GO (HREG_DMA_CTRL_RXHWEN | HREG_DMA_CTRL_RX_MODE_MULTI_PACKET | \ HREG_DMA_CTRL_RXAUTOACK_DMAEN | HREG_DMA_CTRL_RXAUTOACK_RX | \ HREG_DMA_CTRL_TXHWEN | /*;?HREG_DMA_CTRL_TX_TBUFCONT_PLAIN |*/ \ -HREG_DMA_CTRL_TX_MODE_MULTI_PACKET | HREG_DMA_CTRL_TXAUTOACK_DMAEN |\ +HREG_DMA_CTRL_TX_MODE_MULTI_PACKET | HREG_DMA_CTRL_TXAUTOACK_DMAEN | \ HREG_DMA_CTRL_TXAUTOACK_DMAALLOC)//configuration DWORD to reset both the Tx and Rx DMA engines #define DMA_CTRLSTAT_RESET (HREG_DMA_CTRL_RXHWEN | HREG_DMA_CTRL_RXRESET | HREG_DMA_CTRL_TXHWEN | HREG_DMA_CTRL_TXRESET) -//#define DESC_DMA_OWNED 0x80000000 // BIT31 -#define DESC_DMA_OWNED 0x8000 // BIT31 -#define DESC_SOP 0x8000 // BIT15 -#define DESC_EOP 0x4000 // BIT14 +//#define DESC_DMA_OWNED 0x80000000 // BIT31 +#define DESC_DMA_OWNED 0x8000 // BIT31 +#define DESC_SOP 0x8000 // BIT15 +#define DESC_EOP 0x4000 // BIT14 -#define DMA_RX 0 -#define DMA_TX 1 +#define DMA_RX 0 +#define DMA_TX 1 -// #define IFB_RxFirstDesc IFB_FirstDesc[DMA_RX] -// #define IFB_TxFirstDesc IFB_FirstDesc[DMA_TX] -// #define IFB_RxLastDesc IFB_LastDesc[DMA_RX] -// #define IFB_TxLastDesc IFB_LastDesc[DMA_TX] +// #define IFB_RxFirstDesc IFB_FirstDesc[DMA_RX] +// #define IFB_TxFirstDesc IFB_FirstDesc[DMA_TX] +// #define IFB_RxLastDesc IFB_LastDesc[DMA_RX] +// #define IFB_TxLastDesc IFB_LastDesc[DMA_TX] #endif // HCF_DMA //
@@ -390,96 +353,96 @@ err: these values should match;// Hermes Command Codes and Qualifier bits -#define HCMD_BUSY 0x8000 // Busy bit, applicable for all commands -#define HCMD_INI 0x0000 // -#define HCMD_ENABLE HCF_CNTL_ENABLE // 0x0001 -#define HCMD_DISABLE HCF_CNTL_DISABLE // 0x0002 -#define HCMD_CONNECT HCF_CNTL_CONNECT // 0x0003 -#define HCMD_EXECUTE 0x0004 // -#define HCMD_DISCONNECT HCF_CNTL_DISCONNECT // 0x0005 -#define HCMD_SLEEP 0x0006 // -#define HCMD_CONTINUE HCF_CNTL_CONTINUE // 0x0007 -#define HCMD_RETRY 0x0100 // Retry bit -#define HCMD_ALLOC 0x000A // -#define HCMD_TX 0x000B // -#define HCMD_RECL 0x0100 // Reclaim bit, applicable for Tx and Inquire -#define HCMD_INQUIRE 0x0011 // -#define HCMD_ACCESS 0x0021 // -#define HCMD_ACCESS_WRITE 0x0100 // Write bit -#define HCMD_PROGRAM 0x0022 // -#define HCMD_READ_MIF 0x0030 -#define HCMD_WRITE_MIF 0x0031 -#define HCMD_THESEUS 0x0038 -#define HCMD_STARTPREAMBLE 0x0E00 // Start continuous preamble Tx -#define HCMD_STOP 0x0F00 // Stop Theseus test mode +#define HCMD_BUSY 0x8000 // Busy bit, applicable for all commands +#define HCMD_INI 0x0000 // +#define HCMD_ENABLE HCF_CNTL_ENABLE // 0x0001 +#define HCMD_DISABLE HCF_CNTL_DISABLE // 0x0002 +#define HCMD_CONNECT HCF_CNTL_CONNECT // 0x0003 +#define HCMD_EXECUTE 0x0004 // +#define HCMD_DISCONNECT HCF_CNTL_DISCONNECT // 0x0005 +#define HCMD_SLEEP 0x0006 // +#define HCMD_CONTINUE HCF_CNTL_CONTINUE // 0x0007 +#define HCMD_RETRY 0x0100 // Retry bit +#define HCMD_ALLOC 0x000A // +#define HCMD_TX 0x000B // +#define HCMD_RECL 0x0100 // Reclaim bit, applicable for Tx and Inquire +#define HCMD_INQUIRE 0x0011 // +#define HCMD_ACCESS 0x0021 // +#define HCMD_ACCESS_WRITE 0x0100 // Write bit +#define HCMD_PROGRAM 0x0022 // +#define HCMD_READ_MIF 0x0030 +#define HCMD_WRITE_MIF 0x0031 +#define HCMD_THESEUS 0x0038 +#define HCMD_STARTPREAMBLE 0x0E00 // Start continuous preamble Tx +#define HCMD_STOP 0x0F00 // Stop Theseus test mode//Configuration Management // -#define CFG_DRV_ACT_RANGES_PRI_3_BOTTOM 1 // Default Bottom Compatibility for Primary Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_PRI_3_TOP 1 // Default Top Compatibility for Primary Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_PRI_3_BOTTOM 1 // Default Bottom Compatibility for Primary Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_PRI_3_TOP 1 // Default Top Compatibility for Primary Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_HSI_4_BOTTOM 1 // Default Bottom Compatibility for H/W - driver I/F -#define CFG_DRV_ACT_RANGES_HSI_4_TOP 1 // Default Top Compatibility for H/W - driver I/F +#define CFG_DRV_ACT_RANGES_HSI_4_BOTTOM 1 // Default Bottom Compatibility for H/W - driver I/F +#define CFG_DRV_ACT_RANGES_HSI_4_TOP 1 // Default Top Compatibility for H/W - driver I/F -#define CFG_DRV_ACT_RANGES_HSI_5_BOTTOM 1 // Default Bottom Compatibility for H/W - driver I/F -#define CFG_DRV_ACT_RANGES_HSI_5_TOP 1 // Default Top Compatibility for H/W - driver I/F +#define CFG_DRV_ACT_RANGES_HSI_5_BOTTOM 1 // Default Bottom Compatibility for H/W - driver I/F +#define CFG_DRV_ACT_RANGES_HSI_5_TOP 1 // Default Top Compatibility for H/W - driver I/F#if (HCF_TYPE ) &HCF_TYPE_WPA -#define CFG_DRV_ACT_RANGES_APF_1_BOTTOM 16 // Default Bottom Compatibility for AP Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_APF_1_TOP 16 // Default Top Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_1_BOTTOM 16 // Default Bottom Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_1_TOP 16 // Default Top Compatibility for AP Firmware - driver I/F#else //;? is this REALLY O.K. -#define CFG_DRV_ACT_RANGES_APF_1_BOTTOM 1 // Default Bottom Compatibility for AP Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_APF_1_TOP 1 // Default Top Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_1_BOTTOM 1 // Default Bottom Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_1_TOP 1 // Default Top Compatibility for AP Firmware - driver I/F#endif // HCF_TYPE_WPA -#define CFG_DRV_ACT_RANGES_APF_2_BOTTOM 2 // Default Bottom Compatibility for AP Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_APF_2_TOP 2 // Default Top Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_2_BOTTOM 2 // Default Bottom Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_2_TOP 2 // Default Top Compatibility for AP Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_APF_3_BOTTOM 1 // Default Bottom Compatibility for AP Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_APF_3_TOP 1 // Default Top Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_3_BOTTOM 1 // Default Bottom Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_3_TOP 1 // Default Top Compatibility for AP Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_APF_4_BOTTOM 1 // Default Bottom Compatibility for AP Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_APF_4_TOP 1 // Default Top Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_4_BOTTOM 1 // Default Bottom Compatibility for AP Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_APF_4_TOP 1 // Default Top Compatibility for AP Firmware - driver I/F#if (HCF_TYPE ) &HCF_TYPE_HII5 -#define CFG_DRV_ACT_RANGES_STA_2_BOTTOM 6 // Default Bottom Compatibility for Station Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_STA_2_TOP 6 // Default Top Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_2_BOTTOM 6 // Default Bottom Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_2_TOP 6 // Default Top Compatibility for Station Firmware - driver I/F#else // (HCF_TYPE) & HCF_TYPE_HII5 -#define CFG_DRV_ACT_RANGES_STA_2_BOTTOM 1 // Default Bottom Compatibility for Station Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_STA_2_TOP 2 // Default Top Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_2_BOTTOM 1 // Default Bottom Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_2_TOP 2 // Default Top Compatibility for Station Firmware - driver I/F#endif // (HCF_TYPE) & HCF_TYPE_HII5 -#define CFG_DRV_ACT_RANGES_STA_3_BOTTOM 1 // Default Bottom Compatibility for Station Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_STA_3_TOP 1 // Default Top Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_3_BOTTOM 1 // Default Bottom Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_3_TOP 1 // Default Top Compatibility for Station Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_STA_4_BOTTOM 1 // Default Bottom Compatibility for Station Firmware - driver I/F -#define CFG_DRV_ACT_RANGES_STA_4_TOP 1 // Default Top Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_4_BOTTOM 1 // Default Bottom Compatibility for Station Firmware - driver I/F +#define CFG_DRV_ACT_RANGES_STA_4_TOP 1 // Default Top Compatibility for Station Firmware - driver I/F//--------------------------------------------------------------------------------------------------------------------- #if definedHCF_CFG_PRI_1_TOP || definedHCF_CFG_PRI_1_BOTTOM -err: PRI_1 not supported for H-I; // Compatibility for Primary Firmware - driver I/F +err: PRI_1 not supported for H-I; // Compatibility for Primary Firmware - driver I/F#endif // HCF_CFG_PRI_1_TOP / HCF_CFG_PRI_1_BOTTOM #if definedHCF_CFG_PRI_2_TOP || definedHCF_CFG_PRI_2_BOTTOM -err: PRI_2 not supported for H-I; // Compatibility for Primary Firmware - driver I/F +err: PRI_2 not supported for H-I; // Compatibility for Primary Firmware - driver I/F#endif // HCF_CFG_PRI_2_TOP / HCF_CFG_PRI_2_BOTTOM -#ifdef HCF_CFG_PRI_3_TOP // Top Compatibility for Primary Firmware - driver I/F -#if HCF_CFG_PRI_3_TOP ==0 || \ +#ifdef HCF_CFG_PRI_3_TOP // Top Compatibility for Primary Firmware - driver I/F +#if HCF_CFG_PRI_3_TOP ==0 || \CFG_DRV_ACT_RANGES_PRI_3_BOTTOM <=HCF_CFG_PRI_3_TOP &&HCF_CFG_PRI_3_TOP <=CFG_DRV_ACT_RANGES_PRI_3_TOP #undef CFG_DRV_ACT_RANGES_PRI_3_TOP -#define CFG_DRV_ACT_RANGES_PRI_3_TOP HCF_CFG_PRI_3_TOP +#define CFG_DRV_ACT_RANGES_PRI_3_TOP HCF_CFG_PRI_3_TOP#else err: ;#endif #endif // HCF_CFG_PRI_3_TOP -#ifdef HCF_CFG_PRI_3_BOTTOM // Bottom Compatibility for Primary Firmware - driver I/F +#ifdef HCF_CFG_PRI_3_BOTTOM // Bottom Compatibility for Primary Firmware - driver I/F #if CFG_DRV_ACT_RANGES_PRI_3_BOTTOM <=HCF_CFG_PRI_3_BOTTOM &&HCF_CFG_PRI_3_BOTTOM <=CFG_DRV_ACT_RANGES_PRI_3_TOP #undef CFG_DRV_ACT_RANGES_PRI_3_BOTTOM -#define CFG_DRV_ACT_RANGES_PRI_3_BOTTOM HCF_CFG_PRI_3_BOTTOM +#define CFG_DRV_ACT_RANGES_PRI_3_BOTTOM HCF_CFG_PRI_3_BOTTOM#else err: ;#endif
@@ -488,77 +451,77 @@ err: ;//--------------------------------------------------------------------------------------------------------------------- #if definedHCF_CFG_HSI_0_TOP || definedHCF_CFG_HSI_0_BOTTOM -err: HSI_0 not supported for H-I; // Compatibility for HSI I/F +err: HSI_0 not supported for H-I; // Compatibility for HSI I/F#endif // HCF_CFG_HSI_0_TOP / HCF_CFG_HSI_0_BOTTOM #if definedHCF_CFG_HSI_1_TOP || definedHCF_CFG_HSI_1_BOTTOM -err: HSI_1 not supported for H-I; // Compatibility for HSI I/F +err: HSI_1 not supported for H-I; // Compatibility for HSI I/F#endif // HCF_CFG_HSI_1_TOP / HCF_CFG_HSI_1_BOTTOM #if definedHCF_CFG_HSI_2_TOP || definedHCF_CFG_HSI_2_BOTTOM -err: HSI_2 not supported for H-I; // Compatibility for HSI I/F +err: HSI_2 not supported for H-I; // Compatibility for HSI I/F#endif // HCF_CFG_HSI_2_TOP / HCF_CFG_HSI_2_BOTTOM #if definedHCF_CFG_HSI_3_TOP || definedHCF_CFG_HSI_3_BOTTOM -err: HSI_3 not supported for H-I; // Compatibility for HSI I/F +err: HSI_3 not supported for H-I; // Compatibility for HSI I/F#endif // HCF_CFG_HSI_3_TOP / HCF_CFG_HSI_3_BOTTOM -#ifdef HCF_CFG_HSI_4_TOP // Top Compatibility for HSI I/F -#if HCF_CFG_HSI_4_TOP ==0 || \ +#ifdef HCF_CFG_HSI_4_TOP // Top Compatibility for HSI I/F +#if HCF_CFG_HSI_4_TOP ==0 || \CFG_DRV_ACT_RANGES_HSI_4_BOTTOM <=CF_CFG_HSI_4_TOP &&HCF_CFG_HSI_4_TOP <=CFG_DRV_ACT_RANGES_HSI_4_TOP #undef CFG_DRV_ACT_RANGES_HSI_4_TOP -#define CFG_DRV_ACT_RANGES_HSI_4_TOP HCF_CFG_HSI_4_TOP +#define CFG_DRV_ACT_RANGES_HSI_4_TOP HCF_CFG_HSI_4_TOP#else err: ;#endif #endif // HCF_CFG_HSI_4_TOP -#ifdef HCF_CFG_HSI_4_BOTTOM // Bottom Compatibility for HSI I/F +#ifdef HCF_CFG_HSI_4_BOTTOM // Bottom Compatibility for HSI I/F #if CFG_DRV_ACT_RANGES_HSI_4_BOTTOM <=HCF_CFG_HSI_4_BOTTOM &&HCF_CFG_HSI_4_BOTTOM <=CFG_DRV_ACT_RANGES_HSI_4_TOP #undef CFG_DRV_ACT_RANGES_HSI_4_BOTTOM -#define CFG_DRV_ACT_RANGES_HSI_4_BOTTOM HCF_CFG_HSI_4_BOTTOM +#define CFG_DRV_ACT_RANGES_HSI_4_BOTTOM HCF_CFG_HSI_4_BOTTOM#else err: ;#endif #endif // HCF_CFG_HSI_4_BOTTOM -#ifdef HCF_CFG_HSI_5_TOP // Top Compatibility for HSI I/F -#if HCF_CFG_HSI_5_TOP ==0 || \ +#ifdef HCF_CFG_HSI_5_TOP // Top Compatibility for HSI I/F +#if HCF_CFG_HSI_5_TOP ==0 || \CFG_DRV_ACT_RANGES_HSI_5_BOTTOM <=CF_CFG_HSI_5_TOP &&HCF_CFG_HSI_5_TOP <=CFG_DRV_ACT_RANGES_HSI_5_TOP #undef CFG_DRV_ACT_RANGES_HSI_5_TOP -#define CFG_DRV_ACT_RANGES_HSI_5_TOP HCF_CFG_HSI_5_TOP +#define CFG_DRV_ACT_RANGES_HSI_5_TOP HCF_CFG_HSI_5_TOP#else err: ;#endif #endif // HCF_CFG_HSI_5_TOP -#ifdef HCF_CFG_HSI_5_BOTTOM // Bottom Compatibility for HSI I/F +#ifdef HCF_CFG_HSI_5_BOTTOM // Bottom Compatibility for HSI I/F #if CFG_DRV_ACT_RANGES_HSI_5_BOTTOM <=HCF_CFG_HSI_5_BOTTOM &&HCF_CFG_HSI_5_BOTTOM <=CFG_DRV_ACT_RANGES_HSI_5_TOP #undef CFG_DRV_ACT_RANGES_HSI_5_BOTTOM -#define CFG_DRV_ACT_RANGES_HSI_5_BOTTOM HCF_CFG_HSI_5_BOTTOM +#define CFG_DRV_ACT_RANGES_HSI_5_BOTTOM HCF_CFG_HSI_5_BOTTOM#else err: ;#endif #endif // HCF_CFG_HSI_5_BOTTOM //--------------------------------------------------------------------------------------------------------------------- #if definedHCF_CFG_APF_1_TOP || definedHCF_CFG_APF_1_BOTTOM -err: APF_1 not supported for H-I; // Compatibility for AP Firmware - driver I/F +err: APF_1 not supported for H-I; // Compatibility for AP Firmware - driver I/F#endif // HCF_CFG_APF_1_TOP / HCF_CFG_APF_1_BOTTOM -#ifdef HCF_CFG_APF_2_TOP // Top Compatibility for AP Firmware - driver I/F -#if HCF_CFG_APF_2_TOP ==0 || \ +#ifdef HCF_CFG_APF_2_TOP // Top Compatibility for AP Firmware - driver I/F +#if HCF_CFG_APF_2_TOP ==0 || \CFG_DRV_ACT_RANGES_APF_2_BOTTOM <=HCF_CFG_APF_2_TOP &&HCF_CFG_APF_2_TOP <=CFG_DRV_ACT_RANGES_APF_2_TOP #undef CFG_DRV_ACT_RANGES_APF_2_TOP -#define CFG_DRV_ACT_RANGES_APF_2_TOP HCF_CFG_APF_2_TOP +#define CFG_DRV_ACT_RANGES_APF_2_TOP HCF_CFG_APF_2_TOP#else err: ;#endif #endif // HCF_CFG_APF_TOP -#ifdef HCF_CFG_APF_2_BOTTOM // Bottom Compatibility for AP Firmware - driver I/F +#ifdef HCF_CFG_APF_2_BOTTOM // Bottom Compatibility for AP Firmware - driver I/F #if CFG_DRV_ACT_RANGES_APF_2_BOTTOM <=HCF_CFG_APF_2_BOTTOM &&HCF_CFG_APF_2_BOTTOM <=CFG_DRV_ACT_RANGES_APF_2_TOP #undef CFG_DRV_ACT_RANGES_APF_2_BOTTOM -#define CFG_DRV_ACT_RANGES_APF_2_BOTTOM HCF_CFG_APF_2_BOTTOM +#define CFG_DRV_ACT_RANGES_APF_2_BOTTOM HCF_CFG_APF_2_BOTTOM#else err: ;#endif
@@ -566,23 +529,23 @@ err: ;//--------------------------------------------------------------------------------------------------------------------- #if definedHCF_CFG_STA_1_TOP || definedHCF_CFG_STA_1_BOTTOM -err: STA_1 not supported for H-I; // Compatibility for Station Firmware - driver I/F +err: STA_1 not supported for H-I; // Compatibility for Station Firmware - driver I/F#endif // HCF_CFG_STA_1_TOP / HCF_CFG_STA_1_BOTTOM -#ifdef HCF_CFG_STA_2_TOP // Top Compatibility for Station Firmware - driver I/F -#if HCF_CFG_STA_2_TOP ==0 || \ +#ifdef HCF_CFG_STA_2_TOP // Top Compatibility for Station Firmware - driver I/F +#if HCF_CFG_STA_2_TOP ==0 || \CFG_DRV_ACT_RANGES_STA_2_BOTTOM <=HCF_CFG_STA_2_TOP &&HCF_CFG_STA_2_TOP <=CFG_DRV_ACT_RANGES_STA_2_TOP #undef CFG_DRV_ACT_RANGES_STA_2_TOP -#define CFG_DRV_ACT_RANGES_STA_2_TOP HCF_CFG_STA_2_TOP +#define CFG_DRV_ACT_RANGES_STA_2_TOP HCF_CFG_STA_2_TOP#else err: ;#endif #endif // HCF_CFG_STA_TOP -#ifdef HCF_CFG_STA_2_BOTTOM // Bottom Compatibility for Station Firmware - driver I/F +#ifdef HCF_CFG_STA_2_BOTTOM // Bottom Compatibility for Station Firmware - driver I/F #if CFG_DRV_ACT_RANGES_STA_2_BOTTOM <=HCF_CFG_STA_2_BOTTOM &&HCF_CFG_STA_2_BOTTOM <=CFG_DRV_ACT_RANGES_STA_2_TOP #undef CFG_DRV_ACT_RANGES_STA_2_BOTTOM -#define CFG_DRV_ACT_RANGES_STA_2_BOTTOM HCF_CFG_STA_2_BOTTOM +#define CFG_DRV_ACT_RANGES_STA_2_BOTTOM HCF_CFG_STA_2_BOTTOM#else err: ;#endif
@@ -597,32 +560,32 @@ err: ;#if definedMSF_WAIT err: MSF should no longer supply this macro;#else -#define MSF_WAIT (x) \ - { PROT_CNT_INI \ - HCF_WAIT_WHILE( ( IPW( HREG_IO ) & HREG_IO_WOKEN_UP ) == 0 ); \ - HCFASSERT( prot_cnt, IPW( HREG_IO ) ) \ - } +#define MSF_WAIT (x) \ + { PROT_CNT_INI \ + HCF_WAIT_WHILE( ( IPW( HREG_IO ) & HREG_IO_WOKEN_UP ) == 0 ); \ + HCFASSERT( prot_cnt, IPW( HREG_IO ) ) \ + }#endif // MSF_WAIT #else -#define MSF_WAIT (x)/*NOP*/ +#define MSF_WAIT (x)/*NOP*/ #endif // HCF_SLEEP -#define LOF (x) (sizeof(x)/sizeof(hcf_16)-1) +#define LOF (x) (sizeof(x)/sizeof(hcf_16)-1) -#define MUL_BY_2 ( x ) ( (x) << 1 ) //used to multiply by 2 -#define DIV_BY_2 ( x ) ( (x) >> 1 ) //used to divide by 2 +#define MUL_BY_2 ( x ) ( (x) << 1 ) //used to multiply by 2 +#define DIV_BY_2 ( x ) ( (x) >> 1 ) //used to divide by 2//resolve problems on for some 16 bits compilers to create 32 bit values -#define MERGE_2 ( hw, lw ) ( ( ((hcf_32)(hw)) << 16 ) | ((hcf_16)(lw)) ) +#define MERGE_2 ( hw, lw ) ( ( ((hcf_32)(hw)) << 16 ) | ((hcf_16)(lw)) )#if ! definedHCF_STATIC -#define HCF_STATIC static -#endif // HCF_STATIC +#define HCF_STATIC static +#endif // HCF_STATIC #if ( (HCF_TYPE ) &HCF_TYPE_HII5 ) ==0 -#define DAWA_ACK ( mask) { \ - OPW( HREG_EV_ACK, mask | HREG_EV_ACK_REG_READY ); \ - OPW( HREG_EV_ACK, (mask & ~HREG_EV_ALLOC) | HREG_EV_ACK_REG_READY ); } +#define DAWA_ACK ( mask) { \ + OPW( HREG_EV_ACK, mask | HREG_EV_ACK_REG_READY ); \ + OPW( HREG_EV_ACK, (mask & ~HREG_EV_ALLOC) | HREG_EV_ACK_REG_READY ); }#define DAWA_ZERO_FID (reg) OPW( reg, 0 );#else #define DAWA_ACK ( mask) OPW( HREG_EV_ACK, mask );
@@ -630,20 +593,20 @@ err: MSF should no longer supply this macro;#endif // HCF_TYPE_HII5 #if (HCF_TYPE ) &HCF_TYPE_WPA -#define CALC_RX_MIC ( p, len ) calc_mic_rx_frag( ifbp, p, len ) -#define CALC_TX_MIC ( p, len ) calc_mic_tx_frag( ifbp, p, len ) +#define CALC_RX_MIC ( p, len ) calc_mic_rx_frag( ifbp, p, len ) +#define CALC_TX_MIC ( p, len ) calc_mic_tx_frag( ifbp, p, len )#define IF_SSN (x) x#define IF_NOT_SSN (x)#else -#define CALC_RX_MIC ( p, len ) -#define CALC_TX_MIC ( p, len ) +#define CALC_RX_MIC ( p, len ) +#define CALC_TX_MIC ( p, len )#define MIC_RX_RTN ( mic, dw )#define MIC_TX_RTN ( mic, dw )#define IF_SSN (x)#define IF_NOT_SSN (x) x#endif // HCF_TYPE_WPA -#if HCF_TALLIES &HCF_TALLIES_HCF //HCF tally support +#if HCF_TALLIES &HCF_TALLIES_HCF //HCF tally support #define IF_TALLY (x) x#else #define IF_TALLY (x)
@@ -651,23 +614,23 @@ err: MSF should no longer supply this macro;#if HCF_DMA -#define IF_DMA (x) x +#define IF_DMA (x) x#define IF_NOT_DMA (x) -#define IF_USE_DMA (x) if ( ifbp->IFB_CntlOpt & USE_DMA ) x -#define IF_NOT_USE_DMA (x) if ( !(ifbp->IFB_CntlOpt & USE_DMA) ) x +#define IF_USE_DMA (x) if ( ifbp->IFB_CntlOpt & USE_DMA ) x +#define IF_NOT_USE_DMA (x) if ( !(ifbp->IFB_CntlOpt & USE_DMA) ) x#else #define IF_DMA (x) -#define IF_NOT_DMA (x) x +#define IF_NOT_DMA (x) x#define IF_USE_DMA (x) -#define IF_NOT_USE_DMA (x) x +#define IF_NOT_USE_DMA (x) x#endif // HCF_DMA #define IPW (x) ((hcf_16)IN_PORT_WORD( ifbp->IFB_IOBase + (x) ) )#define OPW (x, y) OUT_PORT_WORD( ifbp->IFB_IOBase + (x), y ) -/* make sure the implementation of HCF_WAIT_WHILE is such that there may be multiple HCF_WAIT_WHILE calls -* in a row and that when one fails all subsequent fail immediately without reinitialization of prot_cnt -*/ +/* make sure the implementation of HCF_WAIT_WHILE is such that there may be multiple HCF_WAIT_WHILE calls +* in a row and that when one fails all subsequent fail immediately without reinitialization of prot_cnt +*/ #if HCF_PROT_TIME ==0 #define PROT_CNT_INI #define IF_PROT_TIME (x)
@@ -677,8 +640,8 @@ err: MSF should no longer supply this macro;#define HCF_WAIT_WHILE ( x ) while ( x )/*NOP*/ ;#endif // HCF_YIELD #else -#define PROT_CNT_INI hcf_32 prot_cnt = ifbp->IFB_TickIni; -#define IF_PROT_TIME (x) x +#define PROT_CNT_INI hcf_32 prot_cnt = ifbp->IFB_TickIni; +#define IF_PROT_TIME (x) x#if definedHCF_YIELD #define HCF_WAIT_WHILE ( x ) while ( prot_cnt && (x) && (HCF_YIELD) ) prot_cnt--;#else
@@ -697,7 +660,7 @@ err: you used an invalid bitmask;#endif // HCF_EX_INT #if 0 //get compiler going -#if HCF_EX_INT_TICK !=HREG_EV_TICK +#if HCF_EX_INT_TICK !=HREG_EV_TICK ;? out dated checking err: someone redefined these macros while the implemenation assumes they are equal;#endif
@@ -724,36 +687,36 @@ err: someone redefined these macros while the implemenation assumes they are equ#define HCFASSERT (x,q) {if (!(x)) {mdd_assert( ifbp, __LINE__ , q );}}#define MMDASSERT (x,q) {if (!(x)) {mdd_assert( assert_ifbp, __LINE__ + FILE_NAME_OFFSET, q );}} -#define HCFLOGENTRY ( where, what ) \ -{if ( (ifbp->IFB_AssertWhere = where) <= 15 ) { \ - HCF_ENTRY( ifbp ); \ - HCFASSERT( (ifbp->IFB_AssertTrace & 1<<((where)&0xF)) == 0, ifbp->IFB_AssertTrace ); \ - ifbp->IFB_AssertTrace |= 1<<((where)&0xF); \ - } \ -HCFTRACE(ifbp, where ) \ -HCFTRACEVALUE(ifbp, what ) \ -} - -#define HCFLOGEXIT ( where ) \ -{if ( (ifbp->IFB_AssertWhere = where) <= 15 ) { \ - HCF_EXIT( ifbp ); \ - ifbp->IFB_AssertTrace &= ~(1<<((where)&0xF)); \ - } \ -HCFTRACE(ifbp, (where)|HCF_TRACE_EXIT ) \ -} +#define HCFLOGENTRY ( where, what ) \ + {if ( (ifbp->IFB_AssertWhere = where) <= 15 ) { \ + HCF_ENTRY( ifbp ); \ + HCFASSERT( (ifbp->IFB_AssertTrace & 1<<((where)&0xF)) == 0, ifbp->IFB_AssertTrace ); \ + ifbp->IFB_AssertTrace |= 1<<((where)&0xF); \ + } \ + HCFTRACE(ifbp, where ) \ + HCFTRACEVALUE(ifbp, what ) \ + } + +#define HCFLOGEXIT ( where ) \ + {if ( (ifbp->IFB_AssertWhere = where) <= 15 ) { \ + HCF_EXIT( ifbp ); \ + ifbp->IFB_AssertTrace &= ~(1<<((where)&0xF)); \ + } \ + HCFTRACE(ifbp, (where)|HCF_TRACE_EXIT ) \ + }#else // HCF_ASSERT #define HCFASSERT ( x, q )#define MMDASSERT ( x, q ) -#define HCFLOGENTRY ( where, what ) {HCF_ENTRY( ifbp );} -#define HCFLOGEXIT ( where ) {HCF_EXIT( ifbp );} +#define HCFLOGENTRY ( where, what ) {HCF_ENTRY( ifbp );} +#define HCFLOGEXIT ( where ) {HCF_EXIT( ifbp );}#endif // HCF_ASSERT #if HCF_INT_ON /* ;? HCFASSERT_INT * #if (HCF_SLEEP) & HCF_DDS * #define HCFASSERT_INT HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFF && ifbp->IFB_IntOffCnt != 0xFFFE, \ -* ifbp->IFB_IntOffCnt ) +* ifbp->IFB_IntOffCnt ) * #else */ #define HCFASSERT_INT HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFF, ifbp->IFB_IntOffCnt )
@@ -764,8 +727,8 @@ HCFTRACE(ifbp, (where)|HCF_TRACE_EXIT ) \#if definedHCF_TRACE -#define HCFTRACE (ifbp, where ) {OPW( HREG_SW_1, where );} -//#define HCFTRACE(ifbp, where ) {HCFASSERT( DO_ASSERT, where );} +#define HCFTRACE (ifbp, where ) {OPW( HREG_SW_1, where );} +//#define HCFTRACE(ifbp, where ) {HCFASSERT( DO_ASSERT, where );} #define HCFTRACEVALUE (ifbp, what ) {OPW( HREG_SW_2, what );}//#define HCFTRACEVALUE(ifbp, what ) {HCFASSERT( DO_ASSERT, what );} #else
@@ -775,7 +738,7 @@ HCFTRACE(ifbp, (where)|HCF_TRACE_EXIT ) \#if HCF_BIG_ENDIAN -#define BE_PAR (x) ,x +#define BE_PAR (x) ,x#else #define BE_PAR (x)#endif // HCF_BIG_ENDIAN
@@ -789,13 +752,13 @@ HCFTRACE(ifbp, (where)|HCF_TRACE_EXIT ) \/************************************************************************************************/ #if HCF_ASSERT -extern IFBP BASED assert_ifbp; //to make asserts easily work under MMD and DHF -EXTERN_C void mdd_assert (IFBP ifbp, unsigned int line_number, hcf_32 q ); +extern IFBP BASED assert_ifbp; //to make asserts easily work under MMD and DHF +EXTERN_C void mdd_assert (IFBP ifbp, unsigned int line_number, hcf_32 q );#endif //HCF_ASSERT -#if ! ( (HCF_IO ) &HCF_IO_32BITS )// defined 16 bits only +#if ! ( (HCF_IO ) &HCF_IO_32BITS )// defined 16 bits only #undef OUT_PORT_STRING_32#undef IN_PORT_STRING_32#endif // HCF_IO -#endif //HCFDEFC_H +#endif //HCFDEFC_H
Signature · 1 line
1.7.4.1
PATCH 3/13 staging: wlags49_h2: Fix macro termination
In reply to David KilroySemi-colon terminate various macros (HCFASSERT, IF_PROT_TIME, IF_DMA, PROT_CNT_INI, HCFLOGENTRY, HCFLOGEXIT, DAWA_ACK, DAWA_ZERO_FID) so auto-indent will work correctly. Add appropriate do {} while protection to the macros.
--- drivers/staging/wlags49_h2/hcf.c | 350 +++++++++++++++++----------------- drivers/staging/wlags49_h2/hcfdef.h | 93 +++++----- 2 files changed, 220 insertions(+), 223 deletions(-)
drivers/staging/wlags49_h2/hcf.c +175 -175
@@ -703,19 +703,19 @@ hcf_action( IFBP ifbp, hcf_16 action ) {int rc =HCF_SUCCESS ; - HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) +HCFASSERT ( ifbp->IFB_Magic ==HCF_MAGIC , ifbp->IFB_Magic );#if HCF_INT_ON - HCFLOGENTRY( action == HCF_ACT_INT_FORCE_ON ? HCF_TRACE_ACTION_KLUDGE : HCF_TRACE_ACTION, action ) /* 0 */ +HCFLOGENTRY ( action ==HCF_ACT_INT_FORCE_ON ?HCF_TRACE_ACTION_KLUDGE :HCF_TRACE_ACTION , action );/* 0 */ #if (HCF_SLEEP )HCFASSERT ( ifbp->IFB_IntOffCnt !=0xFFFE || action ==HCF_ACT_INT_OFF , - MERGE_2( action, ifbp->IFB_IntOffCnt ) ) +MERGE_2 ( action, ifbp->IFB_IntOffCnt ) );#else - HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFE, action ) +HCFASSERT ( ifbp->IFB_IntOffCnt !=0xFFFE , action );#endif // HCF_SLEEP HCFASSERT ( ifbp->IFB_IntOffCnt !=0xFFFF || - action == HCF_ACT_INT_OFF || action == HCF_ACT_INT_FORCE_ON, action ) + action ==HCF_ACT_INT_OFF || action ==HCF_ACT_INT_FORCE_ON , action );HCFASSERT ( ifbp->IFB_IntOffCnt <=16 || ifbp->IFB_IntOffCnt >=0xFFFE , - MERGE_2( action, ifbp->IFB_IntOffCnt ) ) //nesting more than 16 deep seems unreasonable +MERGE_2 ( action, ifbp->IFB_IntOffCnt ) );//nesting more than 16 deep seems unreasonable #endif // HCF_INT_ON switch (action) {
@@ -789,7 +789,7 @@ hcf_16 i;cmd_exe ( ifbp,HCMD_SLEEP ,0 );break ;// case HCF_ACT_WAKEUP: // DDS Wakeup request -// HCFASSERT( ifbp->IFB_IntOffCnt == 0xFFFE, ifbp->IFB_IntOffCnt ) +// HCFASSERT( ifbp->IFB_IntOffCnt == 0xFFFE, ifbp->IFB_IntOffCnt ); // ifbp->IFB_IntOffCnt++; // restore conventional I/F // OPW( HREG_IO, HREG_IO_WAKEUP_ASYNC ); // MSF_WAIT(800); // MSF-defined function to wait n microseconds.
@@ -828,11 +828,11 @@ hcf_16 i;break ;default : -HCFASSERT (DO_ASSERT , action ) +HCFASSERT (DO_ASSERT , action ); break; }//! do not HCFASSERT( rc == HCF_SUCCESS, rc ) /* 30*/ -HCFLOGEXIT ( HCF_TRACE_ACTION ) +HCFLOGEXIT (HCF_TRACE_ACTION );return rc; }// hcf_action #endif // HCF_DL_ONLY
@@ -959,13 +959,13 @@ int rc = HCF_ERR_INCOMP_FW; x &= ~HFS_TX_CNTL_PORT; }HCFASSERT ( x==HCF_CNTL_ENABLE || x==HCF_CNTL_DISABLE ||HCF_CNTL_CONTINUE || - x==HCF_CNTL_CONNECT || x==HCF_CNTL_DISCONNECT, cmd ) + x==HCF_CNTL_CONNECT || x==HCF_CNTL_DISCONNECT , cmd ); }#endif // HCF_ASSERT // #if (HCF_SLEEP) & HCF_DDS -// HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFE, cmd ) +// HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFE, cmd ); // #endif // HCF_DDS - HCFLOGENTRY( HCF_TRACE_CNTL, cmd ) +HCFLOGENTRY (HCF_TRACE_CNTL , cmd );if ( ifbp->IFB_CardStat ==0 ) {/*2*/ /*6*/ rc =cmd_exe ( ifbp, cmd,0 );#if (HCF_SLEEP ) &HCF_DDS
@@ -989,12 +989,12 @@ int rc = HCF_ERR_INCOMP_FW;* as additional beneficiary side effect, the SOP and EOP bits will also be cleared */ ifbp->IFB_CntlOpt |=DMA_ENABLED ; -HCFASSERT (NT_ASSERT ,NEVER_TESTED ) +HCFASSERT (NT_ASSERT ,NEVER_TESTED );// make the entire rx descriptor chain DMA-owned, so the DMA engine can (re-)use it. p = ifbp->IFB_FirstDesc[DMA_RX ];if (p !=NULL ) {//;? Think this over again in the light of the new chaining strategy if (1 ) {//begin alternative - HCFASSERT( NT_ASSERT, NEVER_TESTED ) +HCFASSERT (NT_ASSERT ,NEVER_TESTED );put_frame_lst ( ifbp, ifbp->IFB_FirstDesc[DMA_RX ],DMA_RX );if ( ifbp->IFB_FirstDesc[DMA_RX ] ) {put_frame_lst ( ifbp, ifbp->IFB_FirstDesc[DMA_RX ]->next_desc_addr,DMA_RX );
@@ -1013,8 +1013,8 @@ int rc = HCF_ERR_INCOMP_FW; } }#endif // HCF_DMA - HCFASSERT( rc == HCF_SUCCESS, rc ) -HCFLOGEXIT ( HCF_TRACE_CNTL ) +HCFASSERT ( rc ==HCF_SUCCESS , rc ); +HCFLOGEXIT (HCF_TRACE_CNTL );return rc; }// hcf_cntl
@@ -1217,19 +1217,19 @@ LTV_STRCT x; ifbp->IFB_AssertStrct.frag_buf[0 ].frag_addr = &ifbp->IFB_AssertLine;#endif // HCF_ASSERT_MB #endif // HCF_ASSERT - IF_PROT_TIME( prot_cnt = ifbp->IFB_TickIni = INI_TICK_INI; ) +IF_PROT_TIME ( prot_cnt = ifbp->IFB_TickIni =INI_TICK_INI );#if ( (HCF_TYPE ) &HCF_TYPE_PRELOADED ) ==0 //!! No asserts before Reset-bit in HREG_IO is cleared OPW (HREG_IO ,0x0000 );//OPW useable /* 2b*/ HCF_WAIT_WHILE ( (IPW (HREG_EV_STAT ) &HREG_EV_CMD ) ==0 ); -IF_PROT_TIME ( HCFASSERT(prot_cnt ,IPW (HREG_EV_STAT ) ) ) - IF_PROT_TIME( if ( prot_cnt ) prot_cnt = ifbp->IFB_TickIni; ) +IF_PROT_TIME (HCFASSERT ( prot_cnt,IPW (HREG_EV_STAT ) ) ); + IF_PROT_TIME( if ( prot_cnt ) prot_cnt = ifbp->IFB_TickIni );#endif // HCF_TYPE_PRELOADED //!! No asserts before Reset-bit in HREG_IO is cleared - HCFASSERT( DO_ASSERT, MERGE_2( HCF_ASSERT, 0xCAF0 ) ) //just to proof that the complete assert machinery is working - HCFASSERT( xa != CFG_FW_IDENTITY, 0 ) // assert if hcf_connect is called without intervening hcf_disconnect. - HCFASSERT( ((hcf_32)(void*)ifbp & (HCF_ALIGN-1) ) == 0, (hcf_32)(void*)ifbp ) -HCFASSERT ( (io_addr &0x003F ) ==0 , io_addr ) +HCFASSERT (DO_ASSERT ,MERGE_2 (HCF_ASSERT ,0xCAF0 ) );//just to proof that the complete assert machinery is working +HCFASSERT ( xa !=CFG_FW_IDENTITY ,0 );// assert if hcf_connect is called without intervening hcf_disconnect. +HCFASSERT ( ((hcf_32 )(void *)ifbp & (HCF_ALIGN -1 ) ) ==0 , (hcf_32 )(void *)ifbp ); +HCFASSERT ( (io_addr &0x003F ) ==0 , io_addr );//if Busy bit in Cmd register if (IPW (HREG_CMD ) &HCMD_BUSY ) {/* 8 */ //. Ack all to unblock a (possibly) blocked cmd pipe line
@@ -1237,7 +1237,7 @@ LTV_STRCT x;//. Wait for Busy bit drop in Cmd register //. Wait for Cmd bit raise in Ev register HCF_WAIT_WHILE ( (IPW (HREG_CMD ) &HCMD_BUSY ) && (IPW (HREG_EV_STAT ) &HREG_EV_CMD ) ==0 ); - IF_PROT_TIME( HCFASSERT( prot_cnt, IPW( HREG_EV_STAT) ) ) /* if prot_cnt == 0, cmd_exe will fail, causing DEFUNCT */ +IF_PROT_TIME (HCFASSERT ( prot_cnt,IPW (HREG_EV_STAT ) ) );/* if prot_cnt == 0, cmd_exe will fail, causing DEFUNCT */ }OPW (HREG_EV_ACK , ~HREG_EV_SLEEP_REQ );#if ( (HCF_TYPE ) &HCF_TYPE_PRELOADED ) ==0 /*12*/
@@ -1307,7 +1307,7 @@ get_frame_lst( IFBP ifbp, int tx_rx_flag )DESC_STRCT *head = ifbp->IFB_FirstDesc[tx_rx_flag];DESC_STRCT *copy, *p, *prev; -HCFASSERT ( tx_rx_flag ==DMA_RX || tx_rx_flag ==DMA_TX , tx_rx_flag ) +HCFASSERT ( tx_rx_flag ==DMA_RX || tx_rx_flag ==DMA_TX , tx_rx_flag );//if FrameList if ( head ) {//. search for last descriptor of first FrameList
@@ -1407,27 +1407,27 @@ put_frame_lst( IFBP ifbp, DESC_STRCT *descp, int tx_rx_flag )DESC_STRCT *p = descp;hcf_16 port; - HCFASSERT( ifbp->IFB_CntlOpt & USE_DMA, ifbp->IFB_CntlOpt) //only hcf_dma_tx_put must also be DMA_ENABLED - HCFASSERT( tx_rx_flag == DMA_RX || tx_rx_flag == DMA_TX, tx_rx_flag ) - HCFASSERT( p , 0 ) +HCFASSERT ( ifbp->IFB_CntlOpt &USE_DMA , ifbp->IFB_CntlOpt);//only hcf_dma_tx_put must also be DMA_ENABLED +HCFASSERT ( tx_rx_flag ==DMA_RX || tx_rx_flag ==DMA_TX , tx_rx_flag ); +HCFASSERT ( p ,0 );while ( p ) { - HCFASSERT( ((hcf_32)p & 3 ) == 0, (hcf_32)p ) - HCFASSERT( (p->BUF_CNT & ~DESC_CNT_MASK) == 0, p->BUF_CNT ) -HCFASSERT ( (p->BUF_SIZE & ~DESC_CNT_MASK ) ==0 , p->BUF_SIZE ) +HCFASSERT ( ((hcf_32 )p &3 ) ==0 , (hcf_32 )p ); +HCFASSERT ( (p->BUF_CNT & ~DESC_CNT_MASK ) ==0 , p->BUF_CNT ); +HCFASSERT ( (p->BUF_SIZE & ~DESC_CNT_MASK ) ==0 , p->BUF_SIZE ); p->BUF_SIZE &=DESC_CNT_MASK ;//!!this SHOULD be superfluous in case of correct MSF p->BUF_CNT &= tx_rx_flag ==DMA_RX ?0 :DESC_CNT_MASK ;//!!this SHOULD be superfluous in case of correct MSF p->BUF_CNT |=DESC_DMA_OWNED ;if ( p->next_desc_addr ) { -// HCFASSERT( p->buf_addr && p->buf_phys_addr && p->BUF_SIZE && +/- p->BUF_SIZE, ... ) -HCFASSERT ( p->next_desc_addr->desc_phys_addr, (hcf_32 )p->next_desc_addr ) +// HCFASSERT( p->buf_addr && p->buf_phys_addr && p->BUF_SIZE && +/- p->BUF_SIZE, ... ); +HCFASSERT ( p->next_desc_addr->desc_phys_addr, (hcf_32 )p->next_desc_addr ); p->next_desc_phys_addr = p->next_desc_addr->desc_phys_addr; }else {// p->next_desc_phys_addr =0 ;if ( p->buf_addr ==NULL ) {// DELWA Descriptor - HCFASSERT( descp == p, (hcf_32)descp ) //singleton DescriptorList - HCFASSERT( ifbp->IFB_FirstDesc[tx_rx_flag] == NULL, (hcf_32)ifbp->IFB_FirstDesc[tx_rx_flag]) -HCFASSERT ( ifbp->IFB_LastDesc[tx_rx_flag] ==NULL , (hcf_32 )ifbp->IFB_LastDesc[tx_rx_flag]) +HCFASSERT ( descp == p, (hcf_32 )descp );//singleton DescriptorList +HCFASSERT ( ifbp->IFB_FirstDesc[tx_rx_flag] ==NULL , (hcf_32 )ifbp->IFB_FirstDesc[tx_rx_flag]); +HCFASSERT ( ifbp->IFB_LastDesc[tx_rx_flag] ==NULL , (hcf_32 )ifbp->IFB_LastDesc[tx_rx_flag]); descp->BUF_CNT =0 ;//&= ~DESC_DMA_OWNED; ifbp->IFB_FirstDesc[tx_rx_flag] = descp;// part of alternative ifbp->IFB_LastDesc[tx_rx_flag] = ifbp->IFB_FirstDesc[tx_rx_flag] = descp;
@@ -1436,10 +1436,10 @@ put_frame_lst( IFBP ifbp, DESC_STRCT *descp, int tx_rx_flag )// . prepare for activation DMA controller // part of alternative descp = descp->next_desc_addr; }else {//a "real" FrameList, hand it over to the DMA engine - HCFASSERT( ifbp->IFB_FirstDesc[tx_rx_flag], (hcf_32)descp ) - HCFASSERT( ifbp->IFB_LastDesc[tx_rx_flag], (hcf_32)descp ) +HCFASSERT ( ifbp->IFB_FirstDesc[tx_rx_flag], (hcf_32 )descp ); +HCFASSERT ( ifbp->IFB_LastDesc[tx_rx_flag], (hcf_32 )descp );HCFASSERT ( ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr ==NULL , - (hcf_32 )ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr) + (hcf_32 )ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr);// p->buf_cntl.cntl_stat |= DESC_DMA_OWNED; ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr = descp; ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_phys_addr = descp->desc_phys_addr;
@@ -1522,16 +1522,16 @@ DESC_STRCT *descp; // pointer to start of FrameList {int i;DESC_STRCT *p = descp->next_desc_addr;//pointer to 2nd descriptor of frame -HCFASSERT (p,0 ) +HCFASSERT (p,0 );// The 2nd descriptor contains (maybe) a SNAP header plus part or whole of the payload. //determine decapsulation sub-flag in RxFS i = *(wci_recordp)&descp->buf_addr[HFS_STAT ] & (HFS_STAT_MSG_TYPE |HFS_STAT_ERR );if ( i ==HFS_STAT_TUNNEL || ( i ==HFS_STAT_1042 &&hcf_encap ( (wci_bufp)&p->buf_addr[HCF_DASA_SIZE ] ) !=ENC_TUNNEL )) {// The 2nd descriptor contains a SNAP header plus part or whole of the payload. -HCFASSERT ( p->BUF_CNT == (p->buf_addr[5 ] + (p->buf_addr[4 ]<<8 ) +2 *6 +2 -8 ), p->BUF_CNT ) +HCFASSERT ( p->BUF_CNT == (p->buf_addr[5 ] + (p->buf_addr[4 ]<<8 ) +2 *6 +2 -8 ), p->BUF_CNT );// perform decapsulation -HCFASSERT (p->BUF_SIZE >=8 , p->BUF_SIZE) +HCFASSERT (p->BUF_SIZE >=8 , p->BUF_SIZE);// move SA[2:5] in the second buffer to replace part of the SNAP header for ( i=3 ; i >=0 ; i--) p->buf_addr[i+8 ] = p->buf_addr[i];// copy DA[0:5], SA[0:1] from first buffer to second buffer
@@ -1542,7 +1542,7 @@ DESC_STRCT *p = descp->next_desc_addr; //pointer to 2nd descriptor of frame }#endif // HCF_ENC if ( descp ==NULL ) ifbp->IFB_DmaPackets &= (hcf_16 )~HREG_EV_RDMAD ;//;?could be integrated into get_frame_lst -HCFLOGEXIT ( HCF_TRACE_DMA_RX_GET ) +HCFLOGEXIT (HCF_TRACE_DMA_RX_GET );return descp; }// hcf_dma_rx_get
@@ -1596,20 +1596,20 @@ void hcf_dma_rx_put( IFBP ifbp, DESC_STRCT *descp ) { - HCFLOGENTRY( HCF_TRACE_DMA_RX_PUT, 0xDA01 ) - HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) - HCFASSERT_INT + HCFLOGENTRY( HCF_TRACE_DMA_RX_PUT, 0xDA01 ); +HCFASSERT ( ifbp->IFB_Magic ==HCF_MAGIC , ifbp->IFB_Magic ); +HCFASSERT_INT ;put_frame_lst ( ifbp, descp,DMA_RX );#if HCF_ASSERT && (HCF_ENCAP ) ==HCF_ENC if ( descp->buf_addr ) { - HCFASSERT( descp->BUF_SIZE == HCF_DMA_RX_BUF1_SIZE, descp->BUF_SIZE ) -HCFASSERT ( descp->next_desc_addr,0 )// first descriptor should be followed by another descriptor +HCFASSERT ( descp->BUF_SIZE ==HCF_DMA_RX_BUF1_SIZE , descp->BUF_SIZE ); +HCFASSERT ( descp->next_desc_addr,0 );// first descriptor should be followed by another descriptor // The second DB is for SNAP and payload purposes. It should be a minimum of 12 bytes in size. - HCFASSERT( descp->next_desc_addr->BUF_SIZE >= 12, descp->next_desc_addr->BUF_SIZE ) +HCFASSERT ( descp->next_desc_addr->BUF_SIZE >=12 , descp->next_desc_addr->BUF_SIZE ); }#endif // HCFASSERT / HCF_ENC -HCFLOGEXIT ( HCF_TRACE_DMA_RX_PUT ) +HCFLOGEXIT (HCF_TRACE_DMA_RX_PUT ); }// hcf_dma_rx_put
@@ -1660,7 +1660,7 @@ DESC_STRCT *descp; // pointer to start of FrameListif ( descp ==NULL ) {//;?could be integrated into get_frame_lst ifbp->IFB_DmaPackets &= (hcf_16 )~HREG_EV_TDMAD ; } -HCFLOGEXIT ( HCF_TRACE_DMA_TX_GET ) +HCFLOGEXIT (HCF_TRACE_DMA_TX_GET );return descp; }// hcf_dma_tx_get
@@ -1788,19 +1788,19 @@ int i;#if HCF_ASSERT int x = ifbp->IFB_FWIdentity.comp_id ==COMP_ID_FW_AP ? tx_cntl & ~HFS_TX_CNTL_PORT : tx_cntl; - HCFASSERT( (x & ~HCF_TX_CNTL_MASK ) == 0, tx_cntl ) +HCFASSERT ( (x & ~HCF_TX_CNTL_MASK ) ==0 , tx_cntl );#endif // HCF_ASSERT - HCFLOGENTRY( HCF_TRACE_DMA_TX_PUT, 0xDA03 ) - HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) - HCFASSERT_INT - HCFASSERT( ( ifbp->IFB_CntlOpt & (USE_DMA|DMA_ENABLED) ) == (USE_DMA|DMA_ENABLED), ifbp->IFB_CntlOpt) +HCFLOGENTRY (HCF_TRACE_DMA_TX_PUT ,0xDA03 ); +HCFASSERT ( ifbp->IFB_Magic ==HCF_MAGIC , ifbp->IFB_Magic ); +HCFASSERT_INT ; +HCFASSERT ( ( ifbp->IFB_CntlOpt & (USE_DMA |DMA_ENABLED ) ) == (USE_DMA |DMA_ENABLED ), ifbp->IFB_CntlOpt);if ( descp->buf_addr ) { *(hcf_16 *)(descp->buf_addr +HFS_TX_CNTL ) = tx_cntl;/*1*/ #if (HCF_ENCAP ) ==HCF_ENC - HCFASSERT( descp->next_desc_addr, 0 ) //at least 2 descripors - HCFASSERT( descp->BUF_CNT == HFS_ADDR_DEST, descp->BUF_CNT ) //exact length required for 1st buffer - HCFASSERT( descp->BUF_SIZE >= HCF_DMA_TX_BUF1_SIZE, descp->BUF_SIZE ) //minimal storage for encapsulation +HCFASSERT ( descp->next_desc_addr,0 );//at least 2 descripors +HCFASSERT ( descp->BUF_CNT ==HFS_ADDR_DEST , descp->BUF_CNT );//exact length required for 1st buffer +HCFASSERT ( descp->BUF_SIZE >=HCF_DMA_TX_BUF1_SIZE , descp->BUF_SIZE );//minimal storage for encapsulation HCFASSERT ( p->BUF_CNT >=14 , p->BUF_CNT );//at least DA, SA and 'type' in 2nd buffer #if (HCF_TYPE ) &HCF_TYPE_CCX
@@ -1850,7 +1850,7 @@ int i; #endif // HCF_ENC }put_frame_lst ( ifbp, descp,DMA_TX ); - HCFLOGEXIT( HCF_TRACE_DMA_TX_PUT ) +HCFLOGEXIT (HCF_TRACE_DMA_TX_PUT ); }// hcf_dma_tx_put #endif // HCF_DMA
@@ -2035,11 +2035,11 @@ hcf_16 *q = NULL; /* source word pointer Note!! DOS COM can't cope with FAR*/ int i; - HCFLOGENTRY( HCF_TRACE_GET_INFO, ltvp->typ ) - HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) - HCFASSERT_INT - HCFASSERT( ltvp, 0 ) -HCFASSERT (1 < ltvp->len && ltvp->len <=HCF_MAX_LTV +1 ,MERGE_2 ( ltvp->typ, ltvp->len ) ) +HCFLOGENTRY (HCF_TRACE_GET_INFO , ltvp->typ ); +HCFASSERT ( ifbp->IFB_Magic ==HCF_MAGIC , ifbp->IFB_Magic ); +HCFASSERT_INT ; +HCFASSERT ( ltvp,0 ); +HCFASSERT (1 < ltvp->len && ltvp->len <=HCF_MAX_LTV +1 ,MERGE_2 ( ltvp->typ, ltvp->len ) ); ltvp->len =0 ;//default to: No Info Available #if definedMSF_COMPONENT_ID || (HCF_EXT ) &HCF_EXT_MB //filter out all specials
@@ -2096,9 +2096,9 @@ wci_bufp pt; //pointer with the "right" type, just to help ease writing macr } }else if ( type ==CFG_CMD_HCF ) {#define P ((CFG_CMD_HCF_STRCT FAR *)ltvp) - HCFASSERT( P->cmd == CFG_CMD_HCF_REG_ACCESS, P->cmd ) //only Hermes register access supported +HCFASSERT (P ->cmd ==CFG_CMD_HCF_REG_ACCESS ,P ->cmd );//only Hermes register access supported if (P ->cmd ==CFG_CMD_HCF_REG_ACCESS ) { -HCFASSERT (P ->mode < ifbp->IFB_IOBase,P ->mode )//Check Register space +HCFASSERT (P ->mode < ifbp->IFB_IOBase,P ->mode );//Check Register space ltvp->len =min ( len,4 );//RESTORE ltv length P ->add_info =IPW (P ->mode ); }
@@ -2117,7 +2117,7 @@ wci_bufp pt; //pointer with the "right" type, just to help ease writing macr get_frag( ifbp, (wci_bufp)<vp->len, 2*len+2 BE_PAR(2) );if (IPW (HREG_STAT ) ==0xFFFF ) {//NIC removal test ltvp->len =0 ; - HCFASSERT( DO_ASSERT, type ) +HCFASSERT (DO_ASSERT , type ); } }/*12*/ }else HCFASSERT (DO_ASSERT , type )/*NOP*/ ;//NOP in case HCFASSERT is dummy
@@ -2129,8 +2129,8 @@ wci_bufp pt; //pointer with the "right" type, just to help ease writing macr } }HCFASSERT ( rc ==HCF_SUCCESS || ( rc ==HCF_ERR_LEN && ifbp->IFB_AssertTrace &1 <<HCF_TRACE_PUT_INFO ), - MERGE_2( type, rc ) ) /*20*/ -HCFLOGEXIT ( HCF_TRACE_GET_INFO ) +MERGE_2 ( type, rc ) );/*20*/ +HCFLOGEXIT (HCF_TRACE_GET_INFO );return rc; }// hcf_get_info
@@ -2210,11 +2210,11 @@ hcf_put_info( IFBP ifbp, LTVP ltvp ) {int rc =HCF_SUCCESS ; - HCFLOGENTRY( HCF_TRACE_PUT_INFO, ltvp->typ ) - HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) - HCFASSERT_INT - HCFASSERT( ltvp, 0 ) -HCFASSERT (1 < ltvp->len && ltvp->len <=HCF_MAX_LTV +1 , ltvp->len ) +HCFLOGENTRY (HCF_TRACE_PUT_INFO , ltvp->typ ); +HCFASSERT ( ifbp->IFB_Magic ==HCF_MAGIC , ifbp->IFB_Magic ); +HCFASSERT_INT ; +HCFASSERT ( ltvp,0 ); +HCFASSERT (1 < ltvp->len && ltvp->len <=HCF_MAX_LTV +1 , ltvp->len );//all codes between 0xFA00 and 0xFCFF are passed to Hermes #if (HCF_TYPE ) &HCF_TYPE_WPA
@@ -2256,7 +2256,7 @@ int rc = HCF_SUCCESS;#define P ((CFG_REG_ASSERT_RTNP_STRCT FAR *)ltvp) ifbp->IFB_AssertRtn =P ->rtnp;// ifbp->IFB_AssertLvl = P->lvl; //TODO not yet supported so default is set in hcf_connect - HCFASSERT( DO_ASSERT, MERGE_2( HCF_ASSERT, 0xCAF1 ) ) //just to proof that the complete assert machinery is working +HCFASSERT (DO_ASSERT ,MERGE_2 (HCF_ASSERT ,0xCAF1 ) );//just to proof that the complete assert machinery is working #undef Pbreak ;#endif // HCF_ASSERT_RT_MSF_RTN
@@ -2266,22 +2266,22 @@ int rc = HCF_SUCCESS;break ;#endif // HCF_EXT_INFO_LOG case CFG_CNTL_OPT ://overrule option - HCFASSERT( ( ltvp->val[0] & ~(USE_DMA | USE_16BIT) ) == 0, ltvp->val[0] ) +HCFASSERT ( ( ltvp->val[0 ] & ~(USE_DMA |USE_16BIT ) ) ==0 , ltvp->val[0 ] );if ( ( ltvp->val[0 ] &USE_DMA ) ==0 ) ifbp->IFB_CntlOpt &= ~USE_DMA ; ifbp->IFB_CntlOpt |= ltvp->val[0 ] &USE_16BIT ;break ;#if (HCF_EXT ) &HCF_EXT_MB case CFG_REG_MB ://Register MailBox #define P ((CFG_REG_MB_STRCT FAR *)ltvp) - HCFASSERT( ( (hcf_32)P->mb_addr & 0x0001 ) == 0, (hcf_32)P->mb_addr ) -HCFASSERT ( (P )->mb_size >=60 , (P )->mb_size ) +HCFASSERT ( ( (hcf_32 )P ->mb_addr &0x0001 ) ==0 , (hcf_32 )P ->mb_addr ); +HCFASSERT ( (P )->mb_size >=60 , (P )->mb_size ); ifbp->IFB_MBp =P ->mb_addr;/* if no MB present, size must be 0 for ;?the old;? put_info_mb to work correctly */ ifbp->IFB_MBSize = ifbp->IFB_MBp ==NULL ?0 :P ->mb_size; ifbp->IFB_MBWp = ifbp->IFB_MBRp =0 ; ifbp->IFB_MBp[0 ] =0 ;//flag the MailBox as empty ifbp->IFB_MBInfoLen =0 ; - HCFASSERT( ifbp->IFB_MBSize >= 60 || ifbp->IFB_MBp == NULL, ifbp->IFB_MBSize ) +HCFASSERT ( ifbp->IFB_MBSize >=60 || ifbp->IFB_MBp ==NULL , ifbp->IFB_MBSize );#undef Pbreak ;case CFG_MB_INFO ://store MailBoxInfoBlock
@@ -2306,9 +2306,9 @@ int rc = HCF_SUCCESS;break ;case CFG_CMD_HCF :#define P ((CFG_CMD_HCF_STRCT FAR *)ltvp) - HCFASSERT( P->cmd == CFG_CMD_HCF_REG_ACCESS, P->cmd ) //only Hermes register access supported +HCFASSERT (P ->cmd ==CFG_CMD_HCF_REG_ACCESS ,P ->cmd );//only Hermes register access supported if (P ->cmd ==CFG_CMD_HCF_REG_ACCESS ) { - HCFASSERT( P->mode < ifbp->IFB_IOBase, P->mode ) //Check Register space +HCFASSERT (P ->mode < ifbp->IFB_IOBase,P ->mode );//Check Register space OPW (P ->mode,P ->add_info); }#undef P
@@ -2325,7 +2325,7 @@ int rc = HCF_SUCCESS; rc =put_info ( ifbp, ltvp ); }//DO NOT !!! HCFASSERT( rc == HCF_SUCCESS, rc ) /* 20 */ -HCFLOGEXIT ( HCF_TRACE_PUT_INFO ) +HCFLOGEXIT (HCF_TRACE_PUT_INFO );return rc; }// hcf_put_info
@@ -2448,21 +2448,21 @@ wci_bufp lap = ifbp->IFB_lap + offset; //start address in LookAhead Bufferhcf_16 lal = ifbp->IFB_lal - offset;//available data within LookAhead Buffer hcf_16 j; - HCFLOGENTRY( HCF_TRACE_RCV_MSG, offset ) - HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) -HCFASSERT_INT -HCFASSERT (descp ,HCF_TRACE_RCV_MSG ) - HCFASSERT( ifbp->IFB_RxLen, HCF_TRACE_RCV_MSG ) - HCFASSERT( ifbp->IFB_RxLen >= offset, MERGE_2( offset, ifbp->IFB_RxLen ) ) - HCFASSERT( ifbp->IFB_lal >= offset, offset ) - HCFASSERT( (ifbp->IFB_CntlOpt & USE_DMA) == 0, 0xDADA ) +HCFLOGENTRY (HCF_TRACE_RCV_MSG , offset ); +HCFASSERT ( ifbp->IFB_Magic ==HCF_MAGIC , ifbp->IFB_Magic ); +HCFASSERT_INT ; +HCFASSERT ( descp,HCF_TRACE_RCV_MSG ); +HCFASSERT ( ifbp->IFB_RxLen,HCF_TRACE_RCV_MSG ); +HCFASSERT ( ifbp->IFB_RxLen >= offset,MERGE_2 ( offset, ifbp->IFB_RxLen ) ); +HCFASSERT ( ifbp->IFB_lal >= offset, offset ); +HCFASSERT ( (ifbp->IFB_CntlOpt &USE_DMA ) ==0 ,0xDADA );if ( tot_len <0 ) { lal =0 ; tot_len =0 ;//suppress all copying activity in the do--while loop } do { //loop over all available fragments // obnoxious hcf.c(1480) : warning C4769: conversion of near pointer to long integer - HCFASSERT( ((hcf_32)descp & 3 ) == 0, (hcf_32)descp ) + HCFASSERT( ((hcf_32)descp & 3 ) == 0, (hcf_32)descp ); cp = descp->buf_addr; j = min( (hcf_16)tot_len, descp->BUF_SIZE ); //minimum of "what's` available" and fragment size descp->BUF_CNT = j;
@@ -2486,8 +2486,8 @@ hcf_16 j; }#endif // HCF_TYPE_WPA (void )hcf_action ( ifbp,HCF_ACT_RX_ACK );//only 1 shot to get the data, so free the resources in the NIC - HCFASSERT( rc == HCF_SUCCESS, rc ) -HCFLOGEXIT ( HCF_TRACE_RCV_MSG ) +HCFASSERT ( rc ==HCF_SUCCESS , rc ); +HCFLOGEXIT (HCF_TRACE_RCV_MSG );return rc; } // hcf_rcv_msg#endif // HCF_DL_ONLY
@@ -2658,18 +2658,18 @@ hcf_16 i;hcf_16 fid =0 ; - HCFASSERT( ifbp->IFB_RscInd || descp == NULL, ifbp->IFB_RscInd ) - HCFASSERT( (ifbp->IFB_CntlOpt & USE_DMA) == 0, 0xDADB ) +HCFASSERT ( ifbp->IFB_RscInd || descp ==NULL , ifbp->IFB_RscInd ); +HCFASSERT ( (ifbp->IFB_CntlOpt &USE_DMA ) ==0 ,0xDADB ); - HCFLOGENTRY( HCF_TRACE_SEND_MSG, tx_cntl ) - HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) -HCFASSERT_INT +HCFLOGENTRY (HCF_TRACE_SEND_MSG , tx_cntl ); +HCFASSERT ( ifbp->IFB_Magic ==HCF_MAGIC , ifbp->IFB_Magic ); +HCFASSERT_INT ;/* obnoxious c:/hcf/hcf.c(1480) : warning C4769: conversion of near pointer to long integer, * so skip */ - HCFASSERT( ((hcf_32)descp & 3 ) == 0, (hcf_32)descp ) +HCFASSERT ( ((hcf_32 )descp &3 ) ==0 , (hcf_32 )descp );#if HCF_ASSERT {int x = ifbp->IFB_FWIdentity.comp_id ==COMP_ID_FW_AP ? tx_cntl & ~HFS_TX_CNTL_PORT : tx_cntl; - HCFASSERT( (x & ~HCF_TX_CNTL_MASK ) == 0, tx_cntl ) +HCFASSERT ( (x & ~HCF_TX_CNTL_MASK ) ==0 , tx_cntl ); }#endif // HCF_ASSERT
@@ -2684,7 +2684,7 @@ hcf_16 fid = 0;//copy all the fragments in a transparent fashion for ( p = descp; p; p = p->next_desc_addr ) {/* obnoxious warning C4769: conversion of near pointer to long integer */ - HCFASSERT( ((hcf_32)p & 3 ) == 0, (hcf_32)p ) +HCFASSERT ( ((hcf_32 )p &3 ) ==0 , (hcf_32 )p ); put_frag( ifbp, p->buf_addr, p->BUF_CNT BE_PAR(0) ); } rc =cmd_exe ( ifbp,HCMD_THESEUS |HCMD_BUSY |HCMD_STARTPREAMBLE , fid );
@@ -2693,7 +2693,7 @@ hcf_16 fid = 0; } }// een slecht voorbeeld doet goed volgen ;? -HCFLOGEXIT ( HCF_TRACE_SEND_MSG ) +HCFLOGEXIT (HCF_TRACE_SEND_MSG );return rc; }#endif // HCF_EXT_TX_CONT
@@ -2716,10 +2716,10 @@ hcf_16 fid = 0; p = descp;do len += p->BUF_CNT;while ( ( p = p->next_desc_addr ) !=NULL ); p = descp; -//;? HCFASSERT( len <= HCF_MAX_MSG, len ) +//;? HCFASSERT( len <= HCF_MAX_MSG, len ); /*7*/ (void )setup_bap ( ifbp, fid,HFS_TX_CNTL ,IO_OUT );#if (HCF_TYPE ) &HCF_TYPE_TX_DELAY - HCFASSERT( ( descp != NULL ) ^ ( tx_cntl & HFS_TX_CNTL_TX_DELAY ), tx_cntl ) +HCFASSERT ( ( descp !=NULL ) ^ ( tx_cntl &HFS_TX_CNTL_TX_DELAY ), tx_cntl );if ( tx_cntl &HFS_TX_CNTL_TX_DELAY ) { tx_cntl &= ~HFS_TX_CNTL_TX_DELAY ;//!!HFS_TX_CNTL_TX_DELAY no longer available ifbp->IFB_TxFID = fid;
@@ -2729,7 +2729,7 @@ hcf_16 fid = 0;OPW (HREG_DATA_1 , tx_cntl ) ;OPW (HREG_DATA_1 ,0 );#if ! ( (HCF_TYPE ) &HCF_TYPE_CCX ) -HCFASSERT ( p->BUF_CNT >=14 , p->BUF_CNT ) +HCFASSERT ( p->BUF_CNT >=14 , p->BUF_CNT );/* assume DestAddr/SrcAddr/Len/Type ALWAYS contained in 1st fragment * otherwise life gets too cumbersome for MIC and Encapsulation !!!!!!!! if ( p->BUF_CNT >= 14 ) { alternatively: add a safety escape !!!!!!!!!!!! } */
@@ -2780,7 +2780,7 @@ hcf_16 fid = 0;while ( ( p = p->next_desc_addr ) !=NULL ) {/* obnoxious c:/hcf/hcf.c(1480) : warning C4769: conversion of near pointer to long integer, * so skip */ - HCFASSERT( ((hcf_32)p & 3 ) == 0, (hcf_32)p ) +HCFASSERT ( ((hcf_32 )p &3 ) ==0 , (hcf_32 )p ); put_frag( ifbp, p->buf_addr, p->BUF_CNT BE_PAR(0) );CALC_TX_MIC ( p->buf_addr, p->BUF_CNT ); }
@@ -2800,8 +2800,8 @@ hcf_16 fid = 0; }// #endif // ALLOC_15 } -// HCFASSERT( level::ifbp->IFB_RscInd, ifbp->IFB_RscInd ) -HCFLOGEXIT ( HCF_TRACE_SEND_MSG ) +// HCFASSERT( level::ifbp->IFB_RscInd, ifbp->IFB_RscInd ); +HCFLOGEXIT (HCF_TRACE_SEND_MSG );return rc; }// hcf_send_msg #endif // HCF_DL_ONLY
@@ -3068,9 +3068,9 @@ hcf_16 stat;wci_bufp buf_addr;hcf_16 i; - HCFLOGENTRY( HCF_TRACE_SERVICE_NIC, ifbp->IFB_IntOffCnt ) - HCFASSERT( ifbp->IFB_Magic == HCF_MAGIC, ifbp->IFB_Magic ) - HCFASSERT_INT +HCFLOGENTRY (HCF_TRACE_SERVICE_NIC , ifbp->IFB_IntOffCnt ); +HCFASSERT ( ifbp->IFB_Magic ==HCF_MAGIC , ifbp->IFB_Magic ); +HCFASSERT_INT ; ifbp->IFB_LinkStat =0 ;// ;? to be obsoleted ASAP /* 1*/ ifbp->IFB_DSLinkStat &= ~CFG_LINK_STAT_CHANGE ;/* 1*/
@@ -3084,7 +3084,7 @@ hcf_16 i;if ( ifbp->IFB_RscInd ==0 && stat &HREG_EV_ALLOC ) {//Note: IFB_RscInd is ALWAYS 1 for DMA ifbp->IFB_RscInd =1 ; } - IF_TALLY( if ( stat & HREG_EV_INFO_DROP ) ifbp->IFB_HCF_Tallies.NoBufInfo++; ) + IF_TALLY( if ( stat & HREG_EV_INFO_DROP ) { ifbp->IFB_HCF_Tallies.NoBufInfo++; } );#if (HCF_EXT ) &HCF_EXT_INT_TICK if ( stat &HREG_EV_TICK ) { ifbp->IFB_TickCnt++;
@@ -3112,7 +3112,7 @@ CFG_DDS_TICK_TIME_STRCT ltv; }#if (HCF_EXT ) &HCF_EXT_INT_TX_EX if ( stat &HREG_EV_TX_EXT && ( i =IPW (HREG_TX_COMPL_FID ) ) !=0 /*DAWA*/ ) { - DAWA_ZERO_FID( HREG_TX_COMPL_FID ) +DAWA_ZERO_FID (HREG_TX_COMPL_FID ); (void )setup_bap ( ifbp, i,0 ,IO_IN ); get_frag( ifbp, &ifbp->IFB_TxFsStat, HFS_SWSUP BE_PAR(1) ); }
@@ -3122,10 +3122,10 @@ CFG_DDS_TICK_TIME_STRCT ltv; if ( !( ifbp->IFB_CntlOpt & USE_DMA ) ) //!! be aware of the logical indentations#endif // HCF_DMA /*16*/ if ( stat &HREG_EV_RX && ( ifbp->IFB_RxFID =IPW (HREG_RX_FID ) ) !=0 ) {//if 0 then DAWA_ACK - HCFASSERT( bufp, len ) - HCFASSERT( len >= HFS_DAT + 2, len ) -DAWA_ZERO_FID ( HREG_RX_FID ) - HCFASSERT( ifbp->IFB_RxFID < CFG_PROD_DATA, ifbp->IFB_RxFID) +HCFASSERT ( bufp, len ); +HCFASSERT ( len >=HFS_DAT +2 , len ); +DAWA_ZERO_FID (HREG_RX_FID ); +HCFASSERT ( ifbp->IFB_RxFID <CFG_PROD_DATA , ifbp->IFB_RxFID); (void )setup_bap ( ifbp, ifbp->IFB_RxFID,0 ,IO_IN ); get_frag( ifbp, bufp, HFS_ADDR_DEST BE_PAR(1) ); ifbp->IFB_lap = buf_addr = bufp +HFS_ADDR_DEST ;
@@ -3144,7 +3144,7 @@ CFG_DDS_TICK_TIME_STRCT ltv;#endif // HCF_TYPE_CCX {#if (HCF_ENCAP ) ==HCF_ENC -HCFASSERT ( len >=HFS_DAT +2 +sizeof (snap_header), len ) +HCFASSERT ( len >=HFS_DAT +2 +sizeof (snap_header), len );/*34*/ i = *(wci_recordp)&bufp[HFS_STAT ] & (HFS_STAT_MSG_TYPE |HFS_STAT_ERR );if ( i ==HFS_STAT_TUNNEL || ( i ==HFS_STAT_1042 &&hcf_encap ( (wci_bufp)&bufp[HFS_TYPE ] ) !=ENC_TUNNEL ) ) {
@@ -3174,16 +3174,16 @@ CFG_DDS_TICK_TIME_STRCT ltv; } }// in case of DMA: signal availability of rx and/or tx packets to MSF - IF_USE_DMA( ifbp->IFB_DmaPackets |= stat & ( HREG_EV_RDMAD | HREG_EV_TDMAD ); ) +IF_USE_DMA ( ifbp->IFB_DmaPackets |= stat & (HREG_EV_RDMAD |HREG_EV_TDMAD ) );// rlav : pending HREG_EV_RDMAD or HREG_EV_TDMAD events get acknowledged here. /*54*/ stat &= (hcf_16 )~(HREG_EV_SLEEP_REQ |HREG_EV_CMD |HREG_EV_ACK_REG_READY |HREG_EV_ALLOC |HREG_EV_FW_DMA );//a positive mask would be easier to understand /*54*/ stat &= (hcf_16)~( HREG_EV_SLEEP_REQ | HREG_EV_CMD | HREG_EV_ACK_REG_READY | HREG_EV_ALLOC | HREG_EV_FW_DMA ); - IF_USE_DMA( stat &= (hcf_16)~HREG_EV_RX; ) +IF_USE_DMA ( stat &= (hcf_16 )~HREG_EV_RX );if ( stat ) {DAWA_ACK ( stat );/*DAWA*/ } } -HCFLOGEXIT ( HCF_TRACE_SERVICE_NIC ) +HCFLOGEXIT (HCF_TRACE_SERVICE_NIC );return rc; }// hcf_service_nic #endif // HCF_DL_ONLY
@@ -3507,7 +3507,7 @@ hcf_32 prot_cnt; ifbp->IFB_TickIni =INI_TICK_INI ; ifbp->IFB_DefunctStat =HCF_ERR_DEFUNCT_TIMER ; ifbp->IFB_CardStat |=CARD_STAT_DEFUNCT ; - HCFASSERT( DO_ASSERT, prot_cnt ) +HCFASSERT (DO_ASSERT , prot_cnt ); } } ifbp->IFB_TickIni <<=HCF_PROT_TIME_SHFT ;/*8*/
@@ -3617,19 +3617,19 @@ HCF_STATIC int cmd_cmpl( IFBP ifbp ) { -PROT_CNT_INI +PROT_CNT_INI ;int rc =HCF_SUCCESS ;hcf_16 stat; -HCFLOGENTRY (HCF_TRACE_CMD_CPL , ifbp->IFB_Cmd ) +HCFLOGENTRY (HCF_TRACE_CMD_CPL , ifbp->IFB_Cmd ); ifbp->IFB_Cmd &= ~HCMD_BUSY ;/* 2 */ HCF_WAIT_WHILE ( (IPW (HREG_EV_STAT ) &HREG_EV_CMD ) ==0 );/* 4 */ stat =IPW (HREG_STAT );#if HCF_PROT_TIME if ( prot_cnt ==0 ) { - IF_TALLY( ifbp->IFB_HCF_Tallies.MiscErr++; ) +IF_TALLY ( ifbp->IFB_HCF_Tallies.MiscErr++ ); rc =HCF_ERR_TIME_OUT ; - HCFASSERT( DO_ASSERT, ifbp->IFB_Cmd ) +HCFASSERT (DO_ASSERT , ifbp->IFB_Cmd ); } else#endif // HCF_PROT_TIME {
@@ -3639,15 +3639,15 @@ hcf_16 stat; rc = ifbp->IFB_DefunctStat =HCF_ERR_DEFUNCT_CMD_SEQ ; ifbp->IFB_CardStat |=CARD_STAT_DEFUNCT ; } - IF_TALLY( ifbp->IFB_HCF_Tallies.MiscErr++; ) +IF_TALLY ( ifbp->IFB_HCF_Tallies.MiscErr++ ); ifbp->IFB_ErrCmd = stat; ifbp->IFB_ErrQualifier =IPW (HREG_RESP_0 ); - HCFASSERT( DO_ASSERT, MERGE_2( IPW( HREG_PARAM_0 ), ifbp->IFB_Cmd ) ) - HCFASSERT( DO_ASSERT, MERGE_2( ifbp->IFB_ErrQualifier, ifbp->IFB_ErrCmd ) ) +HCFASSERT (DO_ASSERT ,MERGE_2 (IPW (HREG_PARAM_0 ), ifbp->IFB_Cmd ) ); +HCFASSERT (DO_ASSERT ,MERGE_2 ( ifbp->IFB_ErrQualifier, ifbp->IFB_ErrCmd ) ); } } - HCFASSERT( rc == HCF_SUCCESS, rc) -HCFLOGEXIT ( HCF_TRACE_CMD_CPL ) +HCFASSERT ( rc ==HCF_SUCCESS , rc); +HCFLOGEXIT (HCF_TRACE_CMD_CPL );return rc; }// cmd_cmpl
@@ -3706,8 +3706,8 @@ cmd_exe( IFBP ifbp, hcf_16 cmd_code, hcf_16 par_0 ) //if HCMD_BUSY of cmd_code s {int rc; - HCFLOGENTRY( HCF_TRACE_CMD_EXE, cmd_code ) - HCFASSERT( (cmd_code & HCMD_CMD_CODE) != HCMD_TX || cmd_code & HCMD_BUSY, cmd_code ) //Tx must have Busy bit set +HCFLOGENTRY (HCF_TRACE_CMD_EXE , cmd_code ); +HCFASSERT ( (cmd_code &HCMD_CMD_CODE ) !=HCMD_TX || cmd_code &HCMD_BUSY , cmd_code );//Tx must have Busy bit set OPW (HREG_SW_0 ,HCF_MAGIC );if (IPW (HREG_SW_0 ) ==HCF_MAGIC ) {/* 1 */ rc = ifbp->IFB_DefunctStat;
@@ -3725,8 +3725,8 @@ int rc; rc =cmd_cmpl ( ifbp ); } } - HCFASSERT( rc == HCF_SUCCESS, MERGE_2( rc, cmd_code ) ) -HCFLOGEXIT ( HCF_TRACE_CMD_EXE ) +HCFASSERT ( rc ==HCF_SUCCESS ,MERGE_2 ( rc, cmd_code ) ); +HCFLOGEXIT (HCF_TRACE_CMD_EXE );return rc; }// cmd_exe
@@ -3764,9 +3764,9 @@ int rc = HCF_SUCCESS;wci_bufp cp;hcf_io io_port = ifbp->IFB_IOBase +HREG_AUX_DATA ; - HCFLOGENTRY( HCF_TRACE_DL, ltvp->typ ) +HCFLOGENTRY (HCF_TRACE_DL , ltvp->typ );#if (HCF_TYPE ) &HCF_TYPE_PRELOADED - HCFASSERT( DO_ASSERT, ltvp->mode ) +HCFASSERT (DO_ASSERT , ltvp->mode );#else //if initial "program" LTV if ( ifbp->IFB_DLMode ==CFG_PROG_STOP && ltvp->mode ==CFG_PROG_VOLATILE ) {
@@ -3818,7 +3818,7 @@ hcf_io io_port = ifbp->IFB_IOBase + HREG_AUX_DATA; } else#endif //;? as long as the above if contains a hard coded 0, might as well leave it out even more obvious {//. . get number of words to program -HCFASSERT ( ltvp->segment_size, *ltvp->host_addr ) +HCFASSERT ( ltvp->segment_size, *ltvp->host_addr ); i = ltvp->segment_size/2 ;//. . copy data (words) from LTV via AUX port to NIC cp = (wci_bufp )ltvp->host_addr;//OUT_PORT_STRING_8_16 macro may modify its parameters
@@ -3833,8 +3833,8 @@ hcf_io io_port = ifbp->IFB_IOBase + HREG_AUX_DATA; } ifbp->IFB_DLMode = ltvp->mode;//save state in IFB_DLMode #endif // HCF_TYPE_PRELOADED - HCFASSERT( rc == HCF_SUCCESS, rc ) -HCFLOGEXIT ( HCF_TRACE_DL ) +HCFASSERT ( rc ==HCF_SUCCESS , rc ); +HCFLOGEXIT (HCF_TRACE_DL );return rc; }// download
@@ -3916,18 +3916,18 @@ get_fid( IFBP ifbp )hcf_16 fid =0 ;#if ( (HCF_TYPE ) &HCF_TYPE_HII5 ) ==0 -PROT_CNT_INI +PROT_CNT_INI ;#endif // HCF_TYPE_HII5 - IF_DMA( HCFASSERT(!(ifbp->IFB_CntlOpt & USE_DMA), ifbp->IFB_CntlOpt) ) +IF_DMA (HCFASSERT (!(ifbp->IFB_CntlOpt &USE_DMA ), ifbp->IFB_CntlOpt) );if (IPW (HREG_EV_STAT ) &HREG_EV_ALLOC ) { fid =IPW (HREG_ALLOC_FID ); - HCFASSERT( fid, ifbp->IFB_RscInd ) - DAWA_ZERO_FID( HREG_ALLOC_FID ) +HCFASSERT ( fid, ifbp->IFB_RscInd ); +DAWA_ZERO_FID (HREG_ALLOC_FID );#if ( (HCF_TYPE ) &HCF_TYPE_HII5 ) ==0 HCF_WAIT_WHILE ( (IPW (HREG_EV_STAT ) &HREG_EV_ACK_REG_READY ) ==0 ); - HCFASSERT( prot_cnt, IPW( HREG_EV_STAT ) ) +HCFASSERT ( prot_cnt,IPW (HREG_EV_STAT ) );#endif // HCF_TYPE_HII5 DAWA_ACK (HREG_EV_ALLOC );//!!note that HREG_EV_ALLOC is written only once // 180 degree error in logic ;? #if ALLOC_15
@@ -3989,7 +3989,7 @@ wci_bufp p = bufp; //working pointerint i;//prevent side effects from macro int j; -HCFASSERT ( ((hcf_32 )bufp & (HCF_ALIGN -1 ) ) ==0 , (hcf_32 )bufp ) +HCFASSERT ( ((hcf_32 )bufp & (HCF_ALIGN -1 ) ) ==0 , (hcf_32 )bufp );/*1: here recovery logic for intervening BAP access between hcf_service_nic and hcf_rcv_msg COULD be added * if current access is RxInitial
@@ -4045,9 +4045,9 @@ hcf_32 FAR *p4; //prevent side effects from macro } }#if HCF_BIG_ENDIAN - HCFASSERT( word_len == 0 || word_len == 2 || word_len == 4, word_len ) - HCFASSERT( word_len == 0 || ((hcf_32)bufp & 1 ) == 0, (hcf_32)bufp ) -HCFASSERT ( word_len <= len,MERGE2 ( word_len, len ) ) +HCFASSERT ( word_len ==0 || word_len ==2 || word_len ==4 , word_len ); +HCFASSERT ( word_len ==0 || ((hcf_32 )bufp &1 ) ==0 , (hcf_32 )bufp ); +HCFASSERT ( word_len <= len,MERGE2 ( word_len, len ) );//see put_frag for an alternative implementation, but be careful about what are int's and what are //hcf_16's if ( word_len ) {//. if there is anything to convert
@@ -4158,11 +4158,11 @@ init( IFBP ifbp )int rc =HCF_SUCCESS ; -HCFLOGENTRY (HCF_TRACE_INIT ,0 ) +HCFLOGENTRY (HCF_TRACE_INIT ,0 ); ifbp->IFB_CardStat =0 ;/* 2*/ OPW (HREG_EV_ACK , ~HREG_EV_SLEEP_REQ );/* 4*/ - IF_PROT_TIME( calibrate( ifbp ); ) /*10*/ +IF_PROT_TIME (calibrate ( ifbp ) );/*10*/ #if 0 // OOR ifbp->IFB_FWIdentity.len =2 ;//misuse the IFB space for a put ifbp->IFB_FWIdentity.typ =CFG_TICK_TIME ;
@@ -4234,7 +4234,7 @@ int i = sizeof( CFG_FW_IDENTITY_STRCT) + sizeof(CFG_SUP_RANGE_STRCT );#endif // MSF_COMPONENT_ID #if (HCF_DL_ONLY ) ==0 /* 28 */ if ( rc ==HCF_SUCCESS && ifbp->IFB_FWIdentity.comp_id >=COMP_ID_FW_STA ) { -PROT_CNT_INI +PROT_CNT_INI ;/************************************************************************************** * rlav: the DMA engine needs the host to cause a 'hanging alloc event' for it to consume. * not sure if this is the right spot in the HCF, thinking about hcf_enable...
@@ -4245,22 +4245,22 @@ PROT_CNT_INI//#else if ( rc ==HCF_SUCCESS ) {HCF_WAIT_WHILE ( (IPW (HREG_EV_STAT ) &HREG_EV_ALLOC ) ==0 ); - IF_PROT_TIME( HCFASSERT(prot_cnt, IPW( HREG_EV_STAT ) ) /*NOP*/;) +IF_PROT_TIME (HCFASSERT (prot_cnt,IPW (HREG_EV_STAT )) );#if HCF_DMA if ( ! ( ifbp->IFB_CntlOpt &USE_DMA ) ) #endif // HCF_DMA { ifbp->IFB_RscInd =get_fid ( ifbp ); - HCFASSERT( ifbp->IFB_RscInd, 0 ) +HCFASSERT ( ifbp->IFB_RscInd,0 );cmd_exe ( ifbp,HCMD_ALLOC ,0 ); - IF_PROT_TIME( if ( prot_cnt == 0 ) rc = HCF_ERR_TIME_OUT; ) + IF_PROT_TIME( if ( prot_cnt == 0 ) rc = HCF_ERR_TIME_OUT ); } } //#endif // ALLOC_15 }#endif // HCF_DL_ONLY - HCFASSERT( rc == HCF_SUCCESS, rc ) -HCFLOGEXIT ( HCF_TRACE_INIT ) +HCFASSERT ( rc ==HCF_SUCCESS , rc ); +HCFLOGEXIT (HCF_TRACE_INIT );return rc; }// init
@@ -4307,11 +4307,11 @@ RID_LOGP ridp = ifbp->IFB_RIDLogp; //NULL or pointer to array of RID_LOG structuHCFTRACE ( ifbp,HCF_TRACE_ISR_INFO );/* 1 */ fid =IPW (HREG_INFO_FID ); -DAWA_ZERO_FID ( HREG_INFO_FID ) +DAWA_ZERO_FID (HREG_INFO_FID );if ( fid ) { (void )setup_bap ( ifbp, fid,0 ,IO_IN ); get_frag( ifbp, (wci_bufp)info, 4 BE_PAR(2) ); - HCFASSERT( info[0] <= HCF_MAX_LTV + 1, MERGE_2( info[1], info[0] ) ) //;? a smaller value makes more sense +HCFASSERT ( info[0 ] <=HCF_MAX_LTV +1 ,MERGE_2 ( info[1 ], info[0 ] ) );//;? a smaller value makes more sense #if (HCF_TALLIES ) &HCF_TALLIES_NIC //Hermes tally support if ( info[1 ] ==CFG_TALLIES ) {hcf_32 *p;
@@ -4331,7 +4331,7 @@ hcf_32 *p;/*6*/ while (1 ) {if ( ridp->typ ==0 || ridp->typ == info[1 ] ) {if ( ridp->bufp ) { -HCFASSERT ( ridp->len >=2 , ridp->typ ) +HCFASSERT ( ridp->len >=2 , ridp->typ ); ridp->bufp[0 ] =min ((hcf_16)(ridp->len -1 ), info[0 ] );//save L ridp->bufp[1 ] = info[1 ];//save T get_frag( ifbp, (wci_bufp)&ridp->bufp[2], (ridp->bufp[0] - 1)*2 BE_PAR(0) );
@@ -4366,7 +4366,7 @@ hcf_32 *p;// /*6*/ while ( 1 ) { // if ( ridp->typ == 0 || ridp->typ == info[1] ) { // if ( ridp->bufp ) { -// HCFASSERT( ridp->len >= 2, ridp->typ ) +// HCFASSERT( ridp->len >= 2, ridp->typ ); // (void)setup_bap( ifbp, fid, 2, IO_IN ); //restore BAP for tallies, linkstat and specific type followed by wild card // ridp->bufp[0] = min( ridp->len - 1, info[0] ); //save L // get_frag( ifbp, (wci_bufp)&ridp->bufp[1], ridp->bufp[0]*2 BE_PAR(0) );
@@ -4483,11 +4483,11 @@ put_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) )hcf_io io_port = ifbp->IFB_IOBase +HREG_DATA_1 ;//BAP data register int i;//prevent side effects from macro hcf_16 j; - HCFASSERT( ((hcf_32)bufp & (HCF_ALIGN-1) ) == 0, (hcf_32)bufp ) +HCFASSERT ( ((hcf_32 )bufp & (HCF_ALIGN -1 ) ) ==0 , (hcf_32 )bufp );#if HCF_BIG_ENDIAN - HCFASSERT( word_len == 0 || word_len == 2 || word_len == 4, word_len ) - HCFASSERT( word_len == 0 || ((hcf_32)bufp & 1 ) == 0, (hcf_32)bufp ) - HCFASSERT( word_len <= len, MERGE_2( word_len, len ) ) +HCFASSERT ( word_len ==0 || word_len ==2 || word_len ==4 , word_len ); +HCFASSERT ( word_len ==0 || ((hcf_32 )bufp &1 ) ==0 , (hcf_32 )bufp ); +HCFASSERT ( word_len <= len,MERGE_2 ( word_len, len ) );if ( word_len ) {//if there is anything to convert //. convert and write the 1st hcf_16
@@ -4635,8 +4635,8 @@ put_info( IFBP ifbp, LTVP ltvp )int rc =HCF_SUCCESS ; - HCFASSERT( ifbp->IFB_CardStat == 0, MERGE_2( ltvp->typ, ifbp->IFB_CardStat ) ) -HCFASSERT (CFG_RID_CFG_MIN <= ltvp->typ && ltvp->typ <=CFG_RID_CFG_MAX , ltvp->typ ) +HCFASSERT ( ifbp->IFB_CardStat ==0 ,MERGE_2 ( ltvp->typ, ifbp->IFB_CardStat ) ); +HCFASSERT (CFG_RID_CFG_MIN <= ltvp->typ && ltvp->typ <=CFG_RID_CFG_MAX , ltvp->typ ); if ( ifbp->IFB_CardStat == 0 && /* 20*/ ( ( CFG_RID_CFG_MIN <= ltvp->typ && ltvp->typ <= CFG_RID_CFG_MAX ) ||
@@ -4654,7 +4654,7 @@ int rc = HCF_SUCCESS; t != CFG_DEAUTHENTICATE_ADDR ) ) { - HCFASSERT( DO_ASSERT, ltvp->typ ) +HCFASSERT (DO_ASSERT , ltvp->typ ); } }#endif // HCF_ASSERT
@@ -4738,8 +4738,8 @@ hcf_16 len; //total length to copy to MailBoxhcf_16 tlen;//free length/working length/offset in WMP frame if ( ifbp->IFB_MBp ==NULL )return rc;//;?not sufficient - HCFASSERT( ifbp->IFB_MBp != NULL, 0 ) //!!!be careful, don't get into an endless recursion -HCFASSERT ( ifbp->IFB_MBSize,0 ) +HCFASSERT ( ifbp->IFB_MBp !=NULL ,0 );//!!!be careful, don't get into an endless recursion +HCFASSERT ( ifbp->IFB_MBSize,0 ); len =1 ;/* 1 */ for ( i =0 ; i < ltvp->frag_cnt; i++ ) {
@@ -4765,7 +4765,7 @@ hcf_16 tlen; //free length/working length/offset in WMP frame }if ( len +2 >= tlen ){/* 6 */ //Do Not ASSERT, this is a normal condition - IF_TALLY( ifbp->IFB_HCF_Tallies.NoBufMB++; ) /*NOP to cover against analomies with empty compound*/; +IF_TALLY ( ifbp->IFB_HCF_Tallies.NoBufMB++ ); rc =HCF_ERR_LEN ; }else { *dp++ = len;//write Len (= size of T+V in words to MB_Info block
@@ -4861,7 +4861,7 @@ hcf_16 tlen; //free length/working length/offset in WMP frame HCF_STATIC intsetup_bap (IFBP ifbp,hcf_16 fid,int offset,int type ) { -PROT_CNT_INI +PROT_CNT_INI ;int rc;HCFTRACE ( ifbp,HCF_TRACE_STRIO );
@@ -4874,9 +4874,9 @@ int rc; }else ifbp->IFB_CarryOut =0 ;HCF_WAIT_WHILE (IPW (HREG_OFFSET_1 ) &HCMD_BUSY ); - HCFASSERT( !( IPW( HREG_OFFSET_1) & HREG_OFFSET_ERR ), MERGE_2( fid, offset ) ) /*8*/ +HCFASSERT ( !(IPW (HREG_OFFSET_1 ) &HREG_OFFSET_ERR ),MERGE_2 ( fid, offset ) );/*8*/ if ( prot_cnt ==0 ) { -HCFASSERT (DO_ASSERT ,MERGE_2 ( fid, offset ) ) +HCFASSERT (DO_ASSERT ,MERGE_2 ( fid, offset ) ); rc = ifbp->IFB_DefunctStat =HCF_ERR_DEFUNCT_TIME_OUT ; ifbp->IFB_CardStat |=CARD_STAT_DEFUNCT ; }
drivers/staging/wlags49_h2/hcfdef.h +45 -48
158 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH 4/13 staging: wlags49_h2: Reindent hcf.c
In reply to David KilroyUntabify with tab-width set to 4 (to match VI header). Then reindent with tab-width reset to 8.
--- drivers/staging/wlags49_h2/hcf.c | 6084 +++++++++++++++++++------------------- 1 files changed, 3042 insertions(+), 3042 deletions(-)
drivers/staging/wlags49_h2/hcf.c +3042 -3042
@@ -1,97 +1,96 @@ -// vim:tw=110:ts=4: /************************************************************************************************************ -* -* FILE : HCF.C -* -* DATE : $Date: 2004/08/05 11:47:10 $ $Revision: 1.10 $ -* Original: 2004/06/02 10:22:22 Revision: 1.85 Tag: hcf7_t20040602_01 -* Original: 2004/04/15 09:24:41 Revision: 1.63 Tag: hcf7_t7_20040415_01 -* Original: 2004/04/13 14:22:44 Revision: 1.62 Tag: t7_20040413_01 -* Original: 2004/04/01 15:32:55 Revision: 1.59 Tag: t7_20040401_01 -* Original: 2004/03/10 15:39:27 Revision: 1.55 Tag: t20040310_01 -* Original: 2004/03/04 11:03:37 Revision: 1.53 Tag: t20040304_01 -* Original: 2004/03/02 14:51:21 Revision: 1.50 Tag: t20040302_03 -* Original: 2004/02/24 13:00:27 Revision: 1.43 Tag: t20040224_01 -* Original: 2004/02/19 10:57:25 Revision: 1.39 Tag: t20040219_01 -* -* AUTHOR : Nico Valster -* -* SPECIFICATION: ........ -* -* DESCRIPTION : HCF Routines for Hermes-II (callable via the Wireless Connection I/F or WCI) -* Local Support Routines for above procedures -* -* Customizable via HCFCFG.H, which is included by HCF.H -* -************************************************************************************************************* -* -* -* SOFTWARE LICENSE -* -* This software is provided subject to the following terms and conditions, -* which you should read carefully before using the software. Using this -* software indicates your acceptance of these terms and conditions. If you do -* not agree with these terms and conditions, do not use the software. -* -* COPYRIGHT � 1994 - 1995 by AT&T. All Rights Reserved -* COPYRIGHT � 1996 - 2000 by Lucent Technologies. All Rights Reserved -* COPYRIGHT � 2001 - 2004 by Agere Systems Inc. All Rights Reserved -* All rights reserved. -* -* Redistribution and use in source or binary forms, with or without -* modifications, are permitted provided that the following conditions are met: -* -* . Redistributions of source code must retain the above copyright notice, this -* list of conditions and the following Disclaimer as comments in the code as -* well as in the documentation and/or other materials provided with the -* distribution. -* -* . Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following Disclaimer in the documentation -* and/or other materials provided with the distribution. -* -* . Neither the name of Agere Systems Inc. nor the names of the contributors -* may be used to endorse or promote products derived from this software -* without specific prior written permission. -* -* Disclaimer -* -* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF -* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY -* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN -* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT -* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -* DAMAGE. -* -* -************************************************************************************************************/ +* +* FILE : HCF.C +* +* DATE : $Date: 2004/08/05 11:47:10 $ $Revision: 1.10 $ +* Original: 2004/06/02 10:22:22 Revision: 1.85 Tag: hcf7_t20040602_01 +* Original: 2004/04/15 09:24:41 Revision: 1.63 Tag: hcf7_t7_20040415_01 +* Original: 2004/04/13 14:22:44 Revision: 1.62 Tag: t7_20040413_01 +* Original: 2004/04/01 15:32:55 Revision: 1.59 Tag: t7_20040401_01 +* Original: 2004/03/10 15:39:27 Revision: 1.55 Tag: t20040310_01 +* Original: 2004/03/04 11:03:37 Revision: 1.53 Tag: t20040304_01 +* Original: 2004/03/02 14:51:21 Revision: 1.50 Tag: t20040302_03 +* Original: 2004/02/24 13:00:27 Revision: 1.43 Tag: t20040224_01 +* Original: 2004/02/19 10:57:25 Revision: 1.39 Tag: t20040219_01 +* +* AUTHOR : Nico Valster +* +* SPECIFICATION: ........ +* +* DESCRIPTION : HCF Routines for Hermes-II (callable via the Wireless Connection I/F or WCI) +* Local Support Routines for above procedures +* +* Customizable via HCFCFG.H, which is included by HCF.H +* +************************************************************************************************************* +* +* +* SOFTWARE LICENSE +* +* This software is provided subject to the following terms and conditions, +* which you should read carefully before using the software. Using this +* software indicates your acceptance of these terms and conditions. If you do +* not agree with these terms and conditions, do not use the software. +* +* COPYRIGHT � 1994 - 1995 by AT&T. All Rights Reserved +* COPYRIGHT � 1996 - 2000 by Lucent Technologies. All Rights Reserved +* COPYRIGHT � 2001 - 2004 by Agere Systems Inc. All Rights Reserved +* All rights reserved. +* +* Redistribution and use in source or binary forms, with or without +* modifications, are permitted provided that the following conditions are met: +* +* . Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following Disclaimer as comments in the code as +* well as in the documentation and/or other materials provided with the +* distribution. +* +* . Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following Disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* . Neither the name of Agere Systems Inc. nor the names of the contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* Disclaimer +* +* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY +* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN +* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY +* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +* DAMAGE. +* +* +************************************************************************************************************/ /************************************************************************************************************ -** -** Implementation Notes -** -* - a leading marker of //! is used. The purpose of such a sequence is to help to understand the flow -* An example is: //!rc = HCF_SUCCESS; -* if this is superfluous because rc is already guaranteed to be 0 but it shows to the (maintenance) -* programmer it is an intentional omission at the place where someone could consider it most appropriate at -* first glance -* - using near pointers in a model where ss!=ds is an invitation for disaster, so be aware of how you specify -* your model and how you define variables which are used at interrupt time -* - remember that sign extension on 32 bit platforms may cause problems unless code is carefully constructed, -* e.g. use "(hcf_16)~foo" rather than "~foo" -* -************************************************************************************************************/ +** +** Implementation Notes +** +* - a leading marker of //! is used. The purpose of such a sequence is to help to understand the flow +* An example is: //!rc = HCF_SUCCESS; +* if this is superfluous because rc is already guaranteed to be 0 but it shows to the (maintenance) +* programmer it is an intentional omission at the place where someone could consider it most appropriate at +* first glance +* - using near pointers in a model where ss!=ds is an invitation for disaster, so be aware of how you specify +* your model and how you define variables which are used at interrupt time +* - remember that sign extension on 32 bit platforms may cause problems unless code is carefully constructed, +* e.g. use "(hcf_16)~foo" rather than "~foo" +* +************************************************************************************************************/ -#include "hcf.h" // HCF and MSF common include file -#include "hcfdef.h" // HCF specific include file -#include "mmd.h" // MoreModularDriver common include file +#include "hcf.h" // HCF and MSF common include file +#include "hcfdef.h" // HCF specific include file +#include "mmd.h" // MoreModularDriver common include file #include <linux/kernel.h> #if ! defined offsetof
@@ -102,56 +101,56 @@/***********************************************************************************************************/ /*************************************** PROTOTYPES ******************************************************/ /***********************************************************************************************************/ -HCF_STATIC int cmd_exe( IFBP ifbp, hcf_16 cmd_code, hcf_16 par_0 ); -HCF_STATIC int init( IFBP ifbp ); -HCF_STATIC int put_info( IFBP ifbp, LTVP ltvp ); +HCF_STATIC int cmd_exe( IFBP ifbp, hcf_16 cmd_code, hcf_16 par_0 ); +HCF_STATIC int init( IFBP ifbp ); +HCF_STATIC int put_info( IFBP ifbp, LTVP ltvp );#if (HCF_EXT ) &HCF_EXT_MB -HCF_STATIC int put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp ); +HCF_STATIC int put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp );#endif // HCF_EXT_MB #if (HCF_TYPE ) &HCF_TYPE_WPA -HCF_STATIC void calc_mic( hcf_32* p, hcf_32 M ); -void calc_mic_rx_frag (IFBP ifbp,wci_bufp p,int len ); -void calc_mic_tx_frag (IFBP ifbp,wci_bufp p,int len ); -HCF_STATIC int check_mic( IFBP ifbp ); +HCF_STATIC void calc_mic( hcf_32* p, hcf_32 M ); +void calc_mic_rx_frag (IFBP ifbp,wci_bufp p,int len ); +void calc_mic_tx_frag (IFBP ifbp,wci_bufp p,int len ); +HCF_STATIC int check_mic( IFBP ifbp );#endif // HCF_TYPE_WPA -HCF_STATIC void calibrate( IFBP ifbp ); -HCF_STATIC int cmd_cmpl( IFBP ifbp ); -HCF_STATIC hcf_16 get_fid( IFBP ifbp ); -HCF_STATIC void isr_info( IFBP ifbp ); +HCF_STATIC void calibrate( IFBP ifbp ); +HCF_STATIC int cmd_cmpl( IFBP ifbp ); +HCF_STATIC hcf_16 get_fid( IFBP ifbp ); +HCF_STATIC void isr_info( IFBP ifbp );#if HCF_DMA -HCF_STATIC DESC_STRCT* get_frame_lst(IFBP ifbp, int tx_rx_flag); +HCF_STATIC DESC_STRCT* get_frame_lst(IFBP ifbp, int tx_rx_flag);#endif // HCF_DMA -HCF_STATIC void get_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) ); //char*, byte count (usually even) +HCF_STATIC void get_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) ); //char*, byte count (usually even)#if HCF_DMA -HCF_STATIC void put_frame_lst( IFBP ifbp, DESC_STRCT *descp, int tx_rx_flag ); +HCF_STATIC void put_frame_lst( IFBP ifbp, DESC_STRCT *descp, int tx_rx_flag );#endif // HCF_DMA -HCF_STATIC void put_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) ); -HCF_STATIC void put_frag_finalize( IFBP ifbp ); -HCF_STATIC int setup_bap( IFBP ifbp, hcf_16 fid, int offset, int type ); +HCF_STATIC void put_frag( IFBP ifbp, wci_bufp bufp, int len BE_PAR( int word_len ) ); +HCF_STATIC void put_frag_finalize( IFBP ifbp ); +HCF_STATIC int setup_bap( IFBP ifbp, hcf_16 fid, int offset, int type );#if (HCF_ASSERT ) &HCF_ASSERT_PRINTF static int fw_printf(IFBP ifbp, CFG_FW_PRINTF_STRCT FAR *ltvp);#endif // HCF_ASSERT_PRINTF -HCF_STATIC int download( IFBP ifbp, CFG_PROG_STRCT FAR *ltvp ); +HCF_STATIC int download( IFBP ifbp, CFG_PROG_STRCT FAR *ltvp );#if (HCF_ENCAP ) &HCF_ENC -HCF_STATIC hcf_8 hcf_encap( wci_bufp type ); +HCF_STATIC hcf_8 hcf_encap( wci_bufp type );#endif // HCF_ENCAP -HCF_STATIC hcf_8 null_addr[4] = { 0, 0, 0, 0 }; -#if ! definedIN_PORT_WORD //replace I/O Macros with logging facility +HCF_STATIC hcf_8 null_addr[4] = { 0, 0, 0, 0 }; +#if ! definedIN_PORT_WORD //replace I/O Macros with logging facility extern FILE *log_file; -#define IN_PORT_WORD (port) in_port_word( (hcf_io)(port) ) +#define IN_PORT_WORD (port) in_port_word( (hcf_io)(port) )static hcf_16 in_port_word (hcf_io port ) { -hcf_16 i = (hcf_16 )_inpw ( port ); +hcf_16 i = (hcf_16 )_inpw ( port );if ( log_file ) {fprintf ( log_file,"\nR %2.2x %4.4x" , (port)&0xFF , i); }return i; }// in_port_word -#define OUT_PORT_WORD (port, value) out_port_word( (hcf_io)(port), (hcf_16)(value) ) +#define OUT_PORT_WORD (port, value) out_port_word( (hcf_io)(port), (hcf_16)(value) )static void out_port_word (hcf_io port,hcf_16 value ) {_outpw ( port, value );
@@ -160,12 +159,12 @@ static void out_port_word( hcf_io port, hcf_16 value ) { } } -void IN_PORT_STRING_32( hcf_io prt, hcf_32 FAR * dst, int n) { +void IN_PORT_STRING_32( hcf_io prt, hcf_32 FAR * dst, int n) {int i =0 ; hcf_16 FAR * p;if ( log_file ) {fprintf ( log_file,"\nread string_32 length %04x (%04d) at port %02.2x to addr %lp" , - (hcf_16 )n, (hcf_16 )n, (hcf_16)(prt)&0xFF , dst); + (hcf_16 )n, (hcf_16 )n, (hcf_16)(prt)&0xFF , dst); }while ( n-- ) { p = (hcf_16 FAR *)dst;
@@ -178,12 +177,12 @@ void IN_PORT_STRING_32( hcf_io prt, hcf_32 FAR * dst, int n) { } }// IN_PORT_STRING_32 -void IN_PORT_STRING_8_16( hcf_io prt, hcf_8 FAR * dst, int n) { //also handles byte alignment problems - hcf_16 FAR * p = (hcf_16 FAR *)dst; //this needs more elaborate code in non-x86 platforms +void IN_PORT_STRING_8_16( hcf_io prt, hcf_8 FAR * dst, int n) { //also handles byte alignment problems + hcf_16 FAR * p = (hcf_16 FAR *)dst; //this needs more elaborate code in non-x86 platformsint i =0 ;if ( log_file ) {fprintf ( log_file,"\nread string_16 length %04x (%04d) at port %02.2x to addr %lp" , - (hcf_16 )n, (hcf_16 )n, (hcf_16)(prt)&0xFF , dst ); + (hcf_16 )n, (hcf_16 )n, (hcf_16)(prt)&0xFF , dst ); }while ( n-- ) { *p =(hcf_16 )_inpw ( prt);
@@ -198,12 +197,12 @@ void IN_PORT_STRING_8_16( hcf_io prt, hcf_8 FAR * dst, int n) { //also handles b } }// IN_PORT_STRING_8_16 -void OUT_PORT_STRING_32( hcf_io prt, hcf_32 FAR * src, int n) { +void OUT_PORT_STRING_32( hcf_io prt, hcf_32 FAR * src, int n) {int i =0 ; hcf_16 FAR * p;if ( log_file ) {fprintf ( log_file,"\nwrite string_32 length %04x (%04d) at port %02.2x" , - (hcf_16 )n, (hcf_16 )n, (hcf_16)(prt)&0xFF ); + (hcf_16 )n, (hcf_16 )n, (hcf_16)(prt)&0xFF ); }while ( n-- ) { p = (hcf_16 FAR *)src;
@@ -216,8 +215,8 @@ void OUT_PORT_STRING_32( hcf_io prt, hcf_32 FAR * src, int n) { } }// OUT_PORT_STRING_32 -void OUT_PORT_STRING_8_16( hcf_io prt, hcf_8 FAR * src, int n) { //also handles byte alignment problems - hcf_16 FAR * p = (hcf_16 FAR *)src; //this needs more elaborate code in non-x86 platforms +void OUT_PORT_STRING_8_16( hcf_io prt, hcf_8 FAR * src, int n) { //also handles byte alignment problems + hcf_16 FAR * p = (hcf_16 FAR *)src; //this needs more elaborate code in non-x86 platformsint i =0 ;if ( log_file ) {fprintf ( log_file,"\nwrite string_16 length %04x (%04d) at port %04x" , n, n, (hcf_16 )prt);
@@ -238,27 +237,27 @@ void OUT_PORT_STRING_8_16( hcf_io prt, hcf_8 FAR * src, int n) { //also handles#endif // IN_PORT_WORD /************************************************************************************************************ -******************************* D A T A D E F I N I T I O N S ******************************************** -************************************************************************************************************/ +******************************* D A T A D E F I N I T I O N S ******************************************** +************************************************************************************************************/ #if HCF_ASSERT -IFBP BASED assert_ifbp = NULL; //to make asserts easily work under MMD and DHF +IFBP BASED assert_ifbp = NULL; //to make asserts easily work under MMD and DHF#endif // HCF_ASSERT #if HCF_ENCAP /* SNAP header to be inserted in Ethernet-II frames */ -HCF_STATIC hcf_8 BASED snap_header[] = { 0xAA, 0xAA, 0x03, 0x00, 0x00, //5 bytes signature + -0 };//1 byte protocol identifier +HCF_STATIC hcf_8 BASED snap_header[] = { 0xAA, 0xAA, 0x03, 0x00, 0x00, //5 bytes signature + +0 };//1 byte protocol identifier #endif // HCF_ENCAP #if (HCF_TYPE ) &HCF_TYPE_WPA -HCF_STATIC hcf_8 BASED mic_pad[8] = { 0x5A, 0, 0, 0, 0, 0, 0, 0 }; //MIC padding of message +HCF_STATIC hcf_8 BASED mic_pad[8] = { 0x5A, 0, 0, 0, 0, 0, 0, 0 }; //MIC padding of message#endif // HCF_TYPE_WPA #if definedMSF_COMPONENT_ID CFG_IDENTITY_STRCT BASED cfg_drv_identity = { -sizeof (cfg_drv_identity)/sizeof (hcf_16) -1 ,//length of RID -CFG_DRV_IDENTITY ,// (0x0826) +sizeof (cfg_drv_identity)/sizeof (hcf_16) -1 ,//length of RID +CFG_DRV_IDENTITY ,// (0x0826) MSF_COMPONENT_ID ,MSF_COMPONENT_VAR , MSF_COMPONENT_MAJOR_VER,
@@ -266,186 +265,186 @@ CFG_IDENTITY_STRCT BASED cfg_drv_identity = { } ; CFG_RANGES_STRCT BASED cfg_drv_sup_range = { -sizeof (cfg_drv_sup_range)/sizeof (hcf_16) -1 ,//length of RID -CFG_DRV_SUP_RANGE ,// (0x0827) +sizeof (cfg_drv_sup_range)/sizeof (hcf_16) -1 ,//length of RID +CFG_DRV_SUP_RANGE ,// (0x0827) COMP_ROLE_SUPL ,COMP_ID_DUI , - {{DUI_COMPAT_VAR , -DUI_COMPAT_BOT , -DUI_COMPAT_TOP + {{DUI_COMPAT_VAR , +DUI_COMPAT_BOT , +DUI_COMPAT_TOP }} } ; struct CFG_RANGE3_STRCT BASED cfg_drv_act_ranges_pri = { -sizeof (cfg_drv_act_ranges_pri)/sizeof (hcf_16) -1 ,//length of RID -CFG_DRV_ACT_RANGES_PRI ,// (0x0828) +sizeof (cfg_drv_act_ranges_pri)/sizeof (hcf_16) -1 ,//length of RID +CFG_DRV_ACT_RANGES_PRI ,// (0x0828) COMP_ROLE_ACT ,COMP_ID_PRI , { - {0 ,0 ,0 },// HCF_PRI_VAR_1 not supported by HCF 7 - {0 ,0 ,0 },// HCF_PRI_VAR_2 not supported by HCF 7 - {3 ,//var_rec[2] - Variant number -CFG_DRV_ACT_RANGES_PRI_3_BOTTOM ,// - Bottom Compatibility -CFG_DRV_ACT_RANGES_PRI_3_TOP // - Top Compatibility - } + {0 ,0 ,0 },// HCF_PRI_VAR_1 not supported by HCF 7 + {0 ,0 ,0 },// HCF_PRI_VAR_2 not supported by HCF 7 + {3 ,//var_rec[2] - Variant number +CFG_DRV_ACT_RANGES_PRI_3_BOTTOM ,// - Bottom Compatibility +CFG_DRV_ACT_RANGES_PRI_3_TOP // - Top Compatibility + } } } ; struct CFG_RANGE4_STRCT BASED cfg_drv_act_ranges_sta = { -sizeof (cfg_drv_act_ranges_sta)/sizeof (hcf_16) -1 ,//length of RID -CFG_DRV_ACT_RANGES_STA ,// (0x0829) +sizeof (cfg_drv_act_ranges_sta)/sizeof (hcf_16) -1 ,//length of RID +CFG_DRV_ACT_RANGES_STA ,// (0x0829) COMP_ROLE_ACT ,COMP_ID_STA , { #if defined HCF_STA_VAR_1 - {1 ,//var_rec[1] - Variant number -CFG_DRV_ACT_RANGES_STA_1_BOTTOM ,// - Bottom Compatibility -CFG_DRV_ACT_RANGES_STA_1_TOP // - Top Compatibility - }, + {1 ,//var_rec[1] - Variant number +CFG_DRV_ACT_RANGES_STA_1_BOTTOM ,// - Bottom Compatibility +CFG_DRV_ACT_RANGES_STA_1_TOP // - Top Compatibility + }, #else - {0 ,0 ,0 }, + {0 ,0 ,0 }, #endif // HCF_STA_VAR_1 #if defined HCF_STA_VAR_2 - {2 ,//var_rec[1] - Variant number -CFG_DRV_ACT_RANGES_STA_2_BOTTOM ,// - Bottom Compatibility -CFG_DRV_ACT_RANGES_STA_2_TOP // - Top Compatibility - }, + {2 ,//var_rec[1] - Variant number +CFG_DRV_ACT_RANGES_STA_2_BOTTOM ,// - Bottom Compatibility +CFG_DRV_ACT_RANGES_STA_2_TOP // - Top Compatibility + }, #else - {0 ,0 ,0 }, + {0 ,0 ,0 }, #endif // HCF_STA_VAR_2 // For Native_USB (Not used!) #if defined HCF_STA_VAR_3 - {3 ,//var_rec[1] - Variant number -CFG_DRV_ACT_RANGES_STA_3_BOTTOM ,// - Bottom Compatibility -CFG_DRV_ACT_RANGES_STA_3_TOP // - Top Compatibility - }, + {3 ,//var_rec[1] - Variant number +CFG_DRV_ACT_RANGES_STA_3_BOTTOM ,// - Bottom Compatibility +CFG_DRV_ACT_RANGES_STA_3_TOP // - Top Compatibility + }, #else - {0 ,0 ,0 }, + {0 ,0 ,0 }, #endif // HCF_STA_VAR_3 // Warp #if defined HCF_STA_VAR_4 - {4 ,//var_rec[1] - Variant number -CFG_DRV_ACT_RANGES_STA_4_BOTTOM ,// - Bottom Compatibility -CFG_DRV_ACT_RANGES_STA_4_TOP // - Top Compatibility - } + {4 ,//var_rec[1] - Variant number +CFG_DRV_ACT_RANGES_STA_4_BOTTOM ,// - Bottom Compatibility +CFG_DRV_ACT_RANGES_STA_4_TOP // - Top Compatibility + } #else - { 0, 0, 0 } + { 0, 0, 0 } #endif // HCF_STA_VAR_4 } } ; struct CFG_RANGE6_STRCT BASED cfg_drv_act_ranges_hsi = { -sizeof (cfg_drv_act_ranges_hsi)/sizeof (hcf_16) -1 ,//length of RID -CFG_DRV_ACT_RANGES_HSI ,// (0x082A) +sizeof (cfg_drv_act_ranges_hsi)/sizeof (hcf_16) -1 ,//length of RID +CFG_DRV_ACT_RANGES_HSI ,// (0x082A) COMP_ROLE_ACT ,COMP_ID_HSI , { -#if defined HCF_HSI_VAR_0 // Controlled deployment - {0 ,// var_rec[1] - Variant number -CFG_DRV_ACT_RANGES_HSI_0_BOTTOM ,// - Bottom Compatibility -CFG_DRV_ACT_RANGES_HSI_0_TOP // - Top Compatibility - }, +#if defined HCF_HSI_VAR_0 // Controlled deployment + {0 ,// var_rec[1] - Variant number +CFG_DRV_ACT_RANGES_HSI_0_BOTTOM ,// - Bottom Compatibility +CFG_DRV_ACT_RANGES_HSI_0_TOP // - Top Compatibility + }, #else - {0 ,0 ,0 }, + {0 ,0 ,0 }, #endif // HCF_HSI_VAR_0 - {0 ,0 ,0 },// HCF_HSI_VAR_1 not supported by HCF 7 - {0 ,0 ,0 },// HCF_HSI_VAR_2 not supported by HCF 7 - {0 ,0 ,0 },// HCF_HSI_VAR_3 not supported by HCF 7 -#if defined HCF_HSI_VAR_4 // Hermes-II all types - {4 ,// var_rec[1] - Variant number -CFG_DRV_ACT_RANGES_HSI_4_BOTTOM ,// - Bottom Compatibility -CFG_DRV_ACT_RANGES_HSI_4_TOP // - Top Compatibility - }, + {0 ,0 ,0 },// HCF_HSI_VAR_1 not supported by HCF 7 + {0 ,0 ,0 },// HCF_HSI_VAR_2 not supported by HCF 7 + {0 ,0 ,0 },// HCF_HSI_VAR_3 not supported by HCF 7 +#if defined HCF_HSI_VAR_4 // Hermes-II all types + {4 ,// var_rec[1] - Variant number +CFG_DRV_ACT_RANGES_HSI_4_BOTTOM ,// - Bottom Compatibility +CFG_DRV_ACT_RANGES_HSI_4_TOP // - Top Compatibility + }, #else - {0 ,0 ,0 }, + {0 ,0 ,0 }, #endif // HCF_HSI_VAR_4 -#if defined HCF_HSI_VAR_5 // WARP Hermes-2.5 - {5 ,// var_rec[1] - Variant number -CFG_DRV_ACT_RANGES_HSI_5_BOTTOM ,// - Bottom Compatibility -CFG_DRV_ACT_RANGES_HSI_5_TOP // - Top Compatibility - } +#if defined HCF_HSI_VAR_5 // WARP Hermes-2.5 + {5 ,// var_rec[1] - Variant number +CFG_DRV_ACT_RANGES_HSI_5_BOTTOM ,// - Bottom Compatibility +CFG_DRV_ACT_RANGES_HSI_5_TOP // - Top Compatibility + } #else - { 0, 0, 0 } + { 0, 0, 0 } #endif // HCF_HSI_VAR_5 } } ; CFG_RANGE4_STRCT BASED cfg_drv_act_ranges_apf = { -sizeof (cfg_drv_act_ranges_apf)/sizeof (hcf_16) -1 ,//length of RID -CFG_DRV_ACT_RANGES_APF ,// (0x082B) +sizeof (cfg_drv_act_ranges_apf)/sizeof (hcf_16) -1 ,//length of RID +CFG_DRV_ACT_RANGES_APF ,// (0x082B) COMP_ROLE_ACT ,COMP_ID_APF , { -#if defined HCF_APF_VAR_1 //(Fake) Hermes-I - {1 ,//var_rec[1] - Variant number -CFG_DRV_ACT_RANGES_APF_1_BOTTOM ,// - Bottom Compatibility -CFG_DRV_ACT_RANGES_APF_1_TOP // - Top Compatibility - }, +#if defined HCF_APF_VAR_1 //(Fake) Hermes-I + {1 ,//var_rec[1] - Variant number +CFG_DRV_ACT_RANGES_APF_1_BOTTOM ,// - Bottom Compatibility +CFG_DRV_ACT_RANGES_APF_1_TOP // - Top Compatibility + }, #else - {0 ,0 ,0 }, + {0 ,0 ,0 }, #endif // HCF_APF_VAR_1 -#if defined HCF_APF_VAR_2 //Hermes-II - {2 ,// var_rec[1] - Variant number -CFG_DRV_ACT_RANGES_APF_2_BOTTOM ,// - Bottom Compatibility -CFG_DRV_ACT_RANGES_APF_2_TOP // - Top Compatibility - }, +#if defined HCF_APF_VAR_2 //Hermes-II + {2 ,// var_rec[1] - Variant number +CFG_DRV_ACT_RANGES_APF_2_BOTTOM ,// - Bottom Compatibility +CFG_DRV_ACT_RANGES_APF_2_TOP // - Top Compatibility + }, #else - {0 ,0 ,0 }, + {0 ,0 ,0 }, #endif // HCF_APF_VAR_2 -#if defined HCF_APF_VAR_3 // Native_USB - {3 ,// var_rec[1] - Variant number -CFG_DRV_ACT_RANGES_APF_3_BOTTOM ,// - Bottom Compatibility !!!!!see note below!!!!!!! -CFG_DRV_ACT_RANGES_APF_3_TOP // - Top Compatibility - }, +#if defined HCF_APF_VAR_3 // Native_USB + {3 ,// var_rec[1] - Variant number +CFG_DRV_ACT_RANGES_APF_3_BOTTOM ,// - Bottom Compatibility !!!!!see note below!!!!!!! +CFG_DRV_ACT_RANGES_APF_3_TOP // - Top Compatibility + }, #else - {0 ,0 ,0 }, + {0 ,0 ,0 }, #endif // HCF_APF_VAR_3 -#if defined HCF_APF_VAR_4 // WARP Hermes 2.5 - {4 ,// var_rec[1] - Variant number -CFG_DRV_ACT_RANGES_APF_4_BOTTOM ,// - Bottom Compatibility !!!!!see note below!!!!!!! -CFG_DRV_ACT_RANGES_APF_4_TOP // - Top Compatibility - } +#if defined HCF_APF_VAR_4 // WARP Hermes 2.5 + {4 ,// var_rec[1] - Variant number +CFG_DRV_ACT_RANGES_APF_4_BOTTOM ,// - Bottom Compatibility !!!!!see note below!!!!!!! +CFG_DRV_ACT_RANGES_APF_4_TOP // - Top Compatibility + } #else - { 0, 0, 0 } + { 0, 0, 0 } #endif // HCF_APF_VAR_4 } } ;#define HCF_VERSION TEXT( "HCF$Revision: 1.10 $" )static struct /*CFG_HCF_OPT_STRCT*/ { -hcf_16 len;//length of cfg_hcf_opt struct -hcf_16 typ;//type 0x082C -hcf_16 v0;//offset HCF_VERSION -hcf_16 v1;// MSF_COMPONENT_ID -hcf_16 v2;// HCF_ALIGN -hcf_16 v3;// HCF_ASSERT -hcf_16 v4;// HCF_BIG_ENDIAN -hcf_16 v5;// /* HCF_DLV | HCF_DLNV */ -hcf_16 v6;// HCF_DMA -hcf_16 v7;// HCF_ENCAP -hcf_16 v8;// HCF_EXT -hcf_16 v9;// HCF_INT_ON -hcf_16 v10;// HCF_IO -hcf_16 v11;// HCF_LEGACY -hcf_16 v12;// HCF_MAX_LTV -hcf_16 v13;// HCF_PROT_TIME -hcf_16 v14;// HCF_SLEEP -hcf_16 v15;// HCF_TALLIES -hcf_16 v16;// HCF_TYPE -hcf_16 v17;// HCF_NIC_TAL_CNT -hcf_16 v18;// HCF_HCF_TAL_CNT -hcf_16 v19;// offset tallies -TCHAR val[sizeof (HCF_VERSION )]; +hcf_16 len;//length of cfg_hcf_opt struct +hcf_16 typ;//type 0x082C +hcf_16 v0;//offset HCF_VERSION +hcf_16 v1;// MSF_COMPONENT_ID +hcf_16 v2;// HCF_ALIGN +hcf_16 v3;// HCF_ASSERT +hcf_16 v4;// HCF_BIG_ENDIAN +hcf_16 v5;// /* HCF_DLV | HCF_DLNV */ +hcf_16 v6;// HCF_DMA +hcf_16 v7;// HCF_ENCAP +hcf_16 v8;// HCF_EXT +hcf_16 v9;// HCF_INT_ON +hcf_16 v10;// HCF_IO +hcf_16 v11;// HCF_LEGACY +hcf_16 v12;// HCF_MAX_LTV +hcf_16 v13;// HCF_PROT_TIME +hcf_16 v14;// HCF_SLEEP +hcf_16 v15;// HCF_TALLIES +hcf_16 v16;// HCF_TYPE +hcf_16 v17;// HCF_NIC_TAL_CNT +hcf_16 v18;// HCF_HCF_TAL_CNT +hcf_16 v19;// offset tallies +TCHAR val[sizeof (HCF_VERSION )]; } BASED cfg_hcf_opt = {sizeof (cfg_hcf_opt)/sizeof (hcf_16) -1 , -CFG_HCF_OPT ,// (0x082C) +CFG_HCF_OPT ,// (0x082C) (sizeof (cfg_hcf_opt) -sizeof (HCF_VERSION ) -4 )/sizeof (hcf_16), #if defined MSF_COMPONENT_ID MSF_COMPONENT_ID,
@@ -455,7 +454,7 @@ static struct /*CFG_HCF_OPT_STRCT*/ {HCF_ALIGN ,HCF_ASSERT ,HCF_BIG_ENDIAN , -0 ,// /* HCF_DLV | HCF_DLNV*/, +0 ,// /* HCF_DLV | HCF_DLNV*/, HCF_DMA ,HCF_ENCAP , HCF_EXT,
@@ -488,208 +487,208 @@ HCF_STATIC LTV_STRCT BASED cfg_null = { 1, CFG_NULL, {0} };#endif // HCF_EXT_MB HCF_STATIC hcf_16* BASED xxxx[ ] = { #if (HCF_EXT) & HCF_EXT_MB - &cfg_null.len,//CFG_NULL 0x0820 + &cfg_null.len,//CFG_NULL 0x0820 #endif // HCF_EXT_MB #if defined MSF_COMPONENT_ID - &cfg_drv_identity.len,//CFG_DRV_IDENTITY 0x0826 - &cfg_drv_sup_range.len,//CFG_DRV_SUP_RANGE 0x0827 - &cfg_drv_act_ranges_pri.len,//CFG_DRV_ACT_RANGES_PRI 0x0828 - &cfg_drv_act_ranges_sta.len,//CFG_DRV_ACT_RANGES_STA 0x0829 - &cfg_drv_act_ranges_hsi.len,//CFG_DRV_ACT_RANGES_HSI 0x082A - &cfg_drv_act_ranges_apf.len,//CFG_DRV_ACT_RANGES_APF 0x082B - &cfg_hcf_opt.len,//CFG_HCF_OPT 0x082C -NULL ,//IFB_PRIIdentity placeholder 0xFD02 -NULL ,//IFB_PRISup placeholder 0xFD03 + &cfg_drv_identity.len,//CFG_DRV_IDENTITY 0x0826 + &cfg_drv_sup_range.len,//CFG_DRV_SUP_RANGE 0x0827 + &cfg_drv_act_ranges_pri.len,//CFG_DRV_ACT_RANGES_PRI 0x0828 + &cfg_drv_act_ranges_sta.len,//CFG_DRV_ACT_RANGES_STA 0x0829 + &cfg_drv_act_ranges_hsi.len,//CFG_DRV_ACT_RANGES_HSI 0x082A + &cfg_drv_act_ranges_apf.len,//CFG_DRV_ACT_RANGES_APF 0x082B + &cfg_hcf_opt.len,//CFG_HCF_OPT 0x082C +NULL ,//IFB_PRIIdentity placeholder 0xFD02 +NULL ,//IFB_PRISup placeholder 0xFD03 #endif // MSF_COMPONENT_ID -NULL //endsentinel - }; -#define xxxx_PRI_IDENTITY_OFFSET (ARRAY_SIZE(xxxx) - 3) +NULL //endsentinel +}; +#define xxxx_PRI_IDENTITY_OFFSET (ARRAY_SIZE(xxxx) - 3)#endif // MSF_COMPONENT_ID / HCF_EXT_MB /************************************************************************************************************ -************************** T O P L E V E L H C F R O U T I N E S ************************************** -************************************************************************************************************/ +************************** T O P L E V E L H C F R O U T I N E S ************************************** +************************************************************************************************************/ #if (HCF_DL_ONLY ) ==0 /************************************************************************************************************ -* -*.MODULE int hcf_action( IFBP ifbp, hcf_16 action ) -*.PURPOSE Changes the run-time Card behavior. -* Performs Miscellanuous actions. -* -*.ARGUMENTS -* ifbp address of the Interface Block -* action number identifying the type of change -* - HCF_ACT_CCX_OFF disable CKIP -* - HCF_ACT_CCX_ON enable CKIP -* - HCF_ACT_INT_FORCE_ON enable interrupt generation by WaveLAN NIC -* - HCF_ACT_INT_OFF disable interrupt generation by WaveLAN NIC -* - HCF_ACT_INT_ON compensate 1 HCF_ACT_INT_OFF, enable interrupt generation if balance reached -* - HCF_ACT_PRS_SCAN Hermes Probe Respons Scan (F102) command -* - HCF_ACT_RX_ACK acknowledge non-DMA receiver to Hermes -* - HCF_ACT_SCAN Hermes Inquire Scan (F101) command (non-WARP only) -* - HCF_ACT_SLEEP DDS Sleep request -* - HCF_ACT_TALLIES Hermes Inquire Tallies (F100) command -* -*.RETURNS -* HCF_SUCCESS all (including invalid) -* HCF_INT_PENDING HCF_ACT_INT_OFF, interrupt pending -* HCF_ERR_NO_NIC HCF_ACT_INT_OFF, NIC presence check fails -* -*.CONDITIONS -* Except for hcf_action with HCF_ACT_INT_FORCE_ON or HCF_ACT_INT_OFF as parameter or hcf_connect with an I/O -* address (i.e. not HCF_DISCONNECT), all hcf-function calls MUST be preceded by a call of hcf_action with -* HCF_ACT_INT_OFF as parameter. -* Note that hcf_connect defaults to NIC interrupt disabled mode, i.e. as if hcf_action( HCF_ACT_INT_OFF ) -* was called. -* -*.DESCRIPTION -* hcf_action supports the following mode changing action-code pairs that are antonyms -* - HCF_ACT_CCX_OFF / HCF_ACT_CCX_ON -* - HCF_ACT_INT_[FORCE_]ON / HCF_ACT_INT_OFF -* -* Additionally hcf_action can start the following actions in the NIC: -* - HCF_ACT_PRS_SCAN -* - HCF_ACT_RX_ACK -* - HCF_ACT_SCAN -* - HCF_ACT_SLEEP -* - HCF_ACT_TALLIES -* -* o HCF_ACT_INT_OFF: Sets NIC Interrupts mode Disabled. -* This command, and the associated [Force] Enable NIC interrupts command, are only available if the HCF_INT_ON -* compile time option is not set at 0x0000. -* -* o HCF_ACT_INT_ON: Sets NIC Interrupts mode Enabled. -* Enable NIC Interrupts, depending on the number of preceding Disable NIC Interrupt calls. -* -* o HCF_ACT_INT_FORCE_ON: Force NIC Interrupts mode Enabled. -* Sets NIC Interrupts mode Enabled, regardless off the number of preceding Disable NIC Interrupt calls. -* -* The disabling and enabling of interrupts are antonyms. -* These actions must be balanced. -* For each "disable interrupts" there must be a matching "enable interrupts". -* The disable interrupts may be executed multiple times in a row without intervening enable interrupts, in -* other words, the disable interrupts may be nested. -* The interrupt generation mechanism is disabled at the first call with HCF_ACT_INT_OFF. -* The interrupt generation mechanism is re-enabled when the number of calls with HCF_ACT_INT_ON matches the -* number of calls with INT_OFF. -* -* It is not allowed to have more Enable NIC Interrupts calls than Disable NIC Interrupts calls. -* The interrupt generation mechanism is initially (i.e. after hcf_connect) disabled. -* An MSF based on a interrupt strategy must call hcf_action with INT_ON in its initialization logic. -* -*! The INT_OFF/INT_ON housekeeping is initialized at 0x0000 by hcf_connect, causing the interrupt generation -* mechanism to be disabled at first. This suits MSF implementation based on a polling strategy. -* -* o HCF_ACT_CCX_OFF / HCF_ACT_CCX_ON -*!! This can use some more explanation;? -* Disables and Enables support in the HCF runtime code for the CCX feature. Each time one of these action -* codes is used, the effects of the preceding use cease. -* -* o HCF_ACT_SLEEP: Initiates the Disconnected DeepSleep process -* This command is only available if the HCF_DDS compile time option is set. It triggers the F/W to start the -* sleep handshaking. Regardless whether the Host initiates a Disconnected DeepSleep (DDS) or the F/W initiates -* a Connected DeepSleep (CDS), the Host-F/W sleep handshaking is completed when the NIC Interrupts mode is -* enabled (by means of the balancing HCF_ACT_INT_ON), i.e. at that moment the F/W really goes into sleep mode. -* The F/W is wokenup by the HCF when the NIC Interrupts mode are disabled, i.e. at the first HCF_ACT_INT_OFF -* after going into sleep. -* -* The following Miscellanuous actions are defined: -* -* o HCF_ACT_RX_ACK: Receiver Acknowledgement (non-DMA, non-USB mode only) -* Acking the receiver, frees the NIC memory used to hold the Rx frame and allows the F/W to -* report the existence of the next Rx frame. -* If the MSF does not need access (any longer) to the current frame, e.g. because it is rejected based on the -* look ahead or copied to another buffer, the receiver may be acked. Acking earlier is assumed to have the -* potential of improving the performance. -* If the MSF does not explitly ack te receiver, the acking is done implicitly if: -* - the received frame fits in the look ahead buffer, by the hcf_service_nic call that reported the Rx frame -* - if not in the above step, by hcf_rcv_msg (assuming hcf_rcv_msg is called) -* - if neither of the above implicit acks nor an explicit ack by the MSF, by the first hcf_service_nic after -* the hcf_service_nic that reported the Rx frame. -* Note: If an Rx frame is already acked, an explicit ACK by the MSF acts as a NoOperation. -* -* o HCF_ACT_TALLIES: Inquire Tallies command -* This command is only operational if the F/W is enabled. -* The Inquire Tallies command requests the F/W to provide its current set of tallies. -* See also hcf_get_info with CFG_TALLIES as parameter. -* -* o HCF_ACT_PRS_SCAN: Inquire Probe Respons Scan command -* This command is only operational if the F/W is enabled. -* The Probe Respons Scan command starts a scan sequence. -* The HCF puts the result of this action in an MSF defined buffer (see CFG_RID_LOG_STRCT). -* -* o HCF_ACT_SCAN: Inquire Scan command -* This command is only supported for HII F/W (i.e. pre-WARP) and it is operational if the F/W is enabled. -* The Inquire Scan command starts a scan sequence. -* The HCF puts the result of this action in an MSF defined buffer (see CFG_RID_LOG_STRCT). -* -* Assert fails if -* - ifbp has a recognizable out-of-range value. -* - NIC interrupts are not disabled while required by parameter action. -* - an invalid code is specified in parameter action. -* - HCF_ACT_INT_ON commands outnumber the HCF_ACT_INT_OFF commands. -* - reentrancy, may be caused by calling hcf_functions without adequate protection against NIC interrupts or -* multi-threading -* -* - Since the HCF does not maintain status information relative to the F/W enabled state, it is not asserted -* whether HCF_ACT_SCAN, HCF_ACT_PRS_SCAN or HCF_ACT_TALLIES are only used while F/W is enabled. -* -*.DIAGRAM -* 0: The assert embedded in HCFLOGENTRY checks against re-entrancy. Re-entrancy could be caused by a MSF logic -* at task-level calling hcf_functions without shielding with HCF_ACT_ON/_OFF. However the HCF_ACT_INT_OFF -* action itself can per definition not be protected this way. Based on code inspection, it can be concluded, -* that there is no re-entrancy PROBLEM in this particular flow. It does not seem worth the trouble to -* explicitly check for this condition (although there was a report of an MSF which ran into this assert. -* 2:IFB_IntOffCnt is used to balance the INT_OFF and INT_ON calls. Disabling of the interrupts is achieved by -* writing a zero to the Hermes IntEn register. In a shared interrupt environment (e.g. the mini-PCI NDIS -* driver) it is considered more correct to return the status HCF_INT_PENDING if and only if, the current -* invocation of hcf_service_nic is (apparently) called in the ISR when the ISR was activated as result of a -* change in HREG_EV_STAT matching a bit in HREG_INT_EN, i.e. not if invoked as result of another device -* generating an interrupt on the shared interrupt line. -* Note 1: it has been observed that under certain adverse conditions on certain platforms the writing of -* HREG_INT_EN can apparently fail, therefor it is paramount that HREG_INT_EN is written again with 0 for -* each and every call to HCF_ACT_INT_OFF. -* Note 2: it has been observed that under certain H/W & S/W architectures this logic is called when there is -* no NIC at all. To cater for this, the value of HREG_INT_EN is validated. If the unused bit 0x0100 is set, -* it is assumed there is no NIC. -* Note 3: During the download process, some versions of the F/W reset HREG_SW_0, hence checking this -* register for HCF_MAGIC (the classical NIC presence test) when HCF_ACT_INT_OFF is called due to another -* card interrupting via a shared IRQ during a download, fails. -*4: The construction "if ( ifbp->IFB_IntOffCnt-- == 0 )" is optimal (in the sense of shortest/quickest -* path in error free flows) but NOT fail safe in case of too many INT_ON invocations compared to INT_OFF). -* Enabling of the interrupts is achieved by writing the Hermes IntEn register. -* - If the HCF is in Defunct mode, the interrupts stay disabled. -* - Under "normal" conditions, the HCF is only interested in Info Events, Rx Events and Notify Events. -* - When the HCF is out of Tx/Notify resources, the HCF is also interested in Alloc Events. -* - via HCF_EXT, the MSF programmer can also request HREG_EV_TICK and/or HREG_EV_TX_EXC interrupts. -* For DMA operation, the DMA hardware handles the alloc events. The DMA engine will generate a 'TxDmaDone' -* event as soon as it has pumped a frame from host ram into NIC-RAM (note that the frame does not have to be -* transmitted then), and a 'RxDmaDone' event as soon as a received frame has been pumped from NIC-RAM into -* host ram. Note that the 'alloc' event has been removed from the event-mask, because the DMA engine will -* react to and acknowledge this event. -*6: ack the "old" Rx-event. See "Rx Buffer free strategy" in hcf_service_nic above for more explanation. -* IFB_RxFID and IFB_RxLen must be cleared to bring both the internal HCF house keeping and the information -* supplied to the MSF in the state "no frame received". -*8: The HCF_ACT_SCAN, HCF_ACT_PRS_SCAN and HCF_ACT_TALLIES activity are merged by "clever" algebraic -* manipulations of the RID-values and action codes, so foregoing robustness against migration problems for -* ease of implementation. The assumptions about numerical relationships between CFG_TALLIES etc and -* HCF_ACT_TALLIES etc are checked by the "#if" statements just prior to the body of this routine, resulting -* in: err "maintenance" during compilation if the assumptions are no longer met. The writing of HREG_PARAM_1 -* with 0x3FFF in case of an PRS scan, is a kludge to get around lack of specification, hence different -* implementation in F/W and Host. -* When there is no NIC RAM available, some versions of the Hermes F/W do report 0x7F00 as error in the -* Result field of the Status register and some F/W versions don't. To mask this difference to the MSF all -* return codes of the Hermes are ignored ("best" and "most simple" solution to these types of analomies with -* an acceptable loss due to ignoring all error situations as well). -* The "No inquire space" is reported via the Hermes tallies. -*30: do not HCFASSERT( rc, rc ) since rc == HCF_INT_PENDING is no error -* -*.ENDDOC END DOCUMENTATION -* -************************************************************************************************************/ +* +*.MODULE int hcf_action( IFBP ifbp, hcf_16 action ) +*.PURPOSE Changes the run-time Card behavior. +* Performs Miscellanuous actions. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* action number identifying the type of change +* - HCF_ACT_CCX_OFF disable CKIP +* - HCF_ACT_CCX_ON enable CKIP +* - HCF_ACT_INT_FORCE_ON enable interrupt generation by WaveLAN NIC +* - HCF_ACT_INT_OFF disable interrupt generation by WaveLAN NIC +* - HCF_ACT_INT_ON compensate 1 HCF_ACT_INT_OFF, enable interrupt generation if balance reached +* - HCF_ACT_PRS_SCAN Hermes Probe Respons Scan (F102) command +* - HCF_ACT_RX_ACK acknowledge non-DMA receiver to Hermes +* - HCF_ACT_SCAN Hermes Inquire Scan (F101) command (non-WARP only) +* - HCF_ACT_SLEEP DDS Sleep request +* - HCF_ACT_TALLIES Hermes Inquire Tallies (F100) command +* +*.RETURNS +* HCF_SUCCESS all (including invalid) +* HCF_INT_PENDING HCF_ACT_INT_OFF, interrupt pending +* HCF_ERR_NO_NIC HCF_ACT_INT_OFF, NIC presence check fails +* +*.CONDITIONS +* Except for hcf_action with HCF_ACT_INT_FORCE_ON or HCF_ACT_INT_OFF as parameter or hcf_connect with an I/O +* address (i.e. not HCF_DISCONNECT), all hcf-function calls MUST be preceded by a call of hcf_action with +* HCF_ACT_INT_OFF as parameter. +* Note that hcf_connect defaults to NIC interrupt disabled mode, i.e. as if hcf_action( HCF_ACT_INT_OFF ) +* was called. +* +*.DESCRIPTION +* hcf_action supports the following mode changing action-code pairs that are antonyms +* - HCF_ACT_CCX_OFF / HCF_ACT_CCX_ON +* - HCF_ACT_INT_[FORCE_]ON / HCF_ACT_INT_OFF +* +* Additionally hcf_action can start the following actions in the NIC: +* - HCF_ACT_PRS_SCAN +* - HCF_ACT_RX_ACK +* - HCF_ACT_SCAN +* - HCF_ACT_SLEEP +* - HCF_ACT_TALLIES +* +* o HCF_ACT_INT_OFF: Sets NIC Interrupts mode Disabled. +* This command, and the associated [Force] Enable NIC interrupts command, are only available if the HCF_INT_ON +* compile time option is not set at 0x0000. +* +* o HCF_ACT_INT_ON: Sets NIC Interrupts mode Enabled. +* Enable NIC Interrupts, depending on the number of preceding Disable NIC Interrupt calls. +* +* o HCF_ACT_INT_FORCE_ON: Force NIC Interrupts mode Enabled. +* Sets NIC Interrupts mode Enabled, regardless off the number of preceding Disable NIC Interrupt calls. +* +* The disabling and enabling of interrupts are antonyms. +* These actions must be balanced. +* For each "disable interrupts" there must be a matching "enable interrupts". +* The disable interrupts may be executed multiple times in a row without intervening enable interrupts, in +* other words, the disable interrupts may be nested. +* The interrupt generation mechanism is disabled at the first call with HCF_ACT_INT_OFF. +* The interrupt generation mechanism is re-enabled when the number of calls with HCF_ACT_INT_ON matches the +* number of calls with INT_OFF. +* +* It is not allowed to have more Enable NIC Interrupts calls than Disable NIC Interrupts calls. +* The interrupt generation mechanism is initially (i.e. after hcf_connect) disabled. +* An MSF based on a interrupt strategy must call hcf_action with INT_ON in its initialization logic. +* +*! The INT_OFF/INT_ON housekeeping is initialized at 0x0000 by hcf_connect, causing the interrupt generation +* mechanism to be disabled at first. This suits MSF implementation based on a polling strategy. +* +* o HCF_ACT_CCX_OFF / HCF_ACT_CCX_ON +*!! This can use some more explanation;? +* Disables and Enables support in the HCF runtime code for the CCX feature. Each time one of these action +* codes is used, the effects of the preceding use cease. +* +* o HCF_ACT_SLEEP: Initiates the Disconnected DeepSleep process +* This command is only available if the HCF_DDS compile time option is set. It triggers the F/W to start the +* sleep handshaking. Regardless whether the Host initiates a Disconnected DeepSleep (DDS) or the F/W initiates +* a Connected DeepSleep (CDS), the Host-F/W sleep handshaking is completed when the NIC Interrupts mode is +* enabled (by means of the balancing HCF_ACT_INT_ON), i.e. at that moment the F/W really goes into sleep mode. +* The F/W is wokenup by the HCF when the NIC Interrupts mode are disabled, i.e. at the first HCF_ACT_INT_OFF +* after going into sleep. +* +* The following Miscellanuous actions are defined: +* +* o HCF_ACT_RX_ACK: Receiver Acknowledgement (non-DMA, non-USB mode only) +* Acking the receiver, frees the NIC memory used to hold the Rx frame and allows the F/W to +* report the existence of the next Rx frame. +* If the MSF does not need access (any longer) to the current frame, e.g. because it is rejected based on the +* look ahead or copied to another buffer, the receiver may be acked. Acking earlier is assumed to have the +* potential of improving the performance. +* If the MSF does not explitly ack te receiver, the acking is done implicitly if: +* - the received frame fits in the look ahead buffer, by the hcf_service_nic call that reported the Rx frame +* - if not in the above step, by hcf_rcv_msg (assuming hcf_rcv_msg is called) +* - if neither of the above implicit acks nor an explicit ack by the MSF, by the first hcf_service_nic after +* the hcf_service_nic that reported the Rx frame. +* Note: If an Rx frame is already acked, an explicit ACK by the MSF acts as a NoOperation. +* +* o HCF_ACT_TALLIES: Inquire Tallies command +* This command is only operational if the F/W is enabled. +* The Inquire Tallies command requests the F/W to provide its current set of tallies. +* See also hcf_get_info with CFG_TALLIES as parameter. +* +* o HCF_ACT_PRS_SCAN: Inquire Probe Respons Scan command +* This command is only operational if the F/W is enabled. +* The Probe Respons Scan command starts a scan sequence. +* The HCF puts the result of this action in an MSF defined buffer (see CFG_RID_LOG_STRCT). +* +* o HCF_ACT_SCAN: Inquire Scan command +* This command is only supported for HII F/W (i.e. pre-WARP) and it is operational if the F/W is enabled. +* The Inquire Scan command starts a scan sequence. +* The HCF puts the result of this action in an MSF defined buffer (see CFG_RID_LOG_STRCT). +* +* Assert fails if +* - ifbp has a recognizable out-of-range value. +* - NIC interrupts are not disabled while required by parameter action. +* - an invalid code is specified in parameter action. +* - HCF_ACT_INT_ON commands outnumber the HCF_ACT_INT_OFF commands. +* - reentrancy, may be caused by calling hcf_functions without adequate protection against NIC interrupts or +* multi-threading +* +* - Since the HCF does not maintain status information relative to the F/W enabled state, it is not asserted +* whether HCF_ACT_SCAN, HCF_ACT_PRS_SCAN or HCF_ACT_TALLIES are only used while F/W is enabled. +* +*.DIAGRAM +* 0: The assert embedded in HCFLOGENTRY checks against re-entrancy. Re-entrancy could be caused by a MSF logic +* at task-level calling hcf_functions without shielding with HCF_ACT_ON/_OFF. However the HCF_ACT_INT_OFF +* action itself can per definition not be protected this way. Based on code inspection, it can be concluded, +* that there is no re-entrancy PROBLEM in this particular flow. It does not seem worth the trouble to +* explicitly check for this condition (although there was a report of an MSF which ran into this assert. +* 2:IFB_IntOffCnt is used to balance the INT_OFF and INT_ON calls. Disabling of the interrupts is achieved by +* writing a zero to the Hermes IntEn register. In a shared interrupt environment (e.g. the mini-PCI NDIS +* driver) it is considered more correct to return the status HCF_INT_PENDING if and only if, the current +* invocation of hcf_service_nic is (apparently) called in the ISR when the ISR was activated as result of a +* change in HREG_EV_STAT matching a bit in HREG_INT_EN, i.e. not if invoked as result of another device +* generating an interrupt on the shared interrupt line. +* Note 1: it has been observed that under certain adverse conditions on certain platforms the writing of +* HREG_INT_EN can apparently fail, therefor it is paramount that HREG_INT_EN is written again with 0 for +* each and every call to HCF_ACT_INT_OFF. +* Note 2: it has been observed that under certain H/W & S/W architectures this logic is called when there is +* no NIC at all. To cater for this, the value of HREG_INT_EN is validated. If the unused bit 0x0100 is set, +* it is assumed there is no NIC. +* Note 3: During the download process, some versions of the F/W reset HREG_SW_0, hence checking this +* register for HCF_MAGIC (the classical NIC presence test) when HCF_ACT_INT_OFF is called due to another +* card interrupting via a shared IRQ during a download, fails. +*4: The construction "if ( ifbp->IFB_IntOffCnt-- == 0 )" is optimal (in the sense of shortest/quickest +* path in error free flows) but NOT fail safe in case of too many INT_ON invocations compared to INT_OFF). +* Enabling of the interrupts is achieved by writing the Hermes IntEn register. +* - If the HCF is in Defunct mode, the interrupts stay disabled. +* - Under "normal" conditions, the HCF is only interested in Info Events, Rx Events and Notify Events. +* - When the HCF is out of Tx/Notify resources, the HCF is also interested in Alloc Events. +* - via HCF_EXT, the MSF programmer can also request HREG_EV_TICK and/or HREG_EV_TX_EXC interrupts. +* For DMA operation, the DMA hardware handles the alloc events. The DMA engine will generate a 'TxDmaDone' +* event as soon as it has pumped a frame from host ram into NIC-RAM (note that the frame does not have to be +* transmitted then), and a 'RxDmaDone' event as soon as a received frame has been pumped from NIC-RAM into +* host ram. Note that the 'alloc' event has been removed from the event-mask, because the DMA engine will +* react to and acknowledge this event. +*6: ack the "old" Rx-event. See "Rx Buffer free strategy" in hcf_service_nic above for more explanation. +* IFB_RxFID and IFB_RxLen must be cleared to bring both the internal HCF house keeping and the information +* supplied to the MSF in the state "no frame received". +*8: The HCF_ACT_SCAN, HCF_ACT_PRS_SCAN and HCF_ACT_TALLIES activity are merged by "clever" algebraic +* manipulations of the RID-values and action codes, so foregoing robustness against migration problems for +* ease of implementation. The assumptions about numerical relationships between CFG_TALLIES etc and +* HCF_ACT_TALLIES etc are checked by the "#if" statements just prior to the body of this routine, resulting +* in: err "maintenance" during compilation if the assumptions are no longer met. The writing of HREG_PARAM_1 +* with 0x3FFF in case of an PRS scan, is a kludge to get around lack of specification, hence different +* implementation in F/W and Host. +* When there is no NIC RAM available, some versions of the Hermes F/W do report 0x7F00 as error in the +* Result field of the Status register and some F/W versions don't. To mask this difference to the MSF all +* return codes of the Hermes are ignored ("best" and "most simple" solution to these types of analomies with +* an acceptable loss due to ignoring all error situations as well). +* The "No inquire space" is reported via the Hermes tallies. +*30: do not HCFASSERT( rc, rc ) since rc == HCF_INT_PENDING is no error +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ #if ( (HCF_TYPE ) &HCF_TYPE_HII5 ) ==0 #if CFG_SCAN !=CFG_TALLIES -HCF_ACT_TALLIES +HCF_ACT_SCAN err:"maintenance" apparently inviolated the underlying assumption about the numerical values of these macros
@@ -701,43 +700,43 @@ err: "maintenance" apparently inviolated the underlying assumption about the numint hcf_action (IFBP ifbp,hcf_16 action ) { -int rc =HCF_SUCCESS ; +int rc =HCF_SUCCESS ;HCFASSERT ( ifbp->IFB_Magic ==HCF_MAGIC , ifbp->IFB_Magic );#if HCF_INT_ON -HCFLOGENTRY ( action ==HCF_ACT_INT_FORCE_ON ?HCF_TRACE_ACTION_KLUDGE :HCF_TRACE_ACTION , action );/* 0 */ +HCFLOGENTRY ( action ==HCF_ACT_INT_FORCE_ON ?HCF_TRACE_ACTION_KLUDGE :HCF_TRACE_ACTION , action );/* 0 */ #if (HCF_SLEEP )HCFASSERT ( ifbp->IFB_IntOffCnt !=0xFFFE || action ==HCF_ACT_INT_OFF , -MERGE_2 ( action, ifbp->IFB_IntOffCnt ) ); +MERGE_2 ( action, ifbp->IFB_IntOffCnt ) );#else HCFASSERT ( ifbp->IFB_IntOffCnt !=0xFFFE , action );#endif // HCF_SLEEP HCFASSERT ( ifbp->IFB_IntOffCnt !=0xFFFF || - action ==HCF_ACT_INT_OFF || action ==HCF_ACT_INT_FORCE_ON , action ); + action ==HCF_ACT_INT_OFF || action ==HCF_ACT_INT_FORCE_ON , action );HCFASSERT ( ifbp->IFB_IntOffCnt <=16 || ifbp->IFB_IntOffCnt >=0xFFFE , -MERGE_2 ( action, ifbp->IFB_IntOffCnt ) );//nesting more than 16 deep seems unreasonable +MERGE_2 ( action, ifbp->IFB_IntOffCnt ) );//nesting more than 16 deep seems unreasonable #endif // HCF_INT_ON switch (action) {#if HCF_INT_ON -hcf_16 i; -case HCF_ACT_INT_OFF :// Disable Interrupt generation +hcf_16 i; +case HCF_ACT_INT_OFF :// Disable Interrupt generation #if HCF_SLEEP -if ( ifbp->IFB_IntOffCnt ==0xFFFE ) {// WakeUp test ;?tie this to the "new" super-LinkStat - ifbp->IFB_IntOffCnt++;// restore conventional I/F -OPW (HREG_IO ,HREG_IO_WAKEUP_ASYNC );// set wakeup bit -OPW (HREG_IO ,HREG_IO_WAKEUP_ASYNC );// set wakeup bit to counteract the clearing by F/W +if ( ifbp->IFB_IntOffCnt ==0xFFFE ) {// WakeUp test ;?tie this to the "new" super-LinkStat + ifbp->IFB_IntOffCnt++;// restore conventional I/F +OPW (HREG_IO ,HREG_IO_WAKEUP_ASYNC );// set wakeup bit +OPW (HREG_IO ,HREG_IO_WAKEUP_ASYNC );// set wakeup bit to counteract the clearing by F/W // 800 us latency before FW switches to high power -MSF_WAIT (800 );// MSF-defined function to wait n microseconds. -//OOR if ( ifbp->IFB_DSLinkStat & CFG_LINK_STAT_DS_OOR ) { // OutOfRange -// printk( "<5>ACT_INT_OFF: Deepsleep phase terminated, enable and go to AwaitConnection\n" ); //;?remove me 1 day +MSF_WAIT (800 );// MSF-defined function to wait n microseconds. +//OOR if ( ifbp->IFB_DSLinkStat & CFG_LINK_STAT_DS_OOR ) { // OutOfRange +// printk( "<5>ACT_INT_OFF: Deepsleep phase terminated, enable and go to AwaitConnection\n" ); //;?remove me 1 day // hcf_cntl( ifbp, HCF_CNTL_ENABLE ); // } -// ifbp->IFB_DSLinkStat &= ~( CFG_LINK_STAT_DS_IR | CFG_LINK_STAT_DS_OOR); //clear IR/OOR state +// ifbp->IFB_DSLinkStat &= ~( CFG_LINK_STAT_DS_IR | CFG_LINK_STAT_DS_OOR); //clear IR/OOR state }#endif // HCF_SLEEP -/*2*/ ifbp->IFB_IntOffCnt++; -//! rc = 0; +/*2*/ ifbp->IFB_IntOffCnt++; +//! rc = 0; i =IPW (HREG_INT_EN );OPW (HREG_INT_EN ,0 );if ( i &0x1000 ) {
@@ -749,89 +748,89 @@ hcf_16 i; }break ; -case HCF_ACT_INT_FORCE_ON :// Enforce Enable Interrupt generation +case HCF_ACT_INT_FORCE_ON :// Enforce Enable Interrupt generation ifbp->IFB_IntOffCnt =0 ;//Fall through in HCF_ACT_INT_ON -case HCF_ACT_INT_ON :// Enable Interrupt generation -/*4*/ if ( ifbp->IFB_IntOffCnt-- ==0 && ifbp->IFB_CardStat ==0 ) { -//determine Interrupt Event mask +case HCF_ACT_INT_ON :// Enable Interrupt generation +/*4*/ if ( ifbp->IFB_IntOffCnt-- ==0 && ifbp->IFB_CardStat ==0 ) { +//determine Interrupt Event mask #if HCF_DMA if ( ifbp->IFB_CntlOpt &USE_DMA ) { - i =HREG_EV_INFO |HREG_EV_RDMAD |HREG_EV_TDMAD |HREG_EV_TX_EXT ;//mask when DMA active + i =HREG_EV_INFO |HREG_EV_RDMAD |HREG_EV_TDMAD |HREG_EV_TX_EXT ;//mask when DMA active } else#endif // HCF_DMA { - i =HREG_EV_INFO |HREG_EV_RX |HREG_EV_TX_EXT ;//mask when DMA not active + i =HREG_EV_INFO |HREG_EV_RX |HREG_EV_TX_EXT ;//mask when DMA not active if ( ifbp->IFB_RscInd ==0 ) { - i |=HREG_EV_ALLOC ;//mask when no TxFID available + i |=HREG_EV_ALLOC ;//mask when no TxFID available } }#if HCF_SLEEP if ( (IPW (HREG_EV_STAT ) & ( i |HREG_EV_SLEEP_REQ ) ) ==HREG_EV_SLEEP_REQ ) {// firmware indicates it would like to go into sleep modus // only acknowledge this request if no other events that can cause an interrupt are pending - ifbp->IFB_IntOffCnt--;//becomes 0xFFFE -OPW (HREG_INT_EN , i |HREG_EV_TICK ); + ifbp->IFB_IntOffCnt--;//becomes 0xFFFE +OPW (HREG_INT_EN , i |HREG_EV_TICK );OPW (HREG_EV_ACK ,HREG_EV_SLEEP_REQ |HREG_EV_TICK |HREG_EV_ACK_REG_READY ); } else#endif // HCF_SLEEP { -OPW (HREG_INT_EN , i |HREG_EV_SLEEP_REQ ); +OPW (HREG_INT_EN , i |HREG_EV_SLEEP_REQ ); } }break ;#endif // HCF_INT_ON #if (HCF_SLEEP ) &HCF_DDS -case HCF_ACT_SLEEP :// DDS Sleep request +case HCF_ACT_SLEEP :// DDS Sleep request hcf_cntl ( ifbp,HCF_CNTL_DISABLE );cmd_exe ( ifbp,HCMD_SLEEP ,0 );break ; -// case HCF_ACT_WAKEUP: // DDS Wakeup request -// HCFASSERT( ifbp->IFB_IntOffCnt == 0xFFFE, ifbp->IFB_IntOffCnt ); -// ifbp->IFB_IntOffCnt++; // restore conventional I/F -// OPW( HREG_IO, HREG_IO_WAKEUP_ASYNC ); -// MSF_WAIT(800); // MSF-defined function to wait n microseconds. -// rc = hcf_action( ifbp, HCF_ACT_INT_OFF ); /*bogus, IFB_IntOffCnt == 0xFFFF, so if you carefully look -// *at the #if HCF_DDS statements, HCF_ACT_INT_OFF is empty -// *for DDS. "Much" better would be to merge the flows for -// *DDS and DEEP_SLEEP -// */ -// break; +// case HCF_ACT_WAKEUP: // DDS Wakeup request +// HCFASSERT( ifbp->IFB_IntOffCnt == 0xFFFE, ifbp->IFB_IntOffCnt ); +// ifbp->IFB_IntOffCnt++; // restore conventional I/F +// OPW( HREG_IO, HREG_IO_WAKEUP_ASYNC ); +// MSF_WAIT(800); // MSF-defined function to wait n microseconds. +// rc = hcf_action( ifbp, HCF_ACT_INT_OFF ); /*bogus, IFB_IntOffCnt == 0xFFFF, so if you carefully look +// *at the #if HCF_DDS statements, HCF_ACT_INT_OFF is empty +// *for DDS. "Much" better would be to merge the flows for +// *DDS and DEEP_SLEEP +// */ +// break; #endif // HCF_DDS #if (HCF_TYPE ) &HCF_TYPE_CCX -case HCF_ACT_CCX_ON :// enable CKIP -case HCF_ACT_CCX_OFF :// disable CKIP +case HCF_ACT_CCX_ON :// enable CKIP +case HCF_ACT_CCX_OFF :// disable CKIP ifbp->IFB_CKIPStat = action;break ;#endif // HCF_TYPE_CCX -case HCF_ACT_RX_ACK ://Receiver ACK -/*6*/ if ( ifbp->IFB_RxFID ) { +case HCF_ACT_RX_ACK ://Receiver ACK +/*6*/ if ( ifbp->IFB_RxFID ) {DAWA_ACK (HREG_EV_RX ); } ifbp->IFB_RxFID = ifbp->IFB_RxLen =0 ;break ; -/*8*/ case HCF_ACT_PRS_SCAN :// Hermes PRS Scan (F102) +/*8*/ case HCF_ACT_PRS_SCAN :// Hermes PRS Scan (F102) OPW (HREG_PARAM_1 ,0x3FFF ); -//Fall through in HCF_ACT_TALLIES -case HCF_ACT_TALLIES :// Hermes Inquire Tallies (F100) +//Fall through in HCF_ACT_TALLIES +case HCF_ACT_TALLIES :// Hermes Inquire Tallies (F100) #if ( (HCF_TYPE ) &HCF_TYPE_HII5 ) ==0 -case HCF_ACT_SCAN :// Hermes Inquire Scan (F101) +case HCF_ACT_SCAN :// Hermes Inquire Scan (F101) #endif // HCF_TYPE_HII5 /*!! the assumptions about numerical relationships between CFG_TALLIES etc and HCF_ACT_TALLIES etc -* are checked by #if statements just prior to this routine resulting in: err "maintenance" */ +* are checked by #if statements just prior to this routine resulting in: err "maintenance" */ cmd_exe ( ifbp,HCMD_INQUIRE , action -HCF_ACT_TALLIES +CFG_TALLIES );break ; -default : +default :HCFASSERT (DO_ASSERT , action );break ; } -//! do not HCFASSERT( rc == HCF_SUCCESS, rc ) /* 30*/ +//! do not HCFASSERT( rc == HCF_SUCCESS, rc ) /* 30*/ HCFLOGEXIT (HCF_TRACE_ACTION );return rc; }// hcf_action
@@ -839,137 +838,137 @@ hcf_16 i;/************************************************************************************************************ -* -*.MODULE int hcf_cntl( IFBP ifbp, hcf_16 cmd ) -*.PURPOSE Connect or disconnect a specific port to a specific network. -*!! ;???????????????? continue needs more explanation -* recovers by means of "continue" when the connect process in CCX mode fails -* Enables or disables data transmission and reception for the NIC. -* Activates static NIC configuration for a specific port at connect. -* Activates static configuration for all ports at enable. -* -*.ARGUMENTS -* ifbp address of the Interface Block -* cmd 0x001F: Hermes command (disable, enable, connect, disconnect, continue) -* HCF_CNTL_ENABLE Enable -* HCF_CNTL_DISABLE Disable -* HCF_CNTL_CONTINUE Continue -* HCF_CNTL_CONNECT Connect -* HCF_CNTL_DISCONNECT Disconnect -* 0x0100: command qualifier (continue) -* HCMD_RETRY retry flag -* 0x0700: port number (connect/disconnect) -* HCF_PORT_0 MAC Port 0 -* HCF_PORT_1 MAC Port 1 -* HCF_PORT_2 MAC Port 2 -* HCF_PORT_3 MAC Port 3 -* HCF_PORT_4 MAC Port 4 -* HCF_PORT_5 MAC Port 5 -* HCF_PORT_6 MAC Port 6 -* -*.RETURNS -* HCF_SUCCESS -*!! via cmd_exe -* HCF_ERR_NO_NIC -* HCF_ERR_DEFUNCT_... -* HCF_ERR_TIME_OUT -* -*.DESCRIPTION -* The parameter cmd contains a number of subfields. -* The actual value for cmd is created by logical or-ing the appropriate mnemonics for the subfields. -* The field 0x001F contains the command code -* - HCF_CNTL_ENABLE -* - HCF_CNTL_DISABLE -* - HCF_CNTL_CONNECT -* - HCF_CNTL_DISCONNECT -* - HCF_CNTL_CONTINUE -* -* For HCF_CNTL_CONTINUE, the field 0x0100 contains the retry flag HCMD_RETRY. -* For HCF_CNTL_CONNECT and HCF_CNTL_DISCONNECT, the field 0x0700 contains the port number as HCF_PORT_#. -* For Station as well as AccessPoint F/W, MAC Port 0 is the "normal" communication channel. -* For AccessPoint F/W, MAC Port 1 through 6 control the WDS links. -* -* Note that despite the names HCF_CNTL_DISABLE and HCF_CNTL_ENABLE, hcf_cntl does not influence the NIC -* Interrupts mode. -* -* The Connect is used by the MSF to bring a particular port in an inactive state as far as data transmission -* and reception are concerned. -* When a particular port is disconnected: -* - the F/W disables the receiver for that port. -* - the F/W ignores send commands for that port. -* - all frames (Receive as well as pending Transmit) for that port on the NIC are discarded. -* -* When the NIC is disabled, above list applies to all ports, i.e. the result is like all ports are -* disconnected. -* -* When a particular port is connected: -* - the F/W effectuates the static configuration for that port. -* - enables the receiver for that port. -* - accepts send commands for that port. -* -* Enabling has the following effects: -* - the F/W effectuates the static configuration for all ports. -* The F/W only updates its static configuration at a transition from disabled to enabled or from -* disconnected to connected. -* In order to enforce the static configuration, the MSF must assure that such a transition takes place. -* Due to such a disable/enable or disconnect/connect sequence, Rx/Tx frames may be lost, in other words, -* configuration may impact communication. -* - The DMA Engine (if applicable) is enabled. -* Note that the Enable Function by itself only enables data transmission and reception, it -* does not enable the Interrupt Generation mechanism. This is done by hcf_action. -* -* Disabling has the following effects: -*!! ;?????is the following statement really true -* - it acts as a disconnect on all ports. -* - The DMA Engine (if applicable) is disabled. -* -* For impact of the disable command on the behavior of hcf_dma_tx/rx_get see the appropriate sections. -* -* Although the Enable/Disable and Connect/Disconnect are antonyms, there is no restriction on their sequencing, -* in other words, they may be called multiple times in arbitrary sequence without being paired or balanced. -* Each time one of these functions is called, the effects of the preceding calls cease. -* -* Assert fails if -* - ifbp has a recognizable out-of-range value. -* - NIC interrupts are not disabled. -* - A command other than Continue, Enable, Disable, Connect or Disconnect is given. -* - An invalid combination of the subfields is given or a bit outside the subfields is given. -* - any return code besides HCF_SUCCESS. -* - reentrancy, may be caused by calling a hcf_function without adequate protection against NIC interrupts or -* multi-threading -* -*.DIAGRAM -* hcf_cntl takes successively the following actions: -*2: If the HCF is in Defunct mode or incompatible with the Primary or Station Supplier in the Hermes, -* hcf_cntl() returns immediately with HCF_ERR_NO_NIC;? as status. -*8: when the port is disabled, the DMA engine needs to be de-activated, so the host can safely reclaim tx -* packets from the tx descriptor chain. -* -*.ENDDOC END DOCUMENTATION -* -************************************************************************************************************/ +* +*.MODULE int hcf_cntl( IFBP ifbp, hcf_16 cmd ) +*.PURPOSE Connect or disconnect a specific port to a specific network. +*!! ;???????????????? continue needs more explanation +* recovers by means of "continue" when the connect process in CCX mode fails +* Enables or disables data transmission and reception for the NIC. +* Activates static NIC configuration for a specific port at connect. +* Activates static configuration for all ports at enable. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* cmd 0x001F: Hermes command (disable, enable, connect, disconnect, continue) +* HCF_CNTL_ENABLE Enable +* HCF_CNTL_DISABLE Disable +* HCF_CNTL_CONTINUE Continue +* HCF_CNTL_CONNECT Connect +* HCF_CNTL_DISCONNECT Disconnect +* 0x0100: command qualifier (continue) +* HCMD_RETRY retry flag +* 0x0700: port number (connect/disconnect) +* HCF_PORT_0 MAC Port 0 +* HCF_PORT_1 MAC Port 1 +* HCF_PORT_2 MAC Port 2 +* HCF_PORT_3 MAC Port 3 +* HCF_PORT_4 MAC Port 4 +* HCF_PORT_5 MAC Port 5 +* HCF_PORT_6 MAC Port 6 +* +*.RETURNS +* HCF_SUCCESS +*!! via cmd_exe +* HCF_ERR_NO_NIC +* HCF_ERR_DEFUNCT_... +* HCF_ERR_TIME_OUT +* +*.DESCRIPTION +* The parameter cmd contains a number of subfields. +* The actual value for cmd is created by logical or-ing the appropriate mnemonics for the subfields. +* The field 0x001F contains the command code +* - HCF_CNTL_ENABLE +* - HCF_CNTL_DISABLE +* - HCF_CNTL_CONNECT +* - HCF_CNTL_DISCONNECT +* - HCF_CNTL_CONTINUE +* +* For HCF_CNTL_CONTINUE, the field 0x0100 contains the retry flag HCMD_RETRY. +* For HCF_CNTL_CONNECT and HCF_CNTL_DISCONNECT, the field 0x0700 contains the port number as HCF_PORT_#. +* For Station as well as AccessPoint F/W, MAC Port 0 is the "normal" communication channel. +* For AccessPoint F/W, MAC Port 1 through 6 control the WDS links. +* +* Note that despite the names HCF_CNTL_DISABLE and HCF_CNTL_ENABLE, hcf_cntl does not influence the NIC +* Interrupts mode. +* +* The Connect is used by the MSF to bring a particular port in an inactive state as far as data transmission +* and reception are concerned. +* When a particular port is disconnected: +* - the F/W disables the receiver for that port. +* - the F/W ignores send commands for that port. +* - all frames (Receive as well as pending Transmit) for that port on the NIC are discarded. +* +* When the NIC is disabled, above list applies to all ports, i.e. the result is like all ports are +* disconnected. +* +* When a particular port is connected: +* - the F/W effectuates the static configuration for that port. +* - enables the receiver for that port. +* - accepts send commands for that port. +* +* Enabling has the following effects: +* - the F/W effectuates the static configuration for all ports. +* The F/W only updates its static configuration at a transition from disabled to enabled or from +* disconnected to connected. +* In order to enforce the static configuration, the MSF must assure that such a transition takes place. +* Due to such a disable/enable or disconnect/connect sequence, Rx/Tx frames may be lost, in other words, +* configuration may impact communication. +* - The DMA Engine (if applicable) is enabled. +* Note that the Enable Function by itself only enables data transmission and reception, it +* does not enable the Interrupt Generation mechanism. This is done by hcf_action. +* +* Disabling has the following effects: +*!! ;?????is the following statement really true +* - it acts as a disconnect on all ports. +* - The DMA Engine (if applicable) is disabled. +* +* For impact of the disable command on the behavior of hcf_dma_tx/rx_get see the appropriate sections. +* +* Although the Enable/Disable and Connect/Disconnect are antonyms, there is no restriction on their sequencing, +* in other words, they may be called multiple times in arbitrary sequence without being paired or balanced. +* Each time one of these functions is called, the effects of the preceding calls cease. +* +* Assert fails if +* - ifbp has a recognizable out-of-range value. +* - NIC interrupts are not disabled. +* - A command other than Continue, Enable, Disable, Connect or Disconnect is given. +* - An invalid combination of the subfields is given or a bit outside the subfields is given. +* - any return code besides HCF_SUCCESS. +* - reentrancy, may be caused by calling a hcf_function without adequate protection against NIC interrupts or +* multi-threading +* +*.DIAGRAM +* hcf_cntl takes successively the following actions: +*2: If the HCF is in Defunct mode or incompatible with the Primary or Station Supplier in the Hermes, +* hcf_cntl() returns immediately with HCF_ERR_NO_NIC;? as status. +*8: when the port is disabled, the DMA engine needs to be de-activated, so the host can safely reclaim tx +* packets from the tx descriptor chain. +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ int hcf_cntl (IFBP ifbp,hcf_16 cmd ) { -int rc =HCF_ERR_INCOMP_FW ; +int rc =HCF_ERR_INCOMP_FW ;#if HCF_ASSERT -{int x = cmd &HCMD_CMD_CODE ; -if ( x ==HCF_CNTL_CONTINUE ) x &= ~HCMD_RETRY ; -else if ( (x ==HCMD_DISABLE || x ==HCMD_ENABLE ) && ifbp->IFB_FWIdentity.comp_id ==COMP_ID_FW_AP ) { - x &= ~HFS_TX_CNTL_PORT ; - } -HCFASSERT ( x==HCF_CNTL_ENABLE || x==HCF_CNTL_DISABLE ||HCF_CNTL_CONTINUE || + {int x = cmd &HCMD_CMD_CODE ; +if ( x ==HCF_CNTL_CONTINUE ) x &= ~HCMD_RETRY ; +else if ( (x ==HCMD_DISABLE || x ==HCMD_ENABLE ) && ifbp->IFB_FWIdentity.comp_id ==COMP_ID_FW_AP ) { + x &= ~HFS_TX_CNTL_PORT ; + } +HCFASSERT ( x==HCF_CNTL_ENABLE || x==HCF_CNTL_DISABLE ||HCF_CNTL_CONTINUE || x==HCF_CNTL_CONNECT || x==HCF_CNTL_DISCONNECT , cmd ); -} + }#endif // HCF_ASSERT // #if (HCF_SLEEP) & HCF_DDS -// HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFE, cmd ); +// HCFASSERT( ifbp->IFB_IntOffCnt != 0xFFFE, cmd ); // #endif // HCF_DDS HCFLOGENTRY (HCF_TRACE_CNTL , cmd ); -if ( ifbp->IFB_CardStat ==0 ) {/*2*/ -/*6*/ rc =cmd_exe ( ifbp, cmd,0 ); +if ( ifbp->IFB_CardStat ==0 ) {/*2*/ +/*6*/ rc =cmd_exe ( ifbp, cmd,0 );#if (HCF_SLEEP ) &HCF_DDS - ifbp->IFB_TickCnt =0 ;//start 2 second period (with 1 tick uncertanty) + ifbp->IFB_TickCnt =0 ;//start 2 second period (with 1 tick uncertanty) #endif // HCF_DDS }#if HCF_DMA
@@ -980,7 +979,7 @@ int rc = HCF_ERR_INCOMP_FW;hcf_io io_port = ifbp->IFB_IOBase;DESC_STRCT *p;if ( cmd ==HCF_CNTL_DISABLE || cmd ==HCF_CNTL_ENABLE ) { -OUT_PORT_DWORD ( (io_port +HREG_DMA_CTRL ),DMA_CTRLSTAT_RESET );/*8*/ +OUT_PORT_DWORD ( (io_port +HREG_DMA_CTRL ),DMA_CTRLSTAT_RESET );/*8*/ ifbp->IFB_CntlOpt &= ~DMA_ENABLED ; }if ( cmd ==HCF_CNTL_ENABLE ) {
@@ -993,7 +992,7 @@ int rc = HCF_ERR_INCOMP_FW;// make the entire rx descriptor chain DMA-owned, so the DMA engine can (re-)use it. p = ifbp->IFB_FirstDesc[DMA_RX ];if (p !=NULL ) {//;? Think this over again in the light of the new chaining strategy -if (1 ) {//begin alternative +if (1 ) {//begin alternative HCFASSERT (NT_ASSERT ,NEVER_TESTED );put_frame_lst ( ifbp, ifbp->IFB_FirstDesc[DMA_RX ],DMA_RX );if ( ifbp->IFB_FirstDesc[DMA_RX ] ) {
@@ -1020,140 +1019,140 @@ int rc = HCF_ERR_INCOMP_FW;/************************************************************************************************************ -* -*.MODULE int hcf_connect( IFBP ifbp, hcf_io io_base ) -*.PURPOSE Grants access right for the HCF to the IFB. -* Initializes Card and HCF housekeeping. -* -*.ARGUMENTS -* ifbp (near) address of the Interface Block -* io_base non-USB: I/O Base address of the NIC (connect) -* non-USB: HCF_DISCONNECT -* USB: HCF_CONNECT, HCF_DISCONNECT -* -*.RETURNS -* HCF_SUCCESS -* HCF_ERR_INCOMP_PRI -* HCF_ERR_INCOMP_FW -* HCF_ERR_DEFUNCT_CMD_SEQ -*!! HCF_ERR_NO_NIC really returned ;? -* HCF_ERR_NO_NIC -* HCF_ERR_TIME_OUT -* -* MSF-accessible fields of Result Block: -* IFB_IOBase entry parameter io_base -* IFB_IORange HREG_IO_RANGE (0x40/0x80) -* IFB_Version version of the IFB layout -* IFB_FWIdentity CFG_FW_IDENTITY_STRCT, specifies the identity of the -* "running" F/W, i.e. tertiary F/W under normal conditions -* IFB_FWSup CFG_SUP_RANGE_STRCT, specifies the supplier range of -* the "running" F/W, i.e. tertiary F/W under normal conditions -* IFB_HSISup CFG_SUP_RANGE_STRCT, specifies the HW/SW I/F range of the NIC -* IFB_PRIIdentity CFG_PRI_IDENTITY_STRCT, specifies the Identity of the Primary F/W -* IFB_PRISup CFG_SUP_RANGE_STRCT, specifies the supplier range of the Primary F/W -* all other all MSF accessible fields, which are not specified above, are zero-filled -* -*.CONDITIONS -* It is the responsibility of the MSF to assure the correctness of the I/O Base address. -* -* Note: hcf_connect defaults to NIC interrupt disabled mode, i.e. as if hcf_action( HCF_ACT_INT_OFF ) -* was called. -* -*.DESCRIPTION -* hcf_connect passes the MSF-defined location of the IFB to the HCF and grants or revokes access right for the -* HCF to the IFB. Revoking is done by specifying HCF_DISCONNECT rather than an I/O address for the parameter -* io_base. Every call of hcf_connect in "connect" mode, must eventually be followed by a call of hcf_connect -* in "disconnect" mode. Clalling hcf_connect in "connect"/"disconnect" mode can not be nested. -* The IFB address must be used as a handle with all subsequent HCF-function calls and the HCF uses the IFB -* address as a handle when it performs a call(back) of an MSF-function (i.e. msf_assert). -* -* Note that not only the MSF accessible fields are cleared, but also all internal housekeeping -* information is re-initialized. -* This implies that all settings which are done via hcf_action and hcf_put_info (e.g. CFG_MB_ASSERT, CFG_REG_MB, -* CFG_REG_INFO_LOG) must be done again. The only field which is not cleared, is IFB_MSFSup. -* -* If HCF_INT_ON is selected as compile option, NIC interrupts are disabled. -* -* Assert fails if -* - ifbp is not properly aligned ( ref chapter HCF_ALIGN in 4.1.1) -* - I/O Base Address is not a multiple of 0x40 (note: 0x0000 is explicitly allowed). -* -*.DIAGRAM -* -*0: Throughout hcf_connect you need to distinguish the connect from the disconnect case, which requires -* some attention about what to use as "I/O" address when for which purpose. -*2: -*2a: Reset H-II by toggling reset bit in IO-register on and off. -* The HCF_TYPE_PRELOADED caters for the DOS environment where H-II is loaded by a separate program to -* overcome the 64k size limit posed on DOS drivers. -* The macro OPW is not yet useable because the IFB_IOBase field is not set. -* Note 1: hopefully the clearing and initializing of the IFB (see below) acts as a delay which meets the -* specification for S/W reset -* Note 2: it turns out that on some H/W constellations, the clock to access the EEProm is not lowered -* to an appropriate frequency by HREG_IO_SRESET. By giving an HCMD_INI first, this problem is worked around. -*2b: Experimentally it is determined over a wide range of F/W versions that waiting for the for Cmd bit in -* Ev register gives a workable strategy. The available documentation does not give much clues. -*4: clear and initialize the IFB -* The HCF house keeping info is designed such that zero is the appropriate initial value for as much as -* feasible IFB-items. -* The readable fields mentioned in the description section and some HCF specific fields are given their -* actual value. -* IFB_TickIni is initialized at best guess before calibration -* Hcf_connect defaults to "no interrupt generation" (implicitly achieved by the zero-filling). -*6: Register compile-time linked MSF Routine and set default filter level -* cast needed to get around the "near" problem in DOS COM model -* er C2446: no conversion from void (__near __cdecl *)(unsigned char __far *,unsigned int,unsigned short,int) -* to void (__far __cdecl *)(unsigned char __far *,unsigned int,unsigned short,int) -*8: If a command is apparently still active (as indicated by the Busy bit in Cmd register) this may indicate a -* blocked cmd pipe line. To unblock the following actions are done: -* - Ack everything -* - Wait for Busy bit drop in Cmd register -* - Wait for Cmd bit raise in Ev register -* The two waits are combined in a single HCF_WAIT_WHILE to optimize memory size. If either of these waits -* fail (prot_cnt becomes 0), then something is serious wrong. Rather than PANICK, the assumption is that the -* next cmd_exe will fail, causing the HCF to go into DEFUNCT mode -*10: Ack everything to unblock a (possibly blocked) cmd pipe line -* Note 1: it is very likely that an Alloc event is pending and very well possible that a (Send) Cmd event is -* pending on non-initial calls -* Note 2: it is assumed that this strategy takes away the need to ack every conceivable event after an -* Hermes Initialize -*12: Only H-II NEEDS the Hermes Initialize command. Due to the different semantics for H-I and H-II -* Initialize command, init() does not (and can not, since it is called e.g. after a download) execute the -* Hermes Initialize command. Executing the Hermes Initialize command for H-I would not harm but not do -* anything useful either, so it is skipped. -* The return status of cmd_exe is ignored. It is assumed that if cmd_exe fails, init fails too -*14: use io_base as a flag to merge hcf_connect and hcf_disconnect into 1 routine -* the call to init and its subsequent call of cmd_exe will return HCF_ERR_NO_NIC if appropriate. This status -* is (badly) needed by some legacy combination of NT4 and card services which do not yield an I/O address in -* time. -* -*.NOTICE -* On platforms where the NULL-pointer is not a bit-pattern of all zeros, the zero-filling of the IFB results -* in an incorrect initialization of pointers. -* The implementation of the MailBox manipulation in put_mb_info protects against the absence of a MailBox -* based on IFB_MBSize, IFB_MBWp and ifbp->IFB_MBRp. This has ramifications on the initialization of the -* MailBox via hcf_put_info with the CFG_REG_MB type, but it prevents dependency on the "NULL-"ness of -* IFB_MBp. -* -*.NOTICE -* There are a number of problems when asserting and logging hcf_connect, e.g. -* - Asserting on re-entrancy of hcf_connect by means of -* "HCFASSERT( (ifbp->IFB_AssertTrace & HCF_ASSERT_CONNECT) == 0, 0 )" is not useful because IFB contents -* are undefined -* - Asserting before the IFB is cleared will cause mdd_assert() to interpret the garbage in IFB_AssertRtn -* as a routine address -* Therefore HCFTRACE nor HCFLOGENTRY is called by hcf_connect. -*.ENDDOC END DOCUMENTATION -* -************************************************************************************************************/ +* +*.MODULE int hcf_connect( IFBP ifbp, hcf_io io_base ) +*.PURPOSE Grants access right for the HCF to the IFB. +* Initializes Card and HCF housekeeping. +* +*.ARGUMENTS +* ifbp (near) address of the Interface Block +* io_base non-USB: I/O Base address of the NIC (connect) +* non-USB: HCF_DISCONNECT +* USB: HCF_CONNECT, HCF_DISCONNECT +* +*.RETURNS +* HCF_SUCCESS +* HCF_ERR_INCOMP_PRI +* HCF_ERR_INCOMP_FW +* HCF_ERR_DEFUNCT_CMD_SEQ +*!! HCF_ERR_NO_NIC really returned ;? +* HCF_ERR_NO_NIC +* HCF_ERR_TIME_OUT +* +* MSF-accessible fields of Result Block: +* IFB_IOBase entry parameter io_base +* IFB_IORange HREG_IO_RANGE (0x40/0x80) +* IFB_Version version of the IFB layout +* IFB_FWIdentity CFG_FW_IDENTITY_STRCT, specifies the identity of the +* "running" F/W, i.e. tertiary F/W under normal conditions +* IFB_FWSup CFG_SUP_RANGE_STRCT, specifies the supplier range of +* the "running" F/W, i.e. tertiary F/W under normal conditions +* IFB_HSISup CFG_SUP_RANGE_STRCT, specifies the HW/SW I/F range of the NIC +* IFB_PRIIdentity CFG_PRI_IDENTITY_STRCT, specifies the Identity of the Primary F/W +* IFB_PRISup CFG_SUP_RANGE_STRCT, specifies the supplier range of the Primary F/W +* all other all MSF accessible fields, which are not specified above, are zero-filled +* +*.CONDITIONS +* It is the responsibility of the MSF to assure the correctness of the I/O Base address. +* +* Note: hcf_connect defaults to NIC interrupt disabled mode, i.e. as if hcf_action( HCF_ACT_INT_OFF ) +* was called. +* +*.DESCRIPTION +* hcf_connect passes the MSF-defined location of the IFB to the HCF and grants or revokes access right for the +* HCF to the IFB. Revoking is done by specifying HCF_DISCONNECT rather than an I/O address for the parameter +* io_base. Every call of hcf_connect in "connect" mode, must eventually be followed by a call of hcf_connect +* in "disconnect" mode. Clalling hcf_connect in "connect"/"disconnect" mode can not be nested. +* The IFB address must be used as a handle with all subsequent HCF-function calls and the HCF uses the IFB +* address as a handle when it performs a call(back) of an MSF-function (i.e. msf_assert). +* +* Note that not only the MSF accessible fields are cleared, but also all internal housekeeping +* information is re-initialized. +* This implies that all settings which are done via hcf_action and hcf_put_info (e.g. CFG_MB_ASSERT, CFG_REG_MB, +* CFG_REG_INFO_LOG) must be done again. The only field which is not cleared, is IFB_MSFSup. +* +* If HCF_INT_ON is selected as compile option, NIC interrupts are disabled. +* +* Assert fails if +* - ifbp is not properly aligned ( ref chapter HCF_ALIGN in 4.1.1) +* - I/O Base Address is not a multiple of 0x40 (note: 0x0000 is explicitly allowed). +* +*.DIAGRAM +* +*0: Throughout hcf_connect you need to distinguish the connect from the disconnect case, which requires +* some attention about what to use as "I/O" address when for which purpose. +*2: +*2a: Reset H-II by toggling reset bit in IO-register on and off. +* The HCF_TYPE_PRELOADED caters for the DOS environment where H-II is loaded by a separate program to +* overcome the 64k size limit posed on DOS drivers. +* The macro OPW is not yet useable because the IFB_IOBase field is not set. +* Note 1: hopefully the clearing and initializing of the IFB (see below) acts as a delay which meets the +* specification for S/W reset +* Note 2: it turns out that on some H/W constellations, the clock to access the EEProm is not lowered +* to an appropriate frequency by HREG_IO_SRESET. By giving an HCMD_INI first, this problem is worked around. +*2b: Experimentally it is determined over a wide range of F/W versions that waiting for the for Cmd bit in +* Ev register gives a workable strategy. The available documentation does not give much clues. +*4: clear and initialize the IFB +* The HCF house keeping info is designed such that zero is the appropriate initial value for as much as +* feasible IFB-items. +* The readable fields mentioned in the description section and some HCF specific fields are given their +* actual value. +* IFB_TickIni is initialized at best guess before calibration +* Hcf_connect defaults to "no interrupt generation" (implicitly achieved by the zero-filling). +*6: Register compile-time linked MSF Routine and set default filter level +* cast needed to get around the "near" problem in DOS COM model +* er C2446: no conversion from void (__near __cdecl *)(unsigned char __far *,unsigned int,unsigned short,int) +* to void (__far __cdecl *)(unsigned char __far *,unsigned int,unsigned short,int) +*8: If a command is apparently still active (as indicated by the Busy bit in Cmd register) this may indicate a +* blocked cmd pipe line. To unblock the following actions are done: +* - Ack everything +* - Wait for Busy bit drop in Cmd register +* - Wait for Cmd bit raise in Ev register +* The two waits are combined in a single HCF_WAIT_WHILE to optimize memory size. If either of these waits +* fail (prot_cnt becomes 0), then something is serious wrong. Rather than PANICK, the assumption is that the +* next cmd_exe will fail, causing the HCF to go into DEFUNCT mode +*10: Ack everything to unblock a (possibly blocked) cmd pipe line +* Note 1: it is very likely that an Alloc event is pending and very well possible that a (Send) Cmd event is +* pending on non-initial calls +* Note 2: it is assumed that this strategy takes away the need to ack every conceivable event after an +* Hermes Initialize +*12: Only H-II NEEDS the Hermes Initialize command. Due to the different semantics for H-I and H-II +* Initialize command, init() does not (and can not, since it is called e.g. after a download) execute the +* Hermes Initialize command. Executing the Hermes Initialize command for H-I would not harm but not do +* anything useful either, so it is skipped. +* The return status of cmd_exe is ignored. It is assumed that if cmd_exe fails, init fails too +*14: use io_base as a flag to merge hcf_connect and hcf_disconnect into 1 routine +* the call to init and its subsequent call of cmd_exe will return HCF_ERR_NO_NIC if appropriate. This status +* is (badly) needed by some legacy combination of NT4 and card services which do not yield an I/O address in +* time. +* +*.NOTICE +* On platforms where the NULL-pointer is not a bit-pattern of all zeros, the zero-filling of the IFB results +* in an incorrect initialization of pointers. +* The implementation of the MailBox manipulation in put_mb_info protects against the absence of a MailBox +* based on IFB_MBSize, IFB_MBWp and ifbp->IFB_MBRp. This has ramifications on the initialization of the +* MailBox via hcf_put_info with the CFG_REG_MB type, but it prevents dependency on the "NULL-"ness of +* IFB_MBp. +* +*.NOTICE +* There are a number of problems when asserting and logging hcf_connect, e.g. +* - Asserting on re-entrancy of hcf_connect by means of +* "HCFASSERT( (ifbp->IFB_AssertTrace & HCF_ASSERT_CONNECT) == 0, 0 )" is not useful because IFB contents +* are undefined +* - Asserting before the IFB is cleared will cause mdd_assert() to interpret the garbage in IFB_AssertRtn +* as a routine address +* Therefore HCFTRACE nor HCFLOGENTRY is called by hcf_connect. +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ int hcf_connect (IFBP ifbp,hcf_io io_base ) { -int rc =HCF_SUCCESS ; -hcf_io io_addr; -hcf_32 prot_cnt; -hcf_8 *q; -LTV_STRCT x; +int rc =HCF_SUCCESS ; +hcf_io io_addr; +hcf_32 prot_cnt; +hcf_8 *q; +LTV_STRCT x;#if HCF_ASSERT hcf_16 xa = ifbp->IFB_FWIdentity.typ;/* is assumed to cause an assert later on if hcf_connect is called without intervening hcf_disconnect.
@@ -1163,51 +1162,51 @@ LTV_STRCT x;*/ #endif // HCF_ASSERT -if ( io_base ==HCF_DISCONNECT ) {//disconnect +if ( io_base ==HCF_DISCONNECT ) {//disconnect io_addr = ifbp->IFB_IOBase; -OPW (HREG_INT_EN ,0 );//;?workaround against dying F/W on subsequent hcf_connect calls - }else {//connect /* 0 */ +OPW (HREG_INT_EN ,0 );//;?workaround against dying F/W on subsequent hcf_connect calls + }else {//connect /* 0 */ io_addr = io_base; }#if 0 //;? if a subsequent hcf_connect is preceded by an hcf_disconnect the wakeup is not needed !! #if HCF_SLEEP - OUT_PORT_WORD( .....+HREG_IO, HREG_IO_WAKEUP_ASYNC ); //OPW not yet useable -MSF_WAIT (800 );// MSF-defined function to wait n microseconds. + OUT_PORT_WORD( .....+HREG_IO, HREG_IO_WAKEUP_ASYNC ); //OPW not yet useable +MSF_WAIT (800 );// MSF-defined function to wait n microseconds. note that MSF_WAIT uses not yet defined!!!! IFB_IOBase and IFB_TickIni (via PROT_CNT_INI) so be careful if this code is restored#endif // HCF_SLEEP #endif // 0 -#if ( (HCF_TYPE ) &HCF_TYPE_PRELOADED ) ==0 //switch clock back for SEEPROM access !!! -OUT_PORT_WORD ( io_addr +HREG_CMD ,HCMD_INI );//OPW not yet useable +#if ( (HCF_TYPE ) &HCF_TYPE_PRELOADED ) ==0 //switch clock back for SEEPROM access !!! +OUT_PORT_WORD ( io_addr +HREG_CMD ,HCMD_INI );//OPW not yet useable prot_cnt =INI_TICK_INI ;HCF_WAIT_WHILE ( (IN_PORT_WORD ( io_addr +HREG_EV_STAT ) &HREG_EV_CMD ) ==0 ); -OUT_PORT_WORD ( (io_addr +HREG_IO ),HREG_IO_SRESET );//OPW not yet useable /* 2a*/ +OUT_PORT_WORD ( (io_addr +HREG_IO ),HREG_IO_SRESET );//OPW not yet useable /* 2a*/ #endif // HCF_TYPE_PRELOADED -for ( q = (hcf_8 *)(&ifbp->IFB_Magic); q > (hcf_8 *)ifbp; *--q =0 )/*NOP*/ ;/* 4 */ - ifbp->IFB_Magic =HCF_MAGIC ; - ifbp->IFB_Version =IFB_VERSION ; +for ( q = (hcf_8 *)(&ifbp->IFB_Magic); q > (hcf_8 *)ifbp; *--q =0 )/*NOP*/ ;/* 4 */ + ifbp->IFB_Magic =HCF_MAGIC ; + ifbp->IFB_Version =IFB_VERSION ;#if definedMSF_COMPONENT_ID //a new IFB demonstrates how dirty the solution is - xxxx[xxxx_PRI_IDENTITY_OFFSET] =NULL ;//IFB_PRIIdentity placeholder 0xFD02 - xxxx[xxxx_PRI_IDENTITY_OFFSET+1 ] =NULL ;//IFB_PRISup placeholder 0xFD03 + xxxx[xxxx_PRI_IDENTITY_OFFSET] =NULL ;//IFB_PRIIdentity placeholder 0xFD02 + xxxx[xxxx_PRI_IDENTITY_OFFSET+1 ] =NULL ;//IFB_PRISup placeholder 0xFD03 #endif // MSF_COMPONENT_ID #if (HCF_TALLIES ) & (HCF_TALLIES_NIC |HCF_TALLIES_HCF ) - ifbp->IFB_TallyLen =1 +2 * (HCF_NIC_TAL_CNT +HCF_HCF_TAL_CNT );//convert # of Tallies to L value for LTV - ifbp->IFB_TallyTyp =CFG_TALLIES ;//IFB_TallyTyp: set T value + ifbp->IFB_TallyLen =1 +2 * (HCF_NIC_TAL_CNT +HCF_HCF_TAL_CNT );//convert # of Tallies to L value for LTV + ifbp->IFB_TallyTyp =CFG_TALLIES ;//IFB_TallyTyp: set T value #endif // HCF_TALLIES_NIC / HCF_TALLIES_HCF - ifbp->IFB_IOBase = io_addr;//set IO_Base asap, so asserts via HREG_SW_2 don't harm - ifbp->IFB_IORange =HREG_IO_RANGE ; - ifbp->IFB_CntlOpt =USE_16BIT ; + ifbp->IFB_IOBase = io_addr;//set IO_Base asap, so asserts via HREG_SW_2 don't harm + ifbp->IFB_IORange =HREG_IO_RANGE ; + ifbp->IFB_CntlOpt =USE_16BIT ;#if HCF_ASSERT assert_ifbp = ifbp; ifbp->IFB_AssertLvl =1 ;#if (HCF_ASSERT ) &HCF_ASSERT_LNK_MSF_RTN if ( io_base !=HCF_DISCONNECT ) { - ifbp->IFB_AssertRtn = (MSF_ASSERT_RTNP )msf_assert;/* 6 */ + ifbp->IFB_AssertRtn = (MSF_ASSERT_RTNP )msf_assert;/* 6 */ }#endif // HCF_ASSERT_LNK_MSF_RTN -#if (HCF_ASSERT ) &HCF_ASSERT_MB //build the structure to pass the assert info to hcf_put_info +#if (HCF_ASSERT ) &HCF_ASSERT_MB //build the structure to pass the assert info to hcf_put_info ifbp->IFB_AssertStrct.len =sizeof (ifbp->IFB_AssertStrct)/sizeof (hcf_16) -1 ; ifbp->IFB_AssertStrct.typ =CFG_MB_INFO ; ifbp->IFB_AssertStrct.base_typ =CFG_MB_ASSERT ;
@@ -1220,31 +1219,31 @@ LTV_STRCT x;IF_PROT_TIME ( prot_cnt = ifbp->IFB_TickIni =INI_TICK_INI );#if ( (HCF_TYPE ) &HCF_TYPE_PRELOADED ) ==0 //!! No asserts before Reset-bit in HREG_IO is cleared -OPW (HREG_IO ,0x0000 );//OPW useable /* 2b*/ +OPW (HREG_IO ,0x0000 );//OPW useable /* 2b*/ HCF_WAIT_WHILE ( (IPW (HREG_EV_STAT ) &HREG_EV_CMD ) ==0 );IF_PROT_TIME (HCFASSERT ( prot_cnt,IPW (HREG_EV_STAT ) ) ); IF_PROT_TIME( if ( prot_cnt ) prot_cnt = ifbp->IFB_TickIni );#endif // HCF_TYPE_PRELOADED //!! No asserts before Reset-bit in HREG_IO is cleared -HCFASSERT (DO_ASSERT ,MERGE_2 (HCF_ASSERT ,0xCAF0 ) );//just to proof that the complete assert machinery is working -HCFASSERT ( xa !=CFG_FW_IDENTITY ,0 );// assert if hcf_connect is called without intervening hcf_disconnect. +HCFASSERT (DO_ASSERT ,MERGE_2 (HCF_ASSERT ,0xCAF0 ) );//just to proof that the complete assert machinery is working +HCFASSERT ( xa !=CFG_FW_IDENTITY ,0 );// assert if hcf_connect is called without intervening hcf_disconnect. HCFASSERT ( ((hcf_32 )(void *)ifbp & (HCF_ALIGN -1 ) ) ==0 , (hcf_32 )(void *)ifbp );HCFASSERT ( (io_addr &0x003F ) ==0 , io_addr ); -//if Busy bit in Cmd register -if (IPW (HREG_CMD ) &HCMD_BUSY ) {/* 8 */ -//. Ack all to unblock a (possibly) blocked cmd pipe line +//if Busy bit in Cmd register +if (IPW (HREG_CMD ) &HCMD_BUSY ) {/* 8 */ +//. Ack all to unblock a (possibly) blocked cmd pipe line OPW (HREG_EV_ACK , ~HREG_EV_SLEEP_REQ ); -//. Wait for Busy bit drop in Cmd register -//. Wait for Cmd bit raise in Ev register +//. Wait for Busy bit drop in Cmd register +//. Wait for Cmd bit raise in Ev register HCF_WAIT_WHILE ( (IPW (HREG_CMD ) &HCMD_BUSY ) && (IPW (HREG_EV_STAT ) &HREG_EV_CMD ) ==0 );IF_PROT_TIME (HCFASSERT ( prot_cnt,IPW (HREG_EV_STAT ) ) );/* if prot_cnt == 0, cmd_exe will fail, causing DEFUNCT */ }OPW (HREG_EV_ACK , ~HREG_EV_SLEEP_REQ ); -#if ( (HCF_TYPE ) &HCF_TYPE_PRELOADED ) ==0 /*12*/ +#if ( (HCF_TYPE ) &HCF_TYPE_PRELOADED ) ==0 /*12*/ (void )cmd_exe ( ifbp,HCMD_INI ,0 );#endif // HCF_TYPE_PRELOADED -if ( io_base !=HCF_DISCONNECT ) { - rc =init ( ifbp );/*14*/ +if ( io_base !=HCF_DISCONNECT ) { + rc =init ( ifbp );/*14*/ if ( rc ==HCF_SUCCESS ) { x.len =2 ; x.typ =CFG_NIC_BUS_TYPE ;
@@ -1253,10 +1252,10 @@ if ( io_base != HCF_DISCONNECT ) {//CFG_NIC_BUS_TYPE not supported -> default 32 bits/DMA, MSF has to overrule via CFG_CNTL_OPT if ( x.len ==0 || x.val[0 ] ==0x0002 || x.val[0 ] ==0x0003 ) {#if (HCF_IO ) &HCF_IO_32BITS - ifbp->IFB_CntlOpt &= ~USE_16BIT ;//reset USE_16BIT + ifbp->IFB_CntlOpt &= ~USE_16BIT ;//reset USE_16BIT #endif // HCF_IO_32BITS #if HCF_DMA - ifbp->IFB_CntlOpt |=USE_DMA ;//SET DMA + ifbp->IFB_CntlOpt |=USE_DMA ;//SET DMA #else ifbp->IFB_IORange =0x40 /*i.s.o. HREG_IO_RANGE*/ ;#endif // HCF_DMA
@@ -1264,147 +1263,147 @@ if ( io_base != HCF_DISCONNECT ) { } }else HCFASSERT ( ( ifbp->IFB_Magic ^=HCF_MAGIC ) ==0 , ifbp->IFB_Magic )/*NOP*/ ;/* of above HCFASSERT only the side effect is needed, NOP in case HCFASSERT is dummy */ - ifbp->IFB_IOBase = io_base;/* 0*/ + ifbp->IFB_IOBase = io_base;/* 0*/ return rc; }// hcf_connect #if HCF_DMA /************************************************************************************************************ -* Function get_frame_lst -* - resolve the "last host-owned descriptor" problems when a descriptor list is reclaimed by the MSF. -* -* The FrameList to be reclaimed as well as the DescriptorList always start in IFB_FirstDesc[tx_rx_flag] -* and this is always the "current" DELWA Descriptor. -* -* If a FrameList is available, the last descriptor of the FrameList to turned into a new DELWA Descriptor: -* - a copy is made from the information in the last descriptor of the FrameList into the current -* DELWA Descriptor -* - the remainder of the DescriptorList is detached from the copy by setting the next_desc_addr at NULL -* - the DMA control bits of the copy are cleared to do not confuse the MSF -* - the copy of the last descriptor (i.e. the "old" DELWA Descriptor) is chained to the prev Descriptor -* of the FrameList, thus replacing the original last Descriptor of the FrameList. -* - IFB_FirstDesc is changed to the address of that replaced (original) last descriptor of the FrameList, -* i.e. the "new" DELWA Descriptor. -* -* This function makes a copy of that last host-owned descriptor, so the MSF will get a copy of the descriptor. -* On top of that, it adjusts DMA related fields in the IFB structure. -// perform a copying-scheme to circumvent the 'last host owned descriptor cannot be reclaimed' limitation imposed by H2.5's DMA hardware design -// a 'reclaim descriptor' should be available in the HCF: -* -* Returns: address of the first descriptor of the FrameList -* +* Function get_frame_lst +* - resolve the "last host-owned descriptor" problems when a descriptor list is reclaimed by the MSF. +* +* The FrameList to be reclaimed as well as the DescriptorList always start in IFB_FirstDesc[tx_rx_flag] +* and this is always the "current" DELWA Descriptor. +* +* If a FrameList is available, the last descriptor of the FrameList to turned into a new DELWA Descriptor: +* - a copy is made from the information in the last descriptor of the FrameList into the current +* DELWA Descriptor +* - the remainder of the DescriptorList is detached from the copy by setting the next_desc_addr at NULL +* - the DMA control bits of the copy are cleared to do not confuse the MSF +* - the copy of the last descriptor (i.e. the "old" DELWA Descriptor) is chained to the prev Descriptor +* of the FrameList, thus replacing the original last Descriptor of the FrameList. +* - IFB_FirstDesc is changed to the address of that replaced (original) last descriptor of the FrameList, +* i.e. the "new" DELWA Descriptor. +* +* This function makes a copy of that last host-owned descriptor, so the MSF will get a copy of the descriptor. +* On top of that, it adjusts DMA related fields in the IFB structure. +// perform a copying-scheme to circumvent the 'last host owned descriptor cannot be reclaimed' limitation imposed by H2.5's DMA hardware design +// a 'reclaim descriptor' should be available in the HCF: +* +* Returns: address of the first descriptor of the FrameList +* 8: Be careful once you start re-ordering the steps in the copy process, that it still works for cases -* of FrameLists of 1, 2 and more than 2 descriptors -* -* Input parameters: -* tx_rx_flag : specifies 'transmit' or 'receive' descriptor. -* -************************************************************************************************************/ +* of FrameLists of 1, 2 and more than 2 descriptors +* +* Input parameters: +* tx_rx_flag : specifies 'transmit' or 'receive' descriptor. +* +************************************************************************************************************/ HCF_STATIC DESC_STRCT*get_frame_lst (IFBP ifbp,int tx_rx_flag ) { -DESC_STRCT *head = ifbp->IFB_FirstDesc[tx_rx_flag]; -DESC_STRCT *copy, *p, *prev; +DESC_STRCT *head = ifbp->IFB_FirstDesc[tx_rx_flag]; +DESC_STRCT *copy, *p, *prev;HCFASSERT ( tx_rx_flag ==DMA_RX || tx_rx_flag ==DMA_TX , tx_rx_flag ); -//if FrameList +//if FrameList if ( head ) { -//. search for last descriptor of first FrameList +//. search for last descriptor of first FrameList p = prev = head;while ( ( p->BUF_SIZE &DESC_EOP ) ==0 && p->next_desc_addr ) { -if ( ( ifbp->IFB_CntlOpt &DMA_ENABLED ) ==0 ) {//clear control bits when disabled +if ( ( ifbp->IFB_CntlOpt &DMA_ENABLED ) ==0 ) {//clear control bits when disabled p->BUF_CNT &=DESC_CNT_MASK ; } prev = p; p = p->next_desc_addr; } -//. if DMA enabled +//. if DMA enabled if ( ifbp->IFB_CntlOpt &DMA_ENABLED ) { -//. . if last descriptor of FrameList is DMA owned -//. . or if FrameList is single (DELWA) Descriptor +//. . if last descriptor of FrameList is DMA owned +//. . or if FrameList is single (DELWA) Descriptor if ( p->BUF_CNT &DESC_DMA_OWNED || head->next_desc_addr ==NULL ) { -//. . . refuse to return FrameList to caller +//. . . refuse to return FrameList to caller head =NULL ; } } } -//if returnable FrameList found +//if returnable FrameList found if ( head ) { -//. if FrameList is single (DELWA) Descriptor (implies DMA disabled) -if ( head->next_desc_addr ==NULL ) { -//. . clear DescriptorList +//. if FrameList is single (DELWA) Descriptor (implies DMA disabled) +if ( head->next_desc_addr ==NULL ) { +//. . clear DescriptorList /*;?ifbp->IFB_LastDesc[tx_rx_flag] =*/ ifbp->IFB_FirstDesc[tx_rx_flag] =NULL ; -//. else +//. else }else { -//. . strip hardware-related bits from last descriptor -//. . remove DELWA Descriptor from head of DescriptorList +//. . strip hardware-related bits from last descriptor +//. . remove DELWA Descriptor from head of DescriptorList copy = head; - head = head->next_desc_addr; -//. . exchange first (Confined) and last (possibly imprisoned) Descriptor + head = head->next_desc_addr; +//. . exchange first (Confined) and last (possibly imprisoned) Descriptor copy->buf_phys_addr = p->buf_phys_addr; copy->buf_addr = p->buf_addr; - copy->BUF_SIZE = p->BUF_SIZE &=DESC_CNT_MASK ;//get rid of DESC_EOP and possibly DESC_SOP - copy->BUF_CNT = p->BUF_CNT &=DESC_CNT_MASK ;//get rid of DESC_DMA_OWNED + copy->BUF_SIZE = p->BUF_SIZE &=DESC_CNT_MASK ;//get rid of DESC_EOP and possibly DESC_SOP + copy->BUF_CNT = p->BUF_CNT &=DESC_CNT_MASK ;//get rid of DESC_DMA_OWNED #if (HCF_EXT ) &HCF_DESC_STRCT_EXT copy->DESC_MSFSup = p->DESC_MSFSup;#endif // HCF_DESC_STRCT_EXT -//. . turn into a DELWA Descriptor +//. . turn into a DELWA Descriptor p->buf_addr =NULL ; -//. . chain copy to prev /* 8*/ +//. . chain copy to prev /* 8*/ prev->next_desc_addr = copy; -//. . detach remainder of the DescriptorList from FrameList +//. . detach remainder of the DescriptorList from FrameList copy->next_desc_addr =NULL ; copy->next_desc_phys_addr =0xDEAD0000 ;//! just to be nice, not really needed -//. . save the new start (i.e. DELWA Descriptor) in IFB_FirstDesc +//. . save the new start (i.e. DELWA Descriptor) in IFB_FirstDesc ifbp->IFB_FirstDesc[tx_rx_flag] = p; } -//. strip DESC_SOP from first descriptor +//. strip DESC_SOP from first descriptor head->BUF_SIZE &=DESC_CNT_MASK ;//head->BUF_CNT &= DESC_CNT_MASK; get rid of DESC_DMA_OWNED head->next_desc_phys_addr =0xDEAD0000 ;//! just to be nice, not really needed } -//return the just detached FrameList (if any) +//return the just detached FrameList (if any) return head; }// get_frame_lst /************************************************************************************************************ -* Function put_frame_lst -* -* This function -* -* Returns: address of the first descriptor of the FrameList -* -* Input parameters: -* tx_rx_flag : specifies 'transmit' or 'receive' descriptor. -* -* The following list should be kept in sync with hcf_dma_tx/rx_put, in order to get them in the WCI-spec !!!! -* Assert fails if -* - DMA is not enabled -* - descriptor list is NULL -* - a descriptor in the descriptor list is not double word aligned -* - a count of size field of a descriptor contains control bits, i.e. bits in the high order nibble. -* - the DELWA descriptor is not a "singleton" DescriptorList. -* - the DELWA descriptor is not the first Descriptor supplied -* - a non_DMA descriptor is supplied before the DELWA Descriptor is supplied -* - Possibly more checks could be added !!!!!!!!!!!!! - -*.NOTICE -* The asserts marked with *sc* are really sanity checks for the HCF, they can (supposedly) not be influenced -* by incorrect MSF behavior - -// The MSF is required to supply the HCF with a single descriptor for MSF tx reclaim purposes. -// This 'reclaim descriptor' can be recognized by the fact that its buf_addr field is zero. -********************************************************************************************* -* Although not required from a hardware perspective: -* - make each descriptor in this rx-chain DMA-owned. -* - Also set the count to zero. EOP and SOP bits are also cleared. -*********************************************************************************************/ +* Function put_frame_lst +* +* This function +* +* Returns: address of the first descriptor of the FrameList +* +* Input parameters: +* tx_rx_flag : specifies 'transmit' or 'receive' descriptor. +* +* The following list should be kept in sync with hcf_dma_tx/rx_put, in order to get them in the WCI-spec !!!! +* Assert fails if +* - DMA is not enabled +* - descriptor list is NULL +* - a descriptor in the descriptor list is not double word aligned +* - a count of size field of a descriptor contains control bits, i.e. bits in the high order nibble. +* - the DELWA descriptor is not a "singleton" DescriptorList. +* - the DELWA descriptor is not the first Descriptor supplied +* - a non_DMA descriptor is supplied before the DELWA Descriptor is supplied +* - Possibly more checks could be added !!!!!!!!!!!!! + +*.NOTICE +* The asserts marked with *sc* are really sanity checks for the HCF, they can (supposedly) not be influenced +* by incorrect MSF behavior + +// The MSF is required to supply the HCF with a single descriptor for MSF tx reclaim purposes. +// This 'reclaim descriptor' can be recognized by the fact that its buf_addr field is zero. +********************************************************************************************* +* Although not required from a hardware perspective: +* - make each descriptor in this rx-chain DMA-owned. +* - Also set the count to zero. EOP and SOP bits are also cleared. +*********************************************************************************************/ HCF_STATIC voidput_frame_lst (IFBP ifbp,DESC_STRCT *descp,int tx_rx_flag ) { -DESC_STRCT *p = descp; +DESC_STRCT *p = descp;hcf_16 port;HCFASSERT ( ifbp->IFB_CntlOpt &USE_DMA , ifbp->IFB_CntlOpt);//only hcf_dma_tx_put must also be DMA_ENABLED
@@ -1415,37 +1414,37 @@ put_frame_lst( IFBP ifbp, DESC_STRCT *descp, int tx_rx_flag )HCFASSERT ( ((hcf_32 )p &3 ) ==0 , (hcf_32 )p );HCFASSERT ( (p->BUF_CNT & ~DESC_CNT_MASK ) ==0 , p->BUF_CNT );HCFASSERT ( (p->BUF_SIZE & ~DESC_CNT_MASK ) ==0 , p->BUF_SIZE ); - p->BUF_SIZE &=DESC_CNT_MASK ;//!!this SHOULD be superfluous in case of correct MSF - p->BUF_CNT &= tx_rx_flag ==DMA_RX ?0 :DESC_CNT_MASK ;//!!this SHOULD be superfluous in case of correct MSF + p->BUF_SIZE &=DESC_CNT_MASK ;//!!this SHOULD be superfluous in case of correct MSF + p->BUF_CNT &= tx_rx_flag ==DMA_RX ?0 :DESC_CNT_MASK ;//!!this SHOULD be superfluous in case of correct MSF p->BUF_CNT |=DESC_DMA_OWNED ;if ( p->next_desc_addr ) {// HCFASSERT( p->buf_addr && p->buf_phys_addr && p->BUF_SIZE && +/- p->BUF_SIZE, ... ); HCFASSERT ( p->next_desc_addr->desc_phys_addr, (hcf_32 )p->next_desc_addr ); p->next_desc_phys_addr = p->next_desc_addr->desc_phys_addr; - }else {// + }else {// p->next_desc_phys_addr =0 ; -if ( p->buf_addr ==NULL ) {// DELWA Descriptor -HCFASSERT ( descp == p, (hcf_32 )descp );//singleton DescriptorList +if ( p->buf_addr ==NULL ) {// DELWA Descriptor +HCFASSERT ( descp == p, (hcf_32 )descp );//singleton DescriptorList HCFASSERT ( ifbp->IFB_FirstDesc[tx_rx_flag] ==NULL , (hcf_32 )ifbp->IFB_FirstDesc[tx_rx_flag]);HCFASSERT ( ifbp->IFB_LastDesc[tx_rx_flag] ==NULL , (hcf_32 )ifbp->IFB_LastDesc[tx_rx_flag]); descp->BUF_CNT =0 ;//&= ~DESC_DMA_OWNED; ifbp->IFB_FirstDesc[tx_rx_flag] = descp;// part of alternative ifbp->IFB_LastDesc[tx_rx_flag] = ifbp->IFB_FirstDesc[tx_rx_flag] = descp; -// if "recycling" a FrameList -// (e.g. called from hcf_cntl( HCF_CNTL_ENABLE ) -// . prepare for activation DMA controller +// if "recycling" a FrameList +// (e.g. called from hcf_cntl( HCF_CNTL_ENABLE ) +// . prepare for activation DMA controller // part of alternative descp = descp->next_desc_addr; - }else {//a "real" FrameList, hand it over to the DMA engine + }else {//a "real" FrameList, hand it over to the DMA engine HCFASSERT ( ifbp->IFB_FirstDesc[tx_rx_flag], (hcf_32 )descp );HCFASSERT ( ifbp->IFB_LastDesc[tx_rx_flag], (hcf_32 )descp );HCFASSERT ( ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr ==NULL , - (hcf_32 )ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr); + (hcf_32 )ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr);// p->buf_cntl.cntl_stat |= DESC_DMA_OWNED; ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_addr = descp; ifbp->IFB_LastDesc[tx_rx_flag]->next_desc_phys_addr = descp->desc_phys_addr; port =HREG_RXDMA_PTR32 ;if ( tx_rx_flag ) { - p->BUF_SIZE |=DESC_EOP ;// p points at the last descriptor in the caller-supplied descriptor chain + p->BUF_SIZE |=DESC_EOP ;// p points at the last descriptor in the caller-supplied descriptor chain descp->BUF_SIZE |=DESC_SOP ; port =HREG_TXDMA_PTR32 ; }
@@ -1459,87 +1458,87 @@ put_frame_lst( IFBP ifbp, DESC_STRCT *descp, int tx_rx_flag )/************************************************************************************************************ -* -*.MODULE DESC_STRCT* hcf_dma_rx_get( IFBP ifbp ) -*.PURPOSE decapsulate a message and provides that message to the MSF. -* reclaim all descriptors in the rx descriptor chain. -* -*.ARGUMENTS -* ifbp address of the Interface Block -* -*.RETURNS -* pointer to a FrameList -* -*.DESCRIPTION -* hcf_dma_rx_get is intended to return a received frame when such a frame is deposited in Host memory by the -* DMA engine. In addition hcf_dma_rx_get can be used to reclaim all descriptors in the rx descriptor chain -* when the DMA Engine is disabled, e.g. as part of a driver unloading strategy. -* hcf_dma_rx_get must be called repeatedly by the MSF when hcf_service_nic signals availability of a rx frame -* through the HREG_EV_RDMAD flag of IFB_DmaPackets. The calling must stop when a NULL pointer is returned, at -* which time the HREG_EV_RDMAD flag is also cleared by the HCF to arm the mechanism for the next frame -* reception. -* Regardless whether the DMA Engine is currently enabled (as controlled via hcf_cntl), if the DMA controller -* deposited an Rx-frame in the Rx-DescriptorList, this frame is detached from the Rx-DescriptorList, -* transformed into a FrameList (i.e. updating the housekeeping fields in the descriptors) and returned to the -* caller. -* If no such Rx-frame is available in the Rx-DescriptorList, the behavior of hcf_dma_rx_get depends on the -* status of the DMA Engine. -* If the DMA Engine is enabled, a NULL pointer is returned. -* If the DMA Engine is disabled, the following strategy is used: -* - the complete Rx-DescriptorList is returned. The DELWA Descriptor is not part of the Rx-DescriptorList. -* - If there is no Rx-DescriptorList, the DELWA Descriptor is returned. -* - If there is no DELWA Descriptor, a NULL pointer is returned. -* -* If the MSF performs an disable/enable sequence without exhausting the Rx-DescriptorList as described above, -* the enable command will reset all house keeping information, i.e. already received but not yet by the MSF -* retrieved frames are lost and the next frame will be received starting with the oldest descriptor. -* -* The HCF can be used in 2 fashions: with and without decapsulation for data transfer. -* This is controlled at compile time by the HCF_ENC bit of the HCF_ENCAP system constant. -* If appropriate, decapsulation is done by moving some data inside the buffers and updating the descriptors -* accordingly. -*!! ;?????where did I describe why a simple manipulation with the count values does not suffice? -* -*.DIAGRAM -* -*.ENDDOC END DOCUMENTATION -* -************************************************************************************************************/ +* +*.MODULE DESC_STRCT* hcf_dma_rx_get( IFBP ifbp ) +*.PURPOSE decapsulate a message and provides that message to the MSF. +* reclaim all descriptors in the rx descriptor chain. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* +*.RETURNS +* pointer to a FrameList +* +*.DESCRIPTION +* hcf_dma_rx_get is intended to return a received frame when such a frame is deposited in Host memory by the +* DMA engine. In addition hcf_dma_rx_get can be used to reclaim all descriptors in the rx descriptor chain +* when the DMA Engine is disabled, e.g. as part of a driver unloading strategy. +* hcf_dma_rx_get must be called repeatedly by the MSF when hcf_service_nic signals availability of a rx frame +* through the HREG_EV_RDMAD flag of IFB_DmaPackets. The calling must stop when a NULL pointer is returned, at +* which time the HREG_EV_RDMAD flag is also cleared by the HCF to arm the mechanism for the next frame +* reception. +* Regardless whether the DMA Engine is currently enabled (as controlled via hcf_cntl), if the DMA controller +* deposited an Rx-frame in the Rx-DescriptorList, this frame is detached from the Rx-DescriptorList, +* transformed into a FrameList (i.e. updating the housekeeping fields in the descriptors) and returned to the +* caller. +* If no such Rx-frame is available in the Rx-DescriptorList, the behavior of hcf_dma_rx_get depends on the +* status of the DMA Engine. +* If the DMA Engine is enabled, a NULL pointer is returned. +* If the DMA Engine is disabled, the following strategy is used: +* - the complete Rx-DescriptorList is returned. The DELWA Descriptor is not part of the Rx-DescriptorList. +* - If there is no Rx-DescriptorList, the DELWA Descriptor is returned. +* - If there is no DELWA Descriptor, a NULL pointer is returned. +* +* If the MSF performs an disable/enable sequence without exhausting the Rx-DescriptorList as described above, +* the enable command will reset all house keeping information, i.e. already received but not yet by the MSF +* retrieved frames are lost and the next frame will be received starting with the oldest descriptor. +* +* The HCF can be used in 2 fashions: with and without decapsulation for data transfer. +* This is controlled at compile time by the HCF_ENC bit of the HCF_ENCAP system constant. +* If appropriate, decapsulation is done by moving some data inside the buffers and updating the descriptors +* accordingly. +*!! ;?????where did I describe why a simple manipulation with the count values does not suffice? +* +*.DIAGRAM +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ DESC_STRCT *hcf_dma_rx_get (IFBP ifbp) { -DESC_STRCT *descp;// pointer to start of FrameList +DESC_STRCT *descp;// pointer to start of FrameList descp =get_frame_lst ( ifbp,DMA_RX );if ( descp && descp->buf_addr )//!be aware of the missing curly bracket - //skip decapsulation at confined descriptor + //skip decapsulation at confined descriptor#if (HCF_ENCAP ) ==HCF_ENC #if (HCF_TYPE ) &HCF_TYPE_CCX - if ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_OFF ) + if ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_OFF )#endif // HCF_TYPE_CCX - { -int i; -DESC_STRCT *p = descp->next_desc_addr;//pointer to 2nd descriptor of frame -HCFASSERT (p,0 ); -// The 2nd descriptor contains (maybe) a SNAP header plus part or whole of the payload. -//determine decapsulation sub-flag in RxFS - i = *(wci_recordp)&descp->buf_addr[HFS_STAT ] & (HFS_STAT_MSG_TYPE |HFS_STAT_ERR ); -if ( i ==HFS_STAT_TUNNEL || - ( i ==HFS_STAT_1042 &&hcf_encap ( (wci_bufp)&p->buf_addr[HCF_DASA_SIZE ] ) !=ENC_TUNNEL )) { -// The 2nd descriptor contains a SNAP header plus part or whole of the payload. -HCFASSERT ( p->BUF_CNT == (p->buf_addr[5 ] + (p->buf_addr[4 ]<<8 ) +2 *6 +2 -8 ), p->BUF_CNT ); -// perform decapsulation -HCFASSERT (p->BUF_SIZE >=8 , p->BUF_SIZE); -// move SA[2:5] in the second buffer to replace part of the SNAP header -for ( i=3 ; i >=0 ; i--) p->buf_addr[i+8 ] = p->buf_addr[i]; -// copy DA[0:5], SA[0:1] from first buffer to second buffer -for ( i=0 ; i<8 ; i++) p->buf_addr[i] = descp->buf_addr[HFS_ADDR_DEST + i]; -// make first buffer shorter in count - descp->BUF_CNT =HFS_ADDR_DEST ; + { +int i; +DESC_STRCT *p = descp->next_desc_addr;//pointer to 2nd descriptor of frame +HCFASSERT (p,0 ); +// The 2nd descriptor contains (maybe) a SNAP header plus part or whole of the payload. +//determine decapsulation sub-flag in RxFS + i = *(wci_recordp)&descp->buf_addr[HFS_STAT ] & (HFS_STAT_MSG_TYPE |HFS_STAT_ERR ); +if ( i ==HFS_STAT_TUNNEL || + ( i ==HFS_STAT_1042 &&hcf_encap ( (wci_bufp)&p->buf_addr[HCF_DASA_SIZE ] ) !=ENC_TUNNEL )) { +// The 2nd descriptor contains a SNAP header plus part or whole of the payload. +HCFASSERT ( p->BUF_CNT == (p->buf_addr[5 ] + (p->buf_addr[4 ]<<8 ) +2 *6 +2 -8 ), p->BUF_CNT ); +// perform decapsulation +HCFASSERT (p->BUF_SIZE >=8 , p->BUF_SIZE); +// move SA[2:5] in the second buffer to replace part of the SNAP header +for ( i=3 ; i >=0 ; i--) p->buf_addr[i+8 ] = p->buf_addr[i]; +// copy DA[0:5], SA[0:1] from first buffer to second buffer +for ( i=0 ; i<8 ; i++) p->buf_addr[i] = descp->buf_addr[HFS_ADDR_DEST + i]; +// make first buffer shorter in count + descp->BUF_CNT =HFS_ADDR_DEST ; + } } - }#endif // HCF_ENC if ( descp ==NULL ) ifbp->IFB_DmaPackets &= (hcf_16 )~HREG_EV_RDMAD ;//;?could be integrated into get_frame_lst HCFLOGEXIT (HCF_TRACE_DMA_RX_GET );
@@ -1548,50 +1547,50 @@ DESC_STRCT *p = descp->next_desc_addr; //pointer to 2nd descriptor of frame/************************************************************************************************************ -* -*.MODULE void hcf_dma_rx_put( IFBP ifbp, DESC_STRCT *descp ) -*.PURPOSE supply buffers for receive purposes. -* supply the Rx-DELWA descriptor. -* -*.ARGUMENTS -* ifbp address of the Interface Block -* descp address of a DescriptorList -* -*.RETURNS N.A. -* -*.DESCRIPTION -* This function is called by the MSF to supply the HCF with new/more buffers for receive purposes. -* The HCF can be used in 2 fashions: with and without encapsulation for data transfer. -* This is controlled at compile time by the HCF_ENC bit of the HCF_ENCAP system constant. -* As a consequence, some additional constraints apply to the number of descriptor and the buffers associated -* with the first 2 descriptors. Independent of the encapsulation feature, the COUNT fields are ignored. -* A special case is the supplying of the DELWA descriptor, which must be supplied as the first descriptor. -* -* Assert fails if -* - ifbp has a recognizable out-of-range value. -* - NIC interrupts are not disabled while required by parameter action. -* - in case decapsulation by the HCF is selected: -* - The first databuffer does not have the exact size corresponding with the RxFS up to the 802.3 DestAddr -* field (== 29 words). -* - The FrameList does not consists of at least 2 Descriptors. -* - The second databuffer does not have the minimum size of 8 bytes. -*!! The 2nd part of the list of asserts should be kept in sync with put_frame_lst, in order to get -*!! them in the WCI-spec !!!! -* - DMA is not enabled -* - descriptor list is NULL -* - a descriptor in the descriptor list is not double word aligned -* - a count of size field of a descriptor contains control bits, i.e. bits in the high order nibble. -* - the DELWA descriptor is not a "singleton" DescriptorList. -* - the DELWA descriptor is not the first Descriptor supplied -* - a non_DMA descriptor is supplied before the DELWA Descriptor is supplied -*!! - Possibly more checks could be added !!!!!!!!!!!!! -* -*.DIAGRAM -* -* -*.ENDDOC END DOCUMENTATION -* -************************************************************************************************************/ +* +*.MODULE void hcf_dma_rx_put( IFBP ifbp, DESC_STRCT *descp ) +*.PURPOSE supply buffers for receive purposes. +* supply the Rx-DELWA descriptor. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* descp address of a DescriptorList +* +*.RETURNS N.A. +* +*.DESCRIPTION +* This function is called by the MSF to supply the HCF with new/more buffers for receive purposes. +* The HCF can be used in 2 fashions: with and without encapsulation for data transfer. +* This is controlled at compile time by the HCF_ENC bit of the HCF_ENCAP system constant. +* As a consequence, some additional constraints apply to the number of descriptor and the buffers associated +* with the first 2 descriptors. Independent of the encapsulation feature, the COUNT fields are ignored. +* A special case is the supplying of the DELWA descriptor, which must be supplied as the first descriptor. +* +* Assert fails if +* - ifbp has a recognizable out-of-range value. +* - NIC interrupts are not disabled while required by parameter action. +* - in case decapsulation by the HCF is selected: +* - The first databuffer does not have the exact size corresponding with the RxFS up to the 802.3 DestAddr +* field (== 29 words). +* - The FrameList does not consists of at least 2 Descriptors. +* - The second databuffer does not have the minimum size of 8 bytes. +*!! The 2nd part of the list of asserts should be kept in sync with put_frame_lst, in order to get +*!! them in the WCI-spec !!!! +* - DMA is not enabled +* - descriptor list is NULL +* - a descriptor in the descriptor list is not double word aligned +* - a count of size field of a descriptor contains control bits, i.e. bits in the high order nibble. +* - the DELWA descriptor is not a "singleton" DescriptorList. +* - the DELWA descriptor is not the first Descriptor supplied +* - a non_DMA descriptor is supplied before the DELWA Descriptor is supplied +*!! - Possibly more checks could be added !!!!!!!!!!!!! +* +*.DIAGRAM +* +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ void hcf_dma_rx_put (IFBP ifbp,DESC_STRCT *descp ) {
@@ -1614,47 +1613,47 @@ hcf_dma_rx_put( IFBP ifbp, DESC_STRCT *descp )/************************************************************************************************************ -* -*.MODULE DESC_STRCT* hcf_dma_tx_get( IFBP ifbp ) -*.PURPOSE DMA mode: reclaims and decapsulates packets in the tx descriptor chain if: -* - A Tx packet has been copied from host-RAM into NIC-RAM by the DMA engine -* - The Hermes/DMAengine have been disabled -* -*.ARGUMENTS -* ifbp address of the Interface Block -* -*.RETURNS -* pointer to a reclaimed Tx packet. -* -*.DESCRIPTION -* impact of the disable command: -* When a non-empty pool of Tx descriptors exists (created by means of hcf_dma_put_tx), the MSF -* is supposed to empty that pool by means of hcf_dma_tx_get calls after the disable in an -* disable/enable sequence. -* -*.DIAGRAM -* -*.NOTICE -* -*.ENDDOC END DOCUMENTATION -* -************************************************************************************************************/ +* +*.MODULE DESC_STRCT* hcf_dma_tx_get( IFBP ifbp ) +*.PURPOSE DMA mode: reclaims and decapsulates packets in the tx descriptor chain if: +* - A Tx packet has been copied from host-RAM into NIC-RAM by the DMA engine +* - The Hermes/DMAengine have been disabled +* +*.ARGUMENTS +* ifbp address of the Interface Block +* +*.RETURNS +* pointer to a reclaimed Tx packet. +* +*.DESCRIPTION +* impact of the disable command: +* When a non-empty pool of Tx descriptors exists (created by means of hcf_dma_put_tx), the MSF +* is supposed to empty that pool by means of hcf_dma_tx_get calls after the disable in an +* disable/enable sequence. +* +*.DIAGRAM +* +*.NOTICE +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ DESC_STRCT *hcf_dma_tx_get (IFBP ifbp ) { -DESC_STRCT *descp;// pointer to start of FrameList +DESC_STRCT *descp;// pointer to start of FrameList descp =get_frame_lst ( ifbp,DMA_TX );if ( descp && descp->buf_addr )//!be aware of the missing curly bracket - //skip decapsulation at confined descriptor + //skip decapsulation at confined descriptor#if (HCF_ENCAP ) ==HCF_ENC if ( ( descp->BUF_CNT ==HFS_TYPE ) #if (HCF_TYPE) & HCF_TYPE_CCX - || ( descp->BUF_CNT ==HFS_DAT ) + || ( descp->BUF_CNT ==HFS_DAT ) #endif // HCF_TYPE_CCX - ) {// perform decapsulation if needed + ) {// perform decapsulation if needed descp->next_desc_addr->buf_phys_addr -=HCF_DASA_SIZE ; - descp->next_desc_addr->BUF_CNT +=HCF_DASA_SIZE ; + descp->next_desc_addr->BUF_CNT +=HCF_DASA_SIZE ; }#endif // HCF_ENC if ( descp ==NULL ) {//;?could be integrated into get_frame_lst
@@ -1666,125 +1665,125 @@ DESC_STRCT *descp; // pointer to start of FrameList/************************************************************************************************************ -* -*.MODULE void hcf_dma_tx_put( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl ) -*.PURPOSE puts a packet in the Tx DMA queue in host ram and kicks off the TxDma engine. -* supply the Tx-DELWA descriptor. -* -*.ARGUMENTS -* ifbp address of the Interface Block -* descp address of Tx Descriptor Chain (i.e. a single Tx frame) -* tx_cntl indicates MAC-port and (Hermes) options -* -*.RETURNS N.A. -* -*.DESCRIPTION -* The HCF can be used in 2 fashions: with and without encapsulation for data transfer. -* This is controlled at compile time by the HCF_ENC bit of the HCF_ENCAP system constant. -* -* Regardless of the HCF_ENCAP system constant, the descriptor list created to describe the frame to be -* transmitted, must supply space to contain the 802.11 header, preceding the actual frame to be transmitted. -* Basically, this only supplies working storage to the HCF which passes this on to the DMA engine. -* As a consequence the contents of this space do not matter. -* Nevertheless BUF_CNT must take in account this storage. -* This working space to contain the 802.11 header may not be fragmented, the first buffer must be -* sufficiently large to contain at least the 802.11 header, i.e. HFS_ADDR_DEST (29 words or 0x3A bytes). -* This way, the HCF can simply, regardless whether or not the HCF encapsulates the frame, write the parameter -* tx_cntl at offset 0x36 (HFS_TX_CNTL) in the first buffer. -* Note that it is allowed to have part or all of the actual frame represented by the first descriptor as long -* as the requirement for storage for the 802.11 header is met, i.e. the 802.3 frame starts at offset -* HFS_ADDR_DEST. -* Except for the Assert on the 1st buffer in case of Encapsualtion, the SIZE fields are ignored. -* -* In case the encapsulation feature is compiled in, there are the following additional requirements. -* o The BUF_CNT of the first buffer changes from a minimum of 0x3A bytes to exactly 0x3A, i.e. the workspace -* to store the 802.11 header -* o The BUF_SIZE of the first buffer is at least the space needed to store the -* - 802.11 header (29 words) -* - 802.3 header, i.e. 12 bytes addressing information and 2 bytes length field -* - 6 bytes SNAP-header -* This results in 39 words or 0x4E bytes or HFS_TYPE. -* Note that if the BUF_SIZE is larger than 0x4E, this surplus is not used. -* o The actual frame begins in the 2nd descriptor (which is already implied by the BUF_CNT == 0x3A requirement) and the associated buffer contains at least the 802.3 header, i.e. the 14 bytes representing addressing information and length/type field -* -* When the HCF does not encapsulates (i.e. length/type field <= 1500), no changes are made to descriptors -* or buffers. -* -* When the HCF actually encapsulates (i.e. length/type field > 1500), it successively writes, starting at -* offset HFS_ADDR_DEST (0x3A) in the first buffer: -* - the 802.3 addressing information, copied from the begin of the second buffer -* - the frame length, derived from the total length of the individual fragments, corrected for the SNAP -* header length and Type field and ignoring the Destination Address, Source Address and Length field -* - the appropriate snap header (Tunnel or 1042, depending on the value of the type field). -* -* The information in the first two descriptors is adjusted accordingly: -* - the first descriptor count is changed from 0x3A to 0x4E (HFS_TYPE), which matches 0x3A + 12 + 2 + 6 -* - the second descriptor count is decreased by 12, being the moved addressing information -* - the second descriptor (physical) buffer address is increased by 12. -* -* When the descriptors are returned by hcf_dma_tx_get, the transformation of the first two descriptors is -* undone. -* -* Under any of the above scenarios, the assert BUF_CNT <= BUF_SIZE must be true for all descriptors -* In case of encapsulation, BUF_SIZE of the 1st descriptor is asserted to be at least HFS_TYPE (0x4E), so it is NOT tested. -* -* Assert fails if -* - ifbp has a recognizable out-of-range value. -* - tx_cntl has a recognizable out-of-range value. -* - NIC interrupts are not disabled while required by parameter action. -* - in case encapsulation by the HCF is selected: -* - The FrameList does not consists of at least 2 Descriptors. -* - The first databuffer does not contain exactly the (space for) the 802.11 header (== 28 words) -* - The first databuffer does not have a size to additionally accommodate the 802.3 header and the -* SNAP header of the frame after encapsulation (== 39 words). -* - The second databuffer does not contain at least DA, SA and 'type/length' (==14 bytes or 7 words) -*!! The 2nd part of the list of asserts should be kept in sync with put_frame_lst, in order to get -*!! them in the WCI-spec !!!! -* - DMA is not enabled -* - descriptor list is NULL -* - a descriptor in the descriptor list is not double word aligned -* - a count of size field of a descriptor contains control bits, i.e. bits in the high order nibble. -* - the DELWA descriptor is not a "singleton" DescriptorList. -* - the DELWA descriptor is not the first Descriptor supplied -* - a non_DMA descriptor is supplied before the DELWA Descriptor is supplied -*!! - Possibly more checks could be added !!!!!!!!!!!!! -*.DIAGRAM -* -*.NOTICE -* -*.ENDDOC END DOCUMENTATION -* -* -*1: Write tx_cntl parameter to HFS_TX_CNTL field into the Hermes-specific header in buffer 1 -*4: determine whether encapsulation is needed and write the type (tunnel or 1042) already at the appropriate -* offset in the 1st buffer -*6: Build the encapsualtion enveloppe in the free space at the end of the 1st buffer -* - Copy DA/SA fields from the 2nd buffer -* - Calculate total length of the message (snap-header + type-field + the length of all buffer fragments -* associated with the 802.3 frame (i.e all descriptors except the first), but not the DestinationAddress, -* SourceAddress and length-field) -* Assert the message length -* Write length. Note that the message is in BE format, hence on LE platforms the length must be converted -* ;? THIS IS NOT WHAT CURRENTLY IS IMPLEMENTED -* - Write snap header. Note that the last byte of the snap header is NOT copied, that byte is already in -* place as result of the call to hcf_encap. -* Note that there are many ways to skin a cat. To express the offsets in the 1st buffer while writing -* the snap header, HFS_TYPE is chosen as a reference point to make it easier to grasp that the snap header -* and encapsualtion type are at least relative in the right. -*8: modify 1st descriptor to reflect moved part of the 802.3 header + Snap-header -* modify 2nd descriptor to skip the moved part of the 802.3 header (DA/SA -*10: set each descriptor to 'DMA owned', clear all other control bits. -* Set SOP bit on first descriptor. Set EOP bit on last descriptor. -*12: Either append the current frame to an existing descriptor list or -*14: create a list beginning with the current frame -*16: remember the new end of the list -*20: hand the frame over to the DMA engine -************************************************************************************************************/ +* +*.MODULE void hcf_dma_tx_put( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl ) +*.PURPOSE puts a packet in the Tx DMA queue in host ram and kicks off the TxDma engine. +* supply the Tx-DELWA descriptor. +* +*.ARGUMENTS +* ifbp address of the Interface Block +* descp address of Tx Descriptor Chain (i.e. a single Tx frame) +* tx_cntl indicates MAC-port and (Hermes) options +* +*.RETURNS N.A. +* +*.DESCRIPTION +* The HCF can be used in 2 fashions: with and without encapsulation for data transfer. +* This is controlled at compile time by the HCF_ENC bit of the HCF_ENCAP system constant. +* +* Regardless of the HCF_ENCAP system constant, the descriptor list created to describe the frame to be +* transmitted, must supply space to contain the 802.11 header, preceding the actual frame to be transmitted. +* Basically, this only supplies working storage to the HCF which passes this on to the DMA engine. +* As a consequence the contents of this space do not matter. +* Nevertheless BUF_CNT must take in account this storage. +* This working space to contain the 802.11 header may not be fragmented, the first buffer must be +* sufficiently large to contain at least the 802.11 header, i.e. HFS_ADDR_DEST (29 words or 0x3A bytes). +* This way, the HCF can simply, regardless whether or not the HCF encapsulates the frame, write the parameter +* tx_cntl at offset 0x36 (HFS_TX_CNTL) in the first buffer. +* Note that it is allowed to have part or all of the actual frame represented by the first descriptor as long +* as the requirement for storage for the 802.11 header is met, i.e. the 802.3 frame starts at offset +* HFS_ADDR_DEST. +* Except for the Assert on the 1st buffer in case of Encapsualtion, the SIZE fields are ignored. +* +* In case the encapsulation feature is compiled in, there are the following additional requirements. +* o The BUF_CNT of the first buffer changes from a minimum of 0x3A bytes to exactly 0x3A, i.e. the workspace +* to store the 802.11 header +* o The BUF_SIZE of the first buffer is at least the space needed to store the +* - 802.11 header (29 words) +* - 802.3 header, i.e. 12 bytes addressing information and 2 bytes length field +* - 6 bytes SNAP-header +* This results in 39 words or 0x4E bytes or HFS_TYPE. +* Note that if the BUF_SIZE is larger than 0x4E, this surplus is not used. +* o The actual frame begins in the 2nd descriptor (which is already implied by the BUF_CNT == 0x3A requirement) and the associated buffer contains at least the 802.3 header, i.e. the 14 bytes representing addressing information and length/type field +* +* When the HCF does not encapsulates (i.e. length/type field <= 1500), no changes are made to descriptors +* or buffers. +* +* When the HCF actually encapsulates (i.e. length/type field > 1500), it successively writes, starting at +* offset HFS_ADDR_DEST (0x3A) in the first buffer: +* - the 802.3 addressing information, copied from the begin of the second buffer +* - the frame length, derived from the total length of the individual fragments, corrected for the SNAP +* header length and Type field and ignoring the Destination Address, Source Address and Length field +* - the appropriate snap header (Tunnel or 1042, depending on the value of the type field). +* +* The information in the first two descriptors is adjusted accordingly: +* - the first descriptor count is changed from 0x3A to 0x4E (HFS_TYPE), which matches 0x3A + 12 + 2 + 6 +* - the second descriptor count is decreased by 12, being the moved addressing information +* - the second descriptor (physical) buffer address is increased by 12. +* +* When the descriptors are returned by hcf_dma_tx_get, the transformation of the first two descriptors is +* undone. +* +* Under any of the above scenarios, the assert BUF_CNT <= BUF_SIZE must be true for all descriptors +* In case of encapsulation, BUF_SIZE of the 1st descriptor is asserted to be at least HFS_TYPE (0x4E), so it is NOT tested. +* +* Assert fails if +* - ifbp has a recognizable out-of-range value. +* - tx_cntl has a recognizable out-of-range value. +* - NIC interrupts are not disabled while required by parameter action. +* - in case encapsulation by the HCF is selected: +* - The FrameList does not consists of at least 2 Descriptors. +* - The first databuffer does not contain exactly the (space for) the 802.11 header (== 28 words) +* - The first databuffer does not have a size to additionally accommodate the 802.3 header and the +* SNAP header of the frame after encapsulation (== 39 words). +* - The second databuffer does not contain at least DA, SA and 'type/length' (==14 bytes or 7 words) +*!! The 2nd part of the list of asserts should be kept in sync with put_frame_lst, in order to get +*!! them in the WCI-spec !!!! +* - DMA is not enabled +* - descriptor list is NULL +* - a descriptor in the descriptor list is not double word aligned +* - a count of size field of a descriptor contains control bits, i.e. bits in the high order nibble. +* - the DELWA descriptor is not a "singleton" DescriptorList. +* - the DELWA descriptor is not the first Descriptor supplied +* - a non_DMA descriptor is supplied before the DELWA Descriptor is supplied +*!! - Possibly more checks could be added !!!!!!!!!!!!! +*.DIAGRAM +* +*.NOTICE +* +*.ENDDOC END DOCUMENTATION +* +* +*1: Write tx_cntl parameter to HFS_TX_CNTL field into the Hermes-specific header in buffer 1 +*4: determine whether encapsulation is needed and write the type (tunnel or 1042) already at the appropriate +* offset in the 1st buffer +*6: Build the encapsualtion enveloppe in the free space at the end of the 1st buffer +* - Copy DA/SA fields from the 2nd buffer +* - Calculate total length of the message (snap-header + type-field + the length of all buffer fragments +* associated with the 802.3 frame (i.e all descriptors except the first), but not the DestinationAddress, +* SourceAddress and length-field) +* Assert the message length +* Write length. Note that the message is in BE format, hence on LE platforms the length must be converted +* ;? THIS IS NOT WHAT CURRENTLY IS IMPLEMENTED +* - Write snap header. Note that the last byte of the snap header is NOT copied, that byte is already in +* place as result of the call to hcf_encap. +* Note that there are many ways to skin a cat. To express the offsets in the 1st buffer while writing +* the snap header, HFS_TYPE is chosen as a reference point to make it easier to grasp that the snap header +* and encapsualtion type are at least relative in the right. +*8: modify 1st descriptor to reflect moved part of the 802.3 header + Snap-header +* modify 2nd descriptor to skip the moved part of the 802.3 header (DA/SA +*10: set each descriptor to 'DMA owned', clear all other control bits. +* Set SOP bit on first descriptor. Set EOP bit on last descriptor. +*12: Either append the current frame to an existing descriptor list or +*14: create a list beginning with the current frame +*16: remember the new end of the list +*20: hand the frame over to the DMA engine +************************************************************************************************************/ void hcf_dma_tx_put (IFBP ifbp,DESC_STRCT *descp,hcf_16 tx_cntl ) { -DESC_STRCT *p = descp->next_desc_addr; -int i; +DESC_STRCT *p = descp->next_desc_addr; +int i;#if HCF_ASSERT int x = ifbp->IFB_FWIdentity.comp_id ==COMP_ID_FW_AP ? tx_cntl & ~HFS_TX_CNTL_PORT : tx_cntl;
@@ -1796,21 +1795,21 @@ int i;HCFASSERT ( ( ifbp->IFB_CntlOpt & (USE_DMA |DMA_ENABLED ) ) == (USE_DMA |DMA_ENABLED ), ifbp->IFB_CntlOpt);if ( descp->buf_addr ) { - *(hcf_16 *)(descp->buf_addr +HFS_TX_CNTL ) = tx_cntl;/*1*/ + *(hcf_16 *)(descp->buf_addr +HFS_TX_CNTL ) = tx_cntl;/*1*/ #if (HCF_ENCAP) == HCF_ENC - HCFASSERT( descp->next_desc_addr, 0 ); //at least 2 descripors - HCFASSERT( descp->BUF_CNT == HFS_ADDR_DEST, descp->BUF_CNT ); //exact length required for 1st buffer - HCFASSERT( descp->BUF_SIZE >= HCF_DMA_TX_BUF1_SIZE, descp->BUF_SIZE ); //minimal storage for encapsulation - HCFASSERT( p->BUF_CNT >= 14, p->BUF_CNT ); //at least DA, SA and 'type' in 2nd buffer + HCFASSERT( descp->next_desc_addr, 0 ); //at least 2 descripors + HCFASSERT( descp->BUF_CNT == HFS_ADDR_DEST, descp->BUF_CNT ); //exact length required for 1st buffer + HCFASSERT( descp->BUF_SIZE >= HCF_DMA_TX_BUF1_SIZE, descp->BUF_SIZE ); //minimal storage for encapsulation + HCFASSERT( p->BUF_CNT >= 14, p->BUF_CNT ); //at least DA, SA and 'type' in 2nd buffer #if (HCF_TYPE) & HCF_TYPE_CCX /* if we are doing PPK +/- CMIC, or we are sending a DDP frame */ if ( ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_ON ) || - ( ( p->BUF_CNT >= 20 ) && ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_OFF ) && - ( p->buf_addr[12] == 0xAA ) && ( p->buf_addr[13] == 0xAA ) && - ( p->buf_addr[14] == 0x03 ) && ( p->buf_addr[15] == 0x00 ) && - ( p->buf_addr[16] == 0x40 ) && ( p->buf_addr[17] == 0x96 ) && - ( p->buf_addr[18] == 0x00 ) && ( p->buf_addr[19] == 0x00 ))) + ( ( p->BUF_CNT >= 20 ) && ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_OFF ) && + ( p->buf_addr[12] == 0xAA ) && ( p->buf_addr[13] == 0xAA ) && + ( p->buf_addr[14] == 0x03 ) && ( p->buf_addr[15] == 0x00 ) && + ( p->buf_addr[16] == 0x40 ) && ( p->buf_addr[17] == 0x96 ) && + ( p->buf_addr[18] == 0x00 ) && ( p->buf_addr[19] == 0x00 ))) { /* copy the DA/SA to the first buffer */ for ( i = 0; i < HCF_DASA_SIZE; i++ ) {
@@ -1821,34 +1820,34 @@ int i;do { i += p->BUF_CNT; }while ( p = p->next_desc_addr ); i -=HCF_DASA_SIZE ;/* convert the length field to big endian, using the endian friendly macros */ - i =CNV_SHORT_TO_BIG (i);//!! this converts ONLY on LE platforms, how does that relate to the non-CCX code + i =CNV_SHORT_TO_BIG (i);//!! this converts ONLY on LE platforms, how does that relate to the non-CCX code *(hcf_16 *)(&descp->buf_addr[HFS_LEN ]) = (hcf_16 )i; descp->BUF_CNT =HFS_DAT ;// modify 2nd descriptor to skip the 'Da/Sa' fields descp->next_desc_addr->buf_phys_addr +=HCF_DASA_SIZE ; - descp->next_desc_addr->BUF_CNT -=HCF_DASA_SIZE ; + descp->next_desc_addr->BUF_CNT -=HCF_DASA_SIZE ; } else#endif // HCF_TYPE_CCX { - descp->buf_addr[HFS_TYPE -1 ] =hcf_encap (&descp->next_desc_addr->buf_addr[HCF_DASA_SIZE ]);/*4*/ + descp->buf_addr[HFS_TYPE -1 ] =hcf_encap (&descp->next_desc_addr->buf_addr[HCF_DASA_SIZE ]);/*4*/ if ( descp->buf_addr[HFS_TYPE -1 ] !=ENC_NONE ) { -for ( i=0 ; i <HCF_DASA_SIZE ; i++ ) {/*6*/ +for ( i=0 ; i <HCF_DASA_SIZE ; i++ ) {/*6*/ descp->buf_addr[i +HFS_ADDR_DEST ] = descp->next_desc_addr->buf_addr[i]; } i =sizeof (snap_header) +2 - (2 *6 +2 );do { i += p->BUF_CNT; }while ( ( p = p->next_desc_addr ) !=NULL ); - *(hcf_16 *)(&descp->buf_addr[HFS_LEN ]) =CNV_END_SHORT (i);//!! this converts on ALL platforms, how does that relate to the CCX code + *(hcf_16 *)(&descp->buf_addr[HFS_LEN ]) =CNV_END_SHORT (i);//!! this converts on ALL platforms, how does that relate to the CCX code for ( i=0 ; i <sizeof (snap_header) -1 ; i++) { descp->buf_addr[HFS_TYPE -sizeof (snap_header) + i] = snap_header[i]; } - descp->BUF_CNT =HFS_TYPE ;/*8*/ - descp->next_desc_addr->buf_phys_addr +=HCF_DASA_SIZE ; - descp->next_desc_addr->BUF_CNT -=HCF_DASA_SIZE ; + descp->BUF_CNT =HFS_TYPE ;/*8*/ + descp->next_desc_addr->buf_phys_addr +=HCF_DASA_SIZE ; + descp->next_desc_addr->BUF_CNT -=HCF_DASA_SIZE ; } }#endif // HCF_ENC - } + }put_frame_lst ( ifbp, descp,DMA_TX );HCFLOGEXIT (HCF_TRACE_DMA_TX_PUT ); }// hcf_dma_tx_put
@@ -1857,44 +1856,44 @@ int i;#if (HCF_DL_ONLY ) ==0 /************************************************************************************************************ -* -*.MODULE hcf_8 hcf_encap( wci_bufp type ) -*.PURPOSE test whether RFC1042 or Bridge-Tunnel encapsulation is needed. -* -*.ARGUMENTS -* type (Far) pointer to the (Big Endian) Type/Length field in the message -* -*.RETURNS -* ENC_NONE len/type is "len" ( (BIG_ENDIAN)type <= 1500 ) -* ENC_TUNNEL len/type is "type" and 0x80F3 or 0x8137 -* ENC_1042 len/type is "type" but not 0x80F3 or 0x8137 -* -*.CONDITIONS -* NIC Interrupts d.c -* -*.DESCRIPTION -* Type must point to the Len/Type field of the message, this is the 2-byte field immediately after the 6 byte -* Destination Address and 6 byte Source Address. The 2 successive bytes addressed by type are interpreted as -* a Big Endian value. If that value is less than or equal to 1500, the message is assumed to be in 802.3 -* format. Otherwise the message is assumed to be in Ethernet-II format. Depending on the value of Len/Typ, -* Bridge Tunnel or RFC1042 encapsulation is needed. -* -*.DIAGRAM -* -* 1: presume 802.3, hence preset return value at ENC_NONE -* 2: convert type from "network" Endian format to native Endian -* 4: the litmus test to distinguish type and len. -* The hard code "magic" value of 1500 is intentional and should NOT be replaced by a mnemonic because it is -* not related at all to the maximum frame size supported by the Hermes. -* 6: check type against: -* 0x80F3 //AppleTalk Address Resolution Protocol (AARP) -* 0x8137 //IPX -* to determine the type of encapsulation -* -*.ENDDOC END DOCUMENTATION -* -************************************************************************************************************/ -#if HCF_ENCAP //i.e HCF_ENC or HCF_ENC_SUP +* +*.MODULE hcf_8 hcf_encap( wci_bufp type ) +*.PURPOSE test whether RFC1042 or Bridge-Tunnel encapsulation is needed. +* +*.ARGUMENTS +* type (Far) pointer to the (Big Endian) Type/Length field in the message +* +*.RETURNS +* ENC_NONE len/type is "len" ( (BIG_ENDIAN)type <= 1500 ) +* ENC_TUNNEL len/type is "type" and 0x80F3 or 0x8137 +* ENC_1042 len/type is "type" but not 0x80F3 or 0x8137 +* +*.CONDITIONS +* NIC Interrupts d.c +* +*.DESCRIPTION +* Type must point to the Len/Type field of the message, this is the 2-byte field immediately after the 6 byte +* Destination Address and 6 byte Source Address. The 2 successive bytes addressed by type are interpreted as +* a Big Endian value. If that value is less than or equal to 1500, the message is assumed to be in 802.3 +* format. Otherwise the message is assumed to be in Ethernet-II format. Depending on the value of Len/Typ, +* Bridge Tunnel or RFC1042 encapsulation is needed. +* +*.DIAGRAM +* +* 1: presume 802.3, hence preset return value at ENC_NONE +* 2: convert type from "network" Endian format to native Endian +* 4: the litmus test to distinguish type and len. +* The hard code "magic" value of 1500 is intentional and should NOT be replaced by a mnemonic because it is +* not related at all to the maximum frame size supported by the Hermes. +* 6: check type against: +* 0x80F3 //AppleTalk Address Resolution Protocol (AARP) +* 0x8137 //IPX +* to determine the type of encapsulation +* +*.ENDDOC END DOCUMENTATION +* +************************************************************************************************************/ +#if HCF_ENCAP //i.e HCF_ENC or HCF_ENC_SUP #if ! ( (HCF_ENCAP ) &HCF_ENC_SUP ) HCF_STATIC#endif // HCF_ENCAP
@@ -1902,12 +1901,12 @@ hcf_8 hcf_encap( wci_bufp type ) { -hcf_8 rc =ENC_NONE ;/* 1 */ -hcf_16 t = (hcf_16)(*type<<8 ) + *(type+1 );/* 2 */ +hcf_8 rc =ENC_NONE ;/* 1 */ +hcf_16 t = (hcf_16)(*type<<8 ) + *(type+1 );/* 2 */ -if ( t >1500 ) {/* 4 */ +if ( t >1500 ) {/* 4 */ if ( t ==0x8137 || t ==0x80F3 ) { - rc =ENC_TUNNEL ;/* 6 */ + rc =ENC_TUNNEL ;/* 6 */ }else { rc =ENC_1042 ; }
@@ -1919,121 +1918,121 @@ hcf_16 t = (hcf_16)(*type<<8) + *(type+1); /* 2 *//************************************************************************************************************ -* -*.MODULE int hcf_get_info( IFBP ifbp, LTVP ltvp ) -*.PURPOSE Obtains transient and persistent configuration information from the Card and from the HCF. -* -*.ARGUMENTS -* ifbp address of the Interface Block -* ltvp address of LengthTypeValue structure specifying the "what" and the "how much" of the -* information to be collected from the HCF or from the Hermes -* -*.RETURNS -* HCF_ERR_LEN The provided buffer was too small -* HCF_SUCCESS Success -*!! via cmd_exe ( type >= CFG_RID_FW_MIN ) -* HCF_ERR_NO_NIC NIC removed during retrieval -* HCF_ERR_TIME_OUT Expected Hermes event did not occur in expected time -*!! via cmd_exe and setup_bap (type >= CFG_RID_FW_MIN ) -* HCF_ERR_DEFUNCT_... HCF is in defunct mode (bits 0x7F reflect cause) -* -*.DESCRIPTION -* The T-field of the LTV-record (provided by the MSF in parameter ltvp) specifies the RID wanted. The RID -* information identified by the T-field is copied into the V-field. -* On entry, the L-field specifies the size of the buffer, also called the "Initial DataLength". The L-value -* includes the size of the T-field, but not the size of the L-field itself. -* On return, the L-field indicates the number of words actually contained by the Type and Value fields. -* As the size of the Type field in the LTV-record is included in the "Initial DataLength" of the record, the -* V-field can contain at most "Initial DataLength" - 1 words of data. -* Copying stops if either the complete Information is copied or if the number of words indicated by the -* "Initial DataLength" were copied. The "Initial DataLength" acts as a safe guard against Configuration -* Information blocks that have different sizes for different F/W versions, e.g. when later versions support -* more tallies than earlier versions. -* If the size of Value field of the RID exceeds the size of the "Initial DataLength" -1, as much data -* as fits is copied, and an error status of HCF_ERR_LEN is returned. -* -* It is the responsibility of the MSF to detect card removal and re-insertion and not call the HCF when the -* NIC is absent. The MSF cannot, however, timely detect a Card removal if the Card is removed while -* hcf_get_info is in progress. Therefore, the HCF performs its own check on Card presence after the read -* operation of the NIC data. If the Card is not present or removed during the execution of hcf_get_info, -* HCF_ERR_NO_NIC is returned and the content of the Data Buffer is unpredictable. This check is not performed -* in case of the "HCF embedded" pseudo RIDs like CFG_TALLIES. -* -* Assert fails if -* - ifbp has a recognizable out-of-range value. -* - reentrancy, may be caused by calling hcf_functions without adequate protection -* against NIC interrupts or multi-threading. -* - ltvp is a NULL pointer. -* - length field of the LTV-record at entry is 0 or 1 or has an excessive value (i.e. exceeds HCF_MAX_LTV). -* - type field of the LTV-record is invalid. -* -*.DIAGRAM -* Hcf_get_mb_info copies the contents of the oldest MailBox Info block in the MailBox to PC RAM. If len is -* less than the size of the MailBox Info block, only as much as fits in the PC RAM buffer is copied. After -* the copying the MailBox Read pointer is updated to point to the next MailBox Info block, hence the -* remainder of an "oversized" MailBox Info block is lost. The truncation of the MailBox Info block is NOT -* reflected in the return status. Note that hcf_get_info guarantees the length of the PC RAM buffer meets -* the minimum requirements of at least 2, so no PC RAM buffer overrun. -* -* Calling hcf_get_mb_info when their is no MailBox Info block available or when there is no MailBox at all, -* results in a "NULL" MailBox Info block. -* -*12: see NOTICE -*17: The return status of cmd_wait and the first hcfio_in_string can be ignored, because when one fails, the -* other fails via the IFB_DefunctStat mechanism -*20: "HCFASSERT( rc == HCF_SUCCESS, rc )" is not suitable because this will always trigger as side effect of -* the HCFASSERT in hcf_put_info which calls hcf_get_info to figure out whether the RID exists at all. +* +*.MODULE int hcf_get_info( IFBP ifbp, LTVP ltvp ) +*.PURPOSE Obtains transient and persistent configuration information from the Card and from the HCF.
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.4.1
Part of the diff is not shown here. View the raw message.
PATCH 5/13 staging: wlags49_h2: Remove HCF_DL_ONLY
In reply to David KilroyThis is supposed to profile the code so that you can build a driver that will only update the firmware. We don't need to support this configuration.
--- drivers/staging/wlags49_h2/hcf.c | 23 ++--------------------- drivers/staging/wlags49_h2/hcfcfg.h | 13 ------------- 2 files changed, 2 insertions(+), 34 deletions(-)
drivers/staging/wlags49_h2/hcf.c +2 -21
@@ -511,7 +511,6 @@ HCF_STATIC hcf_16* BASED xxxx[ ] = {************************** T O P L E V E L H C F R O U T I N E S ************************************** ************************************************************************************************************/ -#if (HCF_DL_ONLY ) ==0 /************************************************************************************************************ * *.MODULE int hcf_action( IFBP ifbp, hcf_16 action )
@@ -834,7 +833,6 @@ hcf_action( IFBP ifbp, hcf_16 action )HCFLOGEXIT (HCF_TRACE_ACTION );return rc; }// hcf_action -#endif // HCF_DL_ONLY /************************************************************************************************************
@@ -1854,7 +1852,6 @@ hcf_dma_tx_put( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl )#endif // HCF_DMA -#if (HCF_DL_ONLY ) ==0 /************************************************************************************************************ * *.MODULE hcf_8 hcf_encap( wci_bufp type )
@@ -1914,7 +1911,6 @@ hcf_encap( wci_bufp type ) return rc; }// hcf_encap #endif // HCF_ENCAP -#endif // HCF_DL_ONLY /************************************************************************************************************
@@ -2330,7 +2326,6 @@ hcf_put_info( IFBP ifbp, LTVP ltvp ) }// hcf_put_info -#if (HCF_DL_ONLY ) ==0 /************************************************************************************************************ * *.MODULE int hcf_rcv_msg( IFBP ifbp, DESC_STRCT *descp, unsigned int offset )
@@ -2490,10 +2485,8 @@ hcf_rcv_msg( IFBP ifbp, DESC_STRCT *descp, unsigned int offset )HCFLOGEXIT (HCF_TRACE_RCV_MSG );return rc; }// hcf_rcv_msg -#endif // HCF_DL_ONLY -#if (HCF_DL_ONLY ) ==0 /************************************************************************************************************ * *.MODULE int hcf_send_msg( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl )
@@ -2804,10 +2797,8 @@ hcf_send_msg( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl )HCFLOGEXIT (HCF_TRACE_SEND_MSG );return rc; }// hcf_send_msg -#endif // HCF_DL_ONLY -#if (HCF_DL_ONLY ) ==0 /************************************************************************************************************ * *.MODULE int hcf_service_nic( IFBP ifbp, wci_bufp bufp, unsigned int len )
@@ -3186,7 +3177,6 @@ hcf_service_nic( IFBP ifbp, wci_bufp bufp, unsigned int len )HCFLOGEXIT (HCF_TRACE_SERVICE_NIC );return rc; }// hcf_service_nic -#endif // HCF_DL_ONLY /************************************************************************************************************
@@ -3517,7 +3507,6 @@ calibrate( IFBP ifbp )#endif // HCF_PROT_TIME -#if (HCF_DL_ONLY ) ==0 #if (HCF_TYPE ) &HCF_TYPE_WPA /************************************************************************************************************ *
@@ -3565,7 +3554,6 @@ check_mic( IFBP ifbp ) return rc; }// check_mic #endif // HCF_TYPE_WPA -#endif // HCF_DL_ONLY /************************************************************************************************************
@@ -3879,7 +3867,6 @@ fw_printf(IFBP ifbp, CFG_FW_PRINTF_STRCT FAR *ltvp)#endif // HCF_ASSERT_PRINTF -#if (HCF_DL_ONLY ) ==0 /************************************************************************************************************ * *.SUBMODULE hcf_16 get_fid( IFBP ifbp )
@@ -3943,7 +3930,6 @@ get_fid( IFBP ifbp ) }return fid; }// get_fid -#endif // HCF_DL_ONLY /************************************************************************************************************
@@ -4232,7 +4218,7 @@ init( IFBP ifbp ) } }#endif // MSF_COMPONENT_ID -#if (HCF_DL_ONLY ) ==0 /* 28 */ +if ( rc ==HCF_SUCCESS && ifbp->IFB_FWIdentity.comp_id >=COMP_ID_FW_STA ) {PROT_CNT_INI ;/**************************************************************************************
@@ -4258,13 +4244,12 @@ init( IFBP ifbp ) }//#endif // ALLOC_15 } -#endif // HCF_DL_ONLY +HCFASSERT ( rc ==HCF_SUCCESS , rc );HCFLOGEXIT (HCF_TRACE_INIT );return rc; }// init -#if (HCF_DL_ONLY ) ==0 /************************************************************************************************************ * *.SUBMODULE void isr_info( IFBP ifbp )
@@ -4346,7 +4331,6 @@ isr_info( IFBP ifbp ) }return ; }// isr_info -#endif // HCF_DL_ONLY // //
@@ -4384,7 +4368,6 @@ isr_info( IFBP ifbp )// // return; //} // isr_info -//#endif // HCF_DL_ONLY /************************************************************************************************************
@@ -4669,7 +4652,6 @@ put_info( IFBP ifbp, LTVP ltvp ) }// put_info -#if (HCF_DL_ONLY ) ==0 /************************************************************************************************************ * *.SUBMODULE int put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp )
@@ -4783,7 +4765,6 @@ put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp ) } // put_info_mb#endif // HCF_EXT_MB -#endif // HCF_DL_ONLY /************************************************************************************************************
drivers/staging/wlags49_h2/hcfcfg.h +0 -13
@@ -479,10 +479,6 @@ typedef unsigned long hcf_32;#define HCF_BIG_ENDIAN 0#endif // HCF_BIG_ENDIAN -#if ! definedHCF_DL_ONLY -#define HCF_DL_ONLY 0 -#endif // HCF_DL_ONLY -#if ! definedHCF_DMA #define HCF_DMA 0#endif // HCF_DMA
@@ -540,11 +536,6 @@ typedef unsigned long hcf_32;#define HCF_BIG_ENDIAN 1 //just for convenience of generating cfg_hcf_opt#endif // HCF_BIG_ENDIAN -#if HCF_DL_ONLY -#undef HCF_DL_ONLY -#define HCF_DL_ONLY 1 //just for convenience of generating cfg_hcf_opt -#endif // HCF_DL_ONLY -#if HCF_DMA #undef HCF_DMA#define HCF_DMA 1 //just for convenience of generating cfg_hcf_opt
@@ -752,10 +743,6 @@ err: these macros are not used consistently; err: invalid value for HCF_BIG_ENDIAN;#endif // HCF_BIG_ENDIAN -#if HCF_DL_ONLY !=0 &&HCF_DL_ONLY !=1 -err: invalid value for HCF_DL_ONLY; -#endif // HCF_DL_ONLY -#if HCF_DMA !=0 &&HCF_DMA !=1 err: invalid value for HCF_DMA;#endif // HCF_DMA
Signature · 1 line
1.7.4.1
PATCH 6/13 staging: wlags49_h2: Simplify HCF_ENCAP usage
In reply to David KilroyEncapsulation should always be enabled. Support is either via firmware or in the driver, so we need to keep the macro. The driver can stop exporting hcf_encap
--- drivers/staging/wlags49_h2/hcf.c | 11 +---------- drivers/staging/wlags49_h2/hcf.h | 3 --- 2 files changed, 1 insertions(+), 13 deletions(-)
drivers/staging/wlags49_h2/hcf.c +1 -10
@@ -133,9 +133,7 @@ static int fw_printf(IFBP ifbp, CFG_FW_PRINTF_STRCT FAR *ltvp);#endif // HCF_ASSERT_PRINTF HCF_STATIC int download( IFBP ifbp, CFG_PROG_STRCT FAR *ltvp ); -#if (HCF_ENCAP ) &HCF_ENC HCF_STATIC hcf_8 hcf_encap( wci_bufp type ); -#endif // HCF_ENCAP HCF_STATIC hcf_8 null_addr[4] = { 0, 0, 0, 0 };#if ! definedIN_PORT_WORD //replace I/O Macros with logging facility extern FILE *log_file;
@@ -244,11 +242,9 @@ void OUT_PORT_STRING_8_16( hcf_io prt, hcf_8 FAR * src, int n) { //also handl IFBP BASED assert_ifbp = NULL; //to make asserts easily work under MMD and DHF#endif // HCF_ASSERT -#if HCF_ENCAP /* SNAP header to be inserted in Ethernet-II frames */ HCF_STATIC hcf_8 BASED snap_header[] = { 0xAA, 0xAA, 0x03, 0x00, 0x00, //5 bytes signature +0 };//1 byte protocol identifier -#endif // HCF_ENCAP #if (HCF_TYPE ) &HCF_TYPE_WPA HCF_STATIC hcf_8 BASED mic_pad[8] = { 0x5A, 0, 0, 0, 0, 0, 0, 0 }; //MIC padding of message
@@ -1890,11 +1886,7 @@ hcf_dma_tx_put( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl )*.ENDDOC END DOCUMENTATION * ************************************************************************************************************/ -#if HCF_ENCAP //i.e HCF_ENC or HCF_ENC_SUP -#if ! ( (HCF_ENCAP ) &HCF_ENC_SUP ) -HCF_STATIC -#endif // HCF_ENCAP -hcf_8 +HCF_STATIC hcf_8hcf_encap (wci_bufp type ) {
@@ -1910,7 +1902,6 @@ hcf_encap( wci_bufp type ) }return rc; }// hcf_encap -#endif // HCF_ENCAP /************************************************************************************************************
drivers/staging/wlags49_h2/hcf.h +0 -3
@@ -382,9 +382,6 @@ typedef IFB_STRCT* IFBP; EXTERN_C int hcf_action (IFBP ifbp, hcf_16 cmd ); EXTERN_C int hcf_connect (IFBP ifbp, hcf_io io_base ); -#if (HCF_ENCAP ) &HCF_ENC_SUP -EXTERN_C hcf_8 hcf_encap (wci_bufp type ); -#endif // HCF_ENC_SUP EXTERN_C int hcf_get_info (IFBP ifbp, LTVP ltvp ); EXTERN_C int hcf_service_nic (IFBP ifbp, wci_bufp bufp, unsigned int len ); EXTERN_C int hcf_cntl (IFBP ifbp, hcf_16 cmd );
Signature · 1 line
1.7.4.1
PATCH 7/13 staging: wlags49_h2: Remove some unused defines
In reply to David KilroyHCF_INT_OFF, _TCHAR_DEFINED, HCF_LITTLE_ENDIAN, HCF_TALLIES_EXTRA HCF_ENTRY, HCF_EXIT, OUTPUTDEBUGMSG, ASSERTDEBUGMSG
--- drivers/staging/wlags49_h2/hcf.c | 6 +----- drivers/staging/wlags49_h2/hcf.h | 2 -- drivers/staging/wlags49_h2/hcfcfg.h | 30 ------------------------------ drivers/staging/wlags49_h2/hcfdef.h | 6 ++---- 4 files changed, 3 insertions(+), 41 deletions(-)
drivers/staging/wlags49_h2/hcf.c +1 -5
@@ -437,7 +437,7 @@ static struct /*CFG_HCF_OPT_STRCT*/ {hcf_16 v17;// HCF_NIC_TAL_CNT hcf_16 v18;// HCF_HCF_TAL_CNT hcf_16 v19;// offset tallies -TCHAR val[sizeof (HCF_VERSION )]; +char val[sizeof (HCF_VERSION )]; }BASED cfg_hcf_opt = {sizeof (cfg_hcf_opt)/sizeof (hcf_16) -1 ,CFG_HCF_OPT ,// (0x082C)
@@ -473,10 +473,6 @@ static struct /*CFG_HCF_OPT_STRCT*/ { }; // cfg_hcf_opt#endif // MSF_COMPONENT_ID -#if definedHCF_TALLIES_EXTRA - replaced by HCF_EXT_TALLIES_FW ; -#endif // HCF_TALLIES_EXTRA -#if definedMSF_COMPONENT_ID || (HCF_EXT ) &HCF_EXT_MB #if (HCF_EXT ) &HCF_EXT_MB HCF_STATIC LTV_STRCT BASED cfg_null = { 1, CFG_NULL, {0} };
drivers/staging/wlags49_h2/hcf.h +0 -2
@@ -335,9 +335,7 @@ typedef struct {CFG_FW_PRINTF_BUFFER_LOCATION_STRCT IFB_FwPfBuff;#endif // HCF_ASSERT_PRINTF #endif // HCF_ASSERT -#if ! definedHCF_INT_OFF hcf_16 volatile IFB_IntOffCnt;// 0xFFFF based HCF_ACT_INT_OFF nesting counter, DeepSleep flag -#endif // HCF_INT_OFF #if (HCF_TYPE ) &HCF_TYPE_CCX hcf_16 IFB_CKIPStat;// CKIP Status flag #endif // HCF_TYPE_CCX
drivers/staging/wlags49_h2/hcfcfg.h +0 -30
@@ -447,16 +447,6 @@ typedef unsigned long hcf_32;#define IN_PORT_STRING_8_16 (port, addr, len) IN_PORT_STRING_16(port, addr, len)#define OUT_PORT_STRING_8_16 (port, addr, len) OUT_PORT_STRING_16(port, addr, len) - -#ifndef OUTPUTDEBUGMSG -#define OUTPUTDEBUGMSG (dprintf_exp) -#endif - - -#ifndef ASSERTDEBUGMSG -#define ASSERTDEBUGMSG (cond, dprintf_exp) -#endif -#ifndef CFG_SCAN_CHANNELS_2GHZ #define CFG_SCAN_CHANNELS_2GHZ 0xFCC2#endif /* CFG_SCAN_CHANNELS_2GHZ */
@@ -487,14 +477,6 @@ typedef unsigned long hcf_32;#define HCF_ENCAP HCF_ENC#endif // HCF_ENCAP -#if ! definedHCF_ENTRY -#define HCF_ENTRY ( ifbp ) -#endif // HCF_ENTRY - -#if ! definedHCF_EXIT -#define HCF_EXIT ( ifbp ) -#endif // HCF_EXIT -#if ! definedHCF_EXT #define HCF_EXT 0#endif // HCF_EXT
@@ -711,21 +693,9 @@ err: primary variants 1 and 2 correspond with H-I only;#define TEXT (x) x#endif // TEXT -#if !defined _TCHAR_DEFINED -#define TCHAR char -#endif // _TCHAR_DEFINED -/************************************************************************************************************/ /*********************** 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 ************************/ /************************************************************************************************************/ -#if definedHCF_LITTLE_ENDIAN -err: HCF_LITTLE_ENDIAN is obsolete; -#endif // HCF_LITTLE_ENDIAN - -#if definedHCF_INT_OFF -err: HCF_INT_OFF is obsolete; -#endif //HCF_INT_OFF -#if HCF_ALIGN !=1 &&HCF_ALIGN !=2 &&HCF_ALIGN !=4 &&HCF_ALIGN !=8 err: invalid value for HCF_ALIGN;#endif // HCF_ALIGN
drivers/staging/wlags49_h2/hcfdef.h +2 -4
@@ -686,7 +686,6 @@ err: someone redefined these macros while the implemenation assumes they are equ#define HCFLOGENTRY ( where, what ) do { \ if ( (ifbp->IFB_AssertWhere = where) <= 15 ) { \ - HCF_ENTRY( ifbp ); \ HCFASSERT( (ifbp->IFB_AssertTrace & 1<<((where)&0xF)) == 0, ifbp->IFB_AssertTrace ); \ ifbp->IFB_AssertTrace |= 1<<((where)&0xF); \ } \
@@ -696,7 +695,6 @@ err: someone redefined these macros while the implemenation assumes they are equ#define HCFLOGEXIT ( where ) do { \ if ( (ifbp->IFB_AssertWhere = where) <= 15 ) { \ - HCF_EXIT( ifbp ); \ ifbp->IFB_AssertTrace &= ~(1<<((where)&0xF)); \ } \ HCFTRACE(ifbp, (where)|HCF_TRACE_EXIT ); \
@@ -705,8 +703,8 @@ err: someone redefined these macros while the implemenation assumes they are equ#else // HCF_ASSERT #define HCFASSERT ( x, q ) do { } while(0)#define MMDASSERT ( x, q ) -#define HCFLOGENTRY ( where, what ) do {HCF_ENTRY( ifbp );} while (0) -#define HCFLOGEXIT ( where ) do {HCF_EXIT( ifbp );} while(0) +#define HCFLOGENTRY ( where, what ) do { } while(0) +#define HCFLOGEXIT ( where ) do { } while(0)#endif // HCF_ASSERT #if HCF_INT_ON
Signature · 1 line
1.7.4.1
PATCH 8/13 staging: wlags49_h2: Remove references to SSN
In reply to David KilroySSN seems to be an old abbreviation for WPA. Remove all references.
--- drivers/staging/wlags49_h2/hcf.c | 10 +++++----- drivers/staging/wlags49_h2/hcfdef.h | 4 ---- drivers/staging/wlags49_h2/mdd.h | 6 +++--- 3 files changed, 8 insertions(+), 12 deletions(-)
drivers/staging/wlags49_h2/hcf.c +5 -5
@@ -2329,7 +2329,7 @@ hcf_put_info( IFBP ifbp, LTVP ltvp )* of frame). * *.RETURNS -* HCF_SUCCESS No SSN error ( or HCF_ERR_MIC already reported by hcf_service_nic) +* HCF_SUCCESS No WPA error ( or HCF_ERR_MIC already reported by hcf_service_nic) * HCF_ERR_MIC message contains an erroneous MIC ( HCF_SUCCESS is reported if HCF_ERR_MIC is already * reported by hcf_service_nic) * HCF_ERR_NO_NIC NIC removed during data retrieval
@@ -2592,10 +2592,10 @@ hcf_rcv_msg( IFBP ifbp, DESC_STRCT *descp, unsigned int offset ) *7: The ControlField of the TxFS is written. Since put_frag can only return the fatal Defunct or "No NIC", the * return status can be ignored because when it fails, cmd_wait will fail as well. (see also the note on the * need for a return code below). - * Note that HFS_TX_CNTL has different values for H-I, H-I/SSN and H-II and HFS_ADDR_DEST has different - * values for H-I (regardless of SSN) and H-II. + * Note that HFS_TX_CNTL has different values for H-I, H-I/WPA and H-II and HFS_ADDR_DEST has different + * values for H-I (regardless of WPA) and H-II. * By writing 17, 1 or 2 ( implying 16, 0 or 1 garbage word after HFS_TX_CNTL) the BAP just gets to - * HFS_ADDR_DEST for H-I, H-I/SSN and H-II respectively. + * HFS_ADDR_DEST for H-I, H-I/WPA and H-II respectively. *10: if neither encapsulation nor MIC calculation is needed, splitting the first fragment in two does not * really help but it makes the flow easier to follow to do not optimize on this difference *
@@ -2985,7 +2985,7 @@ or* compensated for the SNAP header length. * The 22 bytes needed for decapsulation are (more than) sufficient for the exceptional handling of the * MIC algorithm of the L-field (replacing the 2 byte L-field with 4 0x00 bytes). -*30: The 12 in the no-SSN branch corresponds with the get_frag, the 2 with the IPW of the SSN branch +*30: The 12 in the no-WPA branch corresponds with the get_frag, the 2 with the IPW of the WPA branch *32: If Hermes reported MIC-presence, than the MIC engine is initialized with the non-dummy MIC calculation * routine address and appropriate key. *34: The 8 bytes after the DA, SA, L are read and it is checked whether decapsulation is needed i.e.:
drivers/staging/wlags49_h2/hcfdef.h +0 -4
@@ -592,15 +592,11 @@ err: ;#if (HCF_TYPE ) &HCF_TYPE_WPA #define CALC_RX_MIC ( p, len ) calc_mic_rx_frag( ifbp, p, len )#define CALC_TX_MIC ( p, len ) calc_mic_tx_frag( ifbp, p, len ) -#define IF_SSN (x) x -#define IF_NOT_SSN (x)#else #define CALC_RX_MIC ( p, len )#define CALC_TX_MIC ( p, len )#define MIC_RX_RTN ( mic, dw )#define MIC_TX_RTN ( mic, dw ) -#define IF_SSN (x) -#define IF_NOT_SSN (x) x#endif // HCF_TYPE_WPA #if HCF_TALLIES &HCF_TALLIES_HCF //HCF tally support
drivers/staging/wlags49_h2/mdd.h +3 -3
@@ -444,7 +444,7 @@ XX1( CFG_DEFAULT_KEYS, KEY_STRCT, key[4] ) /*defines set of encryption keys tx_mic_key[4], rx_mic_key[4] ) /* */X6 (CFG_ADD_TKIP_MAPPED_KEY , bssid[3 ], tkip_key[8 ], \ tsc[4], rsc[4], tx_mic_key[4], rx_mic_key[4] ) /* */ -X1 (CFG_SET_SSN_AUTHENTICATION_SUITE , \ +X1 (CFG_SET_WPA_AUTHENTICATION_SUITE , \ ssn_authentication_suite ) /* */ X1( CFG_REMOVE_TKIP_DEFAULT_KEY,tkip_key_id ) /* */X1 (CFG_TICK_TIME , tick_time )/*Auxiliary Timer tick interval */
@@ -525,7 +525,7 @@ X2( CFG_WOL_PATTERNS, nPatterns, buffer[WOL_BUF_SIZE] ) /*[STA] WakeOnLan pat X1( CFG_OWN_MAC_ADDR, mac_addr[3] ) /*[AP] Unique local node MAC Address */X3 (CFG_PCF_INFO , medium_occupancy_limit, \ cfp_period, cfp_max_duration ) /*[AP] Point Coordination Function capability info */ - X1( CFG_CUR_SSN_INFO_ELEMENT, ssn_info_element[1] ) /* */ + X1( CFG_CUR_WPA_INFO_ELEMENT, ssn_info_element[1] ) /* */X4 (CFG_CUR_TKIP_IV_INFO , \ tkip_seq_cnt0[4 ], tkip_seq_cnt1[4 ], \ tkip_seq_cnt2[4 ], tkip_seq_cnt3[4 ] )/* */
@@ -802,7 +802,7 @@ XX1( CFG_SCAN, SCAN_RS_STRCT, scan_result[32] ) /*Scan results *#define CFG_PCF_INFO 0xFD87 //[AP] Point Coordination Function capability info//*RESERVED* #define CFG_HIGHEST_BASIC_RATE 0xFD88 // #define CFG_CUR_COUNTRY_INFO 0xFD89 // -#define CFG_CUR_SSN_INFO_ELEMENT 0xFD8A // +#define CFG_CUR_WPA_INFO_ELEMENT 0xFD8A //#define CFG_CUR_TKIP_IV_INFO 0xFD8B //#define CFG_CUR_ASSOC_REQ_INFO 0xFD8C //#define CFG_CUR_ASSOC_RESP_INFO 0xFD8D //
Signature · 1 line
1.7.4.1
PATCH 9/13 staging: wlags49_h2: Remove MUL/DIV_BY_2
In reply to David KilroyOnly used in one place, so just inline and get rid of the macro.
--- drivers/staging/wlags49_h2/hcf.c | 2 +- drivers/staging/wlags49_h2/hcfdef.h | 3 --- 2 files changed, 1 insertions(+), 4 deletions(-)
drivers/staging/wlags49_h2/hcf.c +1 -1
@@ -3766,7 +3766,7 @@ download( IFBP ifbp, CFG_PROG_STRCT FAR *ltvp ) //Hermes-II#if 0 //;? as long as the next if contains a hard coded 0, might as well leave it out even more obvious if (0 /*len is definitely not want we want;?*/ && ltvp->mode ==CFG_PROG_SEEPROM_READBACK ) {OPW (HREG_PARAM_1 , (hcf_16)(ltvp->nic_addr >>16 ) ); -OPW (HREG_PARAM_2 ,MUL_BY_2 (ltvp->len -4 )); +OPW (HREG_PARAM_2 , (hcf_16)((ltvp->len -4 ) <<1 ) );//. . perform Hermes prog cmd with appropriate mode bits rc =cmd_exe ( ifbp,HCMD_PROGRAM | ltvp->mode, (hcf_16 )ltvp->nic_addr );//. . set up NIC RAM addressability according Resp0-1
drivers/staging/wlags49_h2/hcfdef.h +0 -3
@@ -568,9 +568,6 @@ err: ;#define LOF (x) (sizeof(x)/sizeof(hcf_16)-1) -#define MUL_BY_2 ( x ) ( (x) << 1 ) //used to multiply by 2 -#define DIV_BY_2 ( x ) ( (x) >> 1 ) //used to divide by 2 -//resolve problems on for some 16 bits compilers to create 32 bit values #define MERGE_2 ( hw, lw ) ( ( ((hcf_32)(hw)) << 16 ) | ((hcf_16)(lw)) )
Signature · 1 line
1.7.4.1
PATCH 10/13 staging: wlags49_h2: Remove CKIP support from hcf
In reply to David KilroyCKIP is a Cisco proprietary alternative to TKIP. Support removed to simplify code - the defines to interact with the firmware are left in place.
--- drivers/staging/wlags49_h2/hcf.c | 194 ++++++++++++-------------------------- drivers/staging/wlags49_h2/hcf.h | 3 - 2 files changed, 60 insertions(+), 137 deletions(-)
drivers/staging/wlags49_h2/hcf.c +60 -134
@@ -512,8 +512,6 @@ HCF_STATIC hcf_16* BASED xxxx[ ] = { *.ARGUMENTS * ifbp address of the Interface Block * action number identifying the type of change - * - HCF_ACT_CCX_OFF disable CKIP - * - HCF_ACT_CCX_ON enable CKIP * - HCF_ACT_INT_FORCE_ON enable interrupt generation by WaveLAN NIC * - HCF_ACT_INT_OFF disable interrupt generation by WaveLAN NIC * - HCF_ACT_INT_ON compensate 1 HCF_ACT_INT_OFF, enable interrupt generation if balance reached
@@ -537,7 +535,6 @@ HCF_STATIC hcf_16* BASED xxxx[ ] = { * *.DESCRIPTION * hcf_action supports the following mode changing action-code pairs that are antonyms - * -HCF_ACT_CCX_OFF /HCF_ACT_CCX_ON * - HCF_ACT_INT_[FORCE_]ON / HCF_ACT_INT_OFF * * Additionally hcf_action can start the following actions in the NIC:
@@ -573,11 +570,6 @@ HCF_STATIC hcf_16* BASED xxxx[ ] = { *! The INT_OFF/INT_ON housekeeping is initialized at 0x0000 by hcf_connect, causing the interrupt generation * mechanism to be disabled at first. This suits MSF implementation based on a polling strategy. * - * o HCF_ACT_CCX_OFF / HCF_ACT_CCX_ON - *!! This can use some more explanation;? - * Disables and Enables support in the HCF runtime code for the CCX feature. Each time one of these action - * codes is used, the effects of the preceding use cease. - * * o HCF_ACT_SLEEP: Initiates the Disconnected DeepSleep process * This command is only available if the HCF_DDS compile time option is set. It triggers the F/W to start the * sleep handshaking. Regardless whether the Host initiates a Disconnected DeepSleep (DDS) or the F/W initiates
@@ -791,13 +783,6 @@ hcf_action( IFBP ifbp, hcf_16 action )// break; #endif // HCF_DDS -#if (HCF_TYPE ) &HCF_TYPE_CCX -case HCF_ACT_CCX_ON :// enable CKIP -case HCF_ACT_CCX_OFF :// disable CKIP - ifbp->IFB_CKIPStat = action; -break ; -#endif // HCF_TYPE_CCX -case HCF_ACT_RX_ACK ://Receiver ACK /*6*/ if ( ifbp->IFB_RxFID ) {DAWA_ACK (HREG_EV_RX );
@@ -1501,34 +1486,30 @@ hcf_dma_rx_get (IFBP ifbp)DESC_STRCT *descp;// pointer to start of FrameList descp =get_frame_lst ( ifbp,DMA_RX ); -if ( descp && descp->buf_addr )//!be aware of the missing curly bracket +if ( descp && descp->buf_addr ) {//skip decapsulation at confined descriptor #if (HCF_ENCAP ) ==HCF_ENC -#if (HCF_TYPE ) &HCF_TYPE_CCX - if ( ifbp->IFB_CKIPStat == HCF_ACT_CCX_OFF ) -#endif // HCF_TYPE_CCX - { -int i; -DESC_STRCT *p = descp->next_desc_addr;//pointer to 2nd descriptor of frame -HCFASSERT (p,0 ); -// The 2nd descriptor contains (maybe) a SNAP header plus part or whole of the payload. -//determine decapsulation sub-flag in RxFS - i = *(wci_recordp)&descp->buf_addr[HFS_STAT ] & (HFS_STAT_MSG_TYPE |HFS_STAT_ERR ); -if ( i ==HFS_STAT_TUNNEL || - ( i ==HFS_STAT_1042 &&hcf_encap ( (wci_bufp)&p->buf_addr[HCF_DASA_SIZE ] ) !=ENC_TUNNEL )) { -// The 2nd descriptor contains a SNAP header plus part or whole of the payload. -HCFASSERT ( p->BUF_CNT == (p->buf_addr[5 ] + (p->buf_addr[4 ]<<8 ) +2 *6 +2 -8 ), p->BUF_CNT ); -// perform decapsulation -HCFASSERT (p->BUF_SIZE >=8 , p->BUF_SIZE); -// move SA[2:5] in the second buffer to replace part of the SNAP header -for ( i=3 ; i >=0 ; i--) p->buf_addr[i+8 ] = p->buf_addr[i]; -// copy DA[0:5], SA[0:1] from first buffer to second buffer -for ( i=0 ; i<8 ; i++) p->buf_addr[i] = descp->buf_addr[HFS_ADDR_DEST + i]; -// make first buffer shorter in count - descp->BUF_CNT =HFS_ADDR_DEST ; - } +int i; +DESC_STRCT *p = descp->next_desc_addr;//pointer to 2nd descriptor of frame +HCFASSERT (p,0 ); +// The 2nd descriptor contains (maybe) a SNAP header plus part or whole of the payload. +//determine decapsulation sub-flag in RxFS + i = *(wci_recordp)&descp->buf_addr[HFS_STAT ] & (HFS_STAT_MSG_TYPE |HFS_STAT_ERR ); +if ( i ==HFS_STAT_TUNNEL || + ( i ==HFS_STAT_1042 &&hcf_encap ( (wci_bufp)&p->buf_addr[HCF_DASA_SIZE ] ) !=ENC_TUNNEL )) { +// The 2nd descriptor contains a SNAP header plus part or whole of the payload. +HCFASSERT ( p->BUF_CNT == (p->buf_addr[5 ] + (p->buf_addr[4 ]<<8 ) +2 *6 +2 -8 ), p->BUF_CNT ); +// perform decapsulation +HCFASSERT (p->BUF_SIZE >=8 , p->BUF_SIZE); +// move SA[2:5] in the second buffer to replace part of the SNAP header +for ( i=3 ; i >=0 ; i--) p->buf_addr[i+8 ] = p->buf_addr[i]; +// copy DA[0:5], SA[0:1] from first buffer to second buffer +for ( i=0 ; i<8 ; i++) p->buf_addr[i] = descp->buf_addr[HFS_ADDR_DEST + i]; +// make first buffer shorter in count + descp->BUF_CNT =HFS_ADDR_DEST ; } + }#endif // HCF_ENC if ( descp ==NULL ) ifbp->IFB_DmaPackets &= (hcf_16 )~HREG_EV_RDMAD ;//;?could be integrated into get_frame_lst HCFLOGEXIT (HCF_TRACE_DMA_RX_GET );
@@ -1634,18 +1615,16 @@ hcf_dma_tx_get( IFBP ifbp )DESC_STRCT *descp;// pointer to start of FrameList descp =get_frame_lst ( ifbp,DMA_TX ); -if ( descp && descp->buf_addr )//!be aware of the missing curly bracket +if ( descp && descp->buf_addr ) {//skip decapsulation at confined descriptor #if (HCF_ENCAP ) ==HCF_ENC -if ( ( descp->BUF_CNT ==HFS_TYPE ) -#if (HCF_TYPE) & HCF_TYPE_CCX - || ( descp->BUF_CNT ==HFS_DAT ) -#endif // HCF_TYPE_CCX - ) {// perform decapsulation if needed +if ( ( descp->BUF_CNT ==HFS_TYPE )) { +// perform decapsulation if needed descp->next_desc_addr->buf_phys_addr -=HCF_DASA_SIZE ; descp->next_desc_addr->BUF_CNT +=HCF_DASA_SIZE ; }#endif // HCF_ENC + }if ( descp ==NULL ) {//;?could be integrated into get_frame_lst ifbp->IFB_DmaPackets &= (hcf_16 )~HREG_EV_TDMAD ; }
@@ -1792,49 +1771,20 @@ hcf_dma_tx_put( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl )HCFASSERT ( descp->BUF_SIZE >=HCF_DMA_TX_BUF1_SIZE , descp->BUF_SIZE );//minimal storage for encapsulation HCFASSERT ( p->BUF_CNT >=14 , p->BUF_CNT );//at least DA, SA and 'type' in 2nd buffer -#if (HCF_TYPE ) &HCF_TYPE_CCX -/* if we are doing PPK +/- CMIC, or we are sending a DDP frame */ -if ( ( ifbp->IFB_CKIPStat ==HCF_ACT_CCX_ON ) || - ( ( p->BUF_CNT >=20 ) && ( ifbp->IFB_CKIPStat ==HCF_ACT_CCX_OFF ) && - ( p->buf_addr[12 ] ==0xAA ) && ( p->buf_addr[13 ] ==0xAA ) && - ( p->buf_addr[14 ] ==0x03 ) && ( p->buf_addr[15 ] ==0x00 ) && - ( p->buf_addr[16 ] ==0x40 ) && ( p->buf_addr[17 ] ==0x96 ) && - ( p->buf_addr[18 ] ==0x00 ) && ( p->buf_addr[19 ] ==0x00 ))) - { -/* copy the DA/SA to the first buffer */ -for ( i =0 ; i <HCF_DASA_SIZE ; i++ ) { - descp->buf_addr[i +HFS_ADDR_DEST ] = p->buf_addr[i]; + descp->buf_addr[HFS_TYPE -1 ] =hcf_encap (&descp->next_desc_addr->buf_addr[HCF_DASA_SIZE ]);/*4*/ +if ( descp->buf_addr[HFS_TYPE -1 ] !=ENC_NONE ) { +for ( i=0 ; i <HCF_DASA_SIZE ; i++ ) {/*6*/ + descp->buf_addr[i +HFS_ADDR_DEST ] = descp->next_desc_addr->buf_addr[i]; } -/* calculate the length of the second fragment only */ - i =0 ; -do { i += p->BUF_CNT; }while ( p = p->next_desc_addr ); - i -=HCF_DASA_SIZE ; -/* convert the length field to big endian, using the endian friendly macros */ - i =CNV_SHORT_TO_BIG (i);//!! this converts ONLY on LE platforms, how does that relate to the non-CCX code - *(hcf_16 *)(&descp->buf_addr[HFS_LEN ]) = (hcf_16 )i; - descp->BUF_CNT =HFS_DAT ; -// modify 2nd descriptor to skip the 'Da/Sa' fields - descp->next_desc_addr->buf_phys_addr +=HCF_DASA_SIZE ; - descp->next_desc_addr->BUF_CNT -=HCF_DASA_SIZE ; - } - else -#endif // HCF_TYPE_CCX - { - descp->buf_addr[HFS_TYPE -1 ] =hcf_encap (&descp->next_desc_addr->buf_addr[HCF_DASA_SIZE ]);/*4*/ -if ( descp->buf_addr[HFS_TYPE -1 ] !=ENC_NONE ) { -for ( i=0 ; i <HCF_DASA_SIZE ; i++ ) {/*6*/ - descp->buf_addr[i +HFS_ADDR_DEST ] = descp->next_desc_addr->buf_addr[i]; - } - i =sizeof (snap_header) +2 - (2 *6 +2 ); -do { i += p->BUF_CNT; }while ( ( p = p->next_desc_addr ) !=NULL ); - *(hcf_16 *)(&descp->buf_addr[HFS_LEN ]) =CNV_END_SHORT (i);//!! this converts on ALL platforms, how does that relate to the CCX code -for ( i=0 ; i <sizeof (snap_header) -1 ; i++) { - descp->buf_addr[HFS_TYPE -sizeof (snap_header) + i] = snap_header[i]; - } - descp->BUF_CNT =HFS_TYPE ;/*8*/ - descp->next_desc_addr->buf_phys_addr +=HCF_DASA_SIZE ; - descp->next_desc_addr->BUF_CNT -=HCF_DASA_SIZE ; + i =sizeof (snap_header) +2 - (2 *6 +2 ); +do { i += p->BUF_CNT; }while ( ( p = p->next_desc_addr ) !=NULL ); + *(hcf_16 *)(&descp->buf_addr[HFS_LEN ]) =CNV_END_SHORT (i);//!! this converts on ALL platforms, how does that relate to the CCX code +for ( i=0 ; i <sizeof (snap_header) -1 ; i++) { + descp->buf_addr[HFS_TYPE -sizeof (snap_header) + i] = snap_header[i]; } + descp->BUF_CNT =HFS_TYPE ;/*8*/ + descp->next_desc_addr->buf_phys_addr +=HCF_DASA_SIZE ; + descp->next_desc_addr->BUF_CNT -=HCF_DASA_SIZE ; }#endif // HCF_ENC }
@@ -2708,54 +2658,36 @@ hcf_send_msg( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl )#endif // HCF_TYPE_TX_DELAY OPW (HREG_DATA_1 , tx_cntl ) ;OPW (HREG_DATA_1 ,0 ); -#if ! ( (HCF_TYPE ) &HCF_TYPE_CCX ) +HCFASSERT ( p->BUF_CNT >=14 , p->BUF_CNT );/* assume DestAddr/SrcAddr/Len/Type ALWAYS contained in 1st fragment * otherwise life gets too cumbersome for MIC and Encapsulation !!!!!!!! if ( p->BUF_CNT >= 14 ) { alternatively: add a safety escape !!!!!!!!!!!! } */ -#endif // HCF_TYPE_CCX +CALC_TX_MIC (NULL ,-1 );//initialize MIC /*10*/ put_frag( ifbp, p->buf_addr, HCF_DASA_SIZE BE_PAR(0) ); //write DA, SA with MIC calculationCALC_TX_MIC ( p->buf_addr,HCF_DASA_SIZE );//MIC over DA, SA CALC_TX_MIC ( null_addr,4 );//MIC over (virtual) priority field -#if (HCF_TYPE ) &HCF_TYPE_CCX -//!!be careful do not use positive test on HCF_ACT_CCX_OFF, because IFB_CKIPStat is initially 0 -if (( ifbp->IFB_CKIPStat ==HCF_ACT_CCX_ON ) || - ((GET_BUF_CNT (p) >=20 ) && ( ifbp->IFB_CKIPStat ==HCF_ACT_CCX_OFF ) && - (p->buf_addr[12 ] ==0xAA ) && (p->buf_addr[13 ] ==0xAA ) && - (p->buf_addr[14 ] ==0x03 ) && (p->buf_addr[15 ] ==0x00 ) && - (p->buf_addr[16 ] ==0x40 ) && (p->buf_addr[17 ] ==0x96 ) && - (p->buf_addr[18 ] ==0x00 ) && (p->buf_addr[19 ] ==0x00 ))) - { - i =HCF_DASA_SIZE ; - -OPW (HREG_DATA_1 ,CNV_SHORT_TO_BIG ( len - i )); -/* need to send out the remainder of the fragment */ - put_frag( ifbp, &p->buf_addr[i], GET_BUF_CNT(p) - i BE_PAR(0) ); - } - else -#endif // HCF_TYPE_CCX - {//if encapsulation needed #if (HCF_ENCAP ) ==HCF_ENC //write length (with SNAP-header,Type, without //DA,SA,Length ) no MIC calc. -if ( ( snap_header[sizeof (snap_header)-1 ] =hcf_encap ( &p->buf_addr[HCF_DASA_SIZE ] ) ) !=ENC_NONE ) { -OPW (HREG_DATA_1 ,CNV_END_SHORT ( len + (sizeof (snap_header) +2 ) - (2 *6 +2 ) ) ); +if ( ( snap_header[sizeof (snap_header)-1 ] =hcf_encap ( &p->buf_addr[HCF_DASA_SIZE ] ) ) !=ENC_NONE ) { +OPW (HREG_DATA_1 ,CNV_END_SHORT ( len + (sizeof (snap_header) +2 ) - (2 *6 +2 ) ) );//write splice with MIC calculation -put_frag ( ifbp, snap_header,sizeof (snap_header )BE_PAR (0 ) ); -CALC_TX_MIC ( snap_header,sizeof (snap_header) );//MIC over 6 byte SNAP - i =HCF_DASA_SIZE ; - } else +put_frag ( ifbp, snap_header,sizeof (snap_header )BE_PAR (0 ) ); +CALC_TX_MIC ( snap_header,sizeof (snap_header) );//MIC over 6 byte SNAP + i =HCF_DASA_SIZE ; + } else#endif // HCF_ENC - { -OPW (HREG_DATA_1 , *(wci_recordp)&p->buf_addr[HCF_DASA_SIZE ] ); - i =14 ; - } -//complete 1st fragment starting with Type with MIC calculation - put_frag( ifbp, &p->buf_addr[i], p->BUF_CNT - i BE_PAR(0) ); -CALC_TX_MIC ( &p->buf_addr[i], p->BUF_CNT - i ); + { +OPW (HREG_DATA_1 , *(wci_recordp)&p->buf_addr[HCF_DASA_SIZE ] ); + i =14 ; } +//complete 1st fragment starting with Type with MIC calculation + put_frag( ifbp, &p->buf_addr[i], p->BUF_CNT - i BE_PAR(0) ); +CALC_TX_MIC ( &p->buf_addr[i], p->BUF_CNT - i ); +//do the remaining fragments with MIC calculation while ( ( p = p->next_desc_addr ) !=NULL ) {/* obnoxious c:/hcf/hcf.c(1480) : warning C4769: conversion of near pointer to long integer,
@@ -3116,25 +3048,19 @@ hcf_service_nic( IFBP ifbp, wci_bufp bufp, unsigned int len )CALC_RX_MIC ( null_addr,4 );//. MIC over (virtual) priority field CALC_RX_MIC ( buf_addr+14 ,8 );//. skip Len, MIC over SNAP,Type or 8 data bytes) buf_addr +=22 ; -#if (HCF_TYPE ) &HCF_TYPE_CCX -//!!be careful do not use positive test on HCF_ACT_CCX_OFF, because IFB_CKIPStat is initially 0 - if( ifbp->IFB_CKIPStat != HCF_ACT_CCX_ON ) -#endif // HCF_TYPE_CCX - {#if (HCF_ENCAP ) ==HCF_ENC -HCFASSERT ( len >=HFS_DAT +2 +sizeof (snap_header), len ); -/*34*/ i = *(wci_recordp)&bufp[HFS_STAT ] & (HFS_STAT_MSG_TYPE |HFS_STAT_ERR ); -if ( i ==HFS_STAT_TUNNEL || - ( i ==HFS_STAT_1042 &&hcf_encap ( (wci_bufp)&bufp[HFS_TYPE ] ) !=ENC_TUNNEL ) ) { +HCFASSERT ( len >=HFS_DAT +2 +sizeof (snap_header), len ); +/*34*/ i = *(wci_recordp)&bufp[HFS_STAT ] & (HFS_STAT_MSG_TYPE |HFS_STAT_ERR ); +if ( i ==HFS_STAT_TUNNEL || + ( i ==HFS_STAT_1042 &&hcf_encap ( (wci_bufp)&bufp[HFS_TYPE ] ) !=ENC_TUNNEL ) ) {//. copy E-II Type to 802.3 LEN field -/*36*/ bufp[HFS_LEN ] = bufp[HFS_TYPE ]; - bufp[HFS_LEN +1 ] = bufp[HFS_TYPE +1 ]; +/*36*/ bufp[HFS_LEN ] = bufp[HFS_TYPE ]; + bufp[HFS_LEN +1 ] = bufp[HFS_TYPE +1 ];//. discard Snap by overwriting with data - ifbp->IFB_RxLen -= (HFS_TYPE -HFS_LEN ); - buf_addr -= (HFS_TYPE -HFS_LEN );// this happens to bring us at a DW boundary of 36 - } -#endif // HCF_ENC + ifbp->IFB_RxLen -= (HFS_TYPE -HFS_LEN ); + buf_addr -= (HFS_TYPE -HFS_LEN );// this happens to bring us at a DW boundary of 36 } +#endif // HCF_ENC }/*40*/ ifbp->IFB_lal =min ( (hcf_16)(len -HFS_ADDR_DEST ), ifbp->IFB_RxLen ); i = ifbp->IFB_lal - ( buf_addr - ( bufp +HFS_ADDR_DEST ) );
drivers/staging/wlags49_h2/hcf.h +0 -3
@@ -336,9 +336,6 @@ typedef struct {#endif // HCF_ASSERT_PRINTF #endif // HCF_ASSERT hcf_16 volatile IFB_IntOffCnt;// 0xFFFF based HCF_ACT_INT_OFF nesting counter, DeepSleep flag -#if (HCF_TYPE ) &HCF_TYPE_CCX -hcf_16 IFB_CKIPStat;// CKIP Status flag -#endif // HCF_TYPE_CCX #if (HCF_TALLIES ) & (HCF_TALLIES_NIC |HCF_TALLIES_HCF )//Hermes and/or HCF tally support hcf_32 IFB_Silly_you_should_align;//;? hcf_16 IFB_TallyLen;// Tally length (to build an LTV)
Signature · 1 line
1.7.4.1
PATCH 11/13 staging: wlags49_h2: Remove HCF_EXT_MB from code.
In reply to David KilroyThe HII and HII.5 configurations both use the mailboxes.
--- drivers/staging/wlags49_h2/hcf.c | 28 ++++++++-------------------- drivers/staging/wlags49_h2/hcf.h | 2 -- 2 files changed, 8 insertions(+), 22 deletions(-)
drivers/staging/wlags49_h2/hcf.c +8 -20
@@ -104,9 +104,7 @@ HCF_STATIC int cmd_exe( IFBP ifbp, hcf_16 cmd_code, hcf_16 par_0 ); HCF_STATIC int init( IFBP ifbp ); HCF_STATIC int put_info( IFBP ifbp, LTVP ltvp ); -#if (HCF_EXT ) &HCF_EXT_MB HCF_STATIC int put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp ); -#endif // HCF_EXT_MB #if (HCF_TYPE ) &HCF_TYPE_WPA HCF_STATIC void calc_mic( hcf_32* p, hcf_32 M );void calc_mic_rx_frag (IFBP ifbp,wci_bufp p,int len );
@@ -473,14 +471,10 @@ static struct /*CFG_HCF_OPT_STRCT*/ { }; // cfg_hcf_opt#endif // MSF_COMPONENT_ID -#if definedMSF_COMPONENT_ID || (HCF_EXT ) &HCF_EXT_MB -#if (HCF_EXT ) &HCF_EXT_MB HCF_STATIC LTV_STRCT BASED cfg_null = { 1, CFG_NULL, {0} }; -#endif // HCF_EXT_MB + HCF_STATIC hcf_16* BASED xxxx[ ] = { -#if (HCF_EXT) & HCF_EXT_MB &cfg_null.len,//CFG_NULL 0x0820 -#endif // HCF_EXT_MB #if defined MSF_COMPONENT_ID &cfg_drv_identity.len,//CFG_DRV_IDENTITY 0x0826 &cfg_drv_sup_range.len, //CFG_DRV_SUP_RANGE 0x0827
@@ -496,8 +490,6 @@ HCF_STATIC hcf_16* BASED xxxx[ ] = { };#define xxxx_PRI_IDENTITY_OFFSET (ARRAY_SIZE(xxxx) - 3) -#endif // MSF_COMPONENT_ID / HCF_EXT_MB -/************************************************************************************************************ ************************** T O P L E V E L H C F R O U T I N E S **************************************
@@ -1974,16 +1966,16 @@ hcf_get_info( IFBP ifbp, LTVP ltvp )HCFASSERT (1 < ltvp->len && ltvp->len <=HCF_MAX_LTV +1 ,MERGE_2 ( ltvp->typ, ltvp->len ) ); ltvp->len =0 ;//default to: No Info Available -#if definedMSF_COMPONENT_ID || (HCF_EXT ) &HCF_EXT_MB //filter out all specials +//filter out all specials for ( i =0 ; ( q = xxxx[i] ) !=NULL && q[1 ] != type; i++ )/*NOP*/ ; -#endif // MSF_COMPONENT_ID / HCF_EXT_MB +#if HCF_TALLIES if ( type ==CFG_TALLIES ) {/*3*/ (void )hcf_action ( ifbp,HCF_ACT_TALLIES ); q = (hcf_16 *)&ifbp->IFB_TallyLen; }#endif // HCF_TALLIES -#if (HCF_EXT ) &HCF_EXT_MB +if ( type ==CFG_MB_INFO ) {if ( ifbp->IFB_MBInfoLen ) {if ( ifbp->IFB_MBp[ifbp->IFB_MBRp] ==0xFFFF ) {
@@ -1997,7 +1989,7 @@ hcf_get_info( IFBP ifbp, LTVP ltvp ) ifbp->IFB_MBInfoLen = ifbp->IFB_MBp[ifbp->IFB_MBRp]; } } -#endif // HCF_EXT_MB +if ( q !=NULL ) {//a special or CFG_TALLIES or CFG_MB_INFO i =min ( len, *q ) +1 ;//total size of destination (including T-field) while ( i-- ) {
@@ -2203,7 +2195,7 @@ hcf_put_info( IFBP ifbp, LTVP ltvp )if ( ( ltvp->val[0 ] &USE_DMA ) ==0 ) ifbp->IFB_CntlOpt &= ~USE_DMA ; ifbp->IFB_CntlOpt |= ltvp->val[0 ] &USE_16BIT ;break ; -#if (HCF_EXT ) &HCF_EXT_MB +case CFG_REG_MB ://Register MailBox #define P ((CFG_REG_MB_STRCT FAR *)ltvp)HCFASSERT ( ( (hcf_32 )P ->mb_addr &0x0001 ) ==0 , (hcf_32 )P ->mb_addr );
@@ -2220,7 +2212,6 @@ hcf_put_info( IFBP ifbp, LTVP ltvp )case CFG_MB_INFO ://store MailBoxInfoBlock rc = put_info_mb( ifbp, (CFG_MB_INFO_STRCT FAR *)ltvp );break ; -#endif // HCF_EXT_MB #if (HCF_EXT ) &HCF_EXT_NIC_ACCESS case CFG_CMD_NIC :
@@ -4336,11 +4327,11 @@ mdd_assert( IFBP ifbp, unsigned int line_number, hcf_32 q )OPW (HREG_SW_2 , (hcf_16)(q >>16 ) );#endif // HCF_ASSERT_SW_SUP -#if (HCF_EXT ) &HCF_EXT_MB && (HCF_ASSERT ) &HCF_ASSERT_MB +#if (HCF_ASSERT ) &HCF_ASSERT_MB ifbp->IFB_AssertLvl =0 ;// prevent recursive behavior hcf_put_info ( ifbp, (LTVP )&ifbp->IFB_AssertStrct ); ifbp->IFB_AssertLvl = run_time_flag;// restore appropriate filter level -#endif // HCF_EXT_MB / HCF_ASSERT_MB +#endif // HCF_ASSERT_MB } }// mdd_assert #endif // HCF_ASSERT
@@ -4619,7 +4610,6 @@ put_info( IFBP ifbp, LTVP ltvp )*.ENDDOC END DOCUMENTATION * ************************************************************************************************************/ -#if (HCF_EXT ) &HCF_EXT_MB HCF_STATIC int put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp )
@@ -4677,8 +4667,6 @@ put_info_mb( IFBP ifbp, CFG_MB_INFO_STRCT FAR * ltvp )return rc; }// put_info_mb -#endif // HCF_EXT_MB -/************************************************************************************************************ *
drivers/staging/wlags49_h2/hcf.h +0 -2
@@ -301,13 +301,11 @@ typedef struct {#if (HCF_EXT ) &HCF_EXT_INT_TICK int IFB_TickCnt;// Hermes Timer Tick Counter #endif // HCF_EXT_INT_TICK -#if (HCF_EXT ) &HCF_EXT_MB hcf_16 *IFB_MBp;// pointer to the MailBox hcf_16 IFB_MBSize;// size of the MailBox hcf_16 IFB_MBWp;// zero-based write index into the MailBox hcf_16 IFB_MBRp;// zero-based read index into the MailBox hcf_16 IFB_MBInfoLen;// contents of L-field of the oldest available MailBoxInfoBlock -#endif // HCF_EXT_MB #if (HCF_TYPE ) &HCF_TYPE_WPA hcf_16 IFB_MICTxCntl;// MIC bit and Key index in TxControl field of TxFS hcf_32 IFB_MICTxKey[2 ];// calculating key
Signature · 1 line
1.7.4.1
PATCH 12/13 staging: wlags49_h2: Reformat TX_CNTL comment
In reply to David KilroyThis tabular comment is useful, but the original tabbed layout is for a tab-wdth of 4. Reformat with spaces.
--- drivers/staging/wlags49_h2/mdd.h | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-)
drivers/staging/wlags49_h2/mdd.h +14 -14
@@ -893,20 +893,20 @@ XX1( CFG_SCAN, SCAN_RS_STRCT, scan_result[32] ) /*Scan results *//HFS_TX_CNTL /* Note that the HCF_.... System Constants influence the HFS_.... values below -* H-I H-I | H-II H-II H-II.5 -* WPA | WPA -* HFS_TX_CNTL_TX_OK 0002 0002 | 0002 0002 N/A <<<<<<<<deprecated -* HFS_TX_CNTL_TX_EX 0004 0004 | 0004 0004 N/A -* HFS_TX_CNTL_MIC N/A 0010 | N/A 0010 N/A -* HFS_TX_CNTL_TID N/A N/A | N/A N/A 000F -* HFS_TX_CNTL_SERVICE_CLASS N/A N/A | N/A N/A 00C0 -* HFS_TX_CNTL_PORT 0700 0700 | 0700 0700 0700 -* HFS_TX_CNTL_MIC_KEY_ID 1800 1800 | 0000 1800 N/A -* HFS_TX_CNTL_CKIP 0000 0000 | 0000 2000 2000 -* HFS_TX_CNTL_TX_DELAY 4000 4000 | 4000 4000 N/A -* HFS_TX_CNTL_ACTION N/A N/A | N/A N/A 4000 -* ==== ==== | ==== ==== ==== -* 5F06 5F16 | 4706 7F06 67CF +* H-I H-I | H-II H-II H-II.5 +* WPA | WPA +* HFS_TX_CNTL_TX_OK 0002 0002 | 0002 0002 N/A <<<<<<<<deprecated +* HFS_TX_CNTL_TX_EX 0004 0004 | 0004 0004 N/A +* HFS_TX_CNTL_MIC N/A 0010 | N/A 0010 N/A +* HFS_TX_CNTL_TID N/A N/A | N/A N/A 000F +* HFS_TX_CNTL_SERVICE_CLASS N/A N/A | N/A N/A 00C0 +* HFS_TX_CNTL_PORT 0700 0700 | 0700 0700 0700 +* HFS_TX_CNTL_MIC_KEY_ID 1800 1800 | 0000 1800 N/A +* HFS_TX_CNTL_CKIP 0000 0000 | 0000 2000 2000 +* HFS_TX_CNTL_TX_DELAY 4000 4000 | 4000 4000 N/A +* HFS_TX_CNTL_ACTION N/A N/A | N/A N/A 4000 +* ==== ==== | ==== ==== ==== +* 5F06 5F16 | 4706 7F06 67CF * * HCF_TX_CNTL_MASK specifies the bits allowed on the Host I/F * note: bit 0x4000 has different meaning for H-II and H-II.5
Signature · 1 line
1.7.4.1
PATCH 13/13 staging: wlags49_h2: Remove continuous tx test
In reply to David Kilroy--- drivers/staging/wlags49_h2/hcf.c | 22 ---------------------- 1 files changed, 0 insertions(+), 22 deletions(-)
drivers/staging/wlags49_h2/hcf.c +0 -22
@@ -2596,28 +2596,6 @@ hcf_send_msg( IFBP ifbp, DESC_STRCT *descp, hcf_16 tx_cntl )if ( descp ) ifbp->IFB_TxFID =0 ;//cancel a pre-put message -#if (HCF_EXT ) &HCF_EXT_TX_CONT // Continuous transmit test -if ( tx_cntl ==HFS_TX_CNTL_TX_CONT ) { - fid =get_fid (ifbp); -if (fid !=0 ) { -//setup BAP to begin of TxFS - (void )setup_bap ( ifbp, fid,0 ,IO_OUT ); -//copy all the fragments in a transparent fashion -for ( p = descp; p; p = p->next_desc_addr ) { -/* obnoxious warning C4769: conversion of near pointer to long integer */ -HCFASSERT ( ((hcf_32 )p &3 ) ==0 , (hcf_32 )p ); - put_frag( ifbp, p->buf_addr, p->BUF_CNT BE_PAR(0) ); - } - rc =cmd_exe ( ifbp,HCMD_THESEUS |HCMD_BUSY |HCMD_STARTPREAMBLE , fid ); -if ( ifbp->IFB_RscInd ==0 ) { - ifbp->IFB_RscInd =get_fid ( ifbp ); - } - } -// een slecht voorbeeld doet goed volgen ;? -HCFLOGEXIT (HCF_TRACE_SEND_MSG ); -return rc; - } -#endif // HCF_EXT_TX_CONT /* the following initialization code is redundant for a pre-put message * but moving it inside the "if fid" logic makes the merging with the * USB flow awkward
Signature · 1 line
1.7.4.1
David,
Nice work! It looks like you managed to understand how some of the HCF code actually works... I found it rather unreadable but I also lack the knowledge of the inner working of Agere's Hermes II chip.
Op 16-9-2011 1:20, David Kilroy schreef:
Quoted 2 lines
Verified be recompiling and confirming there are no changes to the binary (except line offsets from calls to
mdd_assert).
I applied your patches against the current 3.0 linux kernel driver code and compiled it on my Ubuntu 11.04 system (2.6.38-11). I can confirm the modified driver is still working okay using a Thomson Speedtouch 110 Wifi card with WEP. WPA was - and I guess still is - non functional. The driver is very stable in WEP mode; the laptop is frequently used for bittorrent and Tweetdeck and never crashes.
The only known problem (besides WPA) is removal and reinserting the PCMCIA card. It is not recognized anymore on that slot. The card works on a second PCMCIA slot. This is old behaviour and not due to your changes (however this worked with older kernels).
Kind regards,
Henk.
Quoted 4 lines · Henk de Groot
I applied your patches against the current 3.0 linux kernel driver code and compiled it on my Ubuntu 11.04 system (2.6.38-11). I can confirm the modified driver is still working okay using a Thomson Speedtouch 110 Wifi card with WEP.
Thanks for confirming this.
Quoted 1 line
WPA was - and I guess still is - non functional.
Do you have any idea why this is happening? If the WPA bits are verbatim from the 7.22 Agere driver this should be functional. I can only think that some WEXT changes have caused this breakage.
Quoted 4 lines
The only known problem (besides WPA) is removal and reinserting the PCMCIA card. It is not recognized anymore on that slot. The card works on a second PCMCIA slot. This is old behaviour and not due to your changes (however this worked with older kernels).
I have less idea about what is happening here, but it sounds like there's insufficient initialisation/cleanup.
If you post (or point me at) a WPA supplicant log (with -ddd) I'll take a look at the problem. I may also submit a patch to remove the unused code in wl_wext.c - it seems trivial to fix up.
Dave.