diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2009-11-12 18:46:24 -0800 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2009-11-12 18:46:24 -0800 |
commit | 9b213f53c0858384d639ce002fec21f3f82a2ca1 (patch) | |
tree | eb956c834511fabb52ce97c73837b8ffe8934c11 /wilink_6_1/platforms/os | |
parent | 2c2f52e482a7e2577ec586d7d00a27cf08619420 (diff) | |
download | ti-9b213f53c0858384d639ce002fec21f3f82a2ca1.tar.gz |
eclair snapshot
Diffstat (limited to 'wilink_6_1/platforms/os')
44 files changed, 14952 insertions, 0 deletions
diff --git a/wilink_6_1/platforms/os/common/build/linux/Makefile b/wilink_6_1/platforms/os/common/build/linux/Makefile new file mode 100644 index 0000000..9e92d2a --- /dev/null +++ b/wilink_6_1/platforms/os/common/build/linux/Makefile @@ -0,0 +1,135 @@ + +## +## +## File lists and locations +## +## + +# +# DK_ROOT must be set prior to including common.inc +# +DK_ROOT = ../../../../.. + +# +# Includes common definitions and source file list +# +ifneq ($(KERNELRELEASE),) + include $(M)/$(DK_ROOT)/stad/build/linux/common.inc + include $(M)/$(DK_ROOT)/platforms/os/common/build/linux/os_sources.inc +else + include $(DK_ROOT)/stad/build/linux/common.inc + include $(DK_ROOT)/platforms/os/common/build/linux/os_sources.inc +endif + + +# +# List of platform independent OS files needed to be compiled +# +OS_SRCS = \ + $(DK_ROOT)/platforms/os/common/src/osRgstry.c \ + $(COMSRC)/Ctrl_Interface/CmdHndlr.c \ + +ifeq ($(TI_TRACE_BUFFER),y) + OS_SRCS += $(DK_ROOT)/platforms/os/common/src/tracebuf.c +endif + +OS_OBJS = $(patsubst %.c, %.o, $(OS_SRCS)) + +# +# OS include paths required for compilation. +# +OS_INCS = $(DK_ROOT)/platforms/os/linux/inc $(DK_ROOT)/platforms/os/linux/src $(DK_ROOT)/platforms/os/common/inc + +# +# Location and filename of the OS .lib file created by this makefile. +# +OUTPUT_DIR = $(DK_ROOT)/platforms/os/common/build/linux +OUTPUT_FILE = $(OUTPUT_DIR)/libuadrv.a + + + + + +## +## +## Build process +## +## + +ifneq ($(KERNELRELEASE),) + + + ## + ## + ## This is the kernel build phase - set the appropriate arguments + ## + ## + + # + # Adds the current directory as a prefix to all include directories. + # + EXTRA_CFLAGS += $(addprefix -I$(M)/, $(OS_DK_INCS) $(OS_INCS)) + + # + # Intermediate object name - this should be converted to the appropriate library file + # after the kernel makefile finishes its work. + # + obj-m = tiwlan_drv.o + + # + # List of object files the kernel makefile needs to compile. + # + tiwlan_drv-y = $(OS_OBJS) $(OS_AUXILIARY_LIBS) + + +else # ifneq ($(KERNELRELEASE),) + + +## +## +## This is the regular build phase - act according to the make actions +## +## + +# +# The location of the kernel makefile +# +KERNEL_DIR ?= + + +# +# Build the OS lib file +# +.PHONY: all +all: .depend $(OUTPUT_FILE) + +# +# Prints variables +# +.PHONY: help +help: + @echo Default Compilation: PLATFORM=$(PLATFORM) DEBUG=$(DEBUG) INTR=$(INTR) WSPI=$(WSPI) XCC=$(XCC) EXTRA CFLAGS: $(EXTRA_CFLAGS) + + +# +# Recursively cleans the OS lib object files +# +.PHONY: clean +clean: + $(MAKE) -C $(KERNEL_DIR) M=`pwd` ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) clean + @rm -f *.o .*.o.cmd *~ *.a *.~* core .depend dep $(OS_OBJS) +# +# Causes the library file to get rebuilt +# +.depend: + rm -f $(OUTPUT_FILE) + +# +# Recursively builds the library file +# +$(OUTPUT_FILE): + $(MAKE) -C $(KERNEL_DIR) M=`pwd` ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules + @$(CROSS_COMPILE)$(AR) rcs $@ $(OS_OBJS) + + +endif # ifneq ($(KERNELRELEASE),) diff --git a/wilink_6_1/platforms/os/common/build/linux/common.inc b/wilink_6_1/platforms/os/common/build/linux/common.inc new file mode 100644 index 0000000..305e864 --- /dev/null +++ b/wilink_6_1/platforms/os/common/build/linux/common.inc @@ -0,0 +1,169 @@ + + +## +## +## Directory Locations +## +## + +COMMON := $(DK_ROOT)/stad +COMSRC := $(COMMON)/src +TWD := $(DK_ROOT)/TWD +UTILS := $(DK_ROOT)/utils +TESTSRC := $(DK_ROOT)/Test +LINUX_PFORM := $(DK_ROOT)/platforms/os/linux +PLATFORMS := $(DK_ROOT)/platforms +EXT_DRV := $(DK_ROOT)/external_drivers +EXT_APP := $(DK_ROOT)/external_apps +TXN := $(DK_ROOT)/Txn + +## +## +## Make Flags +## +## + +# +# Compile with FW1273 or FW1251 +# +FW ?= 1273 + +# +# Compile with XCC support or not +# +XCC ?= n + +# +# Choose the bus type (n for SDIO, y for WSPI) +# +WSPI ?= n + +# +# Use periodic interrupt +# +INTR ?= y + +# +# Enable or disable debugging +# +DEBUG ?= y +KERNEL_DEBUGGER ?= n +STRIP ?= y +BMTRACE ?= n +# +# Enable or disable OS and init messages +# +INFO ?= n + +# +# 1273 FPGA platform +# +FPGA1273 ?= n + +# +# Enable trace buffer +# +TI_TRACE_BUFFER ?= n + +## +## +## Driver Compilation Directives +## +## +ifeq "$(HOST_PLATFORM)" "omap3430" + DK_DEFINES += -D HOST_PLATFORM_OMAP3430 +endif +ifeq "$(HOST_PLATFORM)" "zoom2" + DK_DEFINES += -D HOST_PLATFORM_ZOOM2 +endif +ifeq "$(HOST_PLATFORM)" "zoom1" + DK_DEFINES += -D HOST_PLATFORM_ZOOM1 +endif + +ifeq ($(XCC),y) + DK_DEFINES += -D XCC_MODULE_INCLUDED +endif + +ifeq ($(INTR),n) + DK_DEFINES += -D PRIODIC_INTERRUPT +endif + +ifeq ($(DEBUG),y) + DK_DEFINES += -D TI_DBG + DK_DEFINES += -D REPORT_LOG + DK_DEFINES += -O2 + DK_DEFINES += -D PRINTF_ROLLBACK +else + DK_DEFINES += -D TI_DBG + DK_DEFINES += -U REPORT_LOG + DK_DEFINES += -O2 +endif +ifeq ($(KERNEL_DEBUGGER),y) + DK_DEFINES += -g -O2 + STRIP = n +endif +export KERNEL_DEBUGGER + +DK_DEFINES += -D __BYTE_ORDER_LITTLE_ENDIAN + +ifeq ($(TI_TRACE_BUFFER),y) + DK_DEFINES += -D TI_TRACE_BUF +endif + +ifeq ($(BMTRACE),y) + DK_DEFINES += -D TIWLAN_BMTRACE +endif + +## +## +## Platform Compilation Directives +## +## + +# +# Bus Driver +# +ifeq ($(WSPI),y) + BUS_DRV = spi + BUS_DRV_REMOVE = sdio + BUS_DRIVER_MODULE = spi.ko + PFORM_DEFINES += -D WSPI +else + BUS_DRV = sdio + BUS_DRV_REMOVE = spi + BUS_DRV = sdio + BUS_DRV_REMOVE = spi + BUS_DRIVER_MODULE = sdio.ko +endif + +ifeq ($(INFO),y) + PFORM_DEFINES += -D OS_INFO_MESSAGES + PFORM_DEFINES += -D INIT_MESSAGES +endif + +PFORM_DEFINES += -D HOST_COMPILE +PFORM_DEFINES += -D FW_RUNNING_AS_STA +PFORM_DEFINES += -D TNETW1273 + +ifeq ($(FPGA1273),y) + PFORM_DEFINES += -D FPGA1273_STAGE_ +endif + +ifeq ($(FULL_ASYNC),y) + PFORM_DEFINES += -D FULL_ASYNC_MODE +endif + +ifeq ($(USE_IRQ_ACTIVE_HIGH),y) + PFORM_DEFINES += -D USE_IRQ_ACTIVE_HIGH +endif + +## +## +## Miscellaneous Compilation Directivcs +## +## + +EXTRA_CFLAGS += -fsigned-char +EXTRA_CFLAGS += -D __LINUX__ +EXTRA_CFLAGS += $(DK_DEFINES) +EXTRA_CFLAGS += $(PFORM_DEFINES) diff --git a/wilink_6_1/platforms/os/common/build/linux/os_sources.inc b/wilink_6_1/platforms/os/common/build/linux/os_sources.inc new file mode 100644 index 0000000..7578954 --- /dev/null +++ b/wilink_6_1/platforms/os/common/build/linux/os_sources.inc @@ -0,0 +1,109 @@ + +#start of OS_DK_INCS_FILES# do not remove or change this comment +OS_DK_INCS_FILES = \ + $(COMMON)/Export_Inc/Ethernet.h \ + $(COMMON)/Export_Inc/TI_IPC_Api.h \ + $(COMMON)/Export_Inc/paramOut.h \ + $(COMMON)/Export_Inc/tiwlnif.h \ + $(COMMON)/Export_Inc/STADExternalIf.h \ + $(COMMON)/Export_Inc/bssTypes.h \ + $(COMMON)/Export_Inc/InternalCmdCodes.h \ + $(COMMON)/Export_Inc/coreDefaultParams.h \ + $(COMMON)/Export_Inc/TI_Results.h \ + $(COMMON)/Export_Inc/privateCmd.h \ + $(COMMON)/Export_Inc/p_buffer.h \ + $(COMSRC)/Sta_Management/mlmeApi.h \ + $(COMSRC)/Sta_Management/healthMonitor.h \ + $(COMSRC)/Connection_Managment/rsnApi.h \ + $(COMSRC)/Ctrl_Interface/DrvMain.h \ + $(COMSRC)/Ctrl_Interface/CmdHndlr.h \ + $(COMSRC)/Ctrl_Interface/CmdDispatcher.h \ + $(COMSRC)/Ctrl_Interface/CmdInterpret.h \ + $(COMSRC)/Ctrl_Interface/EvHandler.h \ + $(COMSRC)/Data_link/txDataQueue_Api.h \ + $(COMSRC)/Data_link/txMgmtQueue_Api.h \ + $(COMSRC)/Ctrl_Interface/DrvMainModules.h \ + $(COMSRC)/Application/roamingMngrTypes.h \ + $(COMSRC)/Application/scanMngrTypes.h \ + $(UTILS)/fsm.h \ + $(UTILS)/report.h \ + $(UTILS)/utils.h \ + $(UTILS)/tidef.h \ + $(UTILS)/rate.h \ + $(UTILS)/802_11Defs.h \ + $(UTILS)/osDot11.h \ + $(UTILS)/commonTypes.h \ + $(UTILS)/CmdInterfaceCodes.h \ + $(UTILS)/tiQosTypes.h \ + $(UTILS)/version.h \ + $(TWD)/TWDriver/TWDriver.h \ + $(TWD)/TWDriver/TWDriverMsr.h \ + $(TWD)/TWDriver/TWDriverRate.h \ + $(TWD)/TWDriver/TWDriverScan.h \ + $(TWD)/TWDriver/Device.h \ + $(TWD)/TWDriver/Device1273.h \ + $(TWD)/Ctrl/Export_Inc/CmdQueue_api.h \ + $(TWD)/MacServices/Export_Inc/MacServices_api.h \ + $(TWD)/FW_Transfer/Export_Inc/rxXfer_api.h \ + $(TWD)/FW_Transfer/Export_Inc/fwDebug_api.h \ + $(TWD)/FirmwareApi/public_descriptors.h \ + $(TWD)/FirmwareApi/public_infoele.h \ + $(TWD)/FirmwareApi/public_types.h \ + $(TWD)/FirmwareApi/public_host_int.h \ + $(TWD)/FirmwareApi/public_radio.h \ + $(TWD)/FirmwareApi/public_commands.h \ + $(TWD)/FirmwareApi/public_event_mbox.h \ + $(TWD)/TwIf/TwIf.h \ + $(TXN)/BusDrv.h \ + $(TXN)/TxnQueue.h \ + $(EXT_APP)/Linux/bmtrace/Export_Inc \ + $(TESTSRC)/debug.h + +#start of OS_DK_INCS_FILES_XCC# do not remove or change this comment +ifeq ($(XCC),y) + OS_DK_INCS_FILES_XCC = \ + $(COMMON)/Export_Inc/XCC/paramOutXCC.h \ + $(UTILS)/XCC/osDot11XCC.h + + OS_DK_INCS_FILES += $(OS_DK_INCS_FILES_XCC) +endif +#end of OS_DK_INCS_FILES_XCC# do not remove or change this comment + +#start of OS_DK_INCS_FILES# do not remove or change this comment + + +#start of OS_DK_INCS# do not remove or change this comment +OS_DK_INCS = \ + $(COMMON)/Export_Inc \ + $(COMSRC)/AirLink_Managment \ + $(COMSRC)/Application \ + $(COMSRC)/Connection_Managment \ + $(COMSRC)/Ctrl_Interface \ + $(COMSRC)/Data_link \ + $(COMSRC)/Sta_Management \ + $(UTILS) \ + $(TWD) \ + $(TWD)/Ctrl \ + $(TWD)/Data_Service/Export_Inc \ + $(TWD)/FW_Transfer/Export_Inc \ + $(TWD)/Ctrl/Export_Inc \ + $(TWD)/MacServices/Export_Inc \ + $(TWD)/FirmwareApi \ + $(TWD)/TwIf \ + $(TWD)/MacServices \ + $(TWD)/TWDriver \ + $(TESTSRC) \ + $(TXN) + +#start of OS_DK_INCS_XCC# do not remove or change this comment +ifeq ($(XCC),y) + OS_DK_INCS_XCC = \ + $(COMMON)/Export_Inc/XCC \ + $(COMSRC)/XCC \ + $(UTILS)/XCC + + OS_DK_INCS += $(OS_DK_INCS_XCC) +endif +#end of OS_DK_INCS_XCC# do not remove or change this comment + +#start of OS_DK_INCS# do not remove or change this comment diff --git a/wilink_6_1/platforms/os/common/inc/IPCKernelApi.h b/wilink_6_1/platforms/os/common/inc/IPCKernelApi.h new file mode 100644 index 0000000..ad772c4 --- /dev/null +++ b/wilink_6_1/platforms/os/common/inc/IPCKernelApi.h @@ -0,0 +1,45 @@ +/* + * IPCKernelApi.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + +#ifndef _IPCKERNELAPI_H_ +#define _IPCKERNELAPI_H_ +#include "tidef.h" + +TI_UINT32 IPCKernelInit (TI_HANDLE hAdapter,TI_HANDLE hIPCEv); + +TI_UINT32 IPCKernelDeInit (TI_HANDLE hAdapter); + + TI_INT32 IPC_EventSend (TI_HANDLE hAdapter, TI_UINT8 *pEvData, TI_UINT32 EvDataSize); + + +#endif diff --git a/wilink_6_1/platforms/os/common/inc/RxBuf.h b/wilink_6_1/platforms/os/common/inc/RxBuf.h new file mode 100644 index 0000000..062d333 --- /dev/null +++ b/wilink_6_1/platforms/os/common/inc/RxBuf.h @@ -0,0 +1,131 @@ +/* + * RxBuf.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/***************************************************************************/ +/* */ +/* MODULE: buf.h */ +/* PURPOSE: manages the allocation/free and field access of the BUF */ +/* */ +/***************************************************************************/ +#ifndef _BUF_H_ +#define _BUF_H_ + +#include "tidef.h" +#include "queue.h" +#include "public_descriptors.h" + + + +#define WSPI_PAD_BYTES 16 /* Add padding before data buffer for WSPI overhead */ +#define PAYLOAD_ALIGN_PAD_BYTES 4 /* Add an extra word for alignment the MAC payload in case of QoS MSDU */ + + + +/** + * \brief Buffer for Tx/Rx packets + */ +typedef void BUF, *PBUF; + +/* Packet types */ + + +/** + * \def RX_BUF_DATA + * \brief Macro which gets a pointer to BUF packet header and returns the pointer to the start address of the WLAN packet's data + */ +#define RX_BUF_DATA(pBuf) ((void*)((TI_UINT8 *)pBuf + sizeof(RxIfDescriptor_t))) +/** + * \def RX_BUF_LEN + * \brief Macro which gets a pointer to BUF packet header and returns the buffer length (without Rx Descriptor) of the WLAN packet + */ +#define RX_BUF_LEN(pBuf) ( (((RxIfDescriptor_t *)(pBuf))->length << 2) - \ + ((RxIfDescriptor_t *)(pBuf))->extraBytes - \ + sizeof(RxIfDescriptor_t) ) + +/** + * \def RX_ETH_PKT_DATA + * \brief Macro which gets a pointer to BUF packet header and returns the pointer to the start address of the ETH packet's data + */ +#define RX_ETH_PKT_DATA(pBuf) *((void **)(((TI_UINT32)pBuf + sizeof(RxIfDescriptor_t) + 2) & ~3)) +/** + * \def RX_ETH_PKT_LEN + * \brief Macro which gets a pointer to BUF packet header and returns the buffer length (without Rx Descriptor) of the ETH packet + */ +#define RX_ETH_PKT_LEN(pBuf) *((TI_UINT32 *)(((TI_UINT32)pBuf + sizeof(RxIfDescriptor_t) + 6) & ~3)) + + +/** \brief BUF Allocation + * + * \param hOs - OS module object handle + * \param len - Length of allocated WBUF + * \param ePacketClassTag - The RX packet type (used only in EMP) + * \return On success: Pointer to WBUF ; Otherwise: NULL + * + * \par Description + * This function allocates BUF element for Tx/Rx packet + * + * \sa + */ +BUF* RxBufAlloc (TI_HANDLE hOs, TI_UINT32 len, PacketClassTag_e ePacketClassTag); + + +/** \brief BUF Free + * + * \param hOs - OS module object handle + * \param pWbuf - Pointer to WBUF which was previously created by user + * \return void + * + * \par Description + * This function frees the memory allocated for BUF element + * + * \sa + */ +void RxBufFree (TI_HANDLE hOs, void* pBuf); + + +/** \brief BUF Free + * + * \param hOs - OS module object handle + * \param pWbuf - Pointer to WBUF which was previously created by user + * \return void + * + * \par Description + * This function increment the start address of data held in BUF element in len. + * + * \sa + */ +void RxBufReserve (TI_HANDLE hOs, void* pBuf, TI_UINT32 len); + +#endif + diff --git a/wilink_6_1/platforms/os/common/inc/WlanDrvCommon.h b/wilink_6_1/platforms/os/common/inc/WlanDrvCommon.h new file mode 100644 index 0000000..151c5aa --- /dev/null +++ b/wilink_6_1/platforms/os/common/inc/WlanDrvCommon.h @@ -0,0 +1,117 @@ +/* + * WlanDrvCommon.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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 WlanDrvCommon.h + * \brief Defines WlanDrvIf objects common to all OS types. + * + * \see WlanDrvIf.h + */ + +#ifndef __WLAN_DRV_COMMON_H__ +#define __WLAN_DRV_COMMON_H__ + + +#include "tidef.h" +#include "TWDriver.h" + +#define DRV_ADDRESS_SIZE (sizeof(TI_INT32)) +#define MAX_CHUNKS_IN_FILE (1000) +#define OS_SPECIFIC_RAM_ALLOC_LIMIT (0xFFFFFFFF) /* assume OS never reach that limit */ + +/* Driver steady states - for driver external users */ +typedef enum +{ + DRV_STATE_IDLE, + DRV_STATE_RUNNING, + DRV_STATE_STOPING, + DRV_STATE_STOPPED, + DRV_STATE_FAILED +} EDriverSteadyState; + + +/* The driver Start/Stop actions */ +typedef enum +{ + ACTION_TYPE_NONE, + ACTION_TYPE_START, + ACTION_TYPE_STOP +} EActionType; + +/* Initialization file info */ +typedef struct +{ + void *pImage; + unsigned long uSize; +} TInitImageInfo; + +/* WlanDrvIf object common part (included by TWlanDrvIfObj from each OS abstraction layer) */ +typedef struct +{ + /* Other modules handles */ + void *hDrvMain; + void *hCmdHndlr; + void *hContext; + void *hTxDataQ; + void *hTxMgmtQ; + void *hTxCtrl; + void *hTWD; + void *hEvHandler; + + /* Initialization files info */ + TInitImageInfo tIniFile; + TInitImageInfo tNvsImage; + TInitImageInfo tFwImage; + + EDriverSteadyState eDriverState; /* The driver state as presented to the OS */ + TI_UINT32 uLinkSpeed; + +} TWlanDrvIfCommon; + + +/* The loader files interface */ +typedef struct +{ + TI_UINT32 uNvsFileLength; + TI_UINT32 uFwFileLength; + TI_UINT32 uIniFileLength; + char data[1]; + /* eeprom image follows */ + /* firmware image follows */ + /* init file follows */ +} TLoaderFilesData; + + + +#endif /* __WLAN_DRV_COMMON_H__ */ diff --git a/wilink_6_1/platforms/os/common/inc/cli_cu_common.h b/wilink_6_1/platforms/os/common/inc/cli_cu_common.h new file mode 100644 index 0000000..ae755b7 --- /dev/null +++ b/wilink_6_1/platforms/os/common/inc/cli_cu_common.h @@ -0,0 +1,117 @@ +/* + * cli_cu_common.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + +#ifndef common_h +#define common_h + +#include "tidef.h" + +#ifdef _WINDOWS +#define DRV_NAME "\\\\.\\tiwlnpci" +#endif + +#ifndef TIWLAN_DRV_NAME +#define TIWLAN_DRV_NAME DRV_NAME +#endif + +#define IN /* input parameter */ +#define OUT /* output parameter */ +#define INOUT /* input & output parameter */ + +#ifndef TI_TRUE +#define TI_TRUE 1 +#endif + +#ifndef TI_FALSE +#define TI_FALSE 0 +#endif + +#ifndef TI_PENDING +#define TI_PENDING 2 +#endif + + +#ifndef NULL +# define NULL 0L +#endif + +#ifndef TI_VOIDCAST +#define TI_VOIDCAST(p) ((void)p) +#endif + +#ifdef __LINUX__ +#ifndef print +# define print(fmt, arg...) fprintf(stdout, fmt, ##arg) +#endif + +#ifndef print_err +# define print_err(fmt, arg...) fprintf(stderr, fmt, ##arg) +#endif + +#ifndef print_deb +# ifdef DEBUG_MESSAGES +# define print_deb(fmt, arg...) fprintf(stdout, fmt, ##arg) +# else +# define print_deb(fmt, arg...) +# endif /* DEBUG_MESSAGES */ +#endif /* print_deb */ + +#endif /* __LINUX__ */ + +#ifndef SIZE_ARR +# define SIZE_ARR(a) (sizeof(a)/sizeof(a[0]) ) +#endif + +#ifndef min +# define min(a, b) (((a)<(b)) ? (a) : (b)) +#endif + +#ifndef max +# define max(a, b) (((a)>(b)) ? (a) : (b)) +#endif + +typedef struct +{ + TI_UINT32 value; + char *name; +} named_value_t; + +#define print_available_values(arr) \ + { int i; for(i=0; i<SIZE_ARR(arr); i++) \ + print("%d - %s%s", arr[i].value, arr[i].name, (i>=SIZE_ARR(arr)-1) ? "\n" : ", " ); \ + } + +void print_memory_dump(char *addr, int size ); + +#endif /* common_h */ + diff --git a/wilink_6_1/platforms/os/common/inc/convert.h b/wilink_6_1/platforms/os/common/inc/convert.h new file mode 100644 index 0000000..e33fe6a --- /dev/null +++ b/wilink_6_1/platforms/os/common/inc/convert.h @@ -0,0 +1,155 @@ +/* + * convert.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + +#if !defined _CONVERT_H +#define _CONVERT_H + +#include "TWDriver.h" +#include "STADExternalIf.h" +#include "InternalCmdCodes.h" +#include "cu_common.h" +#include "TWDriverScan.h" + +/***********************/ +/* General definitions */ +/***********************/ + +#define TIWLN_802_11_SUPPORTED_RATES SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM +#define TIWLN_802_11_SUPPORTED_RATES_SET SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM +#define TIWLN_802_11_CURRENT_RATES_GET SITE_MGR_CURRENT_TX_RATE_PARAM +#define TIWLN_802_11_CHANNEL_GET SITE_MGR_CURRENT_CHANNEL_PARAM /* wext in linux */ +#define TIWLN_REG_DOMAIN_ENABLE_DISABLE_802_11D REGULATORY_DOMAIN_ENABLE_DISABLE_802_11D +#define TIWLN_REG_DOMAIN_ENABLE_DISABLE_802_11H REGULATORY_DOMAIN_ENABLE_DISABLE_802_11H +#define TIWLN_REG_DOMAIN_GET_802_11D REGULATORY_DOMAIN_ENABLED_PARAM +#define TIWLN_REG_DOMAIN_GET_802_11H REGULATORY_DOMAIN_MANAGEMENT_CAPABILITY_ENABLED_PARAM +#define TIWLN_REG_DOMAIN_GET_COUNTRY_2_4 REGULATORY_DOMAIN_COUNTRY_2_4_PARAM +#define TIWLN_REG_DOMAIN_SET_COUNTRY_2_4 REGULATORY_DOMAIN_COUNTRY_2_4_PARAM +#define TIWLN_REG_DOMAIN_GET_COUNTRY_5 REGULATORY_DOMAIN_COUNTRY_5_PARAM +#define TIWLN_REG_DOMAIN_SET_COUNTRY_5 REGULATORY_DOMAIN_COUNTRY_5_PARAM +#define TIWLN_REG_DOMAIN_SET_DFS_RANGE REGULATORY_DOMAIN_DFS_CHANNELS_RANGE +#define TIWLN_REG_DOMAIN_GET_DFS_RANGE REGULATORY_DOMAIN_DFS_CHANNELS_RANGE +#define TIWLN_802_11_POWER_MODE_GET POWER_MGR_POWER_MODE +#define TIWLN_802_11_POWER_MODE_SET POWER_MGR_POWER_MODE +#define TIWLN_802_11_RSSI TWD_RSSI_LEVEL_PARAM +#define TIWLN_802_11_TX_POWER_DBM_GET REGULATORY_DOMAIN_CURRENT_TX_POWER_IN_DBM_PARAM +#define TIWLN_802_11_POWER_MGR_PROFILE POWER_MGR_POWER_MODE + +#define TIWLN_SHORT_SLOT_GET SITE_MGR_DESIRED_SLOT_TIME_PARAM +#define TIWLN_SHORT_SLOT_SET SITE_MGR_DESIRED_SLOT_TIME_PARAM +#define TIWLN_IBSS_PROTECTION_GET CTRL_DATA_CURRENT_IBSS_PROTECTION_PARAM /* not implemented in CUDK */ +#define TIWLN_IBSS_PROTECTION_SET CTRL_DATA_CURRENT_IBSS_PROTECTION_PARAM /* not implemented in CUDK */ +#define TIWLN_802_11_MIXED_MODE_SET RSN_MIXED_MODE +#define TIWLN_802_11_MIXED_MODE_GET RSN_MIXED_MODE + +#define TIWLN_802_11_GET_AP_QOS_PARAMS QOS_MNGR_AP_QOS_PARAMETERS +#define TIWLN_802_11_GET_AP_QOS_CAPABILITIES SITE_MGR_GET_AP_QOS_CAPABILITIES +#define TIWLN_802_11_ADD_TSPEC QOS_MNGR_ADD_TSPEC_REQUEST +#define TIWLN_802_11_GET_TSPEC_PARAMS QOS_MNGR_OS_TSPEC_PARAMS +#define TIWLN_802_11_DELETE_TSPEC QOS_MNGR_DEL_TSPEC_REQUEST +#define TIWLN_802_11_GET_CURRENT_AC_STATUS QOS_MNGR_AC_STATUS +#define TIWLN_802_11_SET_MEDIUM_USAGE_THRESHOLD TX_CTRL_SET_MEDIUM_USAGE_THRESHOLD +#define TIWLN_802_11_GET_MEDIUM_USAGE_THRESHOLD TX_CTRL_GET_MEDIUM_USAGE_THRESHOLD +#define TIWLN_802_11_GET_DESIRED_PS_MODE QOS_MNGR_GET_DESIRED_PS_MODE +#define TIWLN_802_11_SET_RX_TIMEOUT QOS_SET_RX_TIME_OUT +#define TIWLN_802_11_POWER_LEVEL_DEFAULT_GET POWER_MGR_POWER_LEVEL_DEFAULT +#define TIWLN_802_11_POWER_LEVEL_DEFAULT_SET POWER_MGR_POWER_LEVEL_DEFAULT +#define TIWLN_802_11_POWER_LEVEL_PS_SET POWER_MGR_POWER_LEVEL_PS +#define TIWLN_802_11_POWER_LEVEL_PS_GET POWER_MGR_POWER_LEVEL_PS +#define TIWLN_GET_POWER_CONSUMPTION_STATISTICS POWER_MGR_GET_POWER_CONSUMPTION_STATISTICS +#define TIWLN_802_11_BEACON_FILTER_DESIRED_STATE_SET SITE_MGR_BEACON_FILTER_DESIRED_STATE_PARAM +#define TIWLN_802_11_BEACON_FILTER_DESIRED_STATE_GET SITE_MGR_BEACON_FILTER_DESIRED_STATE_PARAM +#define TIWLN_802_11_POWER_LEVEL_DOZE_MODE_GET POWER_MGR_POWER_LEVEL_DOZE_MODE +#define TIWLN_802_11_POWER_LEVEL_DOZE_MODE_SET POWER_MGR_POWER_LEVEL_DOZE_MODE +#define TIWLN_802_11_SHORT_PREAMBLE_GET SITE_MGR_DESIRED_PREAMBLE_TYPE_PARAM +#define TIWLN_802_11_SHORT_PREAMBLE_SET SITE_MGR_DESIRED_PREAMBLE_TYPE_PARAM +#define TIWLN_ENABLE_DISABLE_RX_DATA_FILTERS RX_DATA_ENABLE_DISABLE_RX_DATA_FILTERS +#define TIWLN_ADD_RX_DATA_FILTER RX_DATA_ADD_RX_DATA_FILTER +#define TIWLN_REMOVE_RX_DATA_FILTER RX_DATA_REMOVE_RX_DATA_FILTER +#define TIWLN_GET_RX_DATA_FILTERS_STATISTICS RX_DATA_GET_RX_DATA_FILTERS_STATISTICS +#define TIWLN_GET_RX_DATA_RATE SITE_MGR_CURRENT_RX_RATE_PARAM +#define TIWLN_REPORT_MODULE_SET REPORT_MODULE_TABLE_PARAM +#define TIWLN_REPORT_MODULE_GET REPORT_MODULE_TABLE_PARAM +#define TIWLN_REPORT_SEVERITY_SET REPORT_SEVERITY_TABLE_PARAM +#define TIWLN_REPORT_SEVERITY_GET REPORT_SEVERITY_TABLE_PARAM +#define TIWLN_DISPLAY_STATS DEBUG_ACTIVATE_FUNCTION +#define TIWLN_RATE_MNG_SET SITE_MGRT_SET_RATE_MANAGMENT +#define TIWLN_RATE_MNG_GET SITE_MGRT_GET_RATE_MANAGMENT +#define TIWLN_802_11_GET_SELECTED_BSSID_INFO SITE_MGR_GET_SELECTED_BSSID_INFO +#define TIWLN_802_11_TX_STATISTICS TX_CTRL_COUNTERS_PARAM +#define TIWLN_802_11_SET_TRAFFIC_INTENSITY_THRESHOLDS CTRL_DATA_TRAFFIC_INTENSITY_THRESHOLD +#define TIWLN_802_11_GET_TRAFFIC_INTENSITY_THRESHOLDS CTRL_DATA_TRAFFIC_INTENSITY_THRESHOLD +#define TIWLN_802_11_TOGGLE_TRAFFIC_INTENSITY_EVENTS CTRL_DATA_TOGGLE_TRAFFIC_INTENSITY_EVENTS +#define TIWLN_802_11_GET_PRIMARY_BSSID_INFO SITE_MGR_PRIMARY_SITE_PARAM /* not implemented in CUDK */ +#define TIWLN_ENABLE_DISABLE_RX_DATA_FILTERS RX_DATA_ENABLE_DISABLE_RX_DATA_FILTERS +#define TIWLN_ADD_RX_DATA_FILTER RX_DATA_ADD_RX_DATA_FILTER +#define TIWLN_REMOVE_RX_DATA_FILTER RX_DATA_REMOVE_RX_DATA_FILTER +#define TIWLN_GET_RX_DATA_FILTERS_STATISTICS RX_DATA_GET_RX_DATA_FILTERS_STATISTICS /* not implemented in CUDK */ +#define TIWLN_802_11_START_APP_SCAN_SET SCAN_CNCN_START_APP_SCAN +#define TIWLN_802_11_STOP_APP_SCAN_SET SCAN_CNCN_STOP_APP_SCAN +#define TIWLN_802_11_SCAN_POLICY_PARAM_SET SCAN_MNGR_SET_CONFIGURATION +#define TIWLN_802_11_SCAN_BSS_LIST_GET SCAN_MNGR_BSS_LIST_GET +#define TIWLN_802_11_SET_QOS_PARAMS QOS_MNGR_SET_OS_PARAMS +#define TIWLN_802_11_CONFIG_TX_CLASS CTRL_DATA_CLSFR_CONFIG +#define TIWLN_802_11_REMOVE_CLSFR_ENTRY CTRL_DATA_CLSFR_REMOVE_ENTRY + + +/********************/ +/* Type definitions */ +/********************/ + +typedef TRates rates_t; +typedef EDraftNumber draftNumber_t; +typedef TCountry country_t; +typedef TDfsChannelRange DFS_ChannelRange_t; +typedef ESlotTime slotTime_e; +typedef TRxDataFilterRequest TIWLAN_DATA_FILTER_REQUEST; +typedef TCuCommon_RxDataFilteringStatistics TIWLAN_DATA_FILTER_STATISTICS; +typedef TScanParams scan_Params_t; +typedef TScanNormalChannelEntry scan_normalChannelEntry_t; +typedef EScanEtCondition scan_ETCondition_e; +typedef TScanSpsChannelEntry scan_SPSChannelEntry_t; +typedef EScanType scan_Type_e; +typedef ERadioBand radioBand_e; +typedef ERateMask rateMask_e; +typedef TSsid ssid_t; +typedef TScanPolicy scan_Policy_t; +typedef TScanBandPolicy scan_bandPolicy_t; +typedef TScanProbReqParams scan_probReqParams_t; +typedef TScanBasicMethodParams scan_basicMethodParams_t; +typedef TScanTidTriggeredMethodParams scan_TidTriggeredMethodParams_t; +typedef TScanSPSMethodParams scan_SPSMethodParams_t; +typedef TScanMethod scan_Method_t; +typedef TClsfrTableEntry clsfr_tableEntry_t; +typedef TIpPort IP_Port_t; + +#endif /* _CONVERT_H */ diff --git a/wilink_6_1/platforms/os/common/inc/osApi.h b/wilink_6_1/platforms/os/common/inc/osApi.h new file mode 100644 index 0000000..f8a9311 --- /dev/null +++ b/wilink_6_1/platforms/os/common/inc/osApi.h @@ -0,0 +1,703 @@ +/* + * osApi.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/*--------------------------------------------------------------------------*/ +/* Module: OSAPI.H*/ +/**/ +/* Purpose: This module defines unified interface to the OS specific*/ +/* sources and services.*/ +/**/ +/*--------------------------------------------------------------------------*/ + +#ifndef __OS_API_H__ +#define __OS_API_H__ + +/** \file osApi.h + * \brief Operating System APIs \n + * This module defines unified interface to the OS specific sources and services + */ + +#include "tidef.h" +#include "TI_IPC_Api.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \struct TI_CONNECTION_STATUS + * \struct *PTI_CONNECTION_STATUS + * \brief Ti Connection Status + * + * \par Description + * + * \sa + */ +typedef struct +{ + TI_UINT32 Event; + TI_UINT8* Data; +} TI_CONNECTION_STATUS, *PTI_CONNECTION_STATUS; + +typedef struct +{ + TI_UINT8 uFormat; + TI_UINT8 uLevel; + TI_UINT8 uParamsNum; + TI_UINT8 uReserved; + TI_UINT16 uFileId; + TI_UINT16 uLineNum; +} TTraceMsg; + +#define OS_PAGE_SIZE 4096 +#define MAX_MESSAGE_SIZE 500 +#define MICROSECOND_IN_SECONDS 1000000 + +#define UINT16_MAX_VAL 0xffff +#define UINT8_MAX_VAL 0xff + +#define TRACE_FORMAT_8_BITS_PARAMS 2 +#define TRACE_FORMAT_16_BITS_PARAMS 4 +#define TRACE_FORMAT_32_BITS_PARAMS 6 + +#define TRACE_MSG_MAX_PARAMS 32 +#define TRACE_MSG_MIN_LENGTH (sizeof(TTraceMsg)) +#define TRACE_MSG_MAX_LENGTH ((TRACE_MSG_MAX_PARAMS * 4) + sizeof(TTraceMsg)) + +#define INSERT_BYTE(pBuf, dataByte) (*((TI_UINT8 *)pBuf) = (TI_UINT8 )dataByte ); pBuf++; +#define INSERT_2_BYTES(pBuf, dataBytes) (*((TI_UINT16 *)pBuf) = (TI_UINT16)dataBytes); pBuf+=2; +#define INSERT_4_BYTES(pBuf, dataBytes) (*((TI_UINT32 *)pBuf) = (TI_UINT32)dataBytes); pBuf+=4; + + +/**************************************************************************************** + START OF OS API (Common to all GWSI LIB, Driver and TI Driver) +*****************************************************************************************/ + + +/**************************************************************************************** + OS HW API NEEDED BY DRIVER +*****************************************************************************************/ + +/** \brief OS Disable IRQ + * + * \param OsContext - Handle to the OS object + * \return void + * + * \par Description + * This function disables the Interrupts + * + * \sa + */ +void os_disableIrq (TI_HANDLE OsContext); + +/** \brief OS Enable IRQ + * + * \param OsContext - Handle to the OS object + * \return void + * + * \par Description + * This function enables the Interrupts + * + * \sa + */ +void os_enableIrq (TI_HANDLE OsContext); + +/** \brief OS IRQ Serviced + * + * \param OsContext - Handle to the OS object + * \return void + * + * \par Description + * This function is used in Level IRQ only. At this point the interrupt line is not asserted anymore + * and we can inform the OS to enable IRQ again. + * + * \sa + */ +void os_InterruptServiced (TI_HANDLE OsContext); + +/**************************************************************************************** + * OS Report API * + ****************************************************************************************/ + +/** \brief OS Set Debug Mode + * + * \param enable - Indicates if debug mode should be enabled or disabled ( TI_TRUE | TI_FALSE ) + * \return void + * + * \par Description + * This function sets the Debug Mode flag to True or False - according to user's request + * + * \sa + */ +void os_setDebugMode (TI_BOOL enable); + +/** \brief OS Printf + * + * \param format - String to print (with formatted parametrs in string if needed) and parameters values + * if formatted parameters are used in string + * \return void + * + * \par Description + * This function prints formatted output using OS available printf method + * + * \sa + */ +void os_printf (const char *format ,...); + +/**************************************************************************************** + * OS Memory API * + ****************************************************************************************/ + +/** \brief OS Memory Allocation + * + * \param OsContext - Handle to the OS object + * \param Size - Size (in bytes) to be allocated + * \return Pointer to the allocated memory on success ; NULL on failure (there isn't enough memory available) + * + * \par Description + * This function allocates resident (nonpaged) system-space memory with calling specific OS allocation function. \n + * It is assumed that this function will never be called in an interrupt context since the OS allocation function + * has the potential to put the caller to sleep while waiting for memory to become available. + * + * \sa + */ +void *os_memoryAlloc (TI_HANDLE OsContext,TI_UINT32 Size); + +/** \brief OS Memory CAllocation + * + * \param OsContext - Handle to the OS object + * \param Number - Number of element to be allocated + * \param Size - Size (in bytes) of one element + * \return Pointer to the allocated memory on success ; NULL on failure (there isn't enough memory available) + * + * \par Description + * This function allocates an array in memory with elements initialized to 0. + * Allocates resident (nonpaged) system-space memory for an array with elements initialized to 0, + * with specific OS allocation function. + * It is assumed that this function will never be called in an interrupt context since the OS allocation function + * has the potential to put the caller to sleep while waiting for memory to become available. + * + * \sa + */ +void *os_memoryCAlloc (TI_HANDLE OsContext, TI_UINT32 Number, TI_UINT32 Size); + +/** \brief OS Memory Set + * + * \param OsContext - Handle to the OS object + * \param pMemPtr - Pointer to the base address of a memory block + * \param Value - Value to set to memory block + * \param Length - Length (in bytes) of memory block + * \return void + * + * \par Description + * This function fills a block of memory with a given value + * + * \sa + */ +void os_memorySet (TI_HANDLE OsContext, void *pMemPtr, TI_INT32 Value, TI_UINT32 Length); + +/** \brief OS Memory Zero + * + * \param OsContext - Handle to the OS object + * \param pMemPtr - Pointer to the base address of a memory block + * \param Length - Length (in bytes) of memory block + * \return void + * + * \par Description + * This function fills a block of memory with zeros + * + * \sa + */ +void os_memoryZero (TI_HANDLE OsContext, void *pMemPtr, TI_UINT32 Length); + +/** \brief OS Memory Copy + * + * \param OsContext - Handle to the OS object + * \param pDestination - Pointer to destination buffer + * \param pSource - Pointer to Source buffer + * \param Size - Size (in bytes) to copy + * \return void + * + * \par Description + * This function copies a specified number of bytes from one caller-supplied location (source buffer) to another (destination buffer) + * + * \sa + */ +void os_memoryCopy (TI_HANDLE OsContext, void *pDestination, void *pSource, TI_UINT32 Size); + +/** \brief OS Memory Free + * + * \param OsContext - Handle to the OS object + * \param pMemPtr - Pointer to the base address of a memory block + * \param Size - Size (in bytes) to free + * \return void + * + * \par Description + * This function releases a block of memory which was previously allocated by user + * + * \sa + */ +void os_memoryFree (TI_HANDLE OsContext, void *pMemPtr, TI_UINT32 Size); + +/** \brief OS Memory Compare + * + * \param OsContext - Handle to the OS object + * \param Buf1 - Pointer to the first buffer in comperation + * \param Buf2 - Pointer to the second buffer in comperation + * \param Count - Count (in bytes) to compare + * \return A value which indicates the relationship between the two compared buffers: + * value < 0: Buf1 less than Buf2 + * value == 0: Buf1 identical to Buf2 + * value > 0: Buf1 greater than Buf2 + * + * \par Description + * This function compares between two given buffers + * + * \sa + */ +TI_INT32 os_memoryCompare (TI_HANDLE OsContext, TI_UINT8* Buf1, TI_UINT8* Buf2, TI_INT32 Count); + +/** \brief OS Memory Allocation for HW DMA + * + * \param pOsContext - Handle to the OS object + * \param Size - Size (in bytes) to allocate + * \return Pointer to the allocated memory on success ; NULL on failure (there isn't enough memory available) + * + * \par Description + * This function allocates resident (nonpaged) system-space memory for HW DMA operations + * + * \sa + */ +void *os_memoryAlloc4HwDma (TI_HANDLE pOsContext, TI_UINT32 Size); + +/** \brief OS Memory for HW DMA Free + * + * \param pOsContext - Handle to the OS object + * \param pMem_ptr - Pointer to the base virtual address of allocated memory block + * This is the address that was returned to user when he allocated the memory for HW DMA usage + * \param Size - Size (in bytes) of the memory block to be released. This parameter must be identical to the Length + * which was given by the user when he allocated the memory block for HW DMA usage + * \return Pointer to the allocated memory on success ; NULL on failure (there isn't enough memory available) + * + * \par Description + * This function releases a block of memory previously allocated by user for HW DMA operations + * + * \sa + */ +void os_memory4HwDmaFree (TI_HANDLE pOsContext, void *pMem_ptr, TI_UINT32 Size); + +/** \brief OS Memory Copy from User + * + * \param OsContext - Handle to the OS object + * \param pDstPtr - Pointer to destination buffer + * \param pSrcPtr - Pointer to Source buffer + * \param Size - Size (in bytes) to copy + * \return TI_OK on success ; TI_NOK otherwise + * + * \par Description + * This function copies a specified number of bytes from one caller-supplied location (Source) to another (Destination) + * + * \sa + */ +int os_memoryCopyFromUser (TI_HANDLE OsContext, void *pDstPtr, void *pSrcPtr, TI_UINT32 Size); + +/** \brief OS Memory Copy To User + * + * \param OsContext - Handle to the OS object + * \param pDstPtr - Pointer to destination buffer + * \param pSrcPtr - Pointer to Source buffer + * \param Size - Size (in bytes) to copy + * \return TI_OK on success ; TI_NOK otherwise + * + * \par Description + * This function copies a specified number of bytes from one caller-supplied location (Source) to another (Destination) + * + * \sa + */ +int os_memoryCopyToUser (TI_HANDLE OsContext, void *pDstPtr, void *pSrcPtr, TI_UINT32 Size); + +/**************************************************************************************** + * OS TIMER API * + ****************************************************************************************/ +/** \brief Timer Callback Function + * + * \param Context - Handle to the OS object + * \return void + * + * \par Description + * This callback is passed by user to OS timer when created, and is called directly from OS timer context when expired. + * E.g. the user user the timer in order to operate this function after a defined time expires + * + */ +typedef void (*fTimerFunction)(TI_HANDLE Context); + +/** \brief OS Timer Create + * + * \param OsContext - Handle to the OS object + * \param pRoutine - Pointer to user's Timer Callback function + * \param hFuncHandle - Handle to user's Timer Callback function parameters + * \return Handle to timer object on success ; NULL on failure + * + * \par Description + * This function creates and initializes an OS timer object associated with a user's Timer Callback function \n + * \note 1) The user's callback is called directly from OS timer context when expired. + * \note 2) In some OSs, it may be needed to use an intermediate callback in the + * \note osapi layer (use os_timerHandlr for that). + * + * \sa + */ +TI_HANDLE os_timerCreate (TI_HANDLE OsContext, fTimerFunction pRoutine, TI_HANDLE hFuncHandle); + +/** \brief OS Timer Destroy + * + * \param OsContext - Handle to the OS object + * \param TimerHandle - Handle to timer object which user got when created the timer + * \return void + * + * \par Description + * This function destroys the OS timer object which was previously created by user + * + * \sa + */ +void os_timerDestroy (TI_HANDLE OsContext, TI_HANDLE TimerHandle); + +/** \brief OS Timer Start + * + * \param OsContext - Handle to the OS object + * \param TimerHandle - Handle to timer object which user got when created the timer + * \param DelayMs - The time in MS untill the timer is awaken + * \return void + * + * \par Description + * This function Start the OS timer object which was previously created by user + * + * \sa + */ +void os_timerStart (TI_HANDLE OsContext, TI_HANDLE TimerHandle, TI_UINT32 DelayMs); + +/** \brief OS Timer Stop + * + * \param OsContext - Handle to the OS object + * \param TimerHandle - Handle to timer object which user got when created the timer + * \return void + * + * \par Description + * This function Stops the OS timer object which was previously created by user + * + * \sa + */ +void os_timerStop (TI_HANDLE OsContext, TI_HANDLE TimerHandle); + +/** \brief OS Periodic Interrupt Timer Start + * + * \param OsContext - Handle to the OS object + * \return void + * + * \par Description + * This function starts the periodic interrupt mechanism. This function is used when PRIODIC_INTERRUPT mode is used. + * This Mode is enabled when interrupts that are usually received from the FW are masked, + * and there is need to check- in a given time periods - if handling of any FW interrupt is needed. + * + * \sa + */ +#ifdef PRIODIC_INTERRUPT +void os_periodicIntrTimerStart (TI_HANDLE OsContext); +#endif + +/** \brief OS Time Stamp Ms + * + * \param OsContext - Handle to the OS object + * \return The number of milliseconds that have elapsed since the system was booted + * + * \par Description + * This function returns the number of milliseconds that have elapsed since the system was booted. + */ +TI_UINT32 os_timeStampMs (TI_HANDLE OsContext); + +/** \brief OS Time Stamp Us + * + * \param OsContext - Handle to the OS object + * \return The number of microseconds that have elapsed since the system was booted + * + * \par Description + * This function returns the number of microseconds that have elapsed since the system was booted. \n + * Note that sometimes this function will be called with NULL(!!!) as argument! + */ +TI_UINT32 os_timeStampUs (TI_HANDLE OsContext); + +/** \brief OS Stall uSec + * + * \param OsContext - Handle to the OS object + * \param uSec - The time to delay in microseconds + * \return void + * + * \par Description + * This function makes delay in microseconds + * + * \sa + */ +void os_StalluSec (TI_HANDLE OsContext, TI_UINT32 uSec); + + +/**************************************************************************************** + * Protection services API * + ****************************************************************************************/ + +/** \brief OS Protect Create + * + * \param OsContext - Handle to the OS object + * \return Handle of the created mutex/spin lock object on Success ; NULL on Failure (not enough memory available or problems to initializing the mutex) + * + * \par Description + * This function allocates a mutex/spin lock object. + * The mutex/spinlock object which is created by this function is used for mutual-exclusion and protection of resources which are shared between + * multi-Tasks/Threads + * + * \sa + */ +TI_HANDLE os_protectCreate (TI_HANDLE OsContext); + +/** \brief OS Protect Destroy + * + * \param OsContext - Handle to the OS object + * \param ProtectContext - Handle to the mutex/spin lock object + * \return void + * + * \par Description + * This function destroys s a mutex/spin lock object which was previously created by user: + * it frees the mutex/spin lock and then frees the object's memory + * + * \sa + */ +void os_protectDestroy (TI_HANDLE OsContext, TI_HANDLE ProtectContext); + +/** \brief OS Protect Lock + * + * \param OsContext - Handle to the OS object + * \param ProtectContext - Handle to the mutex/spin lock object + * \return void + * + * \par Description + * This function locks the mutex/spin lock object. E.g. the caller acquires a mutex/spin lock and gains exclusive + * access to the shared resources, that the mutex/spin lock protects of. + * + * \sa + */ +void os_protectLock (TI_HANDLE OsContext, TI_HANDLE ProtectContext); + +/** \brief OS Protect Unlock + * + * \param OsContext - Handle to the OS object + * \param ProtectContext - Handle to the mutex/spin lock object + * \return void + * + * \par Description + * This function unlocks the mutex/spin lock object. + * + * \sa + */ +void os_protectUnlock (TI_HANDLE OsContext, TI_HANDLE ProtectContext); + +/* Wakelock functionality */ +int os_wake_lock (TI_HANDLE OsContext); +int os_wake_unlock (TI_HANDLE OsContext); +int os_wake_lock_timeout (TI_HANDLE OsContext); +int os_wake_lock_timeout_enable (TI_HANDLE OsContext); + +#define os_profile(hos,fn,par) + + +/**************************************************************************************** + START OF GWSI DRIVER API +*****************************************************************************************/ + +/** \brief OS Signaling Object Create + * + * \param OsContext - Handle to the OS object + * \return Pointer to Signal Object on Success ; NULL on Failure + * + * \par Description + * This function creates a new Signaling Object or opens an already exists Signaling Object. + * The Signaling Object created by this function is used for mutual-exclusion and protection + * of resources which are shared between multi-Tasks/Threads by using a signaling mechanism + * + * \sa + */ +void *os_SignalObjectCreate (TI_HANDLE OsContext); + +/** \brief OS Signaling Object Wait + * + * \param OsContext - Handle to the OS object + * \param ptr - Pointer to Signaling Object previously created by user + * \return TI_OK (0) on Success ; TI_NOK (1) on Failure + * + * \par Description + * This function perform waiting on Signaling Object. The coller waits until signaled or until timeout + * + * \sa + */ +int os_SignalObjectWait (TI_HANDLE OsContext, void *ptr); + +/** \brief OS Signaling Object Set + * + * \param OsContext - Handle to the OS object + * \param ptr - Pointer to Signaling Object previously created by user + * \return TI_OK (0) on Success ; TI_NOK (1) on Failure + * + * \par Description + * This function sets a Signaling Object to signaled state (e.g the siganeling object is released) + * + * \sa + */ +int os_SignalObjectSet (TI_HANDLE OsContext, void *ptr); + +/** \brief OS Signaling Object Free + * + * \param OsContext - Handle to the OS object + * \param ptr - Pointer to Signaling Object previously created by user + * \return TI_OK (0) on Success ; TI_NOK (1) on Failure + * + * \par Description + * This function frees (closes) a Signaling Object Handle + * + * \sa + */ +int os_SignalObjectFree (TI_HANDLE OsContext, void *ptr); + +/** \brief OS Schedule Request + * + * \param OsContext - Handle to the OS object + * \return TI_OK (0) on Success ; TI_NOK (1) on Failure + * + * \par Description + * This function performs scheduling (context switch) according to user request + * + * \sa + */ +int os_RequestSchedule (TI_HANDLE OsContext); + + +/**************************************************************************************** + START OF TI DRIVER API +*****************************************************************************************/ + +/** \brief OS Read Memory Register UINT32 + * + * \param OsContext - Handle to the OS object + * \param Register - Pointer to register address + * \param Data - Pointer to output read data + * \return void + * + * \par Description + * This function reads register in 32 bit length + * + * \sa + */ +void os_hwReadMemRegisterUINT32 (TI_HANDLE OsContext, TI_UINT32* Register, TI_UINT32* Data); + +/** \brief OS Write Memory Register UINT32 + * + * \param OsContext - Handle to the OS object + * \param Register - Pointer to register address + * \param Data - Data to write to register + * \return void + * + * \par Description + * This function reads register in 32 bit length + * + * \sa + */ +void os_hwWriteMemRegisterUINT32 (TI_HANDLE OsContext, TI_UINT32* Register, TI_UINT32 Data); + +/** \brief OS Receive Packet + * + * \param OsContext - Handle to the OS object + * \param pPacket - Pointer to received packet data + * \param Length - Length of received packet + * \return TI_TRUE on Success ; TI_FALSE on Failure + * + * \par Description + * This function transfers a packet from WLAN driver to OS + * + * \sa + */ +TI_BOOL os_receivePacket (TI_HANDLE OsContext, void *pPacket, TI_UINT16 Length); + +/** \brief OS Indicate Event + * + * \param OsContext - Handle to the OS object + * \param pData - Pointer to event data + * \return TI_OK (0) on Success ; + * + * \par Description + * This function indicate the OS about different connection driver's events, + * The function performs the rewuired operations for the event - in the OS side + * + * \sa + */ +TI_INT32 os_IndicateEvent (TI_HANDLE OsContext, IPC_EV_DATA *pData); + +/** \brief OS Send Trace Message to Logger + * + * \param OsContext - The OS handle + * \param uLevel - Severity level of the trace message + * \param uFileId - Source file ID of the trace message + * \param uLineNum - Line number of the trace message + * \param uParamsNum - Number of parameters in the trace message + * \param ... - The trace message parameters + * \return void + * + * \par Description + * This function sends trace message to logger + * + * \sa + */ +void os_Trace (TI_HANDLE OsContext, TI_UINT32 uLevel, TI_UINT32 uFileId, TI_UINT32 uLineNum, TI_UINT32 uParamsNum, ...); + +/** + * \fn os_SetDrvThreadPriority + * \brief Called upon init to set WLAN driver thread priority. + * + * \param OsContext - The OS handle + * \param uWlanDrvThreadPriority - The WLAN driver thread priority + * \return + */ +void os_SetDrvThreadPriority (TI_HANDLE OsContext, TI_UINT32 uWlanDrvThreadPriority); + + +#ifdef __cplusplus +} +#endif + +#endif /* __OS_API_H__ */ diff --git a/wilink_6_1/platforms/os/common/inc/osDebug.h b/wilink_6_1/platforms/os/common/inc/osDebug.h new file mode 100644 index 0000000..19275d7 --- /dev/null +++ b/wilink_6_1/platforms/os/common/inc/osDebug.h @@ -0,0 +1,141 @@ +/* + * osDebug.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +#ifndef __OSDEBUG_H_ +#define __OSDEBUG_H_ + +#ifdef TI_DBG +#ifndef _WINDOWS +#include "windows_types.h" +#endif /*_WINDOWS*/ + + +#define IF_TIDEBUG(f) if (!((TiDebugFlag & (f))^(f))) +extern unsigned long TiDebugFlag; + +#define PRINT(F, A) IF_TIDEBUG( F ) { os_printf(A); } +#define PRINTF(F, A) IF_TIDEBUG( F ) { os_printf A; } + +#define DBG_INIT 0x0001 +#define DBG_REGISTRY 0x0002 +#define DBG_NDIS_CALLS 0x0004 +#define DBG_NDIS_OIDS 0x0008 +#define DBG_PCI_RES 0x0010 +#define DBG_INTERRUPT 0x0020 +#define DBG_IOCTL 0x0040 +#define DBG_RECV 0x0080 +#define DBG_SEND 0x0100 + +#define DBG_SEV_INFO 0x0001 +#define DBG_SEV_LOUD 0x0002 +#define DBG_SEV_VERY_LOUD 0x0004 +#define DBG_SEV_WARNING 0x0008 +#define DBG_SEV_ERROR 0x0010 +#define DBG_SEV_FATAL_ERROR 0x0020 + + +#define DBG_INIT_INFO ((DBG_INIT << 16) | DBG_SEV_INFO) +#define DBG_INIT_LOUD ((DBG_INIT << 16) | DBG_SEV_LOUD) +#define DBG_INIT_VERY_LOUD ((DBG_INIT << 16) | DBG_SEV_VERY_LOUD) +#define DBG_INIT_WARNING ((DBG_INIT << 16) | DBG_SEV_WARNING) +#define DBG_INIT_ERROR ((DBG_INIT << 16) | DBG_SEV_ERROR) +#define DBG_INIT_FATAL_ERROR ((DBG_INIT << 16) | DBG_SEV_FATAL_ERROR) + +#define DBG_REGISTRY_INFO ((DBG_REGISTRY << 16) | DBG_SEV_INFO) +#define DBG_REGISTRY_LOUD ((DBG_REGISTRY << 16) | DBG_SEV_LOUD) +#define DBG_REGISTRY_VERY_LOUD ((DBG_REGISTRY << 16) | DBG_SEV_VERY_LOUD) +#define DBG_REGISTRY_WARNING ((DBG_REGISTRY << 16) | DBG_SEV_WARNING) +#define DBG_REGISTRY_ERROR ((DBG_REGISTRY << 16) | DBG_SEV_ERROR) +#define DBG_REGISTRY_FATAL_ERROR ((DBG_REGISTRY << 16) | DBG_SEV_FATAL_ERROR) + +#define DBG_NDIS_CALLS_INFO ((DBG_NDIS_CALLS << 16) | DBG_SEV_INFO) +#define DBG_NDIS_CALLS_LOUD ((DBG_NDIS_CALLS << 16) | DBG_SEV_LOUD) +#define DBG_NDIS_CALLS_VERY_LOUD ((DBG_NDIS_CALLS << 16) | DBG_SEV_VERY_LOUD) +#define DBG_NDIS_CALLS_WARNING ((DBG_NDIS_CALLS << 16) | DBG_SEV_WARNING) +#define DBG_NDIS_CALLS_ERROR ((DBG_NDIS_CALLS << 16) | DBG_SEV_ERROR) +#define DBG_NDIS_CALLS_FATAL_ERROR ((DBG_NDIS_CALLS << 16) | DBG_SEV_FATAL_ERROR) + +#define DBG_NDIS_OIDS_INFO ((DBG_NDIS_OIDS << 16) | DBG_SEV_INFO) +#define DBG_NDIS_OIDS_LOUD ((DBG_NDIS_OIDS << 16) | DBG_SEV_LOUD) +#define DBG_NDIS_OIDS_VERY_LOUD ((DBG_NDIS_OIDS << 16) | DBG_SEV_VERY_LOUD) +#define DBG_NDIS_OIDS_WARNING ((DBG_NDIS_OIDS << 16) | DBG_SEV_WARNING) +#define DBG_NDIS_OIDS_ERROR ((DBG_NDIS_OIDS << 16) | DBG_SEV_ERROR) +#define DBG_NDIS_OIDS_FATAL_ERROR ((DBG_NDIS_OIDS << 16) | DBG_SEV_FATAL_ERROR) + +#define DBG_PCI_RES_INFO ((DBG_PCI_RES << 16) | DBG_SEV_INFO) +#define DBG_PCI_RES_LOUD ((DBG_PCI_RES << 16) | DBG_SEV_LOUD) +#define DBG_PCI_RES_VERY_LOUD ((DBG_PCI_RES << 16) | DBG_SEV_VERY_LOUD) +#define DBG_PCI_RES_WARNING ((DBG_PCI_RES << 16) | DBG_SEV_WARNING) +#define DBG_PCI_RES_ERROR ((DBG_PCI_RES << 16) | DBG_SEV_ERROR) +#define DBG_PCI_RES_FATAL_ERROR ((DBG_PCI_RES << 16) | DBG_SEV_FATAL_ERROR) + +#define DBG_INTERRUPT_INFO ((DBG_INTERRUPT << 16) | DBG_SEV_INFO) +#define DBG_INTERRUPT_LOUD ((DBG_INTERRUPT << 16) | DBG_SEV_LOUD) +#define DBG_INTERRUPT_VERY_LOUD ((DBG_INTERRUPT << 16) | DBG_SEV_VERY_LOUD) +#define DBG_INTERRUPT_WARNING ((DBG_INTERRUPT << 16) | DBG_SEV_WARNING) +#define DBG_INTERRUPT_ERROR ((DBG_INTERRUPT << 16) | DBG_SEV_ERROR) +#define DBG_INTERRUPT_FATAL_ERROR ((DBG_INTERRUPT << 16) | DBG_SEV_FATAL_ERROR) + +#define DBG_IOCTL_INFO ((DBG_IOCTL << 16) | DBG_SEV_INFO) +#define DBG_IOCTL_LOUD ((DBG_IOCTL << 16) | DBG_SEV_LOUD) +#define DBG_IOCTL_VERY_LOUD ((DBG_IOCTL << 16) | DBG_SEV_VERY_LOUD) +#define DBG_IOCTL_WARNING ((DBG_IOCTL << 16) | DBG_SEV_WARNING) +#define DBG_IOCTL_ERROR ((DBG_IOCTL << 16) | DBG_SEV_ERROR) +#define DBG_IOCTL_FATAL_ERROR ((DBG_IOCTL << 16) | DBG_SEV_FATAL_ERROR) + +#define DBG_RECV_INFO ((DBG_RECV << 16) | DBG_SEV_INFO) +#define DBG_RECV_LOUD ((DBG_RECV << 16) | DBG_SEV_LOUD) +#define DBG_RECV_VERY_LOUD ((DBG_RECV << 16) | DBG_SEV_VERY_LOUD) +#define DBG_RECV_WARNING ((DBG_RECV << 16) | DBG_SEV_WARNING) +#define DBG_RECV_ERROR ((DBG_RECV << 16) | DBG_SEV_ERROR) +#define DBG_RECV_FATAL_ERROR ((DBG_RECV << 16) | DBG_SEV_FATAL_ERROR) + +#define DBG_SEND_INFO ((DBG_SEND << 16) | DBG_SEV_INFO) +#define DBG_SEND_LOUD ((DBG_SEND << 16) | DBG_SEV_LOUD) +#define DBG_SEND_VERY_LOUD ((DBG_SEND << 16) | DBG_SEV_VERY_LOUD) +#define DBG_SEND_WARNING ((DBG_SEND << 16) | DBG_SEV_WARNING) +#define DBG_SEND_ERROR ((DBG_SEND << 16) | DBG_SEV_ERROR) +#define DBG_SEND_FATAL_ERROR ((DBG_SEND << 16) | DBG_SEV_FATAL_ERROR) + + +#else + +#define PRINT(F, A) +#define PRINTF(F, A) + +#endif + + +#endif /* __OSDEBUG_H_*/ + diff --git a/wilink_6_1/platforms/os/common/inc/osRgstry.h b/wilink_6_1/platforms/os/common/inc/osRgstry.h new file mode 100644 index 0000000..67382b4 --- /dev/null +++ b/wilink_6_1/platforms/os/common/inc/osRgstry.h @@ -0,0 +1,78 @@ +/* + * osRgstry.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +#ifndef __OSRGSTRY_H_ +#define __OSRGSTRY_H_ + +typedef struct { + + TI_UINT8* ParameterName; + NDIS_STRING NdisParameterName; + + NDIS_PARAMETER_TYPE ParameterType; + + TI_BOOL RangeCheck; + + TI_UINT32 DefaultValue; + TI_UINT32 MinValue; + TI_UINT32 MaxValue; + + TI_UINT32 FieldOffset; + TI_UINT32 FieldSize; + +} REGISTRY_DATA, *PREGISTRY_DATA; + + +void +regFillInitTable( + TWlanDrvIfObjPtr pAdapter, + void* pInitTable + ); + +#ifdef _WINDOWS +void regReadParameters (TWlanDrvIfObjPtr pAdapter); +#endif + +#ifdef TI_DBG + +void +regReadLastDbgState( + TWlanDrvIfObjPtr pAdapter + ); + + +#endif + +#endif /* __OSRGSTRY_H_*/ + diff --git a/wilink_6_1/platforms/os/common/inc/spi_api.h b/wilink_6_1/platforms/os/common/inc/spi_api.h new file mode 100644 index 0000000..48512d1 --- /dev/null +++ b/wilink_6_1/platforms/os/common/inc/spi_api.h @@ -0,0 +1,74 @@ +/* + * spi_api.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * inc/spi_api.h + * + * Header for SPI API test interface + * + */ + +#ifndef SPI_API_H +#define SPI_API_H + + +typedef void (*request_callback_t) (void *data, int status); + + +typedef enum +{ + SPI_OK = 0, + SPI_TXN_COMPLETE = 0, + SPI_TXN_PENDING = 1, + SPI_ERR_UNKNOWN = -1, + SPI_ERR_BUS_BUSY = -2, + SPI_ERR_QUEUE_FULL = -3, + SPI_ERR_ALLOC_MEM = -4, + SPI_ERR_ASYNC_TIMEOUT = -5, + SPI_ERR_WRONG_LENGTH = -6, + +} SPI_Status_e; + + +void* SPI_Open (void* hOS); +int SPI_Close (void* hSPI); +int SPI_Write (void* hSPI, TI_UINT8 *data, TI_UINT32 length, request_callback_t fCb, void *pCb, int more); +int SPI_Read (void* hSPI, TI_UINT8 *data, TI_UINT32 length, request_callback_t fCb, void *pCb, int more); +int SPI_WriteRead (void* hSPI, TI_UINT8 *data, TI_UINT32 length, TI_UINT8 *rdata, TI_UINT32 rlength, request_callback_t fCb, void* pCb, int more); +int SPI_WriteSync (void* hSPI, TI_UINT8 *data, TI_UINT32 length, int more); +int SPI_ReadSync (void* hSPI, TI_UINT8 *data, TI_UINT32 length); + + +#endif /* SPI_API_H */ + diff --git a/wilink_6_1/platforms/os/common/inc/tracebuf_api.h b/wilink_6_1/platforms/os/common/inc/tracebuf_api.h new file mode 100644 index 0000000..e19d826 --- /dev/null +++ b/wilink_6_1/platforms/os/common/inc/tracebuf_api.h @@ -0,0 +1,79 @@ +/* + * tracebuf_api.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + +/* + * Benchmark tracing utility + */ + +#ifndef TB_TRACE_API_H + +#define TB_TRACE_API_H + +#ifdef TI_TRACE_BUF + +#define TB_NUM_ENTRIES 256 +#define MAX_TB_MSG 128 + +#define TB_OPTION_NONE 0x00000000 +#define TB_OPTION_AUTOPRINT 0x00000001 +#define TB_OPTION_PRINTONCE 0x00000002 +#define TB_OPTION_STOP 0x80000000 + +/* Initialization */ +int tb_init(unsigned long options); +int tb_sprintf(const char *format ,...); +int tb_trace(int loc, unsigned long p1, unsigned long p2); +void tb_destroy(void); +void tb_scan(void); +void tb_dump(void); +void tb_printf(void); +void tb_set_option(unsigned long option); +void tb_reset_option(unsigned long option); + +#define tb_min(x,y) (((x)<(y)) ? (x) : (y)) + +#else /* #ifdef TI_TRACE_BUF */ + +#define tb_init(options) +#define tb_sprintf(format ,...) +#define tb_trace(loc, p1, p2) +#define tb_destroy() +#define tb_scan() +#define tb_dump() +#define tb_printf() +#define tb_set_option(option) +#define tb_reset_option(option) + +#endif /* #ifdef TI_TRACE_BUF */ + +#endif diff --git a/wilink_6_1/platforms/os/common/src/osRgstry.c b/wilink_6_1/platforms/os/common/src/osRgstry.c new file mode 100644 index 0000000..924b8b3 --- /dev/null +++ b/wilink_6_1/platforms/os/common/src/osRgstry.c @@ -0,0 +1,5418 @@ +/* + * osRgstry.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +#if defined(_WINDOWS) +#include <ndis.h> +#elif defined( __LINUX__ ) +#include "osRgstry_parser.h" +#elif defined(__ARMCC__) +#include "osRgstry_parser.h" +#include "string.h" +#endif +#include "WlanDrvIf.h" +#include "osRgstry.h" +#include "paramOut.h" +#include "osDot11.h" +#include "osApi.h" +#include "rate.h" +#include "802_11Defs.h" +#include "TWDriver.h" + + +#define MAX_KEY_BUFFER_LEN 256 +#define BIT_TO_BYTE_FACTOR 8 +#define MAX_SR_PARAM_LEN 14 + +#define N_STR(str) NDIS_STRING_CONST(str) +#define INIT_TBL_OFF(field) FIELD_OFFSET(TInitTable, field) + +/* Reports */ +NDIS_STRING STR_ReportSeverityTable = NDIS_STRING_CONST( "ReportSeverityTable" ); +NDIS_STRING STR_ReportModuleTable = NDIS_STRING_CONST( "ReportModuleTable" ); + + +NDIS_STRING STRFilterEnabled = NDIS_STRING_CONST( "Mac_Filter_Enabled"); +NDIS_STRING STRnumGroupAddrs = NDIS_STRING_CONST( "numGroupAddrs" ); +NDIS_STRING STRGroup_addr0 = NDIS_STRING_CONST( "Group_addr0" ); +NDIS_STRING STRGroup_addr1 = NDIS_STRING_CONST( "Group_addr1" ); +NDIS_STRING STRGroup_addr2 = NDIS_STRING_CONST( "Group_addr2" ); +NDIS_STRING STRGroup_addr3 = NDIS_STRING_CONST( "Group_addr3" ); +NDIS_STRING STRGroup_addr4 = NDIS_STRING_CONST( "Group_addr4" ); +NDIS_STRING STRGroup_addr5 = NDIS_STRING_CONST( "Group_addr5" ); +NDIS_STRING STRGroup_addr6 = NDIS_STRING_CONST( "Group_addr6" ); +NDIS_STRING STRGroup_addr7 = NDIS_STRING_CONST( "Group_addr7" ); + +/* Beacon timing */ +/* If Early Wakeup is Enabled, 1251 wakes-up EARLY_WAKEUP_TIME before expected Beacon reception occasion */ +/* If Early Wakeup is Disabled, 1251 wakes-up at the expected Beacon reception occasion. */ +NDIS_STRING STREarlyWakeup = NDIS_STRING_CONST( "EarlyWakeup" ); + +NDIS_STRING STRArp_Ip_Addr = NDIS_STRING_CONST( "ArpIp_Addr" ); +NDIS_STRING STRArp_Ip_Filter_Ena = NDIS_STRING_CONST( "ArpIp_Filter_ena"); + + +NDIS_STRING STRBeaconFilterDesiredState = NDIS_STRING_CONST( "Beacon_Filter_Desired_State"); +NDIS_STRING STRBeaconFilterStored = NDIS_STRING_CONST( "Beacon_Filter_Stored"); + +/*this is for configuring table from ini file*/ +NDIS_STRING STRBeaconIETableSize = NDIS_STRING_CONST( "Beacon_IE_Table_Size"); +NDIS_STRING STRBeaconIETable = NDIS_STRING_CONST( "Beacon_IE_Table") ; +NDIS_STRING STRBeaconIETableNumOfElem = NDIS_STRING_CONST( "Beacon_IE_Num_Of_Elem"); + +NDIS_STRING STRCoexActivityTable = NDIS_STRING_CONST( "Coex_Activity_Table"); +NDIS_STRING STRCoexActivityNumOfElem = NDIS_STRING_CONST( "Coex_Activity_Num_Of_Elem"); + +/* ------------------------------------------------------ */ +NDIS_STRING STRFirmwareDebug = NDIS_STRING_CONST( "FirmwareDebug" ); +NDIS_STRING STRTraceBufferSize = NDIS_STRING_CONST( "TraceBufferSize" ); +NDIS_STRING STRPrintTrace = NDIS_STRING_CONST( "PrintTrace" ); + +NDIS_STRING STRHwACXAccessMethod = NDIS_STRING_CONST( "HwACXAccessMethod" ); +NDIS_STRING STRMaxSitesFragCollect = NDIS_STRING_CONST( "MaxSitesFragCollect" ); + +NDIS_STRING STRTxFlashEnable = NDIS_STRING_CONST( "TxFlashEnable" ); + +NDIS_STRING STRBetEnable = NDIS_STRING_CONST( "BetEnable"); +NDIS_STRING STRBetMaxConsecutive = NDIS_STRING_CONST( "BetMaxConsecutive"); +NDIS_STRING STRMaxFullBeaconInterval = NDIS_STRING_CONST( "MaxlFullBeaconReceptionInterval" ); +NDIS_STRING STRBetEnableThreshold = NDIS_STRING_CONST( "BetEnableThreshold"); +NDIS_STRING STRBetDisableThreshold = NDIS_STRING_CONST( "BetDisableThreshold"); + +NDIS_STRING STRNumHostRxDescriptors = NDIS_STRING_CONST( "NumHostRxDescriptors" ); +NDIS_STRING STRNumHostTxDescriptors = NDIS_STRING_CONST( "NumHostTxDescriptors" ); + +NDIS_STRING STRACXMemoryBlockSize = NDIS_STRING_CONST( "ACXMemoryBlockSize" ); +NDIS_STRING STRACXRxMemoryBlockSize = NDIS_STRING_CONST( "ACXMemoryBlockSize" ); +NDIS_STRING STRACXTxMemoryBlockSize = NDIS_STRING_CONST( "ACXMemoryBlockSize" ); + +NDIS_STRING STRACXUseTxDataInterrupt = NDIS_STRING_CONST( "ACXUseTxDataInterrupt" ); +NDIS_STRING STRACXUseInterruptThreshold = NDIS_STRING_CONST( "ACXUseInterruptThreshold" ); + +NDIS_STRING STRCalibrationChannel2_4 = NDIS_STRING_CONST( "CalibrationChannel24" ); +NDIS_STRING STRCalibrationChannel5_0 = NDIS_STRING_CONST( "CalibrationChannel5" ); +NDIS_STRING STRdot11RTSThreshold = NDIS_STRING_CONST( "dot11RTSThreshold" ); +NDIS_STRING STRRxDisableBroadcast = NDIS_STRING_CONST( "RxDisableBroadcast" ); +NDIS_STRING STRRecoveryEnable = NDIS_STRING_CONST( "RecoveryEnable" ); +NDIS_STRING STRdot11TxAntenna = NDIS_STRING_CONST( "dot11TxAntenna" ); +NDIS_STRING STRdot11RxAntenna = NDIS_STRING_CONST( "dot11RxAntenna" ); + +NDIS_STRING STRTxCompleteThreshold = NDIS_STRING_CONST( "TxCompleteThreshold" ); +NDIS_STRING STRTxCompleteTimeout = NDIS_STRING_CONST( "TxCompleteTimeout" ); +NDIS_STRING STRRxInterruptThreshold = NDIS_STRING_CONST( "RxInterruptThreshold" ); +NDIS_STRING STRRxInterruptTimeout = NDIS_STRING_CONST( "RxInterruptTimeout" ); + +NDIS_STRING STRRxAggregationPktsLimit = NDIS_STRING_CONST( "RxAggregationPktsLimit" ); + +NDIS_STRING STRdot11FragThreshold = NDIS_STRING_CONST( "dot11FragmentationThreshold" ); +NDIS_STRING STRdot11MaxTxMSDULifetime = NDIS_STRING_CONST( "dot11MaxTransmitMSDULifetime" ); +NDIS_STRING STRdot11MaxReceiveLifetime = NDIS_STRING_CONST( "dot11MaxReceiveLifetime" ); +NDIS_STRING STRdot11RateFallBackRetryLimit = NDIS_STRING_CONST( "dot11RateFallBackRetryLimit"); + +NDIS_STRING STRReAuthActivePriority = NDIS_STRING_CONST( "ReAuthActivePriority" ); + +NDIS_STRING STRListenInterval = NDIS_STRING_CONST( "dot11ListenInterval" ); +NDIS_STRING STRExternalMode = NDIS_STRING_CONST( "DriverExternalMode" ); +NDIS_STRING STRWiFiAdHoc = NDIS_STRING_CONST( "WiFiAdhoc" ); +NDIS_STRING STRWiFiWmmPS = NDIS_STRING_CONST( "WiFiWmmPS" ); +NDIS_STRING STRWiFiMode = NDIS_STRING_CONST( "WiFiMode" ); +NDIS_STRING STRdot11DesiredChannel = NDIS_STRING_CONST( "dot11DesiredChannel"); +NDIS_STRING STRdot11DesiredSSID = NDIS_STRING_CONST( "dot11DesiredSSID" ); +NDIS_STRING STRdot11DesiredBSSType = NDIS_STRING_CONST( "dot11DesiredBSSType" ); +NDIS_STRING STRdot11BasicRateMask_B = NDIS_STRING_CONST( "dot11BasicRateMaskB"); +NDIS_STRING STRdot11SupportedRateMask_B = NDIS_STRING_CONST( "dot11SupportedRateMaskB"); +NDIS_STRING STRdot11BasicRateMask_G = NDIS_STRING_CONST( "dot11BasicRateMaskG"); +NDIS_STRING STRdot11SupportedRateMask_G = NDIS_STRING_CONST( "dot11SupportedRateMaskG"); +NDIS_STRING STRdot11BasicRateMask_A = NDIS_STRING_CONST( "dot11BasicRateMaskA"); +NDIS_STRING STRdot11SupportedRateMask_A = NDIS_STRING_CONST( "dot11SupportedRateMaskA"); +NDIS_STRING STRdot11BasicRateMask_AG = NDIS_STRING_CONST( "dot11BasicRateMaskAG"); +NDIS_STRING STRdot11SupportedRateMask_AG = NDIS_STRING_CONST( "dot11SupportedRateMaskAG"); +NDIS_STRING STRdot11BasicRateMask_N = NDIS_STRING_CONST( "STRdot11BasicRateMask_N"); +NDIS_STRING STRdot11SupportedRateMask_N = NDIS_STRING_CONST( "STRdot11SupportedRateMask_N"); + +NDIS_STRING STRRadio11_RxLevel = NDIS_STRING_CONST( "Radio11_RxLevel"); +NDIS_STRING STRRadio11_LNA = NDIS_STRING_CONST( "Radio11_LNA"); +NDIS_STRING STRRadio11_RSSI = NDIS_STRING_CONST( "Radio11_RSSI"); +NDIS_STRING STRRadio0D_RxLevel = NDIS_STRING_CONST( "Radio0D_RxLevel"); +NDIS_STRING STRRadio0D_LNA = NDIS_STRING_CONST( "Radio0D_LNA"); +NDIS_STRING STRRadio0D_RSSI = NDIS_STRING_CONST( "Radio0D_RSSI"); + +NDIS_STRING STRdot11DesiredNetworkType = NDIS_STRING_CONST( "dot11NetworkType"); +NDIS_STRING STRdot11DefaultNetworkType = NDIS_STRING_CONST( "dot11DefaultNetworkType"); +NDIS_STRING STRdot11SlotTime = NDIS_STRING_CONST( "ShortSlotTime"); +NDIS_STRING STRdot11IbssProtection = NDIS_STRING_CONST( "IbssProtectionType"); +NDIS_STRING STRdot11RtsCtsProtection = NDIS_STRING_CONST( "dot11RtsCtsProtection"); + +NDIS_STRING STRRxEnergyDetection = NDIS_STRING_CONST( "RxEnergyDetection" ); +NDIS_STRING STRTxEnergyDetection = NDIS_STRING_CONST( "TxEnergyDetection" ); +NDIS_STRING STRCrtCalibrationInterval = NDIS_STRING_CONST( "CrtCalibrationInterval" ); +NDIS_STRING STRTddCalibrationInterval = NDIS_STRING_CONST( "TddCalibrationInterval" ); +NDIS_STRING STRMacClockRate = NDIS_STRING_CONST( "MacClockRate" ); +NDIS_STRING STRArmClockRate = NDIS_STRING_CONST( "ArmClockRate" ); +NDIS_STRING STRg80211DraftNumber = NDIS_STRING_CONST( "g80211DraftNumber" ); + +NDIS_STRING STRdot11ShortPreambleInvoked = NDIS_STRING_CONST( "dot11ShortPreambleInvoked" ); + +NDIS_STRING STRdot11BeaconPeriod = NDIS_STRING_CONST( "dot11BeaconPeriod" ); +NDIS_STRING STRdot11MaxScanTime = NDIS_STRING_CONST( "dot11MaxScanTime" ); +NDIS_STRING STRdot11MinScanTime = NDIS_STRING_CONST( "dot11MinScanTime" ); +NDIS_STRING STRdot11MaxSiteLifetime = NDIS_STRING_CONST( "dot11MaxSiteLifetime" ); + +NDIS_STRING STRdot11MaxAuthRetry = NDIS_STRING_CONST( "dot11MaxAuthRetry" ); +NDIS_STRING STRdot11MaxAssocRetry = NDIS_STRING_CONST( "dot11MaxAssocRetry" ); +NDIS_STRING STRdot11AuthRespTimeout = NDIS_STRING_CONST( "dot11AuthenticationResponseTimeout" ); +NDIS_STRING STRdot11AssocRespTimeout = NDIS_STRING_CONST( "dot11AssociationResponseTimeout" ); + +NDIS_STRING STRConnSelfTimeout = NDIS_STRING_CONST( "ConnSelfTimeout" ); + +NDIS_STRING STRCreditCalcTimout = NDIS_STRING_CONST( "CreditCalcTimout" ); +NDIS_STRING STRCreditCalcTimerEnabled = NDIS_STRING_CONST( "CreditCalcTimerEnabled" ); + +NDIS_STRING STRTrafficAdmControlTimeout = NDIS_STRING_CONST("TrafficAdmControlTimeout"); +NDIS_STRING STRTrafficAdmControlUseFixedMsduSize = NDIS_STRING_CONST("TrafficAdmCtrlUseFixedMsduSize"); +NDIS_STRING STRDesiredMaxSpLen = NDIS_STRING_CONST("DesiredMaxSpLen"); + +NDIS_STRING STRCwFromUserEnable = NDIS_STRING_CONST("CwFromUserEnable"); +NDIS_STRING STRDesireCwMin = NDIS_STRING_CONST("DesireCwMin"); +NDIS_STRING STRDesireCwMax = NDIS_STRING_CONST("DesireCwMax"); + +NDIS_STRING STRRatePolicyUserShortRetryLimit = NDIS_STRING_CONST( "RatePolicyUserShortRetryLimit" ); +NDIS_STRING STRRatePolicyUserLongRetryLimit = NDIS_STRING_CONST( "RatePolicyUserLongRetryLimit" ); + +NDIS_STRING STRRatePolicyUserEnabledRatesMaskCck = NDIS_STRING_CONST( "RatePolicyUserEnabledRatesMaskCck" ); +NDIS_STRING STRRatePolicyUserEnabledRatesMaskOfdm = NDIS_STRING_CONST( "RatePolicyUserEnabledRatesMaskOfdm" ); +NDIS_STRING STRRatePolicyUserEnabledRatesMaskOfdmA = NDIS_STRING_CONST( "RatePolicyUserEnabledRatesMaskOfdmA" ); +NDIS_STRING STRRatePolicyUserEnabledRatesMaskOfdmN = NDIS_STRING_CONST( "RatePolicyUserEnabledRatesMaskOfdmN" ); + +NDIS_STRING STRdot11AuthenticationMode = NDIS_STRING_CONST( "dot11AuthenticationMode" ); +NDIS_STRING STRdot11WEPStatus = NDIS_STRING_CONST( "dot11WEPStatus" ); +NDIS_STRING STRdot11ExcludeUnencrypted = NDIS_STRING_CONST( "dot11ExcludeUnencrypted" ); +NDIS_STRING STRdot11WEPKeymappingLength = NDIS_STRING_CONST( "dot11WEPKeymappingLength" ); +NDIS_STRING STRdot11WEPDefaultKeyID = NDIS_STRING_CONST( "dot11WEPDefaultKeyID" ); + +NDIS_STRING STRMixedMode = NDIS_STRING_CONST( "MixedMode" ); + +NDIS_STRING STRWPAMixedMode = NDIS_STRING_CONST( "WPAMixedMode"); +NDIS_STRING STRRSNPreAuth = NDIS_STRING_CONST( "RSNPreAuthentication"); +NDIS_STRING STRRSNPreAuthTimeout = NDIS_STRING_CONST( "RSNPreAuthTimeout" ); +NDIS_STRING STRRSNExternalMode = NDIS_STRING_CONST( "RSNExternalMode" ); + +NDIS_STRING STRPairwiseMicFailureFilter = NDIS_STRING_CONST( "PairwiseMicFailureFilter" ); + +NDIS_STRING STRTimeToResetCountryMs = NDIS_STRING_CONST( "TimeToResetCountryMs" ); +NDIS_STRING STRMultiRegulatoryDomainEnabled = NDIS_STRING_CONST( "MultiRegulatoryDomain" ); +NDIS_STRING STRSpectrumManagementEnabled = NDIS_STRING_CONST( "SpectrumManagement" ); +NDIS_STRING STRScanControlTable24 = NDIS_STRING_CONST( "AllowedChannelsTable24" ); +NDIS_STRING STRScanControlTable5 = NDIS_STRING_CONST( "AllowedChannelsTable5" ); + +NDIS_STRING STRBurstModeEnable = NDIS_STRING_CONST( "BurstModeEnable" ); +/* Smart Reflex */ +NDIS_STRING STRSRState = NDIS_STRING_CONST( "SRState" ); +NDIS_STRING STRSRConfigParam1 = NDIS_STRING_CONST( "SRF1" ); +NDIS_STRING STRSRConfigParam2 = NDIS_STRING_CONST( "SRF2" ); +NDIS_STRING STRSRConfigParam3 = NDIS_STRING_CONST( "SRF3" ); +NDIS_STRING STRSRSenNP = NDIS_STRING_CONST( "SR_SEN_N_P" ); +NDIS_STRING STRSRSenNPGain = NDIS_STRING_CONST( "SR_SEN_N_P_Gain" ); +NDIS_STRING STRSRSenPrn = NDIS_STRING_CONST( "SR_SEN_PRN" ); +NDIS_STRING STRSRSenNrn = NDIS_STRING_CONST( "SR_SEN_NRN" ); +NDIS_STRING STRSRDebugTable = NDIS_STRING_CONST( "SR_Debug_Table" ); + + +/* +Power Manager +*/ +NDIS_STRING STRPowerMode = NDIS_STRING_CONST( "dot11PowerMode" ); +NDIS_STRING STRBeaconReceiveTime = NDIS_STRING_CONST( "BeaconReceiveTime" ); +NDIS_STRING STRBaseBandWakeUpTime = NDIS_STRING_CONST( "BaseBandWakeUpTime" ); +NDIS_STRING STRHangoverPeriod = NDIS_STRING_CONST( "HangoverPeriod" ); +NDIS_STRING STRBeaconListenInterval = NDIS_STRING_CONST( "BeaconListenInterval" ); +NDIS_STRING STRDtimListenInterval = NDIS_STRING_CONST( "DtimListenInterval" ); +NDIS_STRING STRNConsecutiveBeaconsMissed = NDIS_STRING_CONST( "NConsecutiveBeaconsMissed" ); +NDIS_STRING STREnterTo802_11PsRetries = NDIS_STRING_CONST( "EnterTo802_11PsRetries" ); +NDIS_STRING STRAutoPowerModeInterval = NDIS_STRING_CONST( "AutoPowerModeInterval" ); +NDIS_STRING STRAutoPowerModeActiveTh = NDIS_STRING_CONST( "AutoPowerModeActiveTh" ); +NDIS_STRING STRAutoPowerModeDozeTh = NDIS_STRING_CONST( "AutoPowerModeDozeTh" ); +NDIS_STRING STRAutoPowerModeDozeMode = NDIS_STRING_CONST( "AutoPowerModeDozeMode" ); +NDIS_STRING STRDefaultPowerLevel = NDIS_STRING_CONST( "defaultPowerLevel" ); +NDIS_STRING STRPowerSavePowerLevel = NDIS_STRING_CONST( "PowerSavePowerLevel" ); +NDIS_STRING STRHostClkSettlingTime = NDIS_STRING_CONST( "HostClkSettlingTime" ); +NDIS_STRING STRHostFastWakeupSupport = NDIS_STRING_CONST( "HostFastWakeupSupport" ); + +NDIS_STRING STRPsPollDeliveryFailureRecoveryPeriod = NDIS_STRING_CONST( "PsPollDeliveryFailureRecoveryPeriod" ); + +NDIS_STRING STRPowerMgmtHangOverPeriod = NDIS_STRING_CONST( "PowerMgmtHangOverPeriod" ); +NDIS_STRING STRPowerMgmtMode = NDIS_STRING_CONST( "PowerMgmtMode" ); +NDIS_STRING STRPowerMgmtNeedToSendNullData = NDIS_STRING_CONST( "PowerMgmtNeedToSendNullData" ); +NDIS_STRING STRPowerMgmtNullPktRateModulation = NDIS_STRING_CONST( "PowerMgmtNullPktRateModulation" ); +NDIS_STRING STRPowerMgmtNumNullPktRetries = NDIS_STRING_CONST( "PowerMgmtNumNullPktRetries" ); +NDIS_STRING STRPowerMgmtPllLockTime = NDIS_STRING_CONST( "PllLockTime" ); + +NDIS_STRING STRBeaconRxTimeout = NDIS_STRING_CONST( "BeaconRxTimeout" ); +NDIS_STRING STRBroadcastRxTimeout = NDIS_STRING_CONST( "BroadcastRxTimeout" ); +NDIS_STRING STRRxBroadcastInPs = NDIS_STRING_CONST( "RxBroadcastInPs" ); + +NDIS_STRING STRConsecutivePsPollDeliveryFailureThreshold = NDIS_STRING_CONST( "ConsecutivePsPollDeliveryFailureThreshold" ); + +NDIS_STRING STRTxPower = NDIS_STRING_CONST( "TxPower" ); + +/* Scan SRV */ +NDIS_STRING STRNumberOfNoScanCompleteToRecovery = NDIS_STRING_CONST( "NumberOfNoScanCompleteToRecovery" ); +NDIS_STRING STRTriggeredScanTimeOut = NDIS_STRING_CONST( "TriggeredScanTimeOut" ); + +/*-----------------------------------*/ +/* Coexistence params */ +/*-----------------------------------*/ +NDIS_STRING STRBThWlanCoexistEnable = NDIS_STRING_CONST( "BThWlanCoexistEnable" ); + +NDIS_STRING STRBThWlanCoexistPerThreshold = NDIS_STRING_CONST( "coexBtPerThreshold" ); +NDIS_STRING STRBThWlanCoexistParamsAutoScanMaxTime = NDIS_STRING_CONST( "coexAutoScanCompensationMaxTime" ); +NDIS_STRING STRBThWlanCoexistParamsBtLoadRatio = NDIS_STRING_CONST( "coexBtLoadRatio" ); +NDIS_STRING STRBThWlanCoexistParamsAutoPsMode = NDIS_STRING_CONST( "coexAutoPsMode" ); +NDIS_STRING STRBThWlanCoexistParamsAutoScanProbeReqPerc = NDIS_STRING_CONST( "coexAutoScanEnlargedNumOfProbeReqPercent" ); +NDIS_STRING STRBThWlanCoexistParamsAutoScanWindowPerc = NDIS_STRING_CONST( "coexAutoScanEnlargedScanWindowPercent" ); +NDIS_STRING STRBThWlanCoexistcoexAntennaConfiguration = NDIS_STRING_CONST( "coexAntennaConfiguration" ); +NDIS_STRING STRBThWlanCoexistNfsSampleInterval = NDIS_STRING_CONST( "coexBtNfsSampleInterval" ); +NDIS_STRING STRBThWlanCoexistcoexMaxConsecutiveBeaconMissPrecent = NDIS_STRING_CONST( "coexMaxConsecutiveBeaconMissPrecent" ); +NDIS_STRING STRBThWlanCoexistcoexAPRateAdapationThr = NDIS_STRING_CONST( "coexAPRateAdapationThr" ); +NDIS_STRING STRBThWlanCoexistcoexAPRateAdapationSnr = NDIS_STRING_CONST( "coexAPRateAdapationSnr" ); + +NDIS_STRING STRBThWlanCoexistUpsdAclMasterMinBR = NDIS_STRING_CONST( "coexWlanPsBtAclMasterMinBR" ); +NDIS_STRING STRBThWlanCoexistUpsdAclSlaveMinBR = NDIS_STRING_CONST( "coexWlanPsBtAclSlaveMinBR" ); +NDIS_STRING STRBThWlanCoexistUpsdAclMasterMaxBR = NDIS_STRING_CONST( "coexWlanPsBtAclMasterMaxBR" ); +NDIS_STRING STRBThWlanCoexistUpsdAclSlaveMaxBR = NDIS_STRING_CONST( "coexWlanPsBtAclSlaveMaxBR" ); +NDIS_STRING STRBThWlanPsMaxBtAclMasterBR = NDIS_STRING_CONST( "coexWlanPsMaxBtAclMasterBR" ); +NDIS_STRING STRBThWlanPsMaxBtAclSlaveBR = NDIS_STRING_CONST( "coexWlanPsMaxBtAclSlaveBR" ); +NDIS_STRING STRBThWlanCoexistUpsdAclMasterMinEDR = NDIS_STRING_CONST( "coexWlanPsBtAclMasterMinEDR" ); +NDIS_STRING STRBThWlanCoexistUpsdAclSlaveMinEDR = NDIS_STRING_CONST( "coexWlanPsBtAclSlaveMinEDR" ); +NDIS_STRING STRBThWlanCoexistUpsdAclMasterMaxEDR = NDIS_STRING_CONST( "coexWlanPsBtAclMasterMaxEDR" ); +NDIS_STRING STRBThWlanCoexistUpsdAclSlaveMaxEDR = NDIS_STRING_CONST( "coexWlanPsBtAclSlaveMaxEDR" ); +NDIS_STRING STRBThWlanPsMaxBtAclMasterEDR = NDIS_STRING_CONST( "coexWlanPsMaxBtAclMasterEDR" ); +NDIS_STRING STRBThWlanPsMaxBtAclSlaveEDR = NDIS_STRING_CONST( "coexWlanPsMaxBtAclSlaveEDR" ); + +NDIS_STRING STRBThWlanCoexistRxt = NDIS_STRING_CONST( "coexRxt" ); +NDIS_STRING STRBThWlanCoexistTxt = NDIS_STRING_CONST( "coexTxt" ); +NDIS_STRING STRBThWlanCoexistAdaptiveRxtTxt = NDIS_STRING_CONST( "coexAdaptiveRxtTxt" ); +NDIS_STRING STRBThWlanCoexistPsPollTimeout = NDIS_STRING_CONST( "coexPsPollTimeout" ); +NDIS_STRING STRBThWlanCoexistUpsdTimeout = NDIS_STRING_CONST( "coexUpsdTimeout" ); + +NDIS_STRING STRBThWlanCoexistWlanActiveBtAclMasterMinEDR = NDIS_STRING_CONST( "coexWlanActiveBtAclMasterMinEDR" ); +NDIS_STRING STRBThWlanCoexistWlanActiveBtAclMasterMaxEDR = NDIS_STRING_CONST( "coexWlanActiveBtAclMasterMaxEDR" ); +NDIS_STRING STRBThWlanCoexistWlanActiveMaxBtAclMasterEDR = NDIS_STRING_CONST( "coexWlanActiveMaxBtAclMasterEDR" ); +NDIS_STRING STRBThWlanCoexistWlanActiveBtAclSlaveMinEDR = NDIS_STRING_CONST( "coexWlanActiveBtAclSlaveMinEDR" ); +NDIS_STRING STRBThWlanCoexistWlanActiveBtAclSlaveMaxEDR = NDIS_STRING_CONST( "coexWlanActiveBtAclSlaveMaxEDR" ); +NDIS_STRING STRBThWlanCoexistWlanActiveMaxBtAclSlaveEDR = NDIS_STRING_CONST( "coexWlanActiveMaxBtAclSlaveEDR" ); + +NDIS_STRING STRBThWlanCoexistWlanActiveBtAclMinBR = NDIS_STRING_CONST( "coexWlanActiveBtAclMinBR" ); +NDIS_STRING STRBThWlanCoexistWlanActiveBtAclMaxBR = NDIS_STRING_CONST( "coexWlanActiveBtAclMaxBR" ); +NDIS_STRING STRBThWlanCoexistWlanActiveMaxBtAclBR = NDIS_STRING_CONST( "coexWlanActiveMaxBtAclBR" ); + +NDIS_STRING STRBThWlanCoexTemp1 = NDIS_STRING_CONST( "coexTempParam1" ); +NDIS_STRING STRBThWlanCoexTemp2 = NDIS_STRING_CONST( "coexTempParam2" ); +NDIS_STRING STRBThWlanCoexTemp3 = NDIS_STRING_CONST( "coexTempParam3" ); +NDIS_STRING STRBThWlanCoexTemp4 = NDIS_STRING_CONST( "coexTempParam4" ); +NDIS_STRING STRBThWlanCoexTemp5 = NDIS_STRING_CONST( "coexTempParam5" ); + +NDIS_STRING STRDisableSsidPending = NDIS_STRING_CONST( "DisableSsidPending" ); + +/*-----------------------------------*/ +/* SME Init Params */ +/*-----------------------------------*/ +NDIS_STRING STRSmeRadioOn = NDIS_STRING_CONST( "RadioOn" ); +NDIS_STRING STRSmeConnectMode = NDIS_STRING_CONST( "SmeConnectMode" ); +NDIS_STRING STRSmeScanRssiThreshold = NDIS_STRING_CONST( "SmeScanRssiThreshold" ); +NDIS_STRING STRSmeScanSnrThreshold = NDIS_STRING_CONST( "SmeScanSnrThreshold" ); +NDIS_STRING STRSmeScanCycleNumber = NDIS_STRING_CONST( "SmeScanCycleNumber" ); +NDIS_STRING STRSmeScanMaxDwellTime = NDIS_STRING_CONST( "SmeScanMaxDwellTimeMs" ); +NDIS_STRING STRSmeScanMinDwellTime = NDIS_STRING_CONST( "SmeScanMinDwellTimeMs" ); +NDIS_STRING STRSmeScanProbeRequestNumber = NDIS_STRING_CONST( "SmeScanProbeRequestNumber" ); +NDIS_STRING STRSmeScanIntervals = NDIS_STRING_CONST( "SmeScanIntervalList" ); +NDIS_STRING STRSmeScanGChannels = NDIS_STRING_CONST( "SmeScanGChannelList" ); +NDIS_STRING STRSmeScanAChannels = NDIS_STRING_CONST( "SmeScanAChannelList" ); + + +/*-----------------------------------*/ +/* Roaming & Scanning Init Params */ +/*-----------------------------------*/ +NDIS_STRING STRRoamScanEnable = NDIS_STRING_CONST( "RoamScanEnable" ); + +/*-----------------------------------*/ +/* Health Check Init Params */ +/*-----------------------------------*/ +NDIS_STRING STRRecoveryEnabledNoScanComplete = NDIS_STRING_CONST( "RecoveryEnabledNoScanComplete" ); +NDIS_STRING STRRecoveryEnabledMboxFailure = NDIS_STRING_CONST( "RecoveryEnabledMboxFailure" ); +NDIS_STRING STRRecoveryEnabledHwAwakeFailure = NDIS_STRING_CONST( "RecoveryEnabledHwAwakeFailure" ); +NDIS_STRING STRRecoveryEnabledTxStuck = NDIS_STRING_CONST( "RecoveryEnabledTxStuck" ); +NDIS_STRING STRRecoveryEnabledDisconnectTimeout = NDIS_STRING_CONST( "RecoveryEnabledDisconnectTimeout" ); +NDIS_STRING STRRecoveryEnabledPowerSaveFailure = NDIS_STRING_CONST( "RecoveryEnabledPowerSaveFailure" ); +NDIS_STRING STRRecoveryEnabledMeasurementFailure= NDIS_STRING_CONST( "RecoveryEnabledMeasurementFailure" ); +NDIS_STRING STRRecoveryEnabledBusFailure = NDIS_STRING_CONST( "RecoveryEnabledBusFailure" ); +NDIS_STRING STRRecoveryEnabledHwWdExpire = NDIS_STRING_CONST( "RecoveryEnabledHwWdExpire" ); +NDIS_STRING STRRecoveryEnabledRxXferFailure = NDIS_STRING_CONST( "RecoveryEnabledRxXferFailure" ); + +/*-----------------------------------*/ +/* Tx Power control with atheros */ +/*-----------------------------------*/ +NDIS_STRING STRTxPowerCheckTime = NDIS_STRING_CONST("TxPowerCheckTime"); +NDIS_STRING STRTxPowerControlOn = NDIS_STRING_CONST("TxPowerControlOn"); +NDIS_STRING STRTxPowerRssiThresh = NDIS_STRING_CONST("TxPowerRssiThresh"); +NDIS_STRING STRTxPowerRssiRestoreThresh = NDIS_STRING_CONST("TxPowerRssiRestoreThresh"); +NDIS_STRING STRTxPowerTempRecover = NDIS_STRING_CONST("TxPowerTempRecover"); + + +/*-----------------------------------*/ +/*-----------------------------------*/ +/* QOS Parameters */ +/*-----------------------------------*/ +NDIS_STRING STRWMEEnable = NDIS_STRING_CONST("WME_Enable"); +NDIS_STRING STRTrafficAdmCtrlEnable = NDIS_STRING_CONST("TrafficAdmCtrl_Enable"); +NDIS_STRING STRdesiredPsMode = NDIS_STRING_CONST("desiredPsMode"); +NDIS_STRING STRQOSmsduLifeTimeBE = NDIS_STRING_CONST("QOS_msduLifeTimeBE"); +NDIS_STRING STRQOSmsduLifeTimeBK = NDIS_STRING_CONST("QOS_msduLifeTimeBK"); +NDIS_STRING STRQOSmsduLifeTimeVI = NDIS_STRING_CONST("QOS_msduLifeTimeVI"); +NDIS_STRING STRQOSmsduLifeTimeVO = NDIS_STRING_CONST("QOS_msduLifeTimeVO"); +NDIS_STRING STRQOSrxTimeOutPsPoll = NDIS_STRING_CONST("QOS_rxTimeoutPsPoll"); +NDIS_STRING STRQOSrxTimeOutUPSD = NDIS_STRING_CONST("QOS_rxTimeoutUPSD"); +NDIS_STRING STRQOSwmePsModeBE = NDIS_STRING_CONST("QOS_wmePsModeBE"); +NDIS_STRING STRQOSwmePsModeBK = NDIS_STRING_CONST("QOS_wmePsModeBK"); +NDIS_STRING STRQOSwmePsModeVI = NDIS_STRING_CONST("QOS_wmePsModeVI"); +NDIS_STRING STRQOSwmePsModeVO = NDIS_STRING_CONST("QOS_wmePsModeVO"); +NDIS_STRING STRQOSShortRetryLimitBE = NDIS_STRING_CONST("QOS_ShortRetryLimitBE"); +NDIS_STRING STRQOSShortRetryLimitBK = NDIS_STRING_CONST("QOS_ShortRetryLimitBK"); +NDIS_STRING STRQOSShortRetryLimitVI = NDIS_STRING_CONST("QOS_ShortRetryLimitVI"); +NDIS_STRING STRQOSShortRetryLimitVO = NDIS_STRING_CONST("QOS_ShortRetryLimitVO"); +NDIS_STRING STRQOSLongRetryLimitBE = NDIS_STRING_CONST("QOS_LongRetryLimitBE"); +NDIS_STRING STRQOSLongRetryLimitBK = NDIS_STRING_CONST("QOS_LongRetryLimitBK"); +NDIS_STRING STRQOSLongRetryLimitVI = NDIS_STRING_CONST("QOS_LongRetryLimitVI"); +NDIS_STRING STRQOSLongRetryLimitVO = NDIS_STRING_CONST("QOS_LongRetryLimitVO"); + +NDIS_STRING STRQOSAckPolicyBE = NDIS_STRING_CONST("QOS_AckPolicyBE"); +NDIS_STRING STRQOSAckPolicyBK = NDIS_STRING_CONST("QOS_AckPolicyBK"); +NDIS_STRING STRQOSAckPolicyVI = NDIS_STRING_CONST("QOS_AckPolicyVI"); +NDIS_STRING STRQOSAckPolicyVO = NDIS_STRING_CONST("QOS_AckPolicyVO"); +NDIS_STRING STRQoSqueue0OverFlowPolicy = NDIS_STRING_CONST("QOS_queue0OverFlowPolicy"); +NDIS_STRING STRQoSqueue1OverFlowPolicy = NDIS_STRING_CONST("QOS_queue1OverFlowPolicy"); +NDIS_STRING STRQoSqueue2OverFlowPolicy = NDIS_STRING_CONST("QOS_queue2OverFlowPolicy"); +NDIS_STRING STRQoSqueue3OverFlowPolicy = NDIS_STRING_CONST("QOS_queue3OverFlowPolicy"); +/* HP parameters */ +NDIS_STRING STR11nEnable = NDIS_STRING_CONST("HT_Enable"); +NDIS_STRING STRBaPolicyTid_0 = NDIS_STRING_CONST("BaPolicyTid_0"); +NDIS_STRING STRBaPolicyTid_1 = NDIS_STRING_CONST("BaPolicyTid_1"); +NDIS_STRING STRBaPolicyTid_2 = NDIS_STRING_CONST("BaPolicyTid_2"); +NDIS_STRING STRBaPolicyTid_3 = NDIS_STRING_CONST("BaPolicyTid_3"); +NDIS_STRING STRBaPolicyTid_4 = NDIS_STRING_CONST("BaPolicyTid_4"); +NDIS_STRING STRBaPolicyTid_5 = NDIS_STRING_CONST("BaPolicyTid_5"); +NDIS_STRING STRBaPolicyTid_6 = NDIS_STRING_CONST("BaPolicyTid_6"); +NDIS_STRING STRBaPolicyTid_7 = NDIS_STRING_CONST("BaPolicyTid_7"); +NDIS_STRING STRBaInactivityTimeoutTid_0 = NDIS_STRING_CONST("BaInactivityTimeoutTid_0"); +NDIS_STRING STRBaInactivityTimeoutTid_1 = NDIS_STRING_CONST("BaInactivityTimeoutTid_1"); +NDIS_STRING STRBaInactivityTimeoutTid_2 = NDIS_STRING_CONST("BaInactivityTimeoutTid_2"); +NDIS_STRING STRBaInactivityTimeoutTid_3 = NDIS_STRING_CONST("BaInactivityTimeoutTid_3"); +NDIS_STRING STRBaInactivityTimeoutTid_4 = NDIS_STRING_CONST("BaInactivityTimeoutTid_4"); +NDIS_STRING STRBaInactivityTimeoutTid_5 = NDIS_STRING_CONST("BaInactivityTimeoutTid_5"); +NDIS_STRING STRBaInactivityTimeoutTid_6 = NDIS_STRING_CONST("BaInactivityTimeoutTid_6"); +NDIS_STRING STRBaInactivityTimeoutTid_7 = NDIS_STRING_CONST("BaInactivityTimeoutTid_7"); + + +/* HW Tx queues mem-blocks allocation thresholds */ +NDIS_STRING STRQOStxBlksThresholdBE = NDIS_STRING_CONST("QOS_txBlksThresholdBE"); +NDIS_STRING STRQOStxBlksThresholdBK = NDIS_STRING_CONST("QOS_txBlksThresholdBK"); +NDIS_STRING STRQOStxBlksThresholdVI = NDIS_STRING_CONST("QOS_txBlksThresholdVI"); +NDIS_STRING STRQOStxBlksThresholdVO = NDIS_STRING_CONST("QOS_txBlksThresholdVO"); + +/* Traffic Intensity parameters*/ +NDIS_STRING STRTrafficIntensityThresHigh = NDIS_STRING_CONST("TrafficIntensityThresHigh"); +NDIS_STRING STRTrafficIntensityThresLow = NDIS_STRING_CONST("TrafficIntensityThresLow"); +NDIS_STRING STRTrafficIntensityTestInterval = NDIS_STRING_CONST("TrafficIntensityTestInterval"); +NDIS_STRING STRTrafficIntensityThresholdEnabled = NDIS_STRING_CONST("TrafficIntensityThresholdEnabled"); +NDIS_STRING STRTrafficMonitorMinIntervalPercentage = NDIS_STRING_CONST("TrafficMonitorMinIntervalPercent"); + + +/* Packet Burst parameters */ +NDIS_STRING STRQOSPacketBurstEnable = NDIS_STRING_CONST("QOS_PacketBurstEnable"); +NDIS_STRING STRQOSPacketBurstTxOpLimit = NDIS_STRING_CONST("QOS_PacketBurstTxOpLimit"); + +/*-----------------------------------*/ +/* QOS classifier Parameters */ +/*-----------------------------------*/ +NDIS_STRING STRClsfr_Type = NDIS_STRING_CONST("Clsfr_Type"); +NDIS_STRING STRNumOfCodePoints = NDIS_STRING_CONST("NumOfCodePoints"); +NDIS_STRING STRNumOfDstPortClassifiers = NDIS_STRING_CONST("NumOfDstPortClassifiers"); +NDIS_STRING STRNumOfDstIPPortClassifiers = NDIS_STRING_CONST("NumOfDstIPPortClassifiers"); + +NDIS_STRING STRDSCPClassifier00_CodePoint = NDIS_STRING_CONST("DSCPClassifier00_CodePoint"); +NDIS_STRING STRDSCPClassifier01_CodePoint = NDIS_STRING_CONST("DSCPClassifier01_CodePoint"); +NDIS_STRING STRDSCPClassifier02_CodePoint = NDIS_STRING_CONST("DSCPClassifier02_CodePoint"); +NDIS_STRING STRDSCPClassifier03_CodePoint = NDIS_STRING_CONST("DSCPClassifier03_CodePoint"); +NDIS_STRING STRDSCPClassifier04_CodePoint = NDIS_STRING_CONST("DSCPClassifier04_CodePoint"); +NDIS_STRING STRDSCPClassifier05_CodePoint = NDIS_STRING_CONST("DSCPClassifier05_CodePoint"); +NDIS_STRING STRDSCPClassifier06_CodePoint = NDIS_STRING_CONST("DSCPClassifier06_CodePoint"); +NDIS_STRING STRDSCPClassifier07_CodePoint = NDIS_STRING_CONST("DSCPClassifier07_CodePoint"); +NDIS_STRING STRDSCPClassifier08_CodePoint = NDIS_STRING_CONST("DSCPClassifier08_CodePoint"); +NDIS_STRING STRDSCPClassifier09_CodePoint = NDIS_STRING_CONST("DSCPClassifier09_CodePoint"); +NDIS_STRING STRDSCPClassifier10_CodePoint = NDIS_STRING_CONST("DSCPClassifier10_CodePoint"); +NDIS_STRING STRDSCPClassifier11_CodePoint = NDIS_STRING_CONST("DSCPClassifier11_CodePoint"); +NDIS_STRING STRDSCPClassifier12_CodePoint = NDIS_STRING_CONST("DSCPClassifier12_CodePoint"); +NDIS_STRING STRDSCPClassifier13_CodePoint = NDIS_STRING_CONST("DSCPClassifier13_CodePoint"); +NDIS_STRING STRDSCPClassifier14_CodePoint = NDIS_STRING_CONST("DSCPClassifier14_CodePoint"); +NDIS_STRING STRDSCPClassifier15_CodePoint = NDIS_STRING_CONST("DSCPClassifier15_CodePoint"); + +NDIS_STRING STRDSCPClassifier00_DTag = NDIS_STRING_CONST("DSCPClassifier00_DTag"); +NDIS_STRING STRDSCPClassifier01_DTag = NDIS_STRING_CONST("DSCPClassifier01_DTag"); +NDIS_STRING STRDSCPClassifier02_DTag = NDIS_STRING_CONST("DSCPClassifier02_DTag"); +NDIS_STRING STRDSCPClassifier03_DTag = NDIS_STRING_CONST("DSCPClassifier03_DTag"); +NDIS_STRING STRDSCPClassifier04_DTag = NDIS_STRING_CONST("DSCPClassifier04_DTag"); +NDIS_STRING STRDSCPClassifier05_DTag = NDIS_STRING_CONST("DSCPClassifier05_DTag"); +NDIS_STRING STRDSCPClassifier06_DTag = NDIS_STRING_CONST("DSCPClassifier06_DTag"); +NDIS_STRING STRDSCPClassifier07_DTag = NDIS_STRING_CONST("DSCPClassifier07_DTag"); +NDIS_STRING STRDSCPClassifier08_DTag = NDIS_STRING_CONST("DSCPClassifier08_DTag"); +NDIS_STRING STRDSCPClassifier09_DTag = NDIS_STRING_CONST("DSCPClassifier09_DTag"); +NDIS_STRING STRDSCPClassifier10_DTag = NDIS_STRING_CONST("DSCPClassifier10_DTag"); +NDIS_STRING STRDSCPClassifier11_DTag = NDIS_STRING_CONST("DSCPClassifier11_DTag"); +NDIS_STRING STRDSCPClassifier12_DTag = NDIS_STRING_CONST("DSCPClassifier12_DTag"); +NDIS_STRING STRDSCPClassifier13_DTag = NDIS_STRING_CONST("DSCPClassifier13_DTag"); +NDIS_STRING STRDSCPClassifier14_DTag = NDIS_STRING_CONST("DSCPClassifier14_DTag"); +NDIS_STRING STRDSCPClassifier15_DTag = NDIS_STRING_CONST("DSCPClassifier15_DTag"); + + +NDIS_STRING STRPortClassifier00_Port = NDIS_STRING_CONST("PortClassifier00_Port"); +NDIS_STRING STRPortClassifier01_Port = NDIS_STRING_CONST("PortClassifier01_Port"); +NDIS_STRING STRPortClassifier02_Port = NDIS_STRING_CONST("PortClassifier02_Port"); +NDIS_STRING STRPortClassifier03_Port = NDIS_STRING_CONST("PortClassifier03_Port"); +NDIS_STRING STRPortClassifier04_Port = NDIS_STRING_CONST("PortClassifier04_Port"); +NDIS_STRING STRPortClassifier05_Port = NDIS_STRING_CONST("PortClassifier05_Port"); +NDIS_STRING STRPortClassifier06_Port = NDIS_STRING_CONST("PortClassifier06_Port"); +NDIS_STRING STRPortClassifier07_Port = NDIS_STRING_CONST("PortClassifier07_Port"); +NDIS_STRING STRPortClassifier08_Port = NDIS_STRING_CONST("PortClassifier08_Port"); +NDIS_STRING STRPortClassifier09_Port = NDIS_STRING_CONST("PortClassifier09_Port"); +NDIS_STRING STRPortClassifier10_Port = NDIS_STRING_CONST("PortClassifier10_Port"); +NDIS_STRING STRPortClassifier11_Port = NDIS_STRING_CONST("PortClassifier11_Port"); +NDIS_STRING STRPortClassifier12_Port = NDIS_STRING_CONST("PortClassifier12_Port"); +NDIS_STRING STRPortClassifier13_Port = NDIS_STRING_CONST("PortClassifier13_Port"); +NDIS_STRING STRPortClassifier14_Port = NDIS_STRING_CONST("PortClassifier14_Port"); +NDIS_STRING STRPortClassifier15_Port = NDIS_STRING_CONST("PortClassifier15_Port"); + +NDIS_STRING STRPortClassifier00_DTag = NDIS_STRING_CONST("PortClassifier00_DTag"); +NDIS_STRING STRPortClassifier01_DTag = NDIS_STRING_CONST("PortClassifier01_DTag"); +NDIS_STRING STRPortClassifier02_DTag = NDIS_STRING_CONST("PortClassifier02_DTag"); +NDIS_STRING STRPortClassifier03_DTag = NDIS_STRING_CONST("PortClassifier03_DTag"); +NDIS_STRING STRPortClassifier04_DTag = NDIS_STRING_CONST("PortClassifier04_DTag"); +NDIS_STRING STRPortClassifier05_DTag = NDIS_STRING_CONST("PortClassifier05_DTag"); +NDIS_STRING STRPortClassifier06_DTag = NDIS_STRING_CONST("PortClassifier06_DTag"); +NDIS_STRING STRPortClassifier07_DTag = NDIS_STRING_CONST("PortClassifier07_DTag"); +NDIS_STRING STRPortClassifier08_DTag = NDIS_STRING_CONST("PortClassifier08_DTag"); +NDIS_STRING STRPortClassifier09_DTag = NDIS_STRING_CONST("PortClassifier09_DTag"); +NDIS_STRING STRPortClassifier10_DTag = NDIS_STRING_CONST("PortClassifier10_DTag"); +NDIS_STRING STRPortClassifier11_DTag = NDIS_STRING_CONST("PortClassifier11_DTag"); +NDIS_STRING STRPortClassifier12_DTag = NDIS_STRING_CONST("PortClassifier12_DTag"); +NDIS_STRING STRPortClassifier13_DTag = NDIS_STRING_CONST("PortClassifier13_DTag"); +NDIS_STRING STRPortClassifier14_DTag = NDIS_STRING_CONST("PortClassifier14_DTag"); +NDIS_STRING STRPortClassifier15_DTag = NDIS_STRING_CONST("PortClassifier15_DTag"); + +NDIS_STRING STRIPPortClassifier00_IPAddress = NDIS_STRING_CONST("IPPortClassifier00_IPAddress"); +NDIS_STRING STRIPPortClassifier01_IPAddress = NDIS_STRING_CONST("IPPortClassifier01_IPAddress"); +NDIS_STRING STRIPPortClassifier02_IPAddress = NDIS_STRING_CONST("IPPortClassifier02_IPAddress"); +NDIS_STRING STRIPPortClassifier03_IPAddress = NDIS_STRING_CONST("IPPortClassifier03_IPAddress"); +NDIS_STRING STRIPPortClassifier04_IPAddress = NDIS_STRING_CONST("IPPortClassifier04_IPAddress"); +NDIS_STRING STRIPPortClassifier05_IPAddress = NDIS_STRING_CONST("IPPortClassifier05_IPAddress"); +NDIS_STRING STRIPPortClassifier06_IPAddress = NDIS_STRING_CONST("IPPortClassifier06_IPAddress"); +NDIS_STRING STRIPPortClassifier07_IPAddress = NDIS_STRING_CONST("IPPortClassifier07_IPAddress"); +NDIS_STRING STRIPPortClassifier08_IPAddress = NDIS_STRING_CONST("IPPortClassifier08_IPAddress"); +NDIS_STRING STRIPPortClassifier09_IPAddress = NDIS_STRING_CONST("IPPortClassifier09_IPAddress"); +NDIS_STRING STRIPPortClassifier10_IPAddress = NDIS_STRING_CONST("IPPortClassifier10_IPAddress"); +NDIS_STRING STRIPPortClassifier11_IPAddress = NDIS_STRING_CONST("IPPortClassifier11_IPAddress"); +NDIS_STRING STRIPPortClassifier12_IPAddress = NDIS_STRING_CONST("IPPortClassifier12_IPAddress"); +NDIS_STRING STRIPPortClassifier13_IPAddress = NDIS_STRING_CONST("IPPortClassifier13_IPAddress"); +NDIS_STRING STRIPPortClassifier14_IPAddress = NDIS_STRING_CONST("IPPortClassifier14_IPAddress"); +NDIS_STRING STRIPPortClassifier15_IPAddress = NDIS_STRING_CONST("IPPortClassifier15_IPAddress"); + +NDIS_STRING STRIPPortClassifier00_Port = NDIS_STRING_CONST("IPPortClassifier00_Port"); +NDIS_STRING STRIPPortClassifier01_Port = NDIS_STRING_CONST("IPPortClassifier01_Port"); +NDIS_STRING STRIPPortClassifier02_Port = NDIS_STRING_CONST("IPPortClassifier02_Port"); +NDIS_STRING STRIPPortClassifier03_Port = NDIS_STRING_CONST("IPPortClassifier03_Port"); +NDIS_STRING STRIPPortClassifier04_Port = NDIS_STRING_CONST("IPPortClassifier04_Port"); +NDIS_STRING STRIPPortClassifier05_Port = NDIS_STRING_CONST("IPPortClassifier05_Port"); +NDIS_STRING STRIPPortClassifier06_Port = NDIS_STRING_CONST("IPPortClassifier06_Port"); +NDIS_STRING STRIPPortClassifier07_Port = NDIS_STRING_CONST("IPPortClassifier07_Port"); +NDIS_STRING STRIPPortClassifier08_Port = NDIS_STRING_CONST("IPPortClassifier08_Port"); +NDIS_STRING STRIPPortClassifier09_Port = NDIS_STRING_CONST("IPPortClassifier09_Port"); +NDIS_STRING STRIPPortClassifier10_Port = NDIS_STRING_CONST("IPPortClassifier10_Port"); +NDIS_STRING STRIPPortClassifier11_Port = NDIS_STRING_CONST("IPPortClassifier11_Port"); +NDIS_STRING STRIPPortClassifier12_Port = NDIS_STRING_CONST("IPPortClassifier12_Port"); +NDIS_STRING STRIPPortClassifier13_Port = NDIS_STRING_CONST("IPPortClassifier13_Port"); +NDIS_STRING STRIPPortClassifier14_Port = NDIS_STRING_CONST("IPPortClassifier14_Port"); +NDIS_STRING STRIPPortClassifier15_Port = NDIS_STRING_CONST("IPPortClassifier15_Port"); + +NDIS_STRING STRIPPortClassifier00_DTag = NDIS_STRING_CONST("IPPortClassifier00_DTag"); +NDIS_STRING STRIPPortClassifier01_DTag = NDIS_STRING_CONST("IPPortClassifier01_DTag"); +NDIS_STRING STRIPPortClassifier02_DTag = NDIS_STRING_CONST("IPPortClassifier02_DTag"); +NDIS_STRING STRIPPortClassifier03_DTag = NDIS_STRING_CONST("IPPortClassifier03_DTag"); +NDIS_STRING STRIPPortClassifier04_DTag = NDIS_STRING_CONST("IPPortClassifier04_DTag"); +NDIS_STRING STRIPPortClassifier05_DTag = NDIS_STRING_CONST("IPPortClassifier05_DTag"); +NDIS_STRING STRIPPortClassifier06_DTag = NDIS_STRING_CONST("IPPortClassifier06_DTag"); +NDIS_STRING STRIPPortClassifier07_DTag = NDIS_STRING_CONST("IPPortClassifier07_DTag"); +NDIS_STRING STRIPPortClassifier08_DTag = NDIS_STRING_CONST("IPPortClassifier08_DTag"); +NDIS_STRING STRIPPortClassifier09_DTag = NDIS_STRING_CONST("IPPortClassifier09_DTag"); +NDIS_STRING STRIPPortClassifier10_DTag = NDIS_STRING_CONST("IPPortClassifier10_DTag"); +NDIS_STRING STRIPPortClassifier11_DTag = NDIS_STRING_CONST("IPPortClassifier11_DTag"); +NDIS_STRING STRIPPortClassifier12_DTag = NDIS_STRING_CONST("IPPortClassifier12_DTag"); +NDIS_STRING STRIPPortClassifier13_DTag = NDIS_STRING_CONST("IPPortClassifier13_DTag"); +NDIS_STRING STRIPPortClassifier14_DTag = NDIS_STRING_CONST("IPPortClassifier14_DTag"); +NDIS_STRING STRIPPortClassifier15_DTag = NDIS_STRING_CONST("IPPortClassifier15_DTag"); + +/*----------------------------- + Rx Data Filter parameters +-----------------------------*/ +NDIS_STRING STRRxDataFiltersEnabled = NDIS_STRING_CONST("RxDataFilters_Enabled"); +NDIS_STRING STRRxDataFiltersDefaultAction = NDIS_STRING_CONST("RxDataFilters_DefaultAction"); + +NDIS_STRING STRRxDataFiltersFilter1Offset = NDIS_STRING_CONST("RxDataFilters_Filter1Offset"); +NDIS_STRING STRRxDataFiltersFilter1Mask = NDIS_STRING_CONST("RxDataFilters_Filter1Mask"); +NDIS_STRING STRRxDataFiltersFilter1Pattern = NDIS_STRING_CONST("RxDataFilters_Filter1Pattern"); + +NDIS_STRING STRRxDataFiltersFilter2Offset = NDIS_STRING_CONST("RxDataFilters_Filter2Offset"); +NDIS_STRING STRRxDataFiltersFilter2Mask = NDIS_STRING_CONST("RxDataFilters_Filter2Mask"); +NDIS_STRING STRRxDataFiltersFilter2Pattern = NDIS_STRING_CONST("RxDataFilters_Filter2Pattern"); + +NDIS_STRING STRRxDataFiltersFilter3Offset = NDIS_STRING_CONST("RxDataFilters_Filter3Offset"); +NDIS_STRING STRRxDataFiltersFilter3Mask = NDIS_STRING_CONST("RxDataFilters_Filter3Mask"); +NDIS_STRING STRRxDataFiltersFilter3Pattern = NDIS_STRING_CONST("RxDataFilters_Filter3Pattern"); + +NDIS_STRING STRRxDataFiltersFilter4Offset = NDIS_STRING_CONST("RxDataFilters_Filter4Offset"); +NDIS_STRING STRRxDataFiltersFilter4Mask = NDIS_STRING_CONST("RxDataFilters_Filter4Mask"); +NDIS_STRING STRRxDataFiltersFilter4Pattern = NDIS_STRING_CONST("RxDataFilters_Filter4Pattern"); + + +NDIS_STRING STRReAuthActiveTimeout = NDIS_STRING_CONST( "ReAuthActiveTimeout" ); + +/*--------------------------- + Measurement parameters +-----------------------------*/ +NDIS_STRING STRMeasurTrafficThreshold = NDIS_STRING_CONST( "MeasurTrafficThreshold" ); +NDIS_STRING STRMeasurMaxDurationOnNonServingChannel = NDIS_STRING_CONST( "MeasurMaxDurationOnNonServingChannel" ); + +/*--------------------------- + XCC Manager parameters +-----------------------------*/ +#ifdef XCC_MODULE_INCLUDED +NDIS_STRING STRXCCModeEnabled = NDIS_STRING_CONST( "XCCModeEnabled" ); +#endif + +NDIS_STRING STRXCCTestIgnoreDeAuth0 = NDIS_STRING_CONST( "XCCTestRogeAP" ); + +/*-----------------------------------*/ +/* EEPROM-less support */ +/*-----------------------------------*/ +NDIS_STRING STREEPROMlessModeSupported = NDIS_STRING_CONST( "EEPROMlessModeSupported" ); +NDIS_STRING STRstationMacAddress = NDIS_STRING_CONST("dot11StationID"); + + +/*-----------------------------------*/ +/* INI file to configuration */ +/*-----------------------------------*/ + +NDIS_STRING SendINIBufferToUser = NDIS_STRING_CONST("SendINIBufferToUserMode"); + +/*------------------------------------------- + RSSI/SNR Weights for Average calculations +--------------------------------------------*/ + +NDIS_STRING STRRssiBeaconAverageWeight = NDIS_STRING_CONST("RssiBeaconAverageWeight"); +NDIS_STRING STRRssiPacketAverageWeight = NDIS_STRING_CONST("RssiPacketAverageWeight"); +NDIS_STRING STRSnrBeaconAverageWeight = NDIS_STRING_CONST("SnrBeaconAverageWeight"); +NDIS_STRING STRSnrPacketAverageWeight = NDIS_STRING_CONST("SnrPacketAverageWeight"); + +/*-----------------------------------*/ +/* Scan concentrator parameters */ +/*-----------------------------------*/ +NDIS_STRING STRMinimumDurationBetweenOsScans = NDIS_STRING_CONST( "MinimumDurationBetweenOsScans" ); +NDIS_STRING STRDfsPassiveDwellTimeMs = NDIS_STRING_CONST( "DfsPassiveDwellTimeMs" ); +NDIS_STRING STRScanPushMode = NDIS_STRING_CONST( "ScanPushMode" ); + +NDIS_STRING STRParseWSCInBeacons = NDIS_STRING_CONST( "ParseWSCInBeacons" ); + +/*-----------------------------------*/ +/* Current BSS parameters */ +/*-----------------------------------*/ +NDIS_STRING STRNullDataKeepAliveDefaultPeriod = NDIS_STRING_CONST("NullDataKeepAliveDefaultPeriod"); + +/*-----------------------------------*/ +/* Context-Engine parameters */ +/*-----------------------------------*/ +NDIS_STRING STRContextSwitchRequired = NDIS_STRING_CONST("ContextSwitchRequired"); + +/*-----------------------------------*/ +/* Radio parameters */ +/*-----------------------------------*/ +NDIS_STRING STRTXBiPReferencePDvoltage_2_4G = NDIS_STRING_CONST("TXBiPReferencePDvoltage_2_4G"); +NDIS_STRING STRTxBiPReferencePower_2_4G = NDIS_STRING_CONST("TxBiPReferencePower_2_4G"); +NDIS_STRING STRTxBiPOffsetdB_2_4G = NDIS_STRING_CONST("TxBiPOffsetdB_2_4G"); +NDIS_STRING STRTxPerRatePowerLimits_2_4G_Normal = NDIS_STRING_CONST("TxPerRatePowerLimits_2_4G_Normal"); +NDIS_STRING STRTxPerRatePowerLimits_2_4G_Degraded = NDIS_STRING_CONST("TxPerRatePowerLimits_2_4G_Degraded"); +NDIS_STRING STRTxPerChannelPowerLimits_2_4G_11b = NDIS_STRING_CONST("TxPerChannelPowerLimits_2_4G_11b"); +NDIS_STRING STRTxPerChannelPowerLimits_2_4G_OFDM = NDIS_STRING_CONST("TxPerChannelPowerLimits_2_4G_OFDM"); +NDIS_STRING STRTxPDVsRateOffsets_2_4G = NDIS_STRING_CONST("TxPDVsRateOffsets_2_4G"); +NDIS_STRING STRTxIbiasTable_2_4G = NDIS_STRING_CONST("TxIbiasTable_2_4G"); +NDIS_STRING STRRxFemInsertionLoss_2_4G = NDIS_STRING_CONST("RxFemInsertionLoss_2_4G"); +NDIS_STRING STRRxTraceInsertionLoss_2_4G = NDIS_STRING_CONST("RxTraceInsertionLoss_2_4G"); +NDIS_STRING STRTXTraceLoss_2_4G = NDIS_STRING_CONST("TXTraceLoss_2_4G"); +NDIS_STRING STRRxRssiAndProcessCompensation_2_4G = NDIS_STRING_CONST("RxRssiAndProcessCompensation_2_4G"); +NDIS_STRING STRTXBiPReferencePDvoltage_5G = NDIS_STRING_CONST("TXBiPReferencePDvoltage_5G"); +NDIS_STRING STRTxBiPReferencePower_5G = NDIS_STRING_CONST("TxBiPReferencePower_5G"); +NDIS_STRING STRTxBiPOffsetdB_5G = NDIS_STRING_CONST("TxBiPOffsetdB_5G"); +NDIS_STRING STRTxPerRatePowerLimits_5G_Normal = NDIS_STRING_CONST("TxPerRatePowerLimits_5G_Normal"); +NDIS_STRING STRTxPerRatePowerLimits_5G_Degraded = NDIS_STRING_CONST("TxPerRatePowerLimits_5G_Degraded"); +NDIS_STRING STRTxPerChannelPowerLimits_5G_OFDM = NDIS_STRING_CONST("TxPerChannelPowerLimits_5G_OFDM"); +NDIS_STRING STRTxPDVsRateOffsets_5G = NDIS_STRING_CONST("TxPDVsRateOffsets_5G"); +NDIS_STRING STRTxIbiasTable_5G = NDIS_STRING_CONST("TxIbiasTable_5G"); +NDIS_STRING STRRxFemInsertionLoss_5G = NDIS_STRING_CONST("RxFemInsertionLoss_5G"); +NDIS_STRING STRRxTraceInsertionLoss_5G = NDIS_STRING_CONST("RxTraceInsertionLoss_5G"); +NDIS_STRING STRTXTraceLoss_5G = NDIS_STRING_CONST("TXTraceLoss_5G"); +NDIS_STRING STRRxRssiAndProcessCompensation_5G = NDIS_STRING_CONST("RxRssiAndProcessCompensation_5G"); +NDIS_STRING STRFRefClock = NDIS_STRING_CONST("STRFRefClock"); +NDIS_STRING STRFRefClockSettingTime = NDIS_STRING_CONST("STRFRefClockSettingTime"); +NDIS_STRING STRFRefClockStatus = NDIS_STRING_CONST("FRefClockStatus"); +NDIS_STRING STRTXBiPFEMAutoDetect = NDIS_STRING_CONST("TXBiPFEMAutoDetect"); +NDIS_STRING STRTXBiPFEMManufacturer = NDIS_STRING_CONST("TXBiPFEMManufacturer"); +NDIS_STRING STRClockValidOnWakeup = NDIS_STRING_CONST("ClockValidOnWakeup"); +NDIS_STRING STRDC2DCMode = NDIS_STRING_CONST("DC2DCMode"); +NDIS_STRING STRSingle_Dual_Band_Solution = NDIS_STRING_CONST("Single_Dual_Band_Solution"); +NDIS_STRING STRSettings = NDIS_STRING_CONST("Settings"); + +/*-----------------------------------*/ +/* Driver-Main parameters */ +/*-----------------------------------*/ +NDIS_STRING STRWlanDrvThreadPriority = NDIS_STRING_CONST("WlanDrvThreadPriority"); +NDIS_STRING STRBusDrvThreadPriority = NDIS_STRING_CONST("BusDrvThreadPriority"); +NDIS_STRING STRSdioBlkSizeShift = NDIS_STRING_CONST("SdioBlkSizeShift"); + + +/*-----------------------------------*/ +/* Roaming parameters */ +/*-----------------------------------*/ +NDIS_STRING STRRoamingOperationalMode = NDIS_STRING_CONST("RoamingOperationalMode"); + +/*-----------------------------------*/ +/* FM Coexistence parameters */ +/*-----------------------------------*/ +NDIS_STRING STRFmCoexEnable = NDIS_STRING_CONST("FmCoexuEnable"); +NDIS_STRING STRFmCoexSwallowPeriod = NDIS_STRING_CONST("FmCoexuSwallowPeriod"); +NDIS_STRING STRFmCoexNDividerFrefSet1 = NDIS_STRING_CONST("FmCoexuNDividerFrefSet1"); +NDIS_STRING STRFmCoexNDividerFrefSet2 = NDIS_STRING_CONST("FmCoexuNDividerFrefSet2"); +NDIS_STRING STRFmCoexMDividerFrefSet1 = NDIS_STRING_CONST("FmCoexuMDividerFrefSet1"); +NDIS_STRING STRFmCoexMDividerFrefSet2 = NDIS_STRING_CONST("FmCoexuMDividerFrefSet2"); +NDIS_STRING STRFmCoexPllStabilizationTime = NDIS_STRING_CONST("FmCoexuPllStabilizationTime"); +NDIS_STRING STRFmCoexLdoStabilizationTime = NDIS_STRING_CONST("FmCoexuLdoStabilizationTime"); +NDIS_STRING STRFmCoexDisturbedBandMargin = NDIS_STRING_CONST("FmCoexuDisturbedBandMargin"); +NDIS_STRING STRFmCoexSwallowClkDif = NDIS_STRING_CONST("FmCoexSwallowClkDif"); + +/*----------------------------------------*/ +/* Rate Management Parameters */ +/*----------------------------------------*/ + +/* LiorC */ + +NDIS_STRING STRRateMngRateRetryScore = NDIS_STRING_CONST("RateMngRateRetryScore"); +NDIS_STRING STRRateMngPerAdd = NDIS_STRING_CONST("RateMngPerAdd"); +NDIS_STRING STRRateMngPerTh1 = NDIS_STRING_CONST("RateMngPerTh1"); +NDIS_STRING STRRateMngPerTh2 = NDIS_STRING_CONST("RateMngPerTh2"); +NDIS_STRING STRRateMngMaxPer = NDIS_STRING_CONST("RateMngMaxPer"); +NDIS_STRING STRRateMngInverseCuriosityFactor = NDIS_STRING_CONST("RateMngInverseCuriosityFactor"); +NDIS_STRING STRRateMngTxFailLowTh = NDIS_STRING_CONST("RateMngTxFailLowTh"); +NDIS_STRING STRRateMngTxFailHighTh = NDIS_STRING_CONST("RateMngTxFailHighTh"); +NDIS_STRING STRRateMngPerAlphaShift = NDIS_STRING_CONST("RateMngPerAlphaShift"); +NDIS_STRING STRRateMngPerAddShift = NDIS_STRING_CONST("RateMngPerAddShift"); +NDIS_STRING STRRateMngPerBeta1Shift = NDIS_STRING_CONST("RateMngPerBeta1Shift"); +NDIS_STRING STRRateMngPerBeta2Shift = NDIS_STRING_CONST("RateMngPerBeta2Shift"); +NDIS_STRING STRRateMngRateCheckUp = NDIS_STRING_CONST("RateMngRateCheckUp"); +NDIS_STRING STRRateMngRateCheckDown = NDIS_STRING_CONST("RateMngRateCheckDown"); +NDIS_STRING STRRateMngRateRetryPolicy = NDIS_STRING_CONST("RateMngRateRetryPolicy"); + + +/* +NDIS_STRING STRPctACXRxMemoryPool = NDIS_STRING_CONST( "PctACXRxMemoryPool" ); +NDIS_STRING STRSendPacketsPerOID = NDIS_STRING_CONST( "Dot11SendPacketsPerOID" ); +NDIS_STRING STRFragCacheSize = NDIS_STRING_CONST( "FragCacheSize" ); +*/ + +static void regConvertStringtoMACAddress(TI_UINT8 *staMACAddressString,TI_UINT8 *MacAddressArray); +static void regConvertStringtoBeaconIETable(TI_UINT8 *staIpAddressString,TI_UINT8 *BeaconIEArray, TI_UINT8 size); +static void regConvertStringtoCoexActivityTable(TI_UINT8 *strCoexActivityTable, TI_UINT32 numOfElements, TCoexActivity *CoexActivityArray, TI_UINT8 strSize); + +static int decryptWEP( TI_INT8* pSrc, TI_INT8* pDst, TI_UINT32 len); +static short _btoi ( char *sptr, short slen, int *pi, short base ); +static void initValusFromRgstryString( TI_INT8* pSrc, TI_INT8* pDst, TI_UINT32 len); + + + +static void readRates(TWlanDrvIfObjPtr pAdapter, TInitTable *pInitTable); +static void decryptScanControlTable(TI_UINT8* src, TI_UINT8* dst, USHORT len); + +static TI_UINT32 regReadIntegerTable(TWlanDrvIfObjPtr pAdapter, + PNDIS_STRING pParameterName, + TI_INT8* pDefaultValue, + USHORT defaultLen, + TI_UINT8* pUnsignedParameter, + TI_INT8* pSignedParameter, + TI_UINT32* pEntriesNumber, + TI_UINT8 uParameterSize, + TI_BOOL bHex); + +static void assignRegValue(TI_UINT32* lValue, PNDIS_CONFIGURATION_PARAMETER ndisParameter); + +static void parse_filter_request(TRxDataFilterRequest* request, TI_UINT8 offset, char * mask, TI_UINT8 maskLength, char * pattern, TI_UINT8 patternLength); + +static void regReadIntegerParameter ( + TWlanDrvIfObjPtr pAdapter, + PNDIS_STRING pParameterName, + TI_UINT32 defaultValue, + TI_UINT32 minValue, + TI_UINT32 maxValue, + TI_UINT8 parameterSize, + TI_UINT8* pParameter); + +static void regReadIntegerParameterHex ( + TWlanDrvIfObjPtr pAdapter, + PNDIS_STRING pParameterName, + TI_UINT32 defaultValue, + TI_UINT32 minValue, + TI_UINT32 maxValue, + TI_UINT8 defaultSize, + TI_UINT8 * pParameter); + +static void regReadStringParameter ( + TWlanDrvIfObjPtr pAdapter, + PNDIS_STRING pParameterName, + TI_INT8* pDefaultValue, + USHORT defaultLen, + TI_UINT8* pParameter, + void* pParameterSize); + +static void regReadWepKeyParameter (TWlanDrvIfObjPtr pAdapter, TI_UINT8 *pKeysStructure, TI_UINT8 defaultKeyId); + + +/* ---------------------------------------------------------------------------*/ +/* Converts a string to a signed int. Assumes base 10. Assumes positive*/ +/* number*/ +/**/ +/* Returns value on success, -1 on failure*/ +/**/ +/* ---------------------------------------------------------------------------*/ +static TI_UINT32 tiwlnstrtoi (char *num, TI_UINT32 length) +{ + TI_UINT32 value; + + if(num == NULL || length == 0 ) + { + return 0; + } + + for(value=0;length&&*num;num++,length--) + { + if(*num<='9'&&*num>= '0') + { + value=(value*10)+(*num - '0'); + } + else { /* Out of range*/ + break; + } + } + return value; +} + +/* ---------------------------------------------------------------------------*/ +/* Converts a string to a signed int. Assumes base 16. Assumes positive*/ +/* number*/ +/**/ +/* Returns value on success, -1 on failure*/ +/**/ +/* ---------------------------------------------------------------------------*/ +static TI_UINT32 tiwlnstrtoi_hex (TI_UINT8 *num, TI_UINT32 length) +{ + TI_UINT32 value = 0; + + if (num == NULL || length == 0) + { + return 0; + } + + for (value = 0; length && *num; num++, length--) + { + if (*num <= '9' && *num >= '0') + { + value = (value * 16) + (*num - '0'); + } + else if (*num <= 'f' && *num >= 'a') + { + value = (value * 16) + (*num - (TI_UINT8)'a' + 10); + } + else if (*num <= 'F' && *num >= 'A') + { + value = (value * 16) + (*num - (TI_UINT8)'A' + 10); + } + else + { /* Out of range*/ + break; + } + } + + return value; +} + +/*----------------------------------------------------------------------------- + +Routine Name: + + regConvertStringtoMACAddress + +Routine Description: Converts the MAC Adrress in a form of string readen from the Registry +to the MAC Address Array to be stored in the init_table struct + + +Arguments: + + +Return Value: + + None + +-----------------------------------------------------------------------------*/ +static void regConvertStringtoMACAddress(TI_UINT8 *staMACAddressString, TI_UINT8 *MacAddressArray) +{ + char *ptr; + TI_UINT8 *tmpMacAddr; + TI_UINT8 value = 0, value_l, value_h, add_value; + int i, str_len; + + /* Take the pointer to the string MAC Address to convert it to the Array MAC Address */ + ptr = (char *)staMACAddressString; + tmpMacAddr = MacAddressArray; + str_len = 3 * MAC_ADDR_LEN - 1; + + for(i=0;(i < MAC_ADDR_LEN);ptr++,str_len--) + { + if (str_len > 0) { + /* The value can be or "0-9" or from "a-f" */ + value_l = (*ptr - '0'); + value_h = (*ptr - 'a'); + } + else { /* last element */ + value_l = value_h = 16; + } + /*PRINTF(DBG_REGISTRY,("value_l [%d] value_h [%d] *ptr %c value %d\n",value_l,value_h,*ptr,value));*/ + + if( (value_l <= 9) || (value_h <= 15 ) ) + { + /* We are in an expected range */ + /* nCheck if 0-9 */ + if(value_l <= 9 ) + { + add_value = value_l; + } + /* Check if a-f */ + else + { + /* 'a' is in fact 10 decimal in hexa */ + add_value = value_h + 10; + } + value = value * 16 + add_value; + /*PRINTF(DBG_REGISTRY,("value %d add_value %d \n",value,add_value));*/ + } + else + { + tmpMacAddr[i] = value; + /*PRINTF(DBG_REGISTRY,("tmpMacAddr[%d] is %x\n",i,tmpMacAddr[i]));*/ + value = 0; + i++; + } + } +} + + +/*----------------------------------------------------------------------------- + +Routine Name: + + regFillInitTable + +Routine Description: + + +Arguments: + + +Return Value: + + None + +-----------------------------------------------------------------------------*/ +void +regFillInitTable( + TWlanDrvIfObjPtr pAdapter, + void* pInitTable + ) +{ + static TI_UINT8 *ClsfrIp = "0a 03 01 c9"; + static TI_UINT8 ClsfrIpString[16]; + static TI_UINT8 ClsfrIpStringSize; + + /* EEPROM-less : MAC address */ + static TI_UINT8 regMACstrLen = REG_MAC_ADDR_STR_LEN; + static TI_UINT8 staMACAddress[REG_MAC_ADDR_STR_LEN]; + static TI_UINT8 defStaMacAddress0[]= "00 22 11 33 44 55"; + static TI_UINT8 regArpIpStrLen = REG_ARP_IP_ADDR_STR_LEN; + static TI_UINT8 staArpIpAddress[REG_ARP_IP_ADDR_STR_LEN]; + static TI_UINT8 defArpIpAddress[] = "0a 00 00 0a" ; /*value by default*/ + + /*defaults values for beacon IE table*/ + /*TI_UINT8 defBeaconIETableSize = 0 ;*/ + static TI_UINT8 defBeaconIETable[] = "00 01 01 01 32 01 2a 01 03 01 06 01 07 01 20 01 25 01 23 01 30 01 28 01 2e 01 3d 01 85 01 dd 01 00 52 f2 02 00 01"; + /*TI_UINT8 tmpIeTable[BEACON_FILTER_TABLE_MAX_SIZE] ;*/ + static TI_UINT8 tmpIeTableSize = 37; + static TI_UINT8 strSize = 113; + + static TI_UINT8 defRxRssiAndProcessCompensation_2_4G[] = "ec,f6,00,0c,18,f8,fc,00,08,10,f0,f8,00,0a,14"; + static TI_UINT8 tmpRssiTableSize = RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE; + static TI_UINT8 staRssiAndProcessCompensation[RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE] ; + static TI_UINT8 RssiSize = 44; + + /* defaults values for CoexActivity table*/ + /* example: WLAN(0), BT_VOICE(0), defPrio(20), raisePrio(25), minServ(0), maxServ(1ms) */ + static TI_UINT8 defCoexActivityTable[] = ""; /* Sample "01 00 14 19 0000 0001 " */ + + static TI_UINT32 filterOffset = 0; + static char filterMask[16]; + static TI_UINT8 filterMaskLength; + static char filterPattern[16]; + static TI_UINT8 filterPatternLength; + + static USHORT tableLen = 0; + static USHORT loopIndex = 0; + static TI_UINT8 ScanControlTable24Tmp[2 * NUM_OF_CHANNELS_24]; + static TI_UINT8 ScanControlTable5Tmp[2 * NUM_OF_CHANNELS_5]; + static TI_UINT8 ScanControlTable24Def[2* NUM_OF_CHANNELS_24] = "FFFFFFFFFFFFFFFFFFFFFFFFFFFF"; + static TI_UINT8 ScanControlTable5Def[2 * NUM_OF_CHANNELS_5] = "FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000000000000000000000000000000000000000000000000000000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000000000000000FF000000FF000000FF000000FF000000FF000000000000000000000000000000"; + static TI_UINT8 reportSeverityTableDefaults[REPORT_SEVERITY_MAX+1] = "00001101"; + static TI_UINT16 reportSeverityTableLen; + + static TI_UINT32 uWiFiMode = 0; + static TI_INT8 SRConfigParams[14]; + static TI_UINT8 len,TempSRCnt; + static TI_UINT8 uTempRatePolicyList[RATE_MNG_MAX_RETRY_POLICY_PARAMS_LEN]; + static TI_UINT32 uTempRatePolicyCnt=0; + + TInitTable *p = (TInitTable *)pInitTable; + TI_UINT32 uTempEntriesCount, uIndex; + + PRINT(DBG_REGISTRY_LOUD, "TIWL: Reading InitTable parameters\n"); + + if (!p) + return; + + /* Reset structure */ + NdisZeroMemory(p, sizeof(TInitTable)); + + /*reads the arp ip from table*/ + regReadStringParameter(pAdapter ,&STRArp_Ip_Addr, + (TI_INT8*)(defArpIpAddress),REG_ARP_IP_ADDR_STR_LEN, + (TI_UINT8*)staArpIpAddress,®ArpIpStrLen ) ; + + initValusFromRgstryString( (TI_INT8*)(staArpIpAddress), (TI_INT8*)&p->twdInitParams.tArpIpFilter.addr, 4); + + + regReadIntegerParameter(pAdapter, &STRArp_Ip_Filter_Ena, + DEF_FILTER_ENABLE_VALUE, MIN_FILTER_ENABLE_VALUE, MAX_FILTER_ENABLE_VALUE, + sizeof p->twdInitParams.tArpIpFilter.isFilterEnabled, + (TI_UINT8*)&p->twdInitParams.tArpIpFilter.isFilterEnabled ); + + + + /* Beacon filter*/ + /*is the desired state ENABLED ?*/ + regReadIntegerParameter(pAdapter, &STRBeaconFilterDesiredState, + DEF_BEACON_FILTER_ENABLE_VALUE, MIN_BEACON_FILTER_ENABLE_VALUE, MAX_BEACON_FILTER_ENABLE_VALUE, + sizeof p->siteMgrInitParams.beaconFilterParams.desiredState, + (TI_UINT8*)&p->siteMgrInitParams.beaconFilterParams.desiredState ); + + regReadIntegerParameter(pAdapter, &STRBeaconFilterStored, + DEF_NUM_STORED_FILTERS, MIN_NUM_STORED_FILTERS, MAX_NUM_STORED_FILTERS, + sizeof p->siteMgrInitParams.beaconFilterParams.numOfStored, + (TI_UINT8*)&p->siteMgrInitParams.beaconFilterParams.numOfStored ); + + /*Read the beacon filter IE table*/ + /*Read the size of the table*/ + regReadIntegerParameter(pAdapter, &STRBeaconIETableSize, + BEACON_FILTER_IE_TABLE_DEF_SIZE, BEACON_FILTER_IE_TABLE_MIN_SIZE, + BEACON_FILTER_IE_TABLE_MAX_SIZE, + sizeof p->siteMgrInitParams.beaconFilterParams.IETableSize, + (TI_UINT8*)(&p->siteMgrInitParams.beaconFilterParams.IETableSize) ); + + tmpIeTableSize = p->siteMgrInitParams.beaconFilterParams.IETableSize; + + /*Read the number of elements in the table ( this is because 221 has 5 values following it )*/ + regReadIntegerParameter(pAdapter, &STRBeaconIETableNumOfElem, + DEF_BEACON_FILTER_IE_TABLE_NUM, BEACON_FILTER_IE_TABLE_MIN_NUM, + BEACON_FILTER_IE_TABLE_MAX_NUM, + sizeof p->siteMgrInitParams.beaconFilterParams.numOfElements, + (TI_UINT8*)(&p->siteMgrInitParams.beaconFilterParams.numOfElements) ); + + /*printk("\n OsRgstr tmpIeTableSize = %d numOfElems = %d" , tmpIeTableSize , p->siteMgrInitParams.beaconFilterParams.numOfElements) ;*/ + strSize = 3 * tmpIeTableSize - 1 ; /*includes spaces between bytes*/ + if ( ( tmpIeTableSize > 0 ) && ( tmpIeTableSize <= BEACON_FILTER_IE_TABLE_MAX_SIZE) ) + { + TI_UINT8 *staBeaconFilterIETable; + + staBeaconFilterIETable = os_memoryAlloc(pAdapter, BEACON_FILTER_STRING_MAX_LEN); + if (staBeaconFilterIETable) { + regReadStringParameter(pAdapter, &STRBeaconIETable , + (TI_INT8*)(defBeaconIETable), strSize, + (TI_UINT8*)staBeaconFilterIETable, &strSize); + + regConvertStringtoBeaconIETable(staBeaconFilterIETable, (TI_UINT8*)&p->siteMgrInitParams.beaconFilterParams.IETable[0]/*(TI_UINT8*)&(tmpIeTable[0] )*/, tmpIeTableSize); + os_memoryFree(pAdapter, staBeaconFilterIETable, BEACON_FILTER_STRING_MAX_LEN); + } + } + + /* MAC ADDRESSES FILTER*/ + regReadIntegerParameter(pAdapter, &STRFilterEnabled, + DEF_FILTER_ENABLE_VALUE, MIN_FILTER_ENABLE_VALUE, + MAX_FILTER_ENABLE_VALUE, + sizeof p->twdInitParams.tMacAddrFilter.isFilterEnabled, + (TI_UINT8*) &p->twdInitParams.tMacAddrFilter.isFilterEnabled); + + regReadIntegerParameter(pAdapter, &STRnumGroupAddrs, + NUM_GROUP_ADDRESS_VALUE_DEF, NUM_GROUP_ADDRESS_VALUE_MIN, + NUM_GROUP_ADDRESS_VALUE_MAX, + sizeof p->twdInitParams.tMacAddrFilter.numOfMacAddresses, + (TI_UINT8*) &p->twdInitParams.tMacAddrFilter.numOfMacAddresses); + + /*printk("\nOsRgstry Num Of Group Addr:%d \n" , p->twdInitParams.tMacAddrFilter.numOfMacAddresses) ;*/ + { + TI_UINT8 defStaMacAddress1[]= "11 11 12 13 14 15"; + TI_UINT8 defStaMacAddress2[]= "12 21 22 23 24 25"; + TI_UINT8 defStaMacAddress3[]= "13 31 32 33 34 35"; + TI_UINT8 defStaMacAddress4[]= "14 41 42 43 44 45"; + TI_UINT8 defStaMacAddress5[]= "15 51 52 53 54 55"; + TI_UINT8 defStaMacAddress6[]= "16 61 62 63 64 65"; + TI_UINT8 defStaMacAddress7[]= "17 71 72 73 74 75"; + int macIndex ; /*used for group address filtering*/ + + macIndex = p->twdInitParams.tMacAddrFilter.numOfMacAddresses - 1; + switch( macIndex ) + { + case 7: + { + + regReadStringParameter(pAdapter, &STRGroup_addr7, + (TI_INT8*)(defStaMacAddress7), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); + + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[7]); + --macIndex; + } + + case 6: + { + + regReadStringParameter(pAdapter, &STRGroup_addr6, + (TI_INT8*)(defStaMacAddress6), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); + + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[6]); + --macIndex; + } + + case 5: + { + + regReadStringParameter(pAdapter, &STRGroup_addr5, + (TI_INT8*)(defStaMacAddress5), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); + + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[5]); + --macIndex; + } + + case 4: + { + + regReadStringParameter(pAdapter, &STRGroup_addr4, + (TI_INT8*)(defStaMacAddress4), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); + + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[4]); + --macIndex; + } + + case 3: + { + + regReadStringParameter(pAdapter, &STRGroup_addr3, + (TI_INT8*)(defStaMacAddress3), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); + + regConvertStringtoMACAddress(staMACAddress, (TI_UINT8*)&p->twdInitParams.tMacAddrFilter.macAddrTable[3]); + --macIndex; + } + + case 2: + { + + regReadStringParameter(pAdapter, &STRGroup_addr2, + (TI_INT8*)(defStaMacAddress2), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); + + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[2]); + --macIndex; + } + + case 1: + { + + regReadStringParameter(pAdapter, &STRGroup_addr1, + (TI_INT8*)(defStaMacAddress1), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); + + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[1]); + --macIndex; + } + + case 0: + { + + regReadStringParameter(pAdapter, &STRGroup_addr0, + (TI_INT8*)(defStaMacAddress0), REG_MAC_ADDR_STR_LEN, + (TI_UINT8*)staMACAddress, ®MACstrLen); + + regConvertStringtoMACAddress(staMACAddress,(TI_UINT8*) &p->twdInitParams.tMacAddrFilter.macAddrTable[0]); + } + + default: + { + + } + } + } + + /************************/ + /* Read severity table */ + /**********************/ + + regReadStringParameter(pAdapter, &STR_ReportSeverityTable, + (TI_INT8*)reportSeverityTableDefaults, + (TI_UINT8)REPORT_SEVERITY_MAX, + (TI_UINT8*)p->tReport.aSeverityTable, + (TI_UINT8*)&reportSeverityTableLen); + + + /***********************/ + /* Read modules table */ + /*********************/ + { + TI_UINT8 *reportModuleTableDefaults; + TI_UINT16 reportModuleTableLen; + + reportModuleTableDefaults = os_memoryAlloc(pAdapter, REPORT_FILES_NUM); + if (!reportModuleTableDefaults) + return; + + /*set all report modules.as default*/ + memset(reportModuleTableDefaults, '1', REPORT_FILES_NUM ); + + regReadStringParameter(pAdapter, &STR_ReportModuleTable, + (TI_INT8*)reportModuleTableDefaults, + (TI_UINT8)REPORT_FILES_NUM, + (TI_UINT8*)p->tReport.aFileEnable, + (TI_UINT8*)&reportModuleTableLen); + os_memoryFree(pAdapter, reportModuleTableDefaults, REPORT_FILES_NUM); + } + /* rate Policy Params */ + regReadIntegerParameter(pAdapter, &STRRatePolicyUserShortRetryLimit, + CTRL_DATA_RATE_POLICY_USER_SHORT_RETRY_LIMIT_DEF, + CTRL_DATA_RATE_POLICY_USER_SHORT_RETRY_LIMIT_MIN, + CTRL_DATA_RATE_POLICY_USER_SHORT_RETRY_LIMIT_MAX, + sizeof p->ctrlDataInitParams.ctrlDataTxRatePolicy.shortRetryLimit, + (TI_UINT8*)&p->ctrlDataInitParams.ctrlDataTxRatePolicy.shortRetryLimit); + + regReadIntegerParameter(pAdapter, &STRRatePolicyUserLongRetryLimit, + CTRL_DATA_RATE_POLICY_USER_LONG_RETRY_LIMIT_DEF, + CTRL_DATA_RATE_POLICY_USER_LONG_RETRY_LIMIT_MIN, + CTRL_DATA_RATE_POLICY_USER_LONG_RETRY_LIMIT_MAX, + sizeof p->ctrlDataInitParams.ctrlDataTxRatePolicy.longRetryLimit, + (TI_UINT8*)&p->ctrlDataInitParams.ctrlDataTxRatePolicy.longRetryLimit); + + regReadIntegerParameterHex (pAdapter, &STRRatePolicyUserEnabledRatesMaskCck, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_CCK_DEF, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_MIN, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_MAX, + sizeof p->ctrlDataInitParams.policyEnabledRatesMaskCck, + (TI_UINT8*)&p->ctrlDataInitParams.policyEnabledRatesMaskCck); + + regReadIntegerParameterHex (pAdapter, &STRRatePolicyUserEnabledRatesMaskOfdm, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_OFDM_DEF, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_MIN, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_MAX, + sizeof p->ctrlDataInitParams.policyEnabledRatesMaskOfdm, + (TI_UINT8*)&p->ctrlDataInitParams.policyEnabledRatesMaskOfdm); + + regReadIntegerParameterHex (pAdapter, &STRRatePolicyUserEnabledRatesMaskOfdmA, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_OFDMA_DEF, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_MIN, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_MAX, + sizeof p->ctrlDataInitParams.policyEnabledRatesMaskOfdmA, + (TI_UINT8*)&p->ctrlDataInitParams.policyEnabledRatesMaskOfdmA); + + regReadIntegerParameterHex (pAdapter, &STRRatePolicyUserEnabledRatesMaskOfdmN, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_OFDMN_DEF, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_MIN, + CTRL_DATA_RATE_POLICY_USER_EN_DIS_MASK_MAX, + sizeof p->ctrlDataInitParams.policyEnabledRatesMaskOfdmN, + (TI_UINT8*)&p->ctrlDataInitParams.policyEnabledRatesMaskOfdmN); + + + regReadIntegerParameter(pAdapter, &STRRxEnergyDetection, + TI_FALSE, TI_FALSE, TI_TRUE, + sizeof p->twdInitParams.tGeneral.halCtrlRxEnergyDetection, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlRxEnergyDetection); + + regReadIntegerParameter(pAdapter, &STRTxEnergyDetection, + TI_FALSE, TI_FALSE, TI_TRUE, + sizeof p->twdInitParams.tGeneral.halCtrlTxEnergyDetection, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlTxEnergyDetection); + + regReadIntegerParameter(pAdapter, &STRTddCalibrationInterval, + 300, 1, 0xFFFFFFFF, + sizeof p->twdInitParams.tGeneral.tddRadioCalTimout, + (TI_UINT8*)&p->twdInitParams.tGeneral.tddRadioCalTimout); + + regReadIntegerParameter(pAdapter, &STRCrtCalibrationInterval, + 2, 1, 0xFFFFFFFF, + sizeof p->twdInitParams.tGeneral.CrtRadioCalTimout, + (TI_UINT8*)&p->twdInitParams.tGeneral.CrtRadioCalTimout); + + regReadIntegerParameter(pAdapter, &STRMacClockRate, + 80, 0, 255, + sizeof p->twdInitParams.tGeneral.halCtrlMacClock, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlMacClock); + + regReadIntegerParameter(pAdapter, &STRArmClockRate, + 80, 0, 255, + sizeof p->twdInitParams.tGeneral.halCtrlArmClock, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlArmClock); + + regReadIntegerParameter(pAdapter, &STRg80211DraftNumber, + DRAFT_6_AND_LATER, DRAFT_5_AND_EARLIER, DRAFT_6_AND_LATER, + sizeof p->siteMgrInitParams.siteMgrUseDraftNum, + (TI_UINT8*)&p->siteMgrInitParams.siteMgrUseDraftNum); + + regReadIntegerParameter(pAdapter, &STRTraceBufferSize, + /*1024, 0, 1024, sizeof(TI_UINT32), */ + 16, 16, 16, + sizeof p->twdInitParams.tGeneral.TraceBufferSize, + (TI_UINT8*)&p->twdInitParams.tGeneral.TraceBufferSize); + + regReadIntegerParameter(pAdapter, &STRPrintTrace, + TI_FALSE, TI_FALSE, TI_TRUE, + sizeof p->twdInitParams.tGeneral.bDoPrint, + (TI_UINT8*)&p->twdInitParams.tGeneral.bDoPrint); + + regReadIntegerParameter(pAdapter, &STRFirmwareDebug, + TI_FALSE, TI_FALSE, TI_TRUE, + sizeof p->twdInitParams.tGeneral.halCtrlFirmwareDebug, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlFirmwareDebug); + + +#ifndef TIWLN_WINCE30 + regReadIntegerParameter(pAdapter, &STRHwACXAccessMethod, + TWD_HW_ACCESS_METHOD_DEF, TWD_HW_ACCESS_METHOD_MIN, + TWD_HW_ACCESS_METHOD_MAX, + sizeof p->twdInitParams.tGeneral.hwAccessMethod, + (TI_UINT8*)&p->twdInitParams.tGeneral.hwAccessMethod); +#else + /* Slave indirect*/ + p->twdInitParams.tGeneral.hwAccessMethod = 0; +#endif + regReadIntegerParameter(pAdapter, &STRMaxSitesFragCollect, + TWD_SITE_FRAG_COLLECT_DEF, TWD_SITE_FRAG_COLLECT_MIN, + TWD_SITE_FRAG_COLLECT_MAX, + sizeof p->twdInitParams.tGeneral.maxSitesFragCollect, + (TI_UINT8*)&p->twdInitParams.tGeneral.maxSitesFragCollect); + + regReadIntegerParameter(pAdapter, &STRBetEnable, + POWER_MGMNT_BET_ENABLE_DEF, POWER_MGMNT_BET_ENABLE_MIN, + POWER_MGMNT_BET_ENABLE_MAX, + sizeof p->PowerMgrInitParams.BetEnable, + (TI_UINT8*)&p->PowerMgrInitParams.BetEnable); + + regReadIntegerParameter(pAdapter, &STRBetMaxConsecutive, + POWER_MGMNT_BET_MAX_CONSC_DEF, POWER_MGMNT_BET_MAX_CONSC_MIN, + POWER_MGMNT_BET_MAX_CONSC_MAX, + sizeof p->PowerMgrInitParams.MaximumConsecutiveET, + (TI_UINT8*)&p->PowerMgrInitParams.MaximumConsecutiveET); + + /*--------------- Maximal time between full beacon reception ------------------*/ + regReadIntegerParameter(pAdapter, &STRMaxFullBeaconInterval, + POWER_MGMNT_MAX_FULL_BEACON_DEF, POWER_MGMNT_MAX_FULL_BEACON_MIN, + POWER_MGMNT_MAX_FULL_BEACON_MAX, + sizeof p->PowerMgrInitParams.MaximalFullBeaconReceptionInterval, + (TI_UINT8*)&p->PowerMgrInitParams.MaximalFullBeaconReceptionInterval); + + regReadIntegerParameter(pAdapter, &STRBetEnableThreshold, + POWER_MGMNT_BET_DISABLE_THRESHOLD_DEF, POWER_MGMNT_BET_DISABLE_THRESHOLD_MIN, + POWER_MGMNT_BET_DISABLE_THRESHOLD_MAX, + sizeof p->PowerMgrInitParams.BetEnableThreshold, + (TI_UINT8*)&p->PowerMgrInitParams.BetEnableThreshold); + + regReadIntegerParameter(pAdapter, &STRBetDisableThreshold, + HAL_CTRL_BET_DISABLE_THRESHOLD_DEF, HAL_CTRL_BET_DISABLE_THRESHOLD_MIN, + HAL_CTRL_BET_DISABLE_THRESHOLD_MAX, + sizeof p->PowerMgrInitParams.BetDisableThreshold, + (TI_UINT8*)&p->PowerMgrInitParams.BetDisableThreshold); + + regReadIntegerParameter(pAdapter, &STRTxFlashEnable, + TWD_TX_FLASH_ENABLE_DEF, TWD_TX_FLASH_ENABLE_MIN, + TWD_TX_FLASH_ENABLE_MAX, + sizeof p->twdInitParams.tGeneral.TxFlashEnable, + (TI_UINT8*)&p->twdInitParams.tGeneral.TxFlashEnable); + + + p->twdInitParams.tGeneral.beaconTemplateSize = sizeof(probeRspTemplate_t); + p->twdInitParams.tGeneral.probeRequestTemplateSize = sizeof(probeReqTemplate_t); + p->twdInitParams.tGeneral.probeResponseTemplateSize = sizeof(probeRspTemplate_t); + p->twdInitParams.tGeneral.nullTemplateSize = sizeof(nullDataTemplate_t); + p->twdInitParams.tGeneral.disconnTemplateSize = sizeof(disconnTemplate_t); + p->twdInitParams.tGeneral.PsPollTemplateSize = sizeof(psPollTemplate_t); + p->twdInitParams.tGeneral.qosNullDataTemplateSize = sizeof(QosNullDataTemplate_t); + + regReadIntegerParameter(pAdapter, + &STRBeaconRxTimeout, + BCN_RX_TIMEOUT_DEF_VALUE, + BCN_RX_TIMEOUT_MIN_VALUE, + BCN_RX_TIMEOUT_MAX_VALUE, + sizeof p->twdInitParams.tGeneral.BeaconRxTimeout, + (TI_UINT8*)&p->twdInitParams.tGeneral.BeaconRxTimeout); + + regReadIntegerParameter(pAdapter, + &STRBroadcastRxTimeout, + BROADCAST_RX_TIMEOUT_DEF_VALUE, + BROADCAST_RX_TIMEOUT_MIN_VALUE, + BROADCAST_RX_TIMEOUT_MAX_VALUE, + sizeof p->twdInitParams.tGeneral.BroadcastRxTimeout, + (TI_UINT8*)&p->twdInitParams.tGeneral.BroadcastRxTimeout); + + regReadIntegerParameter(pAdapter, + &STRRxBroadcastInPs, + RX_BROADCAST_IN_PS_DEF_VALUE, + RX_BROADCAST_IN_PS_MIN_VALUE, + RX_BROADCAST_IN_PS_MAX_VALUE, + sizeof p->twdInitParams.tGeneral.RxBroadcastInPs, + (TI_UINT8*)&p->twdInitParams.tGeneral.RxBroadcastInPs); + + regReadIntegerParameter(pAdapter, &STRCalibrationChannel2_4, + TWD_CALIBRATION_CHANNEL_2_4_DEF, TWD_CALIBRATION_CHANNEL_2_4_MIN, + TWD_CALIBRATION_CHANNEL_2_4_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlCalibrationChannel2_4, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlCalibrationChannel2_4); + + regReadIntegerParameter(pAdapter, &STRCalibrationChannel5_0, + TWD_CALIBRATION_CHANNEL_5_0_DEF, TWD_CALIBRATION_CHANNEL_5_0_MIN, + TWD_CALIBRATION_CHANNEL_5_0_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlCalibrationChannel5_0, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlCalibrationChannel5_0); + + regReadIntegerParameter(pAdapter, + &STRConsecutivePsPollDeliveryFailureThreshold, + CONSECUTIVE_PS_POLL_FAILURE_DEF, + CONSECUTIVE_PS_POLL_FAILURE_MIN, + CONSECUTIVE_PS_POLL_FAILURE_MAX, + sizeof p->twdInitParams.tGeneral.ConsecutivePsPollDeliveryFailureThreshold, + (TI_UINT8*)&p->twdInitParams.tGeneral.ConsecutivePsPollDeliveryFailureThreshold); + + + regReadIntegerParameter(pAdapter, &STRdot11RTSThreshold, + TWD_RTS_THRESHOLD_DEF, TWD_RTS_THRESHOLD_MIN, + TWD_RTS_THRESHOLD_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlRtsThreshold, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlRtsThreshold); + + regReadIntegerParameter(pAdapter, &STRRxDisableBroadcast, + TWD_RX_DISABLE_BROADCAST_DEF, TWD_RX_DISABLE_BROADCAST_MIN, + TWD_RX_DISABLE_BROADCAST_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlRxDisableBroadcast, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlRxDisableBroadcast); + + regReadIntegerParameter(pAdapter, &STRRecoveryEnable, + TWD_RECOVERY_ENABLE_DEF, TWD_RECOVERY_ENABLE_MIN, + TWD_RECOVERY_ENABLE_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlRecoveryEnable, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlRecoveryEnable); + + p->healthMonitorInitParams.FullRecoveryEnable = (TI_BOOL)p->twdInitParams.tGeneral.halCtrlRecoveryEnable; + + regReadIntegerParameter(pAdapter, &STRdot11FragThreshold, + TWD_FRAG_THRESHOLD_DEF, TWD_FRAG_THRESHOLD_MIN, + TWD_FRAG_THRESHOLD_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlFragThreshold, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlFragThreshold); + + regReadIntegerParameter(pAdapter, &STRdot11MaxTxMSDULifetime, + TWD_MAX_TX_MSDU_LIFETIME_DEF, TWD_MAX_TX_MSDU_LIFETIME_MIN, + TWD_MAX_TX_MSDU_LIFETIME_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlMaxTxMsduLifetime, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlMaxTxMsduLifetime); + + regReadIntegerParameter(pAdapter, &STRdot11MaxReceiveLifetime, + TWD_MAX_RX_MSDU_LIFETIME_DEF, TWD_MAX_RX_MSDU_LIFETIME_MIN, + TWD_MAX_RX_MSDU_LIFETIME_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlMaxRxMsduLifetime, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlMaxRxMsduLifetime); + + regReadIntegerParameter(pAdapter, &STRdot11RateFallBackRetryLimit, + TWD_RATE_FB_RETRY_LIMIT_DEF, TWD_RATE_FB_RETRY_LIMIT_MIN, + TWD_RATE_FB_RETRY_LIMIT_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlRateFallbackRetry, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlRateFallbackRetry); + + regReadIntegerParameter(pAdapter, &STRListenInterval, + TWD_LISTEN_INTERVAL_DEF, TWD_LISTEN_INTERVAL_MIN, + TWD_LISTEN_INTERVAL_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlListenInterval, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlListenInterval); + + regReadIntegerParameter(pAdapter, &STRdot11TxAntenna, + TWD_TX_ANTENNA_DEF, TWD_TX_ANTENNA_MIN, + TWD_TX_ANTENNA_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlTxAntenna, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlTxAntenna); + /* reverse tx antenna value - ACX and utility have reversed values */ + if (p->twdInitParams.tGeneral.halCtrlTxAntenna == TX_ANTENNA_2) + p->twdInitParams.tGeneral.halCtrlTxAntenna = TX_ANTENNA_1; + else + p->twdInitParams.tGeneral.halCtrlTxAntenna = TX_ANTENNA_2; + + + regReadIntegerParameter(pAdapter, &STRdot11RxAntenna, + TWD_RX_ANTENNA_DEF, TWD_RX_ANTENNA_MIN, + TWD_RX_ANTENNA_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlRxAntenna, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlRxAntenna); + + + regReadIntegerParameter(pAdapter, &STRTxCompleteThreshold, + TWD_TX_CMPLT_THRESHOLD_DEF, TWD_TX_CMPLT_THRESHOLD_MIN, + TWD_TX_CMPLT_THRESHOLD_MAX, + sizeof p->twdInitParams.tGeneral.TxCompletePacingThreshold, + (TI_UINT8*)&(p->twdInitParams.tGeneral.TxCompletePacingThreshold)); + + regReadIntegerParameter(pAdapter, &STRTxCompleteTimeout, + TWD_TX_CMPLT_TIMEOUT_DEF, TWD_TX_CMPLT_TIMEOUT_MIN, + TWD_TX_CMPLT_TIMEOUT_MAX, + sizeof p->twdInitParams.tGeneral.TxCompletePacingTimeout, + (TI_UINT8*)&(p->twdInitParams.tGeneral.TxCompletePacingTimeout)); + + regReadIntegerParameter(pAdapter, &STRRxInterruptThreshold, + TWD_RX_INTR_THRESHOLD_DEF, TWD_RX_INTR_THRESHOLD_MIN, + TWD_RX_INTR_THRESHOLD_MAX, + sizeof p->twdInitParams.tGeneral.RxIntrPacingThreshold, + (TI_UINT8*)&(p->twdInitParams.tGeneral.RxIntrPacingThreshold)); + + regReadIntegerParameter(pAdapter, &STRRxInterruptTimeout, + TWD_RX_INTR_TIMEOUT_DEF, TWD_RX_INTR_TIMEOUT_MIN, + TWD_RX_INTR_TIMEOUT_MAX, + sizeof p->twdInitParams.tGeneral.RxIntrPacingTimeout, + (TI_UINT8*)&(p->twdInitParams.tGeneral.RxIntrPacingTimeout)); + + + regReadIntegerParameter(pAdapter, &STRRxAggregationPktsLimit, + TWD_RX_AGGREG_PKTS_LIMIT_DEF, TWD_RX_AGGREG_PKTS_LIMIT_MIN, + TWD_RX_AGGREG_PKTS_LIMIT_MAX, + sizeof p->twdInitParams.tGeneral.uRxAggregPktsLimit, + (TI_UINT8*)&(p->twdInitParams.tGeneral.uRxAggregPktsLimit)); + + + regReadIntegerParameter(pAdapter, &STRdot11DesiredChannel, + SITE_MGR_CHANNEL_DEF, SITE_MGR_CHANNEL_MIN, SITE_MGR_CHANNEL_MAX, + sizeof p->siteMgrInitParams.siteMgrDesiredChannel, + (TI_UINT8*)&p->siteMgrInitParams.siteMgrDesiredChannel); + + /* NOTE: desired BSSID and SSID (and BSS type, later on) are currently set both to the SME and the site manager!!! */ + { + TI_UINT8 bssidBroadcast[MAC_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + MAC_COPY (p->siteMgrInitParams.siteMgrDesiredBSSID, bssidBroadcast); + MAC_COPY (p->tSmeModifiedInitParams.tDesiredBssid, bssidBroadcast); + } + + { + static char dummySsidString[MAX_SSID_LEN]; + + /* + Default SSID should be non-Valid SSID, hence the STA will not try to connect + */ + for(loopIndex = 0; loopIndex < MAX_SSID_LEN; loopIndex++) + dummySsidString[loopIndex] = (loopIndex+1); + + regReadStringParameter(pAdapter, &STRdot11DesiredSSID, + (TI_INT8*)dummySsidString, + (TI_UINT8)MAX_SSID_LEN, + (TI_UINT8*)p->siteMgrInitParams.siteMgrDesiredSSID.str, + (TI_UINT8*)&p->siteMgrInitParams.siteMgrDesiredSSID.len); + + /* in case no SSID desired at the init file set dummy len */ + for(loopIndex = 0; loopIndex < MAX_SSID_LEN; loopIndex++) + { + if(dummySsidString[loopIndex] != p->siteMgrInitParams.siteMgrDesiredSSID.str[loopIndex]) + break; + } + + p->siteMgrInitParams.siteMgrDesiredSSID.len = (TI_UINT8)loopIndex; + } + + NdisMoveMemory(&p->tSmeModifiedInitParams.tDesiredSsid, + &p->siteMgrInitParams.siteMgrDesiredSSID, + sizeof(TSsid)); + + regReadIntegerParameter(pAdapter, &STRdot11DesiredNetworkType, + SITE_MGR_DOT_11_MODE_DEF, SITE_MGR_DOT_11_MODE_MIN, SITE_MGR_DOT_11_MODE_MAX, + sizeof p->siteMgrInitParams.siteMgrDesiredDot11Mode, + (TI_UINT8*)&p->siteMgrInitParams.siteMgrDesiredDot11Mode); + + regReadIntegerParameter(pAdapter, &STRdot11SlotTime, + PHY_SLOT_TIME_SHORT, PHY_SLOT_TIME_LONG, PHY_SLOT_TIME_SHORT, + sizeof p->siteMgrInitParams.siteMgrDesiredSlotTime, + (TI_UINT8*)&p->siteMgrInitParams.siteMgrDesiredSlotTime); + + regReadIntegerParameter(pAdapter, &STRdot11RtsCtsProtection, + 0, 0, 1, + sizeof p->ctrlDataInitParams.ctrlDataDesiredCtsRtsStatus, + (TI_UINT8*)&p->ctrlDataInitParams.ctrlDataDesiredCtsRtsStatus); + + regReadIntegerParameter(pAdapter, &STRdot11IbssProtection, + ERP_PROTECTION_STANDARD, ERP_PROTECTION_NONE, ERP_PROTECTION_STANDARD, + sizeof p->ctrlDataInitParams.ctrlDataDesiredIbssProtection, + (TI_UINT8*)&p->ctrlDataInitParams.ctrlDataDesiredIbssProtection); + + /* When working in band A, minimum channel is 36 and not 1*/ + if (p->siteMgrInitParams.siteMgrDesiredDot11Mode == DOT11_A_MODE) + { + if (p->siteMgrInitParams.siteMgrDesiredChannel < SITE_MGR_CHANNEL_A_MIN) + p->siteMgrInitParams.siteMgrDesiredChannel = SITE_MGR_CHANNEL_A_MIN; + } + + { + static TI_UINT32 Freq2ChannelTable[] = {0,2412000,2417000,2422000,2427000,2432000,2437000, + 2442000,2447000,2452000,2457000, + 2462000,2467000,2472000,2484000}; + + memcpy(p->siteMgrInitParams.siteMgrFreq2ChannelTable, + Freq2ChannelTable, + sizeof(Freq2ChannelTable)); + } + + /* read TX rates from registry */ + readRates(pAdapter, p); + + /* Note: desired BSS type is set both to the SME and site manager */ + regReadIntegerParameter(pAdapter, &STRdot11DesiredBSSType, + SITE_MGR_BSS_TYPE_DEF, BSS_INDEPENDENT, BSS_ANY, + sizeof p->siteMgrInitParams.siteMgrDesiredBSSType, + (TI_UINT8*)&p->siteMgrInitParams.siteMgrDesiredBSSType); + p->tSmeModifiedInitParams.eDesiredBssType = p->siteMgrInitParams.siteMgrDesiredBSSType; + + regReadIntegerParameter(pAdapter, &STRdot11BeaconPeriod, + SITE_MGR_BEACON_INTERVAL_DEF, SITE_MGR_BEACON_INTERVAL_MIN, + SITE_MGR_BEACON_INTERVAL_MAX, + sizeof p->siteMgrInitParams.siteMgrDesiredBeaconInterval, + (TI_UINT8*)&p->siteMgrInitParams.siteMgrDesiredBeaconInterval); + + regReadIntegerParameter(pAdapter, &STRdot11ShortPreambleInvoked, + SITE_MGR_PREAMBLE_TYPE_DEF, PREAMBLE_LONG, PREAMBLE_SHORT, + sizeof p->siteMgrInitParams.siteMgrDesiredPreambleType, + (TI_UINT8*)&p->siteMgrInitParams.siteMgrDesiredPreambleType); + + regReadIntegerParameter(pAdapter, &STRReAuthActivePriority, + POWER_MGMNT_RE_AUTH_ACTIVE_PRIO_DEF_VALUE, POWER_MGMNT_RE_AUTH_ACTIVE_PRIO_MIN_VALUE, + POWER_MGMNT_RE_AUTH_ACTIVE_PRIO_MAX_VALUE, + sizeof p->PowerMgrInitParams.reAuthActivePriority, + (TI_UINT8*)&p->PowerMgrInitParams.reAuthActivePriority); + + regReadIntegerParameter(pAdapter, &STRExternalMode, + SITE_MGR_EXTERNAL_MODE_DEF, SITE_MGR_EXTERNAL_MODE_MIN, + SITE_MGR_EXTERNAL_MODE_MAX, + sizeof p->siteMgrInitParams.siteMgrExternalConfiguration, + (TI_UINT8*)&p->siteMgrInitParams.siteMgrExternalConfiguration); + + regReadIntegerParameter(pAdapter, &STRWiFiAdHoc, + SITE_MGR_WiFiAdHoc_DEF, SITE_MGR_WiFiAdHoc_MIN, SITE_MGR_WiFiAdHoc_MAX, + sizeof p->siteMgrInitParams.siteMgrWiFiAdhoc, + (TI_UINT8*)&p->siteMgrInitParams.siteMgrWiFiAdhoc); + + regReadIntegerParameter(pAdapter, &STRWiFiWmmPS, + WIFI_WMM_PS_DEF, WIFI_WMM_PS_MIN, WIFI_WMM_PS_MAX, + sizeof p->twdInitParams.tGeneral.WiFiWmmPS, + (TI_UINT8*)&p->twdInitParams.tGeneral.WiFiWmmPS); + + regReadIntegerParameter(pAdapter, &STRConnSelfTimeout, + CONN_SELF_TIMEOUT_DEF, CONN_SELF_TIMEOUT_MIN, CONN_SELF_TIMEOUT_MAX, + sizeof p->connInitParams.connSelfTimeout, + (TI_UINT8*)&p->connInitParams.connSelfTimeout); + + regReadIntegerParameter(pAdapter, &STRdot11AuthRespTimeout, + AUTH_RESPONSE_TIMEOUT_DEF, AUTH_RESPONSE_TIMEOUT_MIN, AUTH_RESPONSE_TIMEOUT_MAX, + sizeof p->authInitParams.authResponseTimeout, + (TI_UINT8*)&p->authInitParams.authResponseTimeout); + + regReadIntegerParameter(pAdapter, &STRdot11MaxAuthRetry, + AUTH_MAX_RETRY_COUNT_DEF, AUTH_MAX_RETRY_COUNT_MIN, AUTH_MAX_RETRY_COUNT_MAX, + sizeof p->authInitParams.authMaxRetryCount, + (TI_UINT8*)&p->authInitParams.authMaxRetryCount); + + regReadIntegerParameter(pAdapter, &STRdot11AssocRespTimeout, + ASSOC_RESPONSE_TIMEOUT_DEF, ASSOC_RESPONSE_TIMEOUT_MIN, ASSOC_RESPONSE_TIMEOUT_MAX, + sizeof p->assocInitParams.assocResponseTimeout, + (TI_UINT8*)&p->assocInitParams.assocResponseTimeout); + + regReadIntegerParameter(pAdapter, &STRdot11MaxAssocRetry, + ASSOC_MAX_RETRY_COUNT_DEF, ASSOC_MAX_RETRY_COUNT_MIN, ASSOC_MAX_RETRY_COUNT_MAX, + sizeof p->assocInitParams.assocMaxRetryCount, + (TI_UINT8*)&p->assocInitParams.assocMaxRetryCount); + + regReadIntegerParameter(pAdapter, &STRRxDataFiltersEnabled, + RX_DATA_FILTERS_ENABLED_DEF, RX_DATA_FILTERS_ENABLED_MIN, RX_DATA_FILTERS_ENABLED_MAX, + sizeof p->rxDataInitParams.rxDataFiltersEnabled, + (TI_UINT8*)&p->rxDataInitParams.rxDataFiltersEnabled); + + regReadIntegerParameter(pAdapter, &STRRxDataFiltersFilter1Offset, + RX_DATA_FILTERS_FILTER_OFFSET_DEF, RX_DATA_FILTERS_FILTER_OFFSET_MIN, RX_DATA_FILTERS_FILTER_OFFSET_MAX, + sizeof filterOffset, + (TI_UINT8*) &filterOffset); + + regReadStringParameter(pAdapter, &STRRxDataFiltersFilter1Mask, + RX_DATA_FILTERS_FILTER_MASK_DEF, RX_DATA_FILTERS_FILTER_MASK_LEN_DEF, + (TI_UINT8*) filterMask, + (TI_UINT8*) &filterMaskLength); + + regReadStringParameter(pAdapter, &STRRxDataFiltersFilter1Pattern, + RX_DATA_FILTERS_FILTER_PATTERN_DEF, RX_DATA_FILTERS_FILTER_PATTERN_LEN_DEF, + (TI_UINT8*) filterPattern, + (TI_UINT8*) &filterPatternLength); + + parse_filter_request(&p->rxDataInitParams.rxDataFilterRequests[0], filterOffset, filterMask, filterMaskLength, filterPattern, filterPatternLength); + + regReadIntegerParameter(pAdapter, &STRRxDataFiltersFilter2Offset, + RX_DATA_FILTERS_FILTER_OFFSET_DEF, RX_DATA_FILTERS_FILTER_OFFSET_MIN, RX_DATA_FILTERS_FILTER_OFFSET_MAX, + sizeof filterOffset, + (TI_UINT8*) &filterOffset); + + regReadStringParameter(pAdapter, &STRRxDataFiltersFilter2Mask, + RX_DATA_FILTERS_FILTER_MASK_DEF, RX_DATA_FILTERS_FILTER_MASK_LEN_DEF, + (TI_UINT8*) filterMask, + (TI_UINT8*) &filterMaskLength); + + regReadStringParameter(pAdapter, &STRRxDataFiltersFilter2Pattern, + RX_DATA_FILTERS_FILTER_PATTERN_DEF, RX_DATA_FILTERS_FILTER_PATTERN_LEN_DEF, + (TI_UINT8*) filterPattern, + (TI_UINT8*) &filterPatternLength); + + parse_filter_request(&p->rxDataInitParams.rxDataFilterRequests[1], filterOffset, filterMask, filterMaskLength, filterPattern, filterPatternLength); + + regReadIntegerParameter(pAdapter, &STRRxDataFiltersFilter3Offset, + RX_DATA_FILTERS_FILTER_OFFSET_DEF, RX_DATA_FILTERS_FILTER_OFFSET_MIN, RX_DATA_FILTERS_FILTER_OFFSET_MAX, + sizeof filterOffset, + (TI_UINT8*) &filterOffset); + + regReadStringParameter(pAdapter, &STRRxDataFiltersFilter3Mask, + RX_DATA_FILTERS_FILTER_MASK_DEF, RX_DATA_FILTERS_FILTER_MASK_LEN_DEF, + (TI_UINT8*) filterMask, + (TI_UINT8*) &filterMaskLength); + + regReadStringParameter(pAdapter, &STRRxDataFiltersFilter3Pattern, + RX_DATA_FILTERS_FILTER_PATTERN_DEF, RX_DATA_FILTERS_FILTER_PATTERN_LEN_DEF, + (TI_UINT8*) filterPattern, + (TI_UINT8*) &filterPatternLength); + + parse_filter_request(&p->rxDataInitParams.rxDataFilterRequests[2], filterOffset, filterMask, filterMaskLength, filterPattern, filterPatternLength); + + regReadIntegerParameter(pAdapter, &STRRxDataFiltersFilter4Offset, + RX_DATA_FILTERS_FILTER_OFFSET_DEF, RX_DATA_FILTERS_FILTER_OFFSET_MIN, RX_DATA_FILTERS_FILTER_OFFSET_MAX, + sizeof filterOffset, + (TI_UINT8*) &filterOffset); + + regReadStringParameter(pAdapter, &STRRxDataFiltersFilter4Mask, + RX_DATA_FILTERS_FILTER_MASK_DEF, RX_DATA_FILTERS_FILTER_MASK_LEN_DEF, + (TI_UINT8*) filterMask, + (TI_UINT8*) &filterMaskLength); + + regReadStringParameter(pAdapter, &STRRxDataFiltersFilter4Pattern, + RX_DATA_FILTERS_FILTER_PATTERN_DEF, RX_DATA_FILTERS_FILTER_PATTERN_LEN_DEF, + (TI_UINT8*) filterPattern, + (TI_UINT8*) &filterPatternLength); + + parse_filter_request(&p->rxDataInitParams.rxDataFilterRequests[3], filterOffset, filterMask, filterMaskLength, filterPattern, filterPatternLength); + + regReadIntegerParameter(pAdapter, &STRRxDataFiltersDefaultAction, + RX_DATA_FILTERS_DEFAULT_ACTION_DEF, RX_DATA_FILTERS_DEFAULT_ACTION_MIN, + RX_DATA_FILTERS_DEFAULT_ACTION_MAX, + sizeof p->rxDataInitParams.rxDataFiltersDefaultAction, + (TI_UINT8*)&p->rxDataInitParams.rxDataFiltersDefaultAction); + + regReadIntegerParameter(pAdapter, &STRReAuthActiveTimeout, + RX_DATA_RE_AUTH_ACTIVE_TIMEOUT_DEF, RX_DATA_RE_AUTH_ACTIVE_TIMEOUT_MIN, + RX_DATA_RE_AUTH_ACTIVE_TIMEOUT_MAX, + sizeof p->rxDataInitParams.reAuthActiveTimeout, + (TI_UINT8*)&p->rxDataInitParams.reAuthActiveTimeout); + + regReadIntegerParameter(pAdapter, &STRCreditCalcTimout, + TX_DATA_CREDIT_CALC_TIMOEUT_DEF, TX_DATA_CREDIT_CALC_TIMOEUT_MIN, + TX_DATA_CREDIT_CALC_TIMOEUT_MAX, + sizeof p->txDataInitParams.creditCalculationTimeout, + (TI_UINT8*)&p->txDataInitParams.creditCalculationTimeout); + + regReadIntegerParameter(pAdapter, &STRCreditCalcTimerEnabled, + TI_FALSE, TI_FALSE, TI_TRUE, + sizeof p->txDataInitParams.bCreditCalcTimerEnabled, + (TI_UINT8*)&p->txDataInitParams.bCreditCalcTimerEnabled); + + regReadIntegerParameter(pAdapter, &STRTrafficAdmControlTimeout, + TRAFFIC_ADM_CONTROL_TIMEOUT_DEF, TRAFFIC_ADM_CONTROL_TIMEOUT_MIN, + TRAFFIC_ADM_CONTROL_TIMEOUT_MAX, + sizeof p->qosMngrInitParams.trafficAdmCtrlInitParams.trafficAdmCtrlResponseTimeout, + (TI_UINT8*)&p->qosMngrInitParams.trafficAdmCtrlInitParams.trafficAdmCtrlResponseTimeout); + + regReadIntegerParameter(pAdapter, &STRTrafficAdmControlUseFixedMsduSize, + TI_FALSE, TI_FALSE, TI_TRUE, + sizeof p->qosMngrInitParams.trafficAdmCtrlInitParams.trafficAdmCtrlUseFixedMsduSize, + (TI_UINT8*)&p->qosMngrInitParams.trafficAdmCtrlInitParams.trafficAdmCtrlUseFixedMsduSize); + + regReadIntegerParameter(pAdapter, &STRDesiredMaxSpLen, + QOS_MAX_SP_LEN_DEF, QOS_MAX_SP_LEN_MIN, + QOS_MAX_SP_LEN_MAX, + sizeof p->qosMngrInitParams.desiredMaxSpLen, + (TI_UINT8*)&p->qosMngrInitParams.desiredMaxSpLen); + + regReadIntegerParameter(pAdapter, &STRCwFromUserEnable, + QOS_CW_USER_ENABLE_DEF, QOS_CW_USER_ENABLE_MIN, + QOS_CW_USER_ENABLE_MAX, + sizeof p->qosMngrInitParams.bCwFromUserEnable, + (TI_UINT8*)&p->qosMngrInitParams.bCwFromUserEnable); + + regReadIntegerParameter(pAdapter, &STRDesireCwMin, + QOS_CW_CWMIN_DEF, QOS_CW_CWMIN_MIN, + QOS_CW_CWMIN_MAX, + sizeof p->qosMngrInitParams.uDesireCwMin, + (TI_UINT8*)&p->qosMngrInitParams.uDesireCwMin); + + regReadIntegerParameter(pAdapter, &STRDesireCwMax, + QOS_CW_CWMAX_DEF, QOS_CW_CWMAX_MIN, + QOS_CW_CWMAX_MAX, + sizeof p->qosMngrInitParams.uDesireCwMax, + (TI_UINT8*)&p->qosMngrInitParams.uDesireCwMax); + +/* SME Initialization Parameters */ +/* ==================================== */ + + regReadIntegerParameter(pAdapter, &STRSmeRadioOn, + TI_TRUE, TI_FALSE, TI_TRUE, + sizeof p->tSmeModifiedInitParams.bRadioOn, + (TI_UINT8*)&p->tSmeModifiedInitParams.bRadioOn); + regReadIntegerParameter(pAdapter, &STRSmeConnectMode, + CONNECT_MODE_AUTO, CONNECT_MODE_AUTO, CONNECT_MODE_MANUAL, + sizeof p->tSmeModifiedInitParams.eConnectMode, + (TI_UINT8*)&p->tSmeModifiedInitParams.eConnectMode); + + { + /* due to the fact that two following init keys has negative values, we read them as table */ + TI_UINT32 uEntriesNumber = 1; + + regReadIntegerTable(pAdapter ,&STRSmeScanRssiThreshold, + SME_SCAN_RSSI_THRESHOLD_DEF, sizeof(TI_INT8) * 3, + (TI_UINT8*)&p->tSmeInitParams.iRssiThreshold, NULL, &uEntriesNumber, + sizeof(TI_INT8),TI_FALSE); + + if ( (p->tSmeInitParams.iRssiThreshold < SME_SCAN_RSSI_THRESHOLD_MIN) || + (p->tSmeInitParams.iRssiThreshold > SME_SCAN_RSSI_THRESHOLD_MAX)) + { + p->tSmeInitParams.iRssiThreshold = SME_SCAN_RSSI_THRESHOLD_DEF_NUM; + } + + regReadIntegerTable(pAdapter ,&STRSmeScanSnrThreshold, + SME_SCAN_SNR_THRESHOLD_DEF, sizeof(TI_INT8), + (TI_UINT8*)&p->tSmeInitParams.iSnrThreshold, NULL, &uEntriesNumber, sizeof(TI_INT8),TI_FALSE); + + if ( (p->tSmeInitParams.iSnrThreshold < SME_SCAN_SNR_THRESHOLD_MIN) || + (p->tSmeInitParams.iSnrThreshold > SME_SCAN_SNR_THRESHOLD_MAX)) + { + p->tSmeInitParams.iSnrThreshold = SME_SCAN_SNR_THRESHOLD_DEF_NUM; + } + } + + + regReadIntegerParameter(pAdapter ,&STRRoamScanEnable, + 0, 0, 1, sizeof(p->tRoamScanMngrInitParams.RoamingScanning_2_4G_enable), + (TI_UINT8*)&p->tRoamScanMngrInitParams.RoamingScanning_2_4G_enable); + + regReadIntegerParameter(pAdapter, &STRSmeScanCycleNumber, + SME_SCAN_CYCLES_DEF, SME_SCAN_CYCLES_MIN, SME_SCAN_CYCLES_MAX, + sizeof p->tSmeInitParams.uCycleNum, + (TI_UINT8*)&p->tSmeInitParams.uCycleNum); + regReadIntegerParameter(pAdapter, &STRSmeScanMaxDwellTime, + SME_SCAN_MAX_DWELL_DEF, SME_SCAN_MAX_DWELL_MIN, SME_SCAN_MAX_DWELL_MAX, + sizeof p->tSmeInitParams.uMaxScanDuration, + (TI_UINT8*)&p->tSmeInitParams.uMaxScanDuration); + regReadIntegerParameter(pAdapter, &STRSmeScanMinDwellTime, + SME_SCAN_MIN_DWELL_DEF, SME_SCAN_MIN_DWELL_MIN, SME_SCAN_MIN_DWELL_MAX, + sizeof p->tSmeInitParams.uMinScanDuration, + (TI_UINT8*)&p->tSmeInitParams.uMinScanDuration); + regReadIntegerParameter(pAdapter, &STRSmeScanProbeRequestNumber, + SME_SCAN_PROBE_REQ_DEF, SME_SCAN_PROBE_REQ_MIN, SME_SCAN_PROBE_REQ_MAX, + sizeof p->tSmeInitParams.uProbeReqNum, + (TI_UINT8*)&p->tSmeInitParams.uProbeReqNum); + + { + TI_UINT32 *uSmeScanIntervalsTempList; + + uSmeScanIntervalsTempList = os_memoryAlloc(pAdapter, SME_SCAN_INTERVALS_LIST_STRING_MAX_SIZE * sizeof(TI_UINT32)); + if (!uSmeScanIntervalsTempList) { + return; + } + regReadIntegerTable(pAdapter, &STRSmeScanIntervals, SME_SCAN_INTERVALS_LIST_VAL_DEF, + SME_SCAN_INTERVALS_LIST_STRING_MAX_SIZE, + (TI_UINT8 *)uSmeScanIntervalsTempList, NULL, &uTempEntriesCount, + sizeof (TI_UINT32),TI_FALSE); + /* sanity check */ + if (uTempEntriesCount > PERIODIC_SCAN_MAX_INTERVAL_NUM) + { + uTempEntriesCount = PERIODIC_SCAN_MAX_INTERVAL_NUM; + } + /* convert from TI_UINT8 to TI_UINT32 */ + for (uIndex = 0; uIndex < uTempEntriesCount; uIndex++) + { + p->tSmeInitParams.uScanIntervals[ uIndex ] = uSmeScanIntervalsTempList[ uIndex ]; + } + os_memoryFree(pAdapter, uSmeScanIntervalsTempList, SME_SCAN_INTERVALS_LIST_STRING_MAX_SIZE * sizeof(TI_UINT32)); + } + { + TI_UINT8 *uSmeTempList; + TI_UINT32 uSmeGChannelsCount; + + uSmeTempList = os_memoryAlloc(pAdapter, SME_SCAN_CHANNELS_LIST_G_STRING_MAX_SIZE); + if (!uSmeTempList) { + return; + } + regReadIntegerTable(pAdapter, &STRSmeScanGChannels, SME_SCAN_CHANNELS_LIST_G_VAL_DEF, + SME_SCAN_CHANNELS_LIST_G_STRING_MAX_SIZE, + (TI_UINT8 *)uSmeTempList, NULL, &uTempEntriesCount, + sizeof (TI_UINT8),TI_FALSE); + + + /* convert to channel list */ + for (uIndex = 0; uIndex < uTempEntriesCount; uIndex++) + { + p->tSmeInitParams.tChannelList[ uIndex ].eBand = RADIO_BAND_2_4_GHZ; + p->tSmeInitParams.tChannelList[ uIndex ].uChannel = uSmeTempList[ uIndex ]; + } + uSmeGChannelsCount = uTempEntriesCount; + + /* + * Add A_MODE channels to scan list only if it enabled + * NOTE: Don't use empty channel list string + */ + if ((p->siteMgrInitParams.siteMgrDesiredDot11Mode == DOT11_A_MODE) || + (p->siteMgrInitParams.siteMgrDesiredDot11Mode == DOT11_DUAL_MODE)) + { + regReadIntegerTable(pAdapter, &STRSmeScanAChannels, SME_SCAN_CHANNELS_LIST_A_VAL_DEF, + SME_SCAN_CHANNELS_LIST_A_STRING_MAX_SIZE, + (TI_UINT8*)&uSmeTempList, NULL, &uTempEntriesCount, + sizeof (TI_UINT8),TI_FALSE); + + /* convert to channel list */ + for (uIndex = 0; uIndex < uTempEntriesCount; uIndex++) + { + p->tSmeInitParams.tChannelList[ uSmeGChannelsCount + uIndex ].eBand = RADIO_BAND_5_0_GHZ; + p->tSmeInitParams.tChannelList[ uSmeGChannelsCount + uIndex ].uChannel = uSmeTempList[ uIndex ]; + } + + p->tSmeInitParams.uChannelNum = uSmeGChannelsCount + uIndex; + } + else + { + p->tSmeInitParams.uChannelNum = uSmeGChannelsCount; + } + os_memoryFree(pAdapter, uSmeTempList, SME_SCAN_CHANNELS_LIST_G_STRING_MAX_SIZE); + } + + regReadIntegerParameter(pAdapter, &STRdot11AuthenticationMode, + RSN_AUTH_SUITE_DEF, RSN_AUTH_SUITE_MIN, RSN_AUTH_SUITE_MAX, + sizeof p->rsnInitParams.authSuite, + (TI_UINT8*)&p->rsnInitParams.authSuite); + + /* Soft Gemini Section */ + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistEnable, + SOFT_GEMINI_ENABLED_DEF, SOFT_GEMINI_ENABLED_MIN, SOFT_GEMINI_ENABLED_MAX, + sizeof p->SoftGeminiInitParams.SoftGeminiEnable, + (TI_UINT8*)&p->SoftGeminiInitParams.SoftGeminiEnable); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistParamsBtLoadRatio, + SOFT_GEMINI_PARAMS_LOAD_RATIO_DEF, SOFT_GEMINI_PARAMS_LOAD_RATIO_MIN, SOFT_GEMINI_PARAMS_LOAD_RATIO_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_BT_LOAD_RATIO], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_BT_LOAD_RATIO]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistParamsAutoPsMode, + SOFT_GEMINI_PARAMS_AUTO_PS_MODE_DEF, SOFT_GEMINI_PARAMS_AUTO_PS_MODE_MIN, SOFT_GEMINI_PARAMS_AUTO_PS_MODE_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_AUTO_PS_MODE], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_AUTO_PS_MODE]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistParamsAutoScanProbeReqPerc, + SOFT_GEMINI_PARAMS_AUTO_SCAN_PROBE_REQ_DEF, SOFT_GEMINI_PARAMS_AUTO_SCAN_PROBE_REQ_MIN, SOFT_GEMINI_PARAMS_AUTO_SCAN_PROBE_REQ_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_AUTO_SCAN_PROBE_REQ], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_AUTO_SCAN_PROBE_REQ]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistParamsAutoScanWindowPerc, + SOFT_GEMINI_PARAMS_AUTO_SCAN_WINDOW_DEF, SOFT_GEMINI_PARAMS_AUTO_SCAN_WINDOW_MIN, SOFT_GEMINI_PARAMS_AUTO_SCAN_WINDOW_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_AUTO_SCAN_WINDOW], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_AUTO_SCAN_WINDOW]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistParamsAutoScanMaxTime, + SOFT_GEMINI_AUTO_SCAN_COMPENSATION_MAX_TIME_DEF, SOFT_GEMINI_AUTO_SCAN_COMPENSATION_MAX_TIME_MIN, SOFT_GEMINI_AUTO_SCAN_COMPENSATION_MAX_TIME_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_AUTO_SCAN_COMPENSATION_MAX_TIME], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_AUTO_SCAN_COMPENSATION_MAX_TIME]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistPerThreshold, + SOFT_GEMINI_PARAMS_PER_THRESHOLD_DEF, SOFT_GEMINI_PARAMS_PER_THRESHOLD_MIN, SOFT_GEMINI_PARAMS_PER_THRESHOLD_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_BT_PER_THRESHOLD], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_BT_PER_THRESHOLD]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistNfsSampleInterval, + SOFT_GEMINI_PARAMS_NFS_SAMPLE_INTERVAL_DEF, SOFT_GEMINI_PARAMS_NFS_SAMPLE_INTERVAL_MIN, SOFT_GEMINI_PARAMS_NFS_SAMPLE_INTERVAL_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_BT_NFS_SAMPLE_INTERVAL], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_BT_NFS_SAMPLE_INTERVAL]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistcoexAntennaConfiguration, + SOFT_GEMINI_ANTENNA_CONFIGURATION_DEF, SOFT_GEMINI_ANTENNA_CONFIGURATION_MIN, SOFT_GEMINI_ANTENNA_CONFIGURATION_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_ANTENNA_CONFIGURATION], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_ANTENNA_CONFIGURATION]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistcoexMaxConsecutiveBeaconMissPrecent, + SOFT_GEMINI_BEACON_MISS_PERCENT_DEF, SOFT_GEMINI_BEACON_MISS_PERCENT_MIN, SOFT_GEMINI_BEACON_MISS_PERCENT_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_BEACON_MISS_PERCENT], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_BEACON_MISS_PERCENT]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistcoexAPRateAdapationThr, + SOFT_GEMINI_RATE_ADAPT_THRESH_DEF, SOFT_GEMINI_RATE_ADAPT_THRESH_MIN, SOFT_GEMINI_RATE_ADAPT_THRESH_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistcoexAPRateAdapationSnr, + SOFT_GEMINI_RATE_ADAPT_SNR_DEF, SOFT_GEMINI_RATE_ADAPT_SNR_MIN, SOFT_GEMINI_RATE_ADAPT_SNR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_RATE_ADAPT_SNR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_RATE_ADAPT_SNR]); + + + /* BR section */ + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistUpsdAclMasterMinBR, + SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_BR_DEF, SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_BR_MIN, SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_BR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_BR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_BR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistUpsdAclSlaveMinBR, + SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_BR_DEF, SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_BR_MIN, SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_BR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_BR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_BR]); + + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistUpsdAclMasterMaxBR, + SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_BR_DEF, SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_BR_MIN, SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_BR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_BR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_BR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistUpsdAclSlaveMaxBR, + SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_BR_DEF, SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_BR_MIN, SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_BR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_BR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_BR]); + + + regReadIntegerParameter(pAdapter, &STRBThWlanPsMaxBtAclMasterBR, + SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_BR_DEF, SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_BR_MIN, SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_BR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_BR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_BR]); + + + regReadIntegerParameter(pAdapter, &STRBThWlanPsMaxBtAclSlaveBR, + SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_BR_DEF, SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_BR_MIN, SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_BR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_BR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_BR]); + + + + /* EDR section */ + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistUpsdAclMasterMinEDR, + SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR_DEF, SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR_MIN, SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistUpsdAclSlaveMinEDR, + SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_EDR_DEF, SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_EDR_MIN, SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_EDR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistUpsdAclMasterMaxEDR, + SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_EDR_DEF, SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_EDR_MIN, SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_EDR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistUpsdAclSlaveMaxEDR, + SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_EDR_DEF, SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_EDR_MIN, SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_EDR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanPsMaxBtAclMasterEDR, + SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_EDR_DEF, SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_EDR_MIN, SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_EDR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanPsMaxBtAclSlaveEDR, + SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_EDR_DEF, SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_EDR_MIN, SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_EDR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistRxt, + SOFT_GEMINI_RXT_DEF, SOFT_GEMINI_RXT_MIN, SOFT_GEMINI_RXT_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_RXT], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_RXT]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistTxt, + SOFT_GEMINI_TXT_DEF, SOFT_GEMINI_TXT_MIN, SOFT_GEMINI_TXT_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TXT], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TXT]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistAdaptiveRxtTxt, + SOFT_GEMINI_ADAPTIVE_RXT_TXT_DEF, SOFT_GEMINI_ADAPTIVE_RXT_TXT_MIN, SOFT_GEMINI_ADAPTIVE_RXT_TXT_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_ADAPTIVE_RXT_TXT], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_ADAPTIVE_RXT_TXT]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistPsPollTimeout, + SOFT_GEMINI_PS_POLL_TIMEOUT_DEF, SOFT_GEMINI_PS_POLL_TIMEOUT_MIN, SOFT_GEMINI_PS_POLL_TIMEOUT_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_PS_POLL_TIMEOUT], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_PS_POLL_TIMEOUT]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistUpsdTimeout, + SOFT_GEMINI_UPSD_TIMEOUT_DEF, SOFT_GEMINI_UPSD_TIMEOUT_MIN, SOFT_GEMINI_UPSD_TIMEOUT_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_UPSD_TIMEOUT], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_UPSD_TIMEOUT]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistWlanActiveBtAclMasterMinEDR, + SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MIN_EDR_DEF, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MIN_EDR_MIN, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MIN_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MIN_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MIN_EDR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistWlanActiveBtAclSlaveMinEDR, + SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_EDR_DEF, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_EDR_MIN, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_EDR]); + + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistWlanActiveBtAclMasterMaxEDR, + SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MAX_EDR_DEF, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MAX_EDR_MIN, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MAX_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MAX_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MAX_EDR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistWlanActiveBtAclSlaveMaxEDR, + SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_EDR_DEF, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_EDR_MIN, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_EDR]); + + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistWlanActiveMaxBtAclMasterEDR, + SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_MASTER_EDR_DEF, SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_MASTER_EDR_MIN, SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_MASTER_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_MASTER_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_MASTER_EDR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistWlanActiveMaxBtAclSlaveEDR, + SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_EDR_DEF, SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_EDR_MIN, SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_EDR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_EDR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_EDR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistWlanActiveBtAclMinBR, + SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_BR_DEF, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_BR_MIN, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_BR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_BR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_BR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistWlanActiveBtAclMaxBR, + SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_BR_DEF, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_BR_MIN, SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_BR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_BR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_BR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexistWlanActiveMaxBtAclBR, + SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_BR_DEF, SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_BR_MIN, SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_BR_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_BR], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_BR]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp1, + SOFT_GEMINI_TEMP_PARAM_1_DEF, SOFT_GEMINI_TEMP_PARAM_1_MIN, SOFT_GEMINI_TEMP_PARAM_1_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_1], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_1]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp2, + SOFT_GEMINI_TEMP_PARAM_2_DEF, SOFT_GEMINI_TEMP_PARAM_2_MIN, SOFT_GEMINI_TEMP_PARAM_2_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_2], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_2]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp3, + SOFT_GEMINI_TEMP_PARAM_3_DEF, SOFT_GEMINI_TEMP_PARAM_3_MIN, SOFT_GEMINI_TEMP_PARAM_3_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_3], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_3]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp4, + SOFT_GEMINI_TEMP_PARAM_4_DEF, SOFT_GEMINI_TEMP_PARAM_4_MIN, SOFT_GEMINI_TEMP_PARAM_4_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_4], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_4]); + + regReadIntegerParameter(pAdapter, &STRBThWlanCoexTemp5, + SOFT_GEMINI_TEMP_PARAM_5_DEF, SOFT_GEMINI_TEMP_PARAM_5_MIN, SOFT_GEMINI_TEMP_PARAM_5_MAX, + sizeof p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_5], + (TI_UINT8*)&p->SoftGeminiInitParams.coexParams[SOFT_GEMINI_TEMP_PARAM_5]);; + + + /* + * CoexActivity table + */ + + /* Read the number of elements in the table ( this is because table entry has 5 values following it )*/ + regReadIntegerParameter(pAdapter, &STRCoexActivityNumOfElem, + COEX_ACTIVITY_TABLE_DEF_NUM, COEX_ACTIVITY_TABLE_MIN_NUM, COEX_ACTIVITY_TABLE_MAX_NUM, + sizeof p->twdInitParams.tGeneral.halCoexActivityTable.numOfElements, + (TI_UINT8*)(&p->twdInitParams.tGeneral.halCoexActivityTable.numOfElements) ); + + /* Read the CoexActivity table string */ + { + TI_UINT8 *strCoexActivityTable; + TI_UINT8 strCoexActivitySize = 0; + + strCoexActivityTable = os_memoryAlloc(pAdapter, COEX_ACTIVITY_TABLE_MAX_NUM*COEX_ACTIVITY_TABLE_SIZE); + if (strCoexActivityTable) { + regReadStringParameter(pAdapter, &STRCoexActivityTable , + (TI_INT8*)(defCoexActivityTable), strCoexActivitySize, + (TI_UINT8*)strCoexActivityTable, &strCoexActivitySize); + + /* Convert the CoexActivity table string */ + regConvertStringtoCoexActivityTable(strCoexActivityTable , p->twdInitParams.tGeneral.halCoexActivityTable.numOfElements, &p->twdInitParams.tGeneral.halCoexActivityTable.entry[0] , strCoexActivitySize); + os_memoryFree(pAdapter, strCoexActivityTable, COEX_ACTIVITY_TABLE_MAX_NUM*COEX_ACTIVITY_TABLE_SIZE); + } + } + + /* + Power Manager + */ + regReadIntegerParameter(pAdapter, + &STRPowerMode, + POWER_MODE_DEF_VALUE, + POWER_MODE_MIN_VALUE, + POWER_MODE_MAX_VALUE, + sizeof p->PowerMgrInitParams.powerMode, + (TI_UINT8*)&p->PowerMgrInitParams.powerMode); + + regReadIntegerParameter(pAdapter, + &STRBeaconReceiveTime, + BEACON_RECEIVE_TIME_DEF_VALUE, + BEACON_RECEIVE_TIME_MIN_VALUE, + BEACON_RECEIVE_TIME_MAX_VALUE, + sizeof p->PowerMgrInitParams.beaconReceiveTime, + (TI_UINT8*)&p->PowerMgrInitParams.beaconReceiveTime); + + regReadIntegerParameter(pAdapter, + &STRBaseBandWakeUpTime, + BASE_BAND_WAKE_UP_TIME_DEF_VALUE, + BASE_BAND_WAKE_UP_TIME_MIN_VALUE, + BASE_BAND_WAKE_UP_TIME_MAX_VALUE, + sizeof p->PowerMgrInitParams.BaseBandWakeUpTime, + (TI_UINT8*)&p->PowerMgrInitParams.BaseBandWakeUpTime); + + regReadIntegerParameter(pAdapter, + &STRHangoverPeriod, + HANGOVER_PERIOD_DEF_VALUE, + HANGOVER_PERIOD_MIN_VALUE, + HANGOVER_PERIOD_MAX_VALUE, + sizeof p->PowerMgrInitParams.hangoverPeriod, + (TI_UINT8*)&p->PowerMgrInitParams.hangoverPeriod); + + regReadIntegerParameter(pAdapter, + &STRBeaconListenInterval, + BEACON_LISTEN_INTERVAL_DEF_VALUE, + BEACON_LISTEN_INTERVAL_MIN_VALUE, + BEACON_LISTEN_INTERVAL_MAX_VALUE, + sizeof p->PowerMgrInitParams.beaconListenInterval, + (TI_UINT8*)&p->PowerMgrInitParams.beaconListenInterval); + + regReadIntegerParameter(pAdapter, + &STRDtimListenInterval, + DTIM_LISTEN_INTERVAL_DEF_VALUE, + DTIM_LISTEN_INTERVAL_MIN_VALUE, + DTIM_LISTEN_INTERVAL_MAX_VALUE, + sizeof p->PowerMgrInitParams.dtimListenInterval, + (TI_UINT8*)&p->PowerMgrInitParams.dtimListenInterval); + + regReadIntegerParameter(pAdapter, + &STRNConsecutiveBeaconsMissed, + N_CONSECUTIVE_BEACONS_MISSED_DEF_VALUE, + N_CONSECUTIVE_BEACONS_MISSED_MIN_VALUE, + N_CONSECUTIVE_BEACONS_MISSED_MAX_VALUE, + sizeof p->PowerMgrInitParams.nConsecutiveBeaconsMissed, + (TI_UINT8*)&p->PowerMgrInitParams.nConsecutiveBeaconsMissed); + + regReadIntegerParameter(pAdapter, + &STREnterTo802_11PsRetries, + ENTER_TO_802_11_POWER_SAVE_RETRIES_DEF_VALUE, + ENTER_TO_802_11_POWER_SAVE_RETRIES_MIN_VALUE, + ENTER_TO_802_11_POWER_SAVE_RETRIES_MAX_VALUE, + sizeof p->PowerMgrInitParams.EnterTo802_11PsRetries, + (TI_UINT8*)&p->PowerMgrInitParams.EnterTo802_11PsRetries); + + regReadIntegerParameter(pAdapter, + &STRAutoPowerModeInterval, + AUTO_POWER_MODE_INTERVAL_DEF_VALUE, + AUTO_POWER_MODE_INTERVAL_MIN_VALUE, + AUTO_POWER_MODE_INTERVAL_MAX_VALUE, + sizeof p->PowerMgrInitParams.autoModeInterval, + (TI_UINT8*)&p->PowerMgrInitParams.autoModeInterval); + + regReadIntegerParameter(pAdapter, + &STRAutoPowerModeActiveTh, + AUTO_POWER_MODE_ACTIVE_TH_DEF_VALUE, + AUTO_POWER_MODE_ACTIVE_TH_MIN_VALUE, + AUTO_POWER_MODE_ACTIVE_TH_MAX_VALUE, + sizeof p->PowerMgrInitParams.autoModeActiveTH, + (TI_UINT8*)&p->PowerMgrInitParams.autoModeActiveTH); + + regReadIntegerParameter(pAdapter, + &STRAutoPowerModeDozeTh, + AUTO_POWER_MODE_DOZE_TH_DEF_VALUE, + AUTO_POWER_MODE_DOZE_TH_MIN_VALUE, + AUTO_POWER_MODE_DOZE_TH_MAX_VALUE, + sizeof p->PowerMgrInitParams.autoModeDozeTH, + (TI_UINT8*)&p->PowerMgrInitParams.autoModeDozeTH); + + regReadIntegerParameter(pAdapter, + &STRAutoPowerModeDozeMode, + AUTO_POWER_MODE_DOZE_MODE_DEF_VALUE, + AUTO_POWER_MODE_DOZE_MODE_MIN_VALUE, + AUTO_POWER_MODE_DOZE_MODE_MAX_VALUE, + sizeof p->PowerMgrInitParams.autoModeDozeMode, + (TI_UINT8*)&p->PowerMgrInitParams.autoModeDozeMode); + + regReadIntegerParameter(pAdapter, + &STRDefaultPowerLevel, + POWERAUTHO_POLICY_ELP, + POWERAUTHO_POLICY_ELP, + POWERAUTHO_POLICY_AWAKE, + sizeof p->PowerMgrInitParams.defaultPowerLevel, + (TI_UINT8*)&p->PowerMgrInitParams.defaultPowerLevel); + + regReadIntegerParameter(pAdapter, + &STRPowerSavePowerLevel, + POWERAUTHO_POLICY_ELP, + POWERAUTHO_POLICY_ELP, + POWERAUTHO_POLICY_AWAKE, + sizeof p->PowerMgrInitParams.PowerSavePowerLevel, + (TI_UINT8*)&p->PowerMgrInitParams.PowerSavePowerLevel); + + + regReadIntegerParameter(pAdapter, + &STRBurstModeEnable, + BURST_MODE_ENABLE_DEF, + BURST_MODE_ENABLE_MIN, + BURST_MODE_ENABLE_MAX, + sizeof p->qosMngrInitParams.bEnableBurstMode, + (TI_UINT8*)&p->qosMngrInitParams.bEnableBurstMode); + +/*---------------------- Smart Reflex Configration -----------------------*/ + regReadIntegerParameter(pAdapter, + &STRSRState, + SMART_REFLEX_STATE_DEF, + SMART_REFLEX_STATE_MIN, + SMART_REFLEX_STATE_MAX, + sizeof p->twdInitParams.tSmartReflexState.enable, + (TI_UINT8*)&p->twdInitParams.tSmartReflexState.enable); + + + NdisZeroMemory(&(p->twdInitParams.tSmartReflexParams), sizeof(ACXSmartReflexConfigParams_t)); + + regReadIntegerTable (pAdapter, &STRSRConfigParam1, SMART_REFLEX_CONFIG_PARAMS_DEF_TABLE, + MAX_SR_PARAM_LEN, NULL, (TI_INT8*)&SRConfigParams, + (TI_UINT32*)&TempSRCnt, sizeof (TI_UINT8),TI_TRUE); + + p->twdInitParams.tSmartReflexParams.errorTable[0].len = SRConfigParams[0]; + p->twdInitParams.tSmartReflexParams.errorTable[0].upperLimit = SRConfigParams[1]; + + len = p->twdInitParams.tSmartReflexParams.errorTable[0].len; + if ((len > MAX_SR_PARAM_LEN)|| (TempSRCnt > len + 1)) + { + p->twdInitParams.tSmartReflexParams.errorTable[0].len = 0; + p->twdInitParams.tSmartReflexParams.errorTable[0].upperLimit = 0; + memset(&p->twdInitParams.tSmartReflexParams.errorTable[0].values,0,MAX_SR_PARAM_LEN) ; + } + else + memcpy(&p->twdInitParams.tSmartReflexParams.errorTable[0].values, &SRConfigParams[2],len -1); + + + regReadIntegerTable (pAdapter, &STRSRConfigParam2, SMART_REFLEX_CONFIG_PARAMS_DEF_TABLE, + MAX_SR_PARAM_LEN, NULL, (TI_INT8*)&SRConfigParams, + (TI_UINT32*)&TempSRCnt, sizeof (TI_UINT8),TI_TRUE); + + p->twdInitParams.tSmartReflexParams.errorTable[1].len = SRConfigParams[0]; + p->twdInitParams.tSmartReflexParams.errorTable[1].upperLimit = SRConfigParams[1]; + + len = p->twdInitParams.tSmartReflexParams.errorTable[1].len; + if ((len > MAX_SR_PARAM_LEN)|| (TempSRCnt > len + 1)) + { + p->twdInitParams.tSmartReflexParams.errorTable[1].len = 0; + p->twdInitParams.tSmartReflexParams.errorTable[1].upperLimit = 0; + memset(&p->twdInitParams.tSmartReflexParams.errorTable[1].values,0,MAX_SR_PARAM_LEN) ; + } + else + memcpy(&p->twdInitParams.tSmartReflexParams.errorTable[1].values, &SRConfigParams[2],len -1); + + + regReadIntegerTable (pAdapter, &STRSRConfigParam3, SMART_REFLEX_CONFIG_PARAMS_DEF_TABLE, + MAX_SR_PARAM_LEN, NULL, (TI_INT8*)&SRConfigParams, + (TI_UINT32*)&TempSRCnt, sizeof (TI_UINT8),TI_TRUE); + + p->twdInitParams.tSmartReflexParams.errorTable[2].len = SRConfigParams[0]; + p->twdInitParams.tSmartReflexParams.errorTable[2].upperLimit = SRConfigParams[1]; + + len = p->twdInitParams.tSmartReflexParams.errorTable[2].len; + if ((len > MAX_SR_PARAM_LEN)|| (TempSRCnt > len + 1)) + { + p->twdInitParams.tSmartReflexParams.errorTable[2].len = 0; + p->twdInitParams.tSmartReflexParams.errorTable[2].upperLimit = 0; + memset(&p->twdInitParams.tSmartReflexParams.errorTable[2].values,0,MAX_SR_PARAM_LEN) ; + } + else + memcpy(&p->twdInitParams.tSmartReflexParams.errorTable[2].values, &SRConfigParams[2],len -1); + + + regReadIntegerParameter(pAdapter, + &STRSRSenNP, + SMART_REFLEX_DEBUG_DEF, + SMART_REFLEX_DEBUG_MIN, + SMART_REFLEX_DEBUG_MAX, + sizeof p->twdInitParams.tSmartReflexDebugParams.senN_P, + (TI_UINT8*)&p->twdInitParams.tSmartReflexDebugParams.senN_P); + + regReadIntegerParameter(pAdapter, + &STRSRSenNPGain, + SMART_REFLEX_DEBUG_DEF, + SMART_REFLEX_DEBUG_MIN, + SMART_REFLEX_DEBUG_MAX, + sizeof p->twdInitParams.tSmartReflexDebugParams.senN_P_Gain, + (TI_UINT8*)&p->twdInitParams.tSmartReflexDebugParams.senN_P_Gain); + + regReadIntegerParameter(pAdapter, + &STRSRSenPrn, + SMART_REFLEX_DEBUG_DEF, + SMART_REFLEX_DEBUG_MIN, + SMART_REFLEX_DEBUG_MAX, + sizeof p->twdInitParams.tSmartReflexDebugParams.senPRN, + (TI_UINT8*)&p->twdInitParams.tSmartReflexDebugParams.senPRN); + + regReadIntegerParameter(pAdapter, + &STRSRSenNrn, + SMART_REFLEX_DEBUG_DEF, + SMART_REFLEX_DEBUG_MIN, + SMART_REFLEX_DEBUG_MAX, + sizeof (p->twdInitParams.tSmartReflexDebugParams.senNRN), + (TI_UINT8*)&p->twdInitParams.tSmartReflexDebugParams.senNRN); + + + regReadIntegerTable (pAdapter, &STRSRDebugTable, SMART_REFLEX_CONFIG_PARAMS_DEF_TABLE, + MAX_SR_PARAM_LEN, NULL, (TI_INT8*)&p->twdInitParams.tSmartReflexDebugParams.errorTable, + (TI_UINT32*)&TempSRCnt, sizeof (TI_UINT8),TI_FALSE); + + + + + + +/*---------------------- Power Management Configuration -----------------------*/ + regReadIntegerParameter(pAdapter, + &STRPowerMgmtHangOverPeriod, + HANGOVER_PERIOD_DEF_VALUE, + HANGOVER_PERIOD_MIN_VALUE, + HANGOVER_PERIOD_MAX_VALUE, + sizeof p->PowerMgrInitParams.hangOverPeriod, + (TI_UINT8*)&p->PowerMgrInitParams.hangOverPeriod); + + regReadIntegerParameter(pAdapter, + &STRPowerMgmtNeedToSendNullData, + POWER_MGMNT_NEED_TO_SEND_NULL_PACKET_DEF_VALUE, + POWER_MGMNT_NEED_TO_SEND_NULL_PACKET_MIN_VALUE, + POWER_MGMNT_NEED_TO_SEND_NULL_PACKET_MAX_VALUE, + sizeof p->PowerMgrInitParams.needToSendNullData, + (TI_UINT8*)&p->PowerMgrInitParams.needToSendNullData); + + regReadIntegerParameter(pAdapter, + &STRPowerMgmtNullPktRateModulation, + POWER_MGMNT_NULL_PACKET_RATE_MOD_DEF_VALUE, + POWER_MGMNT_NULL_PACKET_RATE_MOD_MIN_VALUE, + POWER_MGMNT_NULL_PACKET_RATE_MOD_MAX_VALUE, + sizeof p->PowerMgrInitParams.NullPktRateModulation, + (TI_UINT8*)&p->PowerMgrInitParams.NullPktRateModulation); + + regReadIntegerParameter(pAdapter, + &STRPowerMgmtNumNullPktRetries, + POWER_MGMNT_NUM_NULL_PACKET_RETRY_DEF_VALUE, + POWER_MGMNT_NUM_NULL_PACKET_RETRY_MIN_VALUE, + POWER_MGMNT_NUM_NULL_PACKET_RETRY_MAX_VALUE, + sizeof p->PowerMgrInitParams.numNullPktRetries, + (TI_UINT8*)&p->PowerMgrInitParams.numNullPktRetries); + + regReadIntegerParameter(pAdapter, + &STRPowerMgmtPllLockTime, + PLL_LOCK_TIME_DEF_VALUE, + PLL_LOCK_TIME_MIN_VALUE, + PLL_LOCK_TIME_MAX_VALUE, + sizeof p->PowerMgrInitParams.PLLlockTime, + (TI_UINT8*)&p->PowerMgrInitParams.PLLlockTime); + + regReadIntegerParameter(pAdapter, + &STRPsPollDeliveryFailureRecoveryPeriod, + PS_POLL_FAILURE_PERIOD_DEF, + PS_POLL_FAILURE_PERIOD_MIN, + PS_POLL_FAILURE_PERIOD_MAX, + sizeof p->PowerMgrInitParams.PsPollDeliveryFailureRecoveryPeriod, + (TI_UINT8*)&p->PowerMgrInitParams.PsPollDeliveryFailureRecoveryPeriod); + + regReadIntegerParameter(pAdapter, + &STRHostClkSettlingTime, + HOST_CLK_SETTLE_TIME_USEC_DEF, + HOST_CLK_SETTLE_TIME_USEC_MIN, + HOST_CLK_SETTLE_TIME_USEC_MAX, + sizeof p->twdInitParams.tGeneral.uHostClkSettlingTime, + (TI_UINT8*)&p->twdInitParams.tGeneral.uHostClkSettlingTime); + + regReadIntegerParameter(pAdapter, + &STRHostFastWakeupSupport, + HOST_FAST_WAKE_SUPPORT_DEF, + HOST_FAST_WAKE_SUPPORT_MIN, + HOST_FAST_WAKE_SUPPORT_MAX, + sizeof p->twdInitParams.tGeneral.uHostFastWakeupSupport, + (TI_UINT8*)&p->twdInitParams.tGeneral.uHostFastWakeupSupport); + + /*--------------- Power Management Wake up conditions ------------------*/ + + regReadIntegerParameter(pAdapter, &STRListenInterval, + TWD_LISTEN_INTERVAL_DEF, TWD_LISTEN_INTERVAL_MIN, + TWD_LISTEN_INTERVAL_MAX, + sizeof p->PowerMgrInitParams.listenInterval, + (TI_UINT8*)&p->PowerMgrInitParams.listenInterval); + + /*-----------------------------------------------------------------------*/ + + /*--------------- Power Server Init Parameters ------------------*/ + regReadIntegerParameter(pAdapter, + &STRPowerMgmtNumNullPktRetries, + POWER_MGMNT_NUM_NULL_PACKET_RETRY_DEF_VALUE, + POWER_MGMNT_NUM_NULL_PACKET_RETRY_MIN_VALUE, + POWER_MGMNT_NUM_NULL_PACKET_RETRY_MAX_VALUE, + sizeof p->twdInitParams.tPowerSrv.numNullPktRetries, + (TI_UINT8*)&p->twdInitParams.tPowerSrv.numNullPktRetries); + + regReadIntegerParameter(pAdapter, + &STRPowerMgmtHangOverPeriod, + HANGOVER_PERIOD_DEF_VALUE, + HANGOVER_PERIOD_MIN_VALUE, + HANGOVER_PERIOD_MAX_VALUE, + sizeof p->twdInitParams.tPowerSrv.hangOverPeriod, + (TI_UINT8*)&p->twdInitParams.tPowerSrv.hangOverPeriod); + /*-----------------------------------------------------------------------*/ + + + /* Scan SRV */ + regReadIntegerParameter(pAdapter, &STRNumberOfNoScanCompleteToRecovery, + SCAN_SRV_NUMBER_OF_NO_SCAN_COMPLETE_TO_RECOVERY_DEF, + SCAN_SRV_NUMBER_OF_NO_SCAN_COMPLETE_TO_RECOVERY_MIN, + SCAN_SRV_NUMBER_OF_NO_SCAN_COMPLETE_TO_RECOVERY_MAX, + sizeof (p->twdInitParams.tScanSrv.numberOfNoScanCompleteToRecovery), + (TI_UINT8*)&(p->twdInitParams.tScanSrv.numberOfNoScanCompleteToRecovery) ); + + regReadIntegerParameter(pAdapter, &STRTriggeredScanTimeOut, + SCAN_SRV_TRIGGERED_SCAN_TIME_OUT_DEF, + SCAN_SRV_TRIGGERED_SCAN_TIME_OUT_MIN, + SCAN_SRV_TRIGGERED_SCAN_TIME_OUT_MAX, + sizeof (p->twdInitParams.tScanSrv.uTriggeredScanTimeOut), + (TI_UINT8*)&(p->twdInitParams.tScanSrv.uTriggeredScanTimeOut) ); + + + /* Regulatory Domain */ + + /* Indicate the time in which the STA didn't receive any country code and was not connected, and therefore + will delete its current country code */ + regReadIntegerParameter(pAdapter, &STRTimeToResetCountryMs, + REGULATORY_DOMAIN_COUNTRY_TIME_RESET_DEF, REGULATORY_DOMAIN_COUNTRY_TIME_RESET_MIN, + REGULATORY_DOMAIN_COUNTRY_TIME_RESET_MAX, + sizeof p->regulatoryDomainInitParams.uTimeOutToResetCountryMs, + (TI_UINT8*)&(p->regulatoryDomainInitParams.uTimeOutToResetCountryMs)); + + /* 802.11d/h */ + regReadIntegerParameter(pAdapter, &STRMultiRegulatoryDomainEnabled, + MULTI_REGULATORY_DOMAIN_ENABLED_DEF, MULTI_REGULATORY_DOMAIN_ENABLED_MIN, + MULTI_REGULATORY_DOMAIN_ENABLED_MAX, + sizeof p->regulatoryDomainInitParams.multiRegulatoryDomainEnabled, + (TI_UINT8*)&(p->regulatoryDomainInitParams.multiRegulatoryDomainEnabled)); + + regReadIntegerParameter(pAdapter, &STRSpectrumManagementEnabled, + SPECTRUM_MANAGEMENT_ENABLED_DEF, SPECTRUM_MANAGEMENT_ENABLED_MIN, + SPECTRUM_MANAGEMENT_ENABLED_MAX, + sizeof p->regulatoryDomainInitParams.spectrumManagementEnabled, + (TI_UINT8*)&(p->regulatoryDomainInitParams.spectrumManagementEnabled)); + + regReadIntegerParameter(pAdapter, &STRSpectrumManagementEnabled, + SPECTRUM_MANAGEMENT_ENABLED_DEF, SPECTRUM_MANAGEMENT_ENABLED_MIN, + SPECTRUM_MANAGEMENT_ENABLED_MAX, + sizeof p->SwitchChannelInitParams.dot11SpectrumManagementRequired, + (TI_UINT8*)&(p->SwitchChannelInitParams.dot11SpectrumManagementRequired)); + + + /* Scan Control Tables */ + regReadStringParameter(pAdapter, &STRScanControlTable24, + (TI_INT8*)&ScanControlTable24Def[0],(USHORT)(2 * NUM_OF_CHANNELS_24), + (TI_UINT8*)&(ScanControlTable24Tmp[0]), + (PUSHORT)&tableLen); + + for( loopIndex = tableLen ; loopIndex < 2 * NUM_OF_CHANNELS_24 ; loopIndex++) + ScanControlTable24Tmp[loopIndex] = '0'; + + decryptScanControlTable(ScanControlTable24Tmp,(TI_UINT8*)&(p->regulatoryDomainInitParams.desiredScanControlTable.ScanControlTable24.tableString[0]),2 * NUM_OF_CHANNELS_24); + + + /* Scan Control Tables for 5 Ghz*/ + regReadStringParameter(pAdapter, &STRScanControlTable5, + (TI_INT8*)&ScanControlTable5Def[0],(USHORT)(2 * A_5G_BAND_NUM_CHANNELS), + (TI_UINT8*)&(ScanControlTable5Tmp[0]), + (PUSHORT)&tableLen); + + + for( loopIndex = tableLen ; loopIndex < 2 * A_5G_BAND_NUM_CHANNELS ; loopIndex++) + ScanControlTable5Tmp[loopIndex] = '0'; + + decryptScanControlTable(ScanControlTable5Tmp,(TI_UINT8*)&(p->regulatoryDomainInitParams.desiredScanControlTable.ScanControlTable5.tableString[0]),2 * A_5G_BAND_NUM_CHANNELS); + + + /* Tx Power */ + regReadIntegerParameter(pAdapter, &STRTxPower, + DEF_TX_POWER, MIN_TX_POWER, MAX_TX_POWER, + sizeof p->regulatoryDomainInitParams.desiredTxPower, + (TI_UINT8*)&p->regulatoryDomainInitParams.desiredTxPower); + + regReadIntegerParameter(pAdapter, &STRdot11WEPStatus, + RSN_WEP_STATUS_DEF, RSN_WEP_STATUS_MIN, RSN_WEP_STATUS_MAX, + sizeof p->rsnInitParams.privacyOn, + (TI_UINT8*)&p->rsnInitParams.privacyOn); + /* reverse privacy value - windows is setting 1 as off */ + /* + p->rsnInitParams.privacyMode = !(p->rsnInitParams.privacyOn); + p->rsnInitParams.privacyOn = !(p->rsnInitParams.privacyOn); + */ + + regReadIntegerParameter(pAdapter, &STRdot11WEPDefaultKeyID, + RSN_DEFAULT_KEY_ID_DEF, RSN_DEFAULT_KEY_ID_MIN, + RSN_DEFAULT_KEY_ID_MAX, + sizeof p->rsnInitParams.defaultKeyId, + (TI_UINT8*)&p->rsnInitParams.defaultKeyId); + + + regReadIntegerParameter(pAdapter, &STRMixedMode, + RSN_WEPMIXEDMODE_ENABLED_DEF, RSN_WEPMIXEDMODE_ENABLED_MIN, + RSN_WEPMIXEDMODE_ENABLED_MAX, + sizeof p->rsnInitParams.mixedMode, + (TI_UINT8*)&p->rsnInitParams.mixedMode); + + regReadIntegerParameter(pAdapter, &STRWPAMixedMode, + RSN_WPAMIXEDMODE_ENABLE_DEF, RSN_WPAMIXEDMODE_ENABLE_MIN, + RSN_WPAMIXEDMODE_ENABLE_MAX, + sizeof p->rsnInitParams.WPAMixedModeEnable, + (TI_UINT8*)&p->rsnInitParams.WPAMixedModeEnable); + + regReadIntegerParameter(pAdapter, &STRRSNPreAuth, + RSN_PREAUTH_ENABLE_DEF, RSN_PREAUTH_ENABLE_MIN, + RSN_PREAUTH_ENABLE_MAX, + sizeof p->rsnInitParams.preAuthSupport, + (TI_UINT8*)&p->rsnInitParams.preAuthSupport); + + regReadIntegerParameter(pAdapter, &STRRSNPreAuthTimeout, + RSN_PREAUTH_TIMEOUT_DEF, RSN_PREAUTH_TIMEOUT_MIN, + RSN_PREAUTH_TIMEOUT_MAX, + sizeof p->rsnInitParams.preAuthTimeout, + (TI_UINT8*)&p->rsnInitParams.preAuthTimeout); + + regReadIntegerParameter(pAdapter, &STRPairwiseMicFailureFilter, + PAIRWISE_MIC_FAIL_FILTER_DEF, PAIRWISE_MIC_FAIL_FILTER_MIN, + PAIRWISE_MIC_FAIL_FILTER_MAX, + sizeof p->rsnInitParams.bPairwiseMicFailureFilter, + (TI_UINT8*)&p->rsnInitParams.bPairwiseMicFailureFilter); + + regReadWepKeyParameter(pAdapter, (TI_UINT8*)p->rsnInitParams.keys, p->rsnInitParams.defaultKeyId); + + regReadIntegerParameter(pAdapter, &STRRSNExternalMode, + RSN_EXTERNAL_MODE_ENABLE_DEF, RSN_EXTERNAL_MODE_ENABLE_MIN, + RSN_EXTERNAL_MODE_ENABLE_MAX, + sizeof p->rsnInitParams.bRsnExternalMode, + (TI_UINT8*)&p->rsnInitParams.bRsnExternalMode); + + + /*--------------------------- + QOS parameters + -----------------------------*/ + + regReadIntegerParameter(pAdapter, &STRClsfr_Type, + CLSFR_TYPE_DEF, CLSFR_TYPE_MIN, + CLSFR_TYPE_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.eClsfrType, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.eClsfrType); + + switch(p->txDataInitParams.ClsfrInitParam.eClsfrType) + { + case D_TAG_CLSFR: + /* Trivial mapping D-tag to D-tag - no need to read more keys*/ + break; + + case DSCP_CLSFR: + + regReadIntegerParameter(pAdapter, &STRNumOfCodePoints, + NUM_OF_CODE_POINTS_DEF, NUM_OF_CODE_POINTS_MIN, + NUM_OF_CODE_POINTS_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.uNumActiveEntries, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.uNumActiveEntries); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier00_CodePoint, + DSCP_CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier01_CodePoint, + DSCP_CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier02_CodePoint, + DSCP_CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier03_CodePoint, + DSCP_CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier04_CodePoint, + DSCP_CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier05_CodePoint, + DSCP_CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier06_CodePoint, + DSCP_CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier07_CodePoint, + DSCP_CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier08_CodePoint, + CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier09_CodePoint, + CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier10_CodePoint, + CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier11_CodePoint, + CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier12_CodePoint, + CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier13_CodePoint, + CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier14_CodePoint, + CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier15_CodePoint, + CLASSIFIER_CODE_POINT_DEF, CLASSIFIER_CODE_POINT_MIN, + CLASSIFIER_CODE_POINT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].Dscp.CodePoint, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].Dscp.CodePoint); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier00_DTag, + DSCP_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier01_DTag, + DSCP_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier02_DTag, + DSCP_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier03_DTag, + DSCP_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier04_DTag, + DSCP_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier05_DTag, + DSCP_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier06_DTag, + DSCP_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier07_DTag, + DSCP_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier08_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier09_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier10_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier11_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier12_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier13_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier14_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].DTag); + regReadIntegerParameter(pAdapter, &STRDSCPClassifier15_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].DTag); + + + break; + + case PORT_CLSFR: + + regReadIntegerParameter(pAdapter, &STRNumOfDstPortClassifiers, + NUM_OF_PORT_CLASSIFIERS_DEF, NUM_OF_PORT_CLASSIFIERS_MIN, + NUM_OF_PORT_CLASSIFIERS_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.uNumActiveEntries, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.uNumActiveEntries); + regReadIntegerParameter(pAdapter, &STRPortClassifier00_Port, + PORT_CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier01_Port, + PORT_CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier02_Port, + PORT_CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier03_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier04_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier05_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier06_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier07_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier08_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier09_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier10_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier11_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier12_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier13_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier14_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier15_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].Dscp.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].Dscp.DstPortNum); + regReadIntegerParameter(pAdapter, &STRPortClassifier00_DTag, + PORT_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier01_DTag, + PORT_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier02_DTag, + PORT_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier03_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier04_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier05_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier06_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier07_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier08_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier09_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier10_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier11_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier12_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier13_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier14_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].DTag); + regReadIntegerParameter(pAdapter, &STRPortClassifier15_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].DTag); + + break; + + + case IPPORT_CLSFR: + + regReadIntegerParameter(pAdapter, &STRNumOfDstIPPortClassifiers, + NUM_OF_IPPORT_CLASSIFIERS_DEF, NUM_OF_IPPORT_CLASSIFIERS_MIN, + NUM_OF_IPPORT_CLASSIFIERS_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.uNumActiveEntries, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.uNumActiveEntries); + + regReadStringParameter(pAdapter, &STRIPPortClassifier00_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier01_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier02_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier03_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier04_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier05_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier06_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier07_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier08_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier09_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier10_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier11_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier12_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier13_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier14_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].Dscp.DstIPPort.DstIPAddress, 4); + + regReadStringParameter(pAdapter, &STRIPPortClassifier15_IPAddress, (TI_INT8*)(ClsfrIp), 11, (TI_UINT8*)ClsfrIpString, &ClsfrIpStringSize); + initValusFromRgstryString( (TI_INT8*)(ClsfrIpString), (TI_INT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].Dscp.DstIPPort.DstIPAddress, 4); + + regReadIntegerParameter(pAdapter, &STRIPPortClassifier00_Port, + IPPORT_CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier01_Port, + IPPORT_CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier02_Port, + IPPORT_CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier03_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier04_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier05_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier06_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier07_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier08_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier09_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier10_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier11_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier12_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier13_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier14_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier15_Port, + CLASSIFIER_PORT_DEF, CLASSIFIER_PORT_MIN, + CLASSIFIER_PORT_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].Dscp.DstIPPort.DstPortNum, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].Dscp.DstIPPort.DstPortNum); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier00_DTag, + IPPORT_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[0].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier01_DTag, + IPPORT_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[1].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier02_DTag, + IPPORT_CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[2].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier03_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[3].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier04_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[4].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier05_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[5].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier06_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[6].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier07_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[7].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier08_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[8].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier09_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[9].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier10_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[10].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier11_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[11].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier12_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[12].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier13_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[13].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier14_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[14].DTag); + regReadIntegerParameter(pAdapter, &STRIPPortClassifier15_DTag, + CLASSIFIER_DTAG_DEF, CLASSIFIER_DTAG_MIN, + CLASSIFIER_DTAG_MAX, + sizeof p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].DTag, + (TI_UINT8*)&p->txDataInitParams.ClsfrInitParam.ClsfrTable[15].DTag); + + break; + + } + + + + /* --------------------------- + + Traffic Intensity Threshold + + ---------------------------*/ + regReadIntegerParameter(pAdapter, &STRTrafficIntensityThresHigh, + CTRL_DATA_TRAFFIC_THRESHOLD_HIGH_DEF, + CTRL_DATA_TRAFFIC_THRESHOLD_HIGH_MIN, + CTRL_DATA_TRAFFIC_THRESHOLD_HIGH_MAX, + sizeof p->ctrlDataInitParams.ctrlDataTrafficThreshold.uHighThreshold, + (TI_UINT8*)&p->ctrlDataInitParams.ctrlDataTrafficThreshold.uHighThreshold); + + regReadIntegerParameter(pAdapter, &STRTrafficIntensityThresLow, + CTRL_DATA_TRAFFIC_THRESHOLD_LOW_DEF, + CTRL_DATA_TRAFFIC_THRESHOLD_LOW_MIN, + CTRL_DATA_TRAFFIC_THRESHOLD_LOW_MAX, + sizeof p->ctrlDataInitParams.ctrlDataTrafficThreshold.uLowThreshold, + (TI_UINT8*)&p->ctrlDataInitParams.ctrlDataTrafficThreshold.uLowThreshold); + + regReadIntegerParameter(pAdapter, &STRTrafficIntensityTestInterval, + CTRL_DATA_TRAFFIC_THRESHOLD_INTERVAL_DEF, + CTRL_DATA_TRAFFIC_THRESHOLD_INTERVAL_MIN, + CTRL_DATA_TRAFFIC_THRESHOLD_INTERVAL_MAX, + sizeof p->ctrlDataInitParams.ctrlDataTrafficThreshold.TestInterval, + (TI_UINT8*)&p->ctrlDataInitParams.ctrlDataTrafficThreshold.TestInterval); + + regReadIntegerParameter(pAdapter, &STRTrafficIntensityThresholdEnabled, + CTRL_DATA_TRAFFIC_THRESHOLD_ENABLED_DEF, + CTRL_DATA_TRAFFIC_THRESHOLD_ENABLED_MIN, + CTRL_DATA_TRAFFIC_THRESHOLD_ENABLED_MAX, + sizeof p->ctrlDataInitParams.ctrlDataTrafficThresholdEnabled, + (TI_UINT8*)&p->ctrlDataInitParams.ctrlDataTrafficThresholdEnabled); + + regReadIntegerParameter(pAdapter, &STRTrafficMonitorMinIntervalPercentage, + TRAFFIC_MONITOR_MIN_INTERVAL_PERCENT_DEF, + TRAFFIC_MONITOR_MIN_INTERVAL_PERCENT_MIN, + TRAFFIC_MONITOR_MIN_INTERVAL_PERCENT_MAX, + sizeof p->trafficMonitorMinIntervalPercentage, + (TI_UINT8*)&p->trafficMonitorMinIntervalPercentage); + + regReadIntegerParameter(pAdapter, &STRWMEEnable, + WME_ENABLED_DEF, WME_ENABLED_MIN, + WME_ENABLED_MAX, + sizeof p->qosMngrInitParams.wmeEnable, + (TI_UINT8*)&p->qosMngrInitParams.wmeEnable); + + regReadIntegerParameter(pAdapter, &STRTrafficAdmCtrlEnable, + QOS_TRAFFIC_ADM_CTRL_ENABLED_DEF, QOS_TRAFFIC_ADM_CTRL_ENABLED_MIN, + QOS_TRAFFIC_ADM_CTRL_ENABLED_MAX, + sizeof p->qosMngrInitParams.trafficAdmCtrlEnable, + (TI_UINT8*)&p->qosMngrInitParams.trafficAdmCtrlEnable); + + regReadIntegerParameter(pAdapter, &STRdesiredPsMode, + QOS_DESIRED_PS_MODE_DEF, QOS_DESIRED_PS_MODE_MIN, + QOS_DESIRED_PS_MODE_MAX, + sizeof p->qosMngrInitParams.desiredPsMode, + (TI_UINT8*)&p->qosMngrInitParams.desiredPsMode); + + regReadIntegerParameter(pAdapter, &STRQOSmsduLifeTimeBE, + QOS_MSDU_LIFE_TIME_BE_DEF, QOS_MSDU_LIFE_TIME_BE_MIN, + QOS_MSDU_LIFE_TIME_BE_MAX, + sizeof p->qosMngrInitParams.MsduLifeTime[QOS_AC_BE], + (TI_UINT8*)&p->qosMngrInitParams.MsduLifeTime[QOS_AC_BE]); + + regReadIntegerParameter(pAdapter, &STRQOSmsduLifeTimeBK, + QOS_MSDU_LIFE_TIME_BK_DEF, QOS_MSDU_LIFE_TIME_BK_MIN, + QOS_MSDU_LIFE_TIME_BK_MAX, + sizeof p->qosMngrInitParams.MsduLifeTime[QOS_AC_BK], + (TI_UINT8*)&p->qosMngrInitParams.MsduLifeTime[QOS_AC_BK]); + + regReadIntegerParameter(pAdapter, &STRQOSmsduLifeTimeVI, + QOS_MSDU_LIFE_TIME_VI_DEF, QOS_MSDU_LIFE_TIME_VI_MIN, + QOS_MSDU_LIFE_TIME_VI_MAX, + sizeof p->qosMngrInitParams.MsduLifeTime[QOS_AC_VI], + (TI_UINT8*)&p->qosMngrInitParams.MsduLifeTime[QOS_AC_VI]); + + regReadIntegerParameter(pAdapter, &STRQOSmsduLifeTimeVO, + QOS_MSDU_LIFE_TIME_VO_DEF, QOS_MSDU_LIFE_TIME_VO_MIN, + QOS_MSDU_LIFE_TIME_VO_MAX, + sizeof p->qosMngrInitParams.MsduLifeTime[QOS_AC_VO], + (TI_UINT8*)&p->qosMngrInitParams.MsduLifeTime[QOS_AC_VO]); + + + regReadIntegerParameter(pAdapter, &STRQOSrxTimeOutPsPoll, + QOS_RX_TIMEOUT_PS_POLL_DEF, QOS_RX_TIMEOUT_PS_POLL_MIN, + QOS_RX_TIMEOUT_PS_POLL_MAX, + sizeof p->twdInitParams.tGeneral.rxTimeOut.psPoll, + (TI_UINT8*)&p->twdInitParams.tGeneral.rxTimeOut.psPoll); + + regReadIntegerParameter(pAdapter, &STRQOSrxTimeOutUPSD, + QOS_RX_TIMEOUT_UPSD_DEF, QOS_RX_TIMEOUT_UPSD_MIN, + QOS_RX_TIMEOUT_UPSD_MAX, + sizeof p->twdInitParams.tGeneral.rxTimeOut.UPSD, + (TI_UINT8*)&p->twdInitParams.tGeneral.rxTimeOut.UPSD); + + /* Note: The PsPoll wait timeout should be aligned with the UPSD setting */ + /* p->PowerMgrInitParams.HwPsPollResponseTimeout = (TI_UINT8)p->qosMngrInitParams.rxTimeout.UPSD;*/ + + regReadIntegerParameter(pAdapter, &STRQOSwmePsModeBE, + QOS_WME_PS_MODE_BE_DEF, QOS_WME_PS_MODE_BE_MIN, + QOS_WME_PS_MODE_BE_MAX, + sizeof p->qosMngrInitParams.desiredWmeAcPsMode[QOS_AC_BE], + (TI_UINT8*)&p->qosMngrInitParams.desiredWmeAcPsMode[QOS_AC_BE]); + + regReadIntegerParameter(pAdapter, &STRQOSwmePsModeBK, + QOS_WME_PS_MODE_BK_DEF, QOS_WME_PS_MODE_BK_MIN, + QOS_WME_PS_MODE_BK_MAX, + sizeof p->qosMngrInitParams.desiredWmeAcPsMode[QOS_AC_BK], + (TI_UINT8*)&p->qosMngrInitParams.desiredWmeAcPsMode[QOS_AC_BK]); + + regReadIntegerParameter(pAdapter, &STRQOSwmePsModeVI, + QOS_WME_PS_MODE_VI_DEF, QOS_WME_PS_MODE_VI_MIN, + QOS_WME_PS_MODE_VI_MAX, + sizeof p->qosMngrInitParams.desiredWmeAcPsMode[QOS_AC_VI], + (TI_UINT8*)&p->qosMngrInitParams.desiredWmeAcPsMode[QOS_AC_VI]); + + regReadIntegerParameter(pAdapter, &STRQOSwmePsModeVO, + QOS_WME_PS_MODE_VO_DEF, QOS_WME_PS_MODE_VO_MIN, + QOS_WME_PS_MODE_VO_MAX, + sizeof p->qosMngrInitParams.desiredWmeAcPsMode[QOS_AC_VO], + (TI_UINT8*)&p->qosMngrInitParams.desiredWmeAcPsMode[QOS_AC_VO]); + + + /* HW Tx queues buffers allocation low threshold */ + regReadIntegerParameter(pAdapter, &STRQOStxBlksThresholdBE, + QOS_TX_BLKS_THRESHOLD_BE_DEF, QOS_TX_BLKS_THRESHOLD_MIN, + QOS_TX_BLKS_THRESHOLD_MAX, + sizeof p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_BE], + (TI_UINT8*)&p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_BE]); + + regReadIntegerParameter(pAdapter, &STRQOStxBlksThresholdBK, + QOS_TX_BLKS_THRESHOLD_BK_DEF, QOS_TX_BLKS_THRESHOLD_MIN, + QOS_TX_BLKS_THRESHOLD_MAX, + sizeof p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_BK], + (TI_UINT8*)&p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_BK]); + + regReadIntegerParameter(pAdapter, &STRQOStxBlksThresholdVI, + QOS_TX_BLKS_THRESHOLD_VI_DEF, QOS_TX_BLKS_THRESHOLD_MIN, + QOS_TX_BLKS_THRESHOLD_MAX, + sizeof p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_VI], + (TI_UINT8*)&p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_VI]); + + regReadIntegerParameter(pAdapter, &STRQOStxBlksThresholdVO, + QOS_TX_BLKS_THRESHOLD_VO_DEF, QOS_TX_BLKS_THRESHOLD_MIN, + QOS_TX_BLKS_THRESHOLD_MAX, + sizeof p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_VO], + (TI_UINT8*)&p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_VO]); + + regReadIntegerParameter(pAdapter, &STRWiFiMode, + WIFI_MODE_DEF, WIFI_MODE_MIN, + WIFI_MODE_MAX, + sizeof uWiFiMode, + (TI_UINT8*)&uWiFiMode); + if (uWiFiMode) + { + /* special numbers for WiFi mode */ + p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_BE] = QOS_TX_BLKS_THRESHOLD_BE_DEF_WIFI_MODE; + p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_BK] = QOS_TX_BLKS_THRESHOLD_BK_DEF_WIFI_MODE; + p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_VI] = QOS_TX_BLKS_THRESHOLD_VI_DEF_WIFI_MODE; + p->twdInitParams.tGeneral.TxBlocksThresholdPerAc[QOS_AC_VO] = QOS_TX_BLKS_THRESHOLD_VO_DEF_WIFI_MODE; + + p->qosMngrInitParams.MsduLifeTime[QOS_AC_BE] = QOS_MSDU_LIFE_TIME_BE_DEF_WIFI_MODE; + p->qosMngrInitParams.MsduLifeTime[QOS_AC_BK] = QOS_MSDU_LIFE_TIME_BK_DEF_WIFI_MODE; + p->qosMngrInitParams.MsduLifeTime[QOS_AC_VI] = QOS_MSDU_LIFE_TIME_VI_DEF_WIFI_MODE; + p->qosMngrInitParams.MsduLifeTime[QOS_AC_VO] = QOS_MSDU_LIFE_TIME_VO_DEF_WIFI_MODE; + + p->twdInitParams.tGeneral.RxIntrPacingThreshold = TWD_RX_INTR_THRESHOLD_DEF_WIFI_MODE; + } + + regReadIntegerParameter(pAdapter, &STRQOSShortRetryLimitBE, + QOS_SHORT_RETRY_LIMIT_BE_DEF, QOS_SHORT_RETRY_LIMIT_BE_MIN, + QOS_SHORT_RETRY_LIMIT_BE_MAX, + sizeof p->qosMngrInitParams.ShortRetryLimit[QOS_AC_BE], + (TI_UINT8*)&p->qosMngrInitParams.ShortRetryLimit[QOS_AC_BE]); + + regReadIntegerParameter(pAdapter, &STRQOSShortRetryLimitBK, + QOS_SHORT_RETRY_LIMIT_BK_DEF, QOS_SHORT_RETRY_LIMIT_BK_MIN, + QOS_SHORT_RETRY_LIMIT_BK_MAX, + sizeof p->qosMngrInitParams.ShortRetryLimit[QOS_AC_BK], + (TI_UINT8*)&p->qosMngrInitParams.ShortRetryLimit[QOS_AC_BK]); + + regReadIntegerParameter(pAdapter, &STRQOSShortRetryLimitVI, + QOS_SHORT_RETRY_LIMIT_VI_DEF, QOS_SHORT_RETRY_LIMIT_VI_MIN, + QOS_SHORT_RETRY_LIMIT_VI_MAX, + sizeof p->qosMngrInitParams.ShortRetryLimit[QOS_AC_VI], + (TI_UINT8*)&p->qosMngrInitParams.ShortRetryLimit[QOS_AC_VI]); + + regReadIntegerParameter(pAdapter, &STRQOSShortRetryLimitVO, + QOS_SHORT_RETRY_LIMIT_VO_DEF, QOS_SHORT_RETRY_LIMIT_VO_MIN, + QOS_SHORT_RETRY_LIMIT_VO_MAX, + sizeof p->qosMngrInitParams.ShortRetryLimit[QOS_AC_VO], + (TI_UINT8*)&p->qosMngrInitParams.ShortRetryLimit[QOS_AC_VO]); + + regReadIntegerParameter(pAdapter, &STRQOSLongRetryLimitBE, + QOS_LONG_RETRY_LIMIT_BE_DEF, QOS_LONG_RETRY_LIMIT_BE_MIN, + QOS_LONG_RETRY_LIMIT_BE_MAX, + sizeof p->qosMngrInitParams.LongRetryLimit[QOS_AC_BE], + (TI_UINT8*)&p->qosMngrInitParams.LongRetryLimit[QOS_AC_BE]); + + regReadIntegerParameter(pAdapter, &STRQOSLongRetryLimitBK, + QOS_LONG_RETRY_LIMIT_BK_DEF, QOS_LONG_RETRY_LIMIT_BK_MIN, + QOS_LONG_RETRY_LIMIT_BK_MAX, + sizeof p->qosMngrInitParams.LongRetryLimit[QOS_AC_BK], + (TI_UINT8*)&p->qosMngrInitParams.LongRetryLimit[QOS_AC_BK]); + + regReadIntegerParameter(pAdapter, &STRQOSLongRetryLimitVI, + QOS_LONG_RETRY_LIMIT_VI_DEF, QOS_LONG_RETRY_LIMIT_VI_MIN, + QOS_LONG_RETRY_LIMIT_VI_MAX, + sizeof p->qosMngrInitParams.LongRetryLimit[QOS_AC_VI], + (TI_UINT8*)&p->qosMngrInitParams.LongRetryLimit[QOS_AC_VI]); + + regReadIntegerParameter(pAdapter, &STRQOSLongRetryLimitVO, + QOS_LONG_RETRY_LIMIT_VO_DEF, QOS_LONG_RETRY_LIMIT_VO_MIN, + QOS_LONG_RETRY_LIMIT_VO_MAX, + sizeof p->qosMngrInitParams.LongRetryLimit[QOS_AC_VO], + (TI_UINT8*)&p->qosMngrInitParams.LongRetryLimit[QOS_AC_VO]); + + regReadIntegerParameter(pAdapter, &STRQOSAckPolicyBE, + QOS_ACK_POLICY_BE_DEF, QOS_ACK_POLICY_BE_MIN, + QOS_ACK_POLICY_BE_MAX, + sizeof p->qosMngrInitParams.acAckPolicy[QOS_AC_BE], + (TI_UINT8*)&p->qosMngrInitParams.acAckPolicy[QOS_AC_BE]); + + regReadIntegerParameter(pAdapter, &STRQOSAckPolicyBK, + QOS_ACK_POLICY_BK_DEF, QOS_ACK_POLICY_BK_MIN, + QOS_ACK_POLICY_BK_MAX, + sizeof p->qosMngrInitParams.acAckPolicy[QOS_AC_BK], + (TI_UINT8*)&p->qosMngrInitParams.acAckPolicy[QOS_AC_BK]); + + regReadIntegerParameter(pAdapter, &STRQOSAckPolicyVI, + QOS_ACK_POLICY_VI_DEF, QOS_ACK_POLICY_VI_MIN, + QOS_ACK_POLICY_VI_MAX, + sizeof p->qosMngrInitParams.acAckPolicy[QOS_AC_VI], + (TI_UINT8*)&p->qosMngrInitParams.acAckPolicy[QOS_AC_VI]); + + regReadIntegerParameter(pAdapter, &STRQOSAckPolicyVO, + QOS_ACK_POLICY_VO_DEF, QOS_ACK_POLICY_VO_MIN, + QOS_ACK_POLICY_VO_MAX, + sizeof p->qosMngrInitParams.acAckPolicy[QOS_AC_VO], + (TI_UINT8*)&p->qosMngrInitParams.acAckPolicy[QOS_AC_VO]); + + + regReadIntegerParameter(pAdapter, &STRQoSqueue0OverFlowPolicy, + QOS_QUEUE_0_OVFLOW_POLICY_DEF, QOS_QUEUE_0_OVFLOW_POLICY_MIN, + QOS_QUEUE_0_OVFLOW_POLICY_MAX, + sizeof p->qosMngrInitParams.QueueOvFlowPolicy[0], + (TI_UINT8*)&p->qosMngrInitParams.QueueOvFlowPolicy[0]); + + regReadIntegerParameter(pAdapter, &STRQoSqueue1OverFlowPolicy, + QOS_QUEUE_1_OVFLOW_POLICY_DEF, QOS_QUEUE_1_OVFLOW_POLICY_MIN, + QOS_QUEUE_1_OVFLOW_POLICY_MAX, + sizeof p->qosMngrInitParams.QueueOvFlowPolicy[1], + (TI_UINT8*)&p->qosMngrInitParams.QueueOvFlowPolicy[1]); + + regReadIntegerParameter(pAdapter, &STRQoSqueue2OverFlowPolicy, + QOS_QUEUE_2_OVFLOW_POLICY_DEF, QOS_QUEUE_2_OVFLOW_POLICY_MIN, + QOS_QUEUE_2_OVFLOW_POLICY_MAX, + sizeof p->qosMngrInitParams.QueueOvFlowPolicy[2], + (TI_UINT8*)&p->qosMngrInitParams.QueueOvFlowPolicy[2]); + + regReadIntegerParameter(pAdapter, &STRQoSqueue3OverFlowPolicy, + QOS_QUEUE_3_OVFLOW_POLICY_DEF, QOS_QUEUE_3_OVFLOW_POLICY_MIN, + QOS_QUEUE_3_OVFLOW_POLICY_MAX, + sizeof p->qosMngrInitParams.QueueOvFlowPolicy[3], + (TI_UINT8*)&p->qosMngrInitParams.QueueOvFlowPolicy[3]); + + /* Packet Burst parameters */ + + regReadIntegerParameter(pAdapter, &STRQOSPacketBurstEnable, + QOS_PACKET_BURST_ENABLE_DEF, QOS_PACKET_BURST_ENABLE_MIN, + QOS_PACKET_BURST_ENABLE_MAX, + sizeof p->qosMngrInitParams.PacketBurstEnable, + (TI_UINT8*)&p->qosMngrInitParams.PacketBurstEnable); + PRINTF(DBG_REGISTRY,( "STRQOSPacketBurstEnable = %d\n", p->qosMngrInitParams.PacketBurstEnable)); + regReadIntegerParameter(pAdapter, &STRQOSPacketBurstTxOpLimit, + QOS_PACKET_BURST_TXOP_LIMIT_DEF, QOS_PACKET_BURST_TXOP_LIMIT_MIN, + QOS_PACKET_BURST_TXOP_LIMIT_MAX, + sizeof p->qosMngrInitParams.PacketBurstTxOpLimit, + (TI_UINT8*)&p->qosMngrInitParams.PacketBurstTxOpLimit); + + + + /*--------------------------- + Measurement parameters + -----------------------------*/ + + regReadIntegerParameter(pAdapter, &STRMeasurTrafficThreshold, + MEASUREMENT_TRAFFIC_THRSHLD_DEF, MEASUREMENT_TRAFFIC_THRSHLD_MIN, MEASUREMENT_TRAFFIC_THRSHLD_MAX, + sizeof p->measurementInitParams.trafficIntensityThreshold, + (TI_UINT8*)&p->measurementInitParams.trafficIntensityThreshold); + + regReadIntegerParameter(pAdapter, &STRMeasurMaxDurationOnNonServingChannel, + MEASUREMENT_MAX_DUR_NON_SRV_CHANNEL_DEF, MEASUREMENT_MAX_DUR_NON_SRV_CHANNEL_MIN, MEASUREMENT_MAX_DUR_NON_SRV_CHANNEL_MAX, + sizeof p->measurementInitParams.maxDurationOnNonServingChannel, + (TI_UINT8*)&p->measurementInitParams.maxDurationOnNonServingChannel); + + + /*--------------------------- + XCC Manager parameters + -----------------------------*/ +#ifdef XCC_MODULE_INCLUDED + + regReadIntegerParameter(pAdapter, &STRXCCModeEnabled, + XCC_MNGR_ENABLE_DEF, XCC_MNGR_ENABLE_MIN, XCC_MNGR_ENABLE_MAX, + sizeof p->XCCMngrParams.XCCEnabled, + (TI_UINT8*)&p->XCCMngrParams.XCCEnabled); + + + p->measurementInitParams.XCCEnabled = p->XCCMngrParams.XCCEnabled; + +#endif + + regReadIntegerParameter(pAdapter, &STRXCCTestIgnoreDeAuth0, + XCC_TEST_IGNORE_DEAUTH_0_DEF, XCC_TEST_IGNORE_DEAUTH_0_MIN, XCC_TEST_IGNORE_DEAUTH_0_MAX, + sizeof p->apConnParams.ignoreDeauthReason0, + (TI_UINT8*)&p->apConnParams.ignoreDeauthReason0); + + /*--------------------------- + EEPROM less support + -----------------------------*/ + regReadIntegerParameter(pAdapter, &STREEPROMlessModeSupported, + TWD_EEPROMLESS_ENABLE_DEF, TWD_EEPROMLESS_ENABLE_MIN, + TWD_EEPROMLESS_ENABLE_MAX, + sizeof p->twdInitParams.tGeneral.halCtrlEepromLessEnable, + (TI_UINT8*)&p->twdInitParams.tGeneral.halCtrlEepromLessEnable); + + regReadStringParameter(pAdapter, &STRstationMacAddress, + (TI_INT8*)(defStaMacAddress0), 11, + (TI_UINT8*)staMACAddress, ®MACstrLen); + + /*reads the arp ip from table*/ + regReadStringParameter(pAdapter ,&STRArp_Ip_Addr, + (TI_INT8*)(defArpIpAddress),REG_ARP_IP_ADDR_STR_LEN, + (TI_UINT8*)staArpIpAddress,®ArpIpStrLen ) ; + + regReadIntegerParameter(pAdapter, &STRArp_Ip_Filter_Ena, + DEF_FILTER_ENABLE_VALUE, MIN_FILTER_ENABLE_VALUE, MAX_FILTER_ENABLE_VALUE, + sizeof p->twdInitParams.tArpIpFilter.isFilterEnabled, + (TI_UINT8*)&p->twdInitParams.tArpIpFilter.isFilterEnabled); + + + initValusFromRgstryString( (TI_INT8*)(staArpIpAddress), (TI_INT8*)&p->twdInitParams.tArpIpFilter.addr, 4); + + + initValusFromRgstryString( (TI_INT8*)(staMACAddress), + (TI_INT8*)&(p->twdInitParams.tGeneral.StaMacAddress[0]), + 6); +/*fource FragThreshold to be even value (round it down)MR WLAN00003501*/ + p->twdInitParams.tGeneral.halCtrlFragThreshold &= 0xFFFE; + + + + + +/*---------------------------------- + Health Monitor registry init +------------------------------------*/ + + /* No scan complete recovery enabled */ + regReadIntegerParameter(pAdapter, &STRRecoveryEnabledNoScanComplete, + 1, 0, 1, /* default is enabled */ + sizeof (p->healthMonitorInitParams.recoveryTriggerEnabled[ NO_SCAN_COMPLETE_FAILURE ]), + (TI_UINT8*)&(p->healthMonitorInitParams.recoveryTriggerEnabled[ NO_SCAN_COMPLETE_FAILURE ]) ); + + /* Mailbox failure recovery enabled */ + regReadIntegerParameter(pAdapter, &STRRecoveryEnabledMboxFailure, + 1, 0, 1, /* default is enabled */ + sizeof (p->healthMonitorInitParams.recoveryTriggerEnabled[ MBOX_FAILURE ]), + (TI_UINT8*)&(p->healthMonitorInitParams.recoveryTriggerEnabled[ MBOX_FAILURE ]) ); + + /* HW awake failure recovery enabled */ + regReadIntegerParameter(pAdapter, &STRRecoveryEnabledHwAwakeFailure, + 1, 0, 1, /* default is enabled */ + sizeof (p->healthMonitorInitParams.recoveryTriggerEnabled[ HW_AWAKE_FAILURE ]), + (TI_UINT8*)&(p->healthMonitorInitParams.recoveryTriggerEnabled[ HW_AWAKE_FAILURE ]) ); + + /* TX stuck recovery enabled */ + regReadIntegerParameter(pAdapter, &STRRecoveryEnabledTxStuck, + 1, 0, 1, /* default is enabled */ + sizeof (p->healthMonitorInitParams.recoveryTriggerEnabled[ TX_STUCK ]), + (TI_UINT8*)&(p->healthMonitorInitParams.recoveryTriggerEnabled[ TX_STUCK ]) ); + + /* disconnect timeout recovery enabled */ + regReadIntegerParameter(pAdapter, &STRRecoveryEnabledDisconnectTimeout, + 0, 0, 1, /* default is disabled */ + sizeof (p->healthMonitorInitParams.recoveryTriggerEnabled[ DISCONNECT_TIMEOUT ]), + (TI_UINT8*)&(p->healthMonitorInitParams.recoveryTriggerEnabled[ DISCONNECT_TIMEOUT ]) ); + + /* Power save failure recovery enabled */ + regReadIntegerParameter(pAdapter, &STRRecoveryEnabledPowerSaveFailure, + 1, 0, 1, /* default is enabled */ + sizeof (p->healthMonitorInitParams.recoveryTriggerEnabled[ POWER_SAVE_FAILURE ]), + (TI_UINT8*)&(p->healthMonitorInitParams.recoveryTriggerEnabled[ POWER_SAVE_FAILURE ]) ); + + /* Measurement failure recovery enabled */ + regReadIntegerParameter(pAdapter, &STRRecoveryEnabledMeasurementFailure, + 1, 0, 1, /* default is enabled */ + sizeof (p->healthMonitorInitParams.recoveryTriggerEnabled[ MEASUREMENT_FAILURE ]), + (TI_UINT8*)&(p->healthMonitorInitParams.recoveryTriggerEnabled[ MEASUREMENT_FAILURE ]) ); + + /* Bus failure recovery enabled */ + regReadIntegerParameter(pAdapter, &STRRecoveryEnabledBusFailure, + 1, 0, 1, /* default is enabled */ + sizeof (p->healthMonitorInitParams.recoveryTriggerEnabled[ BUS_FAILURE ]), + (TI_UINT8*)&(p->healthMonitorInitParams.recoveryTriggerEnabled[ BUS_FAILURE ]) ); + + /* HW Watchdog Expired recovery enabled */ + regReadIntegerParameter(pAdapter, &STRRecoveryEnabledHwWdExpire, + 1, 0, 1, /* default is enabled */ + sizeof (p->healthMonitorInitParams.recoveryTriggerEnabled[ HW_WD_EXPIRE ]), + (TI_UINT8*)&(p->healthMonitorInitParams.recoveryTriggerEnabled[ HW_WD_EXPIRE ]) ); + + /* Rx Xfer Failure recovery enabled */ + regReadIntegerParameter(pAdapter, &STRRecoveryEnabledRxXferFailure, + 1, 0, 1, /* default is enabled */ + sizeof (p->healthMonitorInitParams.recoveryTriggerEnabled[ RX_XFER_FAILURE ]), + (TI_UINT8*)&(p->healthMonitorInitParams.recoveryTriggerEnabled[ RX_XFER_FAILURE ]) ); + +/*------------------------------------------- + RSSI/SNR Weights for Average calculations +--------------------------------------------*/ + regReadIntegerParameter(pAdapter, &STRRssiBeaconAverageWeight, + TWD_RSSI_BEACON_WEIGHT_DEF, TWD_RSSI_BEACON_WEIGHT_MIN, + TWD_RSSI_BEACON_WEIGHT_MAX, + sizeof p->twdInitParams.tGeneral.uRssiBeaconAverageWeight, + (TI_UINT8*)&p->twdInitParams.tGeneral.uRssiBeaconAverageWeight); + + regReadIntegerParameter(pAdapter, &STRRssiPacketAverageWeight, + TWD_RSSI_PACKET_WEIGHT_DEF, TWD_RSSI_PACKET_WEIGHT_MIN, + TWD_RSSI_PACKET_WEIGHT_MAX, + sizeof p->twdInitParams.tGeneral.uRssiPacketAverageWeight, + (TI_UINT8*)&p->twdInitParams.tGeneral.uRssiPacketAverageWeight); + + regReadIntegerParameter(pAdapter, &STRSnrBeaconAverageWeight, + TWD_SNR_BEACON_WEIGHT_DEF, TWD_SNR_BEACON_WEIGHT_MIN, + TWD_SNR_BEACON_WEIGHT_MAX, + sizeof p->twdInitParams.tGeneral.uSnrBeaconAverageWeight, + (TI_UINT8*)&p->twdInitParams.tGeneral.uSnrBeaconAverageWeight); + + regReadIntegerParameter(pAdapter, &STRSnrPacketAverageWeight, + TWD_SNR_PACKET_WEIGHT_DEF, TWD_SNR_PACKET_WEIGHT_MIN, + TWD_SNR_PACKET_WEIGHT_MAX, + sizeof p->twdInitParams.tGeneral.uSnrPacketAverageWeight, + (TI_UINT8*)&p->twdInitParams.tGeneral.uSnrPacketAverageWeight); + +/*---------------------------------- + TX power adjust +------------------------------------*/ + + regReadIntegerParameter(pAdapter, &STRTxPowerCheckTime, + 1, 1, 1200, /* in units of 5000 ms */ + sizeof p->siteMgrInitParams.TxPowerCheckTime, + (TI_UINT8*)&p->siteMgrInitParams.TxPowerCheckTime); + + + regReadIntegerParameter(pAdapter, &STRTxPowerControlOn, + 1, 0, 1, /* on/off (1/0) default is on */ + sizeof p->siteMgrInitParams.TxPowerControlOn, + (TI_UINT8*)&p->siteMgrInitParams.TxPowerControlOn); + + regReadIntegerParameter(pAdapter, &STRTxPowerRssiThresh, + 38, 0, 200, /* the value is positive and will be translated by driver */ + sizeof p->siteMgrInitParams.TxPowerRssiThresh, + (TI_UINT8*)&p->siteMgrInitParams.TxPowerRssiThresh); + + regReadIntegerParameter(pAdapter, &STRTxPowerRssiRestoreThresh, + 45, 0, 200, /* the value is positive and will be translated by driver */ + sizeof p->siteMgrInitParams.TxPowerRssiRestoreThresh, + (TI_UINT8*)&p->siteMgrInitParams.TxPowerRssiRestoreThresh); + + regReadIntegerParameter(pAdapter, &STRTxPowerTempRecover, + MIN_TX_POWER, MIN_TX_POWER, MAX_TX_POWER, + sizeof p->regulatoryDomainInitParams.uTemporaryTxPower, + (TI_UINT8*)&p->regulatoryDomainInitParams.uTemporaryTxPower); + +/*---------------------------------- + end of TX power adjust +------------------------------------*/ + +/*---------------------------------- + Scan Concentrator +------------------------------------*/ + regReadIntegerParameter (pAdapter, &STRMinimumDurationBetweenOsScans, + SCAN_CNCN_MIN_DURATION_FOR_OS_SCANS_DEF, SCAN_CNCN_MIN_DURATION_FOR_OS_SCANS_MIN, SCAN_CNCN_MIN_DURATION_FOR_OS_SCANS_MAX, + sizeof p->tScanCncnInitParams.uMinimumDurationBetweenOsScans, + (TI_UINT8*)&p->tScanCncnInitParams.uMinimumDurationBetweenOsScans); + + regReadIntegerParameter (pAdapter, &STRDfsPassiveDwellTimeMs, + SCAN_CNCN_DFS_PASSIVE_DWELL_TIME_DEF, SCAN_CNCN_DFS_PASSIVE_DWELL_TIME_MIN, SCAN_CNCN_DFS_PASSIVE_DWELL_TIME_MAX, + sizeof p->tScanCncnInitParams.uDfsPassiveDwellTimeMs, + (TI_UINT8*)&p->tScanCncnInitParams.uDfsPassiveDwellTimeMs); + + regReadIntegerParameter (pAdapter, &STRScanPushMode, + SCAN_CNCN_APP_PUSH_MODE_DEF, SCAN_CNCN_APP_PUSH_MODE_MIN, SCAN_CNCN_APP_PUSH_MODE_MAX, + sizeof p->tScanCncnInitParams.bPushMode, + (TI_UINT8*)&p->tScanCncnInitParams.bPushMode); + +/*---------------------------------- + WSC +------------------------------------*/ + regReadIntegerParameter( pAdapter, &STRParseWSCInBeacons, + WSC_PARSE_IN_BEACON_DEF, WSC_PARSE_IN_BEACON_MIN, WSC_PARSE_IN_BEACON_MAX, + sizeof p->tMlmeInitParams.parseWSCInBeacons, + (TI_UINT8*)&p->tMlmeInitParams.parseWSCInBeacons ); + +/*---------------------------------- + Current BSS +------------------------------------*/ + regReadIntegerParameter( pAdapter, &STRNullDataKeepAliveDefaultPeriod, + NULL_KL_PERIOD_DEF, NULL_KL_PERIOD_MIN, NULL_KL_PERIOD_MAX, + sizeof p->tCurrBssInitParams.uNullDataKeepAlivePeriod, + (TI_UINT8*)&p->tCurrBssInitParams.uNullDataKeepAlivePeriod ); + +/*---------------------------------- + Context Engine +------------------------------------*/ + regReadIntegerParameter( pAdapter, &STRContextSwitchRequired, + CONTEXT_SWITCH_REQUIRED_DEF, CONTEXT_SWITCH_REQUIRED_MIN, CONTEXT_SWITCH_REQUIRED_MAX, + sizeof p->tContextInitParams.bContextSwitchRequired, + (TI_UINT8*)&p->tContextInitParams.bContextSwitchRequired ); + + /* + * set 802.11n init parameters + */ + regReadIntegerParameter(pAdapter, &STR11nEnable, + HT_11N_ENABLED_DEF, HT_11N_ENABLED_MIN, + HT_11N_ENABLED_MAX, + sizeof p->twdInitParams.tGeneral.b11nEnable, + (TI_UINT8*)&p->twdInitParams.tGeneral.b11nEnable); + + regReadIntegerParameter(pAdapter, &STRBaPolicyTid_0, + HT_BA_POLICY_DEF, HT_BA_POLICY_MIN, + HT_BA_POLICY_MAX, + sizeof p->qosMngrInitParams.aBaPolicy[0], + (TI_UINT8*)&p->qosMngrInitParams.aBaPolicy[0]); + + regReadIntegerParameter(pAdapter, &STRBaPolicyTid_1, + HT_BA_POLICY_DEF, HT_BA_POLICY_MIN, + HT_BA_POLICY_MAX, + sizeof p->qosMngrInitParams.aBaPolicy[1], + (TI_UINT8*)&p->qosMngrInitParams.aBaPolicy[1]); + + regReadIntegerParameter(pAdapter, &STRBaPolicyTid_2, + HT_BA_POLICY_DEF, HT_BA_POLICY_MIN, + HT_BA_POLICY_MAX, + sizeof p->qosMngrInitParams.aBaPolicy[2], + (TI_UINT8*)&p->qosMngrInitParams.aBaPolicy[2]); + + regReadIntegerParameter(pAdapter, &STRBaPolicyTid_3, + HT_BA_POLICY_DEF, HT_BA_POLICY_MIN, + HT_BA_POLICY_MAX, + sizeof p->qosMngrInitParams.aBaPolicy[3], + (TI_UINT8*)&p->qosMngrInitParams.aBaPolicy[3]); + + regReadIntegerParameter(pAdapter, &STRBaPolicyTid_4, + HT_BA_POLICY_DEF, HT_BA_POLICY_MIN, + HT_BA_POLICY_MAX, + sizeof p->qosMngrInitParams.aBaPolicy[4], + (TI_UINT8*)&p->qosMngrInitParams.aBaPolicy[4]); + + regReadIntegerParameter(pAdapter, &STRBaPolicyTid_5, + HT_BA_POLICY_DEF, HT_BA_POLICY_MIN, + HT_BA_POLICY_MAX, + sizeof p->qosMngrInitParams.aBaPolicy[5], + (TI_UINT8*)&p->qosMngrInitParams.aBaPolicy[5]); + + regReadIntegerParameter(pAdapter, &STRBaPolicyTid_6, + HT_BA_POLICY_DEF, HT_BA_POLICY_MIN, + HT_BA_POLICY_MAX, + sizeof p->qosMngrInitParams.aBaPolicy[6], + (TI_UINT8*)&p->qosMngrInitParams.aBaPolicy[6]); + + regReadIntegerParameter(pAdapter, &STRBaPolicyTid_7, + HT_BA_POLICY_DEF, HT_BA_POLICY_MIN, + HT_BA_POLICY_MAX, + sizeof p->qosMngrInitParams.aBaPolicy[7], + (TI_UINT8*)&p->qosMngrInitParams.aBaPolicy[7]); + + regReadIntegerParameter(pAdapter, &STRBaInactivityTimeoutTid_0, + HT_BA_INACTIVITY_TIMEOUT_DEF, HT_BA_INACTIVITY_TIMEOUT_MIN, + HT_BA_INACTIVITY_TIMEOUT_MAX, + sizeof p->qosMngrInitParams.aBaInactivityTimeout[0], + (TI_UINT8*)&p->qosMngrInitParams.aBaInactivityTimeout[0]); + + regReadIntegerParameter(pAdapter, &STRBaInactivityTimeoutTid_1, + HT_BA_INACTIVITY_TIMEOUT_DEF, HT_BA_INACTIVITY_TIMEOUT_MIN, + HT_BA_INACTIVITY_TIMEOUT_MAX, + sizeof p->qosMngrInitParams.aBaInactivityTimeout[1], + (TI_UINT8*)&p->qosMngrInitParams.aBaInactivityTimeout[1]); + + regReadIntegerParameter(pAdapter, &STRBaInactivityTimeoutTid_2, + HT_BA_INACTIVITY_TIMEOUT_DEF, HT_BA_INACTIVITY_TIMEOUT_MIN, + HT_BA_INACTIVITY_TIMEOUT_MAX, + sizeof p->qosMngrInitParams.aBaInactivityTimeout[2], + (TI_UINT8*)&p->qosMngrInitParams.aBaInactivityTimeout[2]); + + regReadIntegerParameter(pAdapter, &STRBaInactivityTimeoutTid_3, + HT_BA_INACTIVITY_TIMEOUT_DEF, HT_BA_INACTIVITY_TIMEOUT_MIN, + HT_BA_INACTIVITY_TIMEOUT_MAX, + sizeof p->qosMngrInitParams.aBaInactivityTimeout[3], + (TI_UINT8*)&p->qosMngrInitParams.aBaInactivityTimeout[3]); + + regReadIntegerParameter(pAdapter, &STRBaInactivityTimeoutTid_4, + HT_BA_INACTIVITY_TIMEOUT_DEF, HT_BA_INACTIVITY_TIMEOUT_MIN, + HT_BA_INACTIVITY_TIMEOUT_MAX, + sizeof p->qosMngrInitParams.aBaInactivityTimeout[4], + (TI_UINT8*)&p->qosMngrInitParams.aBaInactivityTimeout[4]); + + regReadIntegerParameter(pAdapter, &STRBaInactivityTimeoutTid_5, + HT_BA_INACTIVITY_TIMEOUT_DEF, HT_BA_INACTIVITY_TIMEOUT_MIN, + HT_BA_INACTIVITY_TIMEOUT_MAX, + sizeof p->qosMngrInitParams.aBaInactivityTimeout[5], + (TI_UINT8*)&p->qosMngrInitParams.aBaInactivityTimeout[5]); + + regReadIntegerParameter(pAdapter, &STRBaInactivityTimeoutTid_6, + HT_BA_INACTIVITY_TIMEOUT_DEF, HT_BA_INACTIVITY_TIMEOUT_MIN, + HT_BA_INACTIVITY_TIMEOUT_MAX, + sizeof p->qosMngrInitParams.aBaInactivityTimeout[6], + (TI_UINT8*)&p->qosMngrInitParams.aBaInactivityTimeout[6]); + + regReadIntegerParameter(pAdapter, &STRBaInactivityTimeoutTid_7, + HT_BA_INACTIVITY_TIMEOUT_DEF, HT_BA_INACTIVITY_TIMEOUT_MIN, + HT_BA_INACTIVITY_TIMEOUT_MAX, + sizeof p->qosMngrInitParams.aBaInactivityTimeout[7], + (TI_UINT8*)&p->qosMngrInitParams.aBaInactivityTimeout[7]); + +/*---------------------------------- + Radio module parameters +------------------------------------*/ +regReadIntegerParameter(pAdapter, &STRTxBiPReferencePower_2_4G, + 128, 0, 255, + sizeof (TI_INT8), + (TI_UINT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxBiPReferencePower_2_4G); + +regReadIntegerTable (pAdapter, &STRTxBiPReferencePower_5G, RADIO_TX_BIP_REF_POWER_DEF_TABLE_5G, + NUMBER_OF_SUB_BANDS_IN_5G_BAND_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxBiPReferencePower_5G, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8), TI_TRUE); + +regReadIntegerParameter(pAdapter, &STRTxBiPOffsetdB_2_4G, + 0,0,255, + sizeof (TI_UINT8), + (TI_UINT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxBiPOffsetdB_2_4G); + +regReadIntegerTable (pAdapter, &STRTxBiPOffsetdB_5G, RADIO_TX_BIP_OFF_BD_5G, + NUMBER_OF_SUB_BANDS_IN_5G_BAND_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxBiPOffsetdB_5G, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8), TI_TRUE); + +regReadIntegerTable (pAdapter, &STRTxPerRatePowerLimits_2_4G_Normal, RADIO_TX_PER_POWER_LIMITS_2_4_NORMAL_DEF_TABLE, + NUMBER_OF_RATE_GROUPS_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxPerRatePowerLimits_2_4G_Normal, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +regReadIntegerTable (pAdapter, &STRTxPerRatePowerLimits_2_4G_Degraded, RADIO_TX_PER_POWER_LIMITS_2_4_DEGRADED_DEF_TABLE, + NUMBER_OF_RATE_GROUPS_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxPerRatePowerLimits_2_4G_Degraded, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +regReadIntegerTable (pAdapter, &STRTxPerRatePowerLimits_5G_Normal, RADIO_TX_PER_POWER_LIMITS_5_NORMAL_DEF_TABLE, + NUMBER_OF_RATE_GROUPS_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxPerRatePowerLimits_5G_Normal, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +regReadIntegerTable (pAdapter, &STRTxPerRatePowerLimits_5G_Degraded, RADIO_TX_PER_POWER_LIMITS_5_DEGRADED_DEF_TABLE, + NUMBER_OF_RATE_GROUPS_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxPerRatePowerLimits_5G_Degraded, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +regReadIntegerTable (pAdapter, &STRTxPerChannelPowerLimits_2_4G_11b, RADIO_TX_PER_POWER_LIMITS_2_4_11B_DEF_TABLE, + NUMBER_OF_2_4_G_CHANNELS, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxPerChannelPowerLimits_2_4G_11b, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +regReadIntegerTable (pAdapter, &STRTxPerChannelPowerLimits_2_4G_OFDM, RADIO_TX_PER_POWER_LIMITS_2_4_OFDM_DEF_TABLE, + NUMBER_OF_2_4_G_CHANNELS, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxPerChannelPowerLimits_2_4G_OFDM, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +regReadIntegerTable (pAdapter, &STRTxPerChannelPowerLimits_5G_OFDM, RADIO_TX_PER_POWER_LIMITS_5_OFDM_DEF_TABLE, + NUMBER_OF_5G_CHANNELS, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxPerChannelPowerLimits_5G_OFDM, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +/* in case of zero value, use this methode */ + RssiSize = tmpRssiTableSize*2 +tmpRssiTableSize - 1 ; /*includes spaces between bytes*/ + + + regReadStringParameter(pAdapter, &STRRxRssiAndProcessCompensation_2_4G , + (TI_INT8*)(defRxRssiAndProcessCompensation_2_4G), RssiSize, + (TI_UINT8*)staRssiAndProcessCompensation, &RssiSize); + + regConvertStringtoBeaconIETable(staRssiAndProcessCompensation , + (TI_UINT8*)&p->twdInitParams.tIniFileRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G, + RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE); + + + +regReadIntegerTable (pAdapter, &STRRxRssiAndProcessCompensation_5G, RADIO_RX_RSSI_PROCESS_5_DEF_TABLE, + RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE, NULL, (TI_INT8*)p->twdInitParams.tIniFileRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_5G, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + + +regReadIntegerTable (pAdapter, &STRTxPDVsRateOffsets_2_4G, RADIO_TX_PD_VS_RATE_OFFSET_2_4_DEF_TABLE, + NUMBER_OF_RATE_GROUPS_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxPDVsRateOffsets_2_4G, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +regReadIntegerTable (pAdapter, &STRTxPDVsRateOffsets_5G, RADIO_TX_PD_VS_RATE_OFFSET_5_DEF_TABLE, + NUMBER_OF_RATE_GROUPS_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxPDVsRateOffsets_5G, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +regReadIntegerTable (pAdapter, &STRTxIbiasTable_2_4G, RADIO_TX_BIAS_2_4_DEF_TABLE, + NUMBER_OF_RATE_GROUPS_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxIbiasTable_2_4G, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +regReadIntegerTable (pAdapter, &STRTxIbiasTable_5G, RADIO_TX_BIAS_5_DEF_TABLE, + NUMBER_OF_RATE_GROUPS_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TxIbiasTable_5G, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +regReadIntegerParameter(pAdapter, &STRTXBiPReferencePDvoltage_2_4G, + RADIO_RX_FEM_INSERT_LOSS_2_4_DEF, RADIO_RX_FEM_INSERT_LOSS_2_4_MIN, + RADIO_RX_FEM_INSERT_LOSS_2_4_MAX, + sizeof (TI_UINT16), + (TI_UINT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TXBiPReferencePDvoltage_2_4G); + +regReadIntegerTable (pAdapter, &STRTXBiPReferencePDvoltage_5G, RADIO_TX_BIP_REF_VOLTAGE_DEF_TABLE_5G, + NUMBER_OF_SUB_BANDS_IN_5G_BAND_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.TXBiPReferencePDvoltage_5G, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT16), TI_TRUE); + + +regReadIntegerParameter(pAdapter, &STRRxFemInsertionLoss_2_4G, + 14, 0, 255, + sizeof (TI_UINT8), + (TI_UINT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.RxFemInsertionLoss_2_4G); + +regReadIntegerTable (pAdapter, &STRRxFemInsertionLoss_5G, RADIO_RX_FEM_INSERT_LOSS_5_DEF_TABLE, + NUMBER_OF_SUB_BANDS_IN_5G_BAND_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tDynRadioParams.RxFemInsertionLoss_5G, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8), TI_TRUE); + +regReadIntegerParameter(pAdapter, &STRRxTraceInsertionLoss_2_4G, + RADIO_RX_TRACE_INSERT_LOSS_2_4_DEF, RADIO_RX_TRACE_INSERT_LOSS_2_4_MIN, + RADIO_RX_TRACE_INSERT_LOSS_2_4_MAX, + sizeof (TI_UINT8), (TI_UINT8*)&p->twdInitParams.tIniFileRadioParams.tStatRadioParams.RxTraceInsertionLoss_2_4G); + +regReadIntegerParameter(pAdapter, &STRTXTraceLoss_2_4G, + RADIO_RX_TRACE_INSERT_LOSS_2_4_DEF, RADIO_RX_TRACE_INSERT_LOSS_2_4_MIN, + RADIO_RX_TRACE_INSERT_LOSS_2_4_MAX, + sizeof (TI_UINT8), (TI_UINT8*)&p->twdInitParams.tIniFileRadioParams.tStatRadioParams.TXTraceLoss_2_4G); + +regReadIntegerParameter(pAdapter, &STRRxTraceInsertionLoss_2_4G, + RADIO_RX_TRACE_INSERT_LOSS_2_4_DEF, RADIO_RX_TRACE_INSERT_LOSS_2_4_MIN, + RADIO_RX_TRACE_INSERT_LOSS_2_4_MAX, + sizeof (TI_UINT8), (TI_UINT8*)&p->twdInitParams.tIniFileRadioParams.tStatRadioParams.RxTraceInsertionLoss_2_4G); + +regReadIntegerTable (pAdapter, &STRRxTraceInsertionLoss_5G, RADIO_RX_TRACE_INSERT_LOSS_5_DEF_TABLE, + NUMBER_OF_SUB_BANDS_IN_5G_BAND_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tStatRadioParams.RxTraceInsertionLoss_5G, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8), TI_TRUE); + +regReadIntegerTable (pAdapter, &STRTXTraceLoss_5G, RADIO_TX_TRACE_LOSS_5_DEF_TABLE, + NUMBER_OF_SUB_BANDS_IN_5G_BAND_E, NULL, (TI_INT8*)&p->twdInitParams.tIniFileRadioParams.tStatRadioParams.TXTraceLoss_5G, + (TI_UINT32*)&uTempEntriesCount, sizeof (TI_UINT8),TI_TRUE); + +regReadIntegerParameter(pAdapter, &STRFRefClock, + RADIO_FREF_CLOCK_DEF, RADIO_FREF_CLOCK_MIN, + RADIO_FREF_CLOCK_MAX, + sizeof p->twdInitParams.tPlatformGenParams.RefClk, + (TI_UINT8*)&p->twdInitParams.tPlatformGenParams.RefClk); + +regReadIntegerParameter(pAdapter, &STRFRefClockSettingTime, + RADIO_FREF_CLOCK_SETTING_TIME_DEF, RADIO_FREF_CLOCK_SETTING_TIME_MIN, + RADIO_FREF_CLOCK_SETTING_TIME_MAX, + sizeof p->twdInitParams.tPlatformGenParams.SettlingTime, + (TI_UINT8*)&p->twdInitParams.tPlatformGenParams.SettlingTime); + +regReadIntegerParameter(pAdapter, &STRTXBiPFEMAutoDetect, + 0,0,1, + sizeof p->twdInitParams.tPlatformGenParams.TXBiPFEMAutoDetect, + (TI_UINT8*)&p->twdInitParams.tPlatformGenParams.TXBiPFEMAutoDetect); + +regReadIntegerParameter(pAdapter, &STRTXBiPFEMManufacturer, + 1,0,1, + sizeof p->twdInitParams.tPlatformGenParams.TXBiPFEMManufacturer, + (TI_UINT8*)&p->twdInitParams.tPlatformGenParams.TXBiPFEMManufacturer); + +regReadIntegerParameter(pAdapter, &STRClockValidOnWakeup, + 0,0,1, + sizeof p->twdInitParams.tPlatformGenParams.ClockValidOnWakeup, + (TI_UINT8*)&p->twdInitParams.tPlatformGenParams.ClockValidOnWakeup); + +regReadIntegerParameter(pAdapter, &STRDC2DCMode, + 0,0,1, + sizeof p->twdInitParams.tPlatformGenParams.DC2DCMode, + (TI_UINT8*)&p->twdInitParams.tPlatformGenParams.DC2DCMode); + +regReadIntegerParameter(pAdapter, &STRSingle_Dual_Band_Solution, + 0,0,1, + sizeof p->twdInitParams.tPlatformGenParams.Single_Dual_Band_Solution, + (TI_UINT8*)&p->twdInitParams.tPlatformGenParams.Single_Dual_Band_Solution); + +regReadIntegerParameter(pAdapter, &STRSettings, + 1,0,255, + sizeof p->twdInitParams.tPlatformGenParams.GeneralSettings, + (TI_UINT8*)&p->twdInitParams.tPlatformGenParams.GeneralSettings); + +/*---------------------------------- + Driver-Main parameters +------------------------------------*/ + regReadIntegerParameter( pAdapter, &STRWlanDrvThreadPriority, + WLAN_DRV_THREAD_PRIORITY_DEF, WLAN_DRV_THREAD_PRIORITY_MIN, WLAN_DRV_THREAD_PRIORITY_MAX, + sizeof p->tDrvMainParams.uWlanDrvThreadPriority, + (TI_UINT8*)&p->tDrvMainParams.uWlanDrvThreadPriority); + + regReadIntegerParameter( pAdapter, &STRBusDrvThreadPriority, + BUS_DRV_THREAD_PRIORITY_DEF, BUS_DRV_THREAD_PRIORITY_MIN, BUS_DRV_THREAD_PRIORITY_MAX, + sizeof p->tDrvMainParams.uBusDrvThreadPriority, + (TI_UINT8*)&p->tDrvMainParams.uBusDrvThreadPriority); + + regReadIntegerParameter( pAdapter, &STRSdioBlkSizeShift, + SDIO_BLK_SIZE_SHIFT_DEF, SDIO_BLK_SIZE_SHIFT_MIN, SDIO_BLK_SIZE_SHIFT_MAX, + sizeof p->tDrvMainParams.uSdioBlkSizeShift, + (TI_UINT8*)&p->tDrvMainParams.uSdioBlkSizeShift); + + + +/*-----------------------------------*/ +/* Roaming parameters */ +/*-----------------------------------*/ +regReadIntegerParameter(pAdapter, & STRRoamingOperationalMode, + ROAMING_MNGR_OPERATIONAL_MODE_DEF, + ROAMING_MNGR_OPERATIONAL_MODE_MIN, + ROAMING_MNGR_OPERATIONAL_MODE_MAX, + sizeof p->tRoamScanMngrInitParams.RoamingOperationalMode, + (TI_UINT8*)&p->tRoamScanMngrInitParams.RoamingOperationalMode); + + +/*-----------------------------------*/ +/* currBss parameters */ +/*-----------------------------------*/ +regReadIntegerParameter(pAdapter, & STRRoamingOperationalMode, + ROAMING_MNGR_OPERATIONAL_MODE_DEF, + ROAMING_MNGR_OPERATIONAL_MODE_MIN, + ROAMING_MNGR_OPERATIONAL_MODE_MAX, + sizeof p->tCurrBssInitParams.RoamingOperationalMode, + (TI_UINT8*)&p->tCurrBssInitParams.RoamingOperationalMode); + + + +/*-----------------------------------*/ +/* FM Coexistence parameters */ +/*-----------------------------------*/ + +regReadIntegerParameter(pAdapter, &STRFmCoexEnable, + FM_COEX_ENABLE_DEF, FM_COEX_ENABLE_MIN, FM_COEX_ENABLE_MAX, + sizeof (p->twdInitParams.tGeneral.tFmCoexParams.uEnable), + (TI_UINT8*)&(p->twdInitParams.tGeneral.tFmCoexParams.uEnable)); + +regReadIntegerParameter(pAdapter, &STRFmCoexSwallowPeriod, + FM_COEX_SWALLOW_PERIOD_DEF, FM_COEX_SWALLOW_PERIOD_MIN, FM_COEX_SWALLOW_PERIOD_MAX, + sizeof (p->twdInitParams.tGeneral.tFmCoexParams.uSwallowPeriod), + (TI_UINT8*)&(p->twdInitParams.tGeneral.tFmCoexParams.uSwallowPeriod)); + +regReadIntegerParameter(pAdapter, &STRFmCoexNDividerFrefSet1, + FM_COEX_N_DIVIDER_FREF_SET1_DEF, FM_COEX_N_DIVIDER_FREF_SET1_MIN, FM_COEX_N_DIVIDER_FREF_SET1_MAX, + sizeof (p->twdInitParams.tGeneral.tFmCoexParams.uNDividerFrefSet1), + (TI_UINT8*)&(p->twdInitParams.tGeneral.tFmCoexParams.uNDividerFrefSet1)); + +regReadIntegerParameter(pAdapter, &STRFmCoexNDividerFrefSet2, + FM_COEX_N_DIVIDER_FREF_SET2_DEF, FM_COEX_N_DIVIDER_FREF_SET2_MIN, FM_COEX_N_DIVIDER_FREF_SET2_MAX, + sizeof (p->twdInitParams.tGeneral.tFmCoexParams.uNDividerFrefSet2), + (TI_UINT8*)&(p->twdInitParams.tGeneral.tFmCoexParams.uNDividerFrefSet2)); + +regReadIntegerParameter(pAdapter, &STRFmCoexMDividerFrefSet1, + FM_COEX_M_DIVIDER_FREF_SET1_DEF, FM_COEX_M_DIVIDER_FREF_SET1_MIN, FM_COEX_M_DIVIDER_FREF_SET1_MAX, + sizeof (p->twdInitParams.tGeneral.tFmCoexParams.uMDividerFrefSet1), + (TI_UINT8*)&(p->twdInitParams.tGeneral.tFmCoexParams.uMDividerFrefSet1)); + +regReadIntegerParameter(pAdapter, &STRFmCoexMDividerFrefSet2, + FM_COEX_M_DIVIDER_FREF_SET2_DEF, FM_COEX_M_DIVIDER_FREF_SET2_MIN, FM_COEX_M_DIVIDER_FREF_SET2_MAX, + sizeof (p->twdInitParams.tGeneral.tFmCoexParams.uMDividerFrefSet2), + (TI_UINT8*)&(p->twdInitParams.tGeneral.tFmCoexParams.uMDividerFrefSet2)); + +regReadIntegerParameter(pAdapter, &STRFmCoexPllStabilizationTime, + FM_COEX_PLL_STABILIZATION_TIME_DEF, FM_COEX_PLL_STABILIZATION_TIME_MIN, FM_COEX_PLL_STABILIZATION_TIME_MAX, + sizeof (p->twdInitParams.tGeneral.tFmCoexParams.uCoexPllStabilizationTime), + (TI_UINT8*)&(p->twdInitParams.tGeneral.tFmCoexParams.uCoexPllStabilizationTime)); + +regReadIntegerParameter(pAdapter, &STRFmCoexLdoStabilizationTime, + FM_COEX_LDO_STABILIZATION_TIME_DEF, FM_COEX_LDO_STABILIZATION_TIME_MIN, FM_COEX_LDO_STABILIZATION_TIME_MAX, + sizeof (p->twdInitParams.tGeneral.tFmCoexParams.uLdoStabilizationTime), + (TI_UINT8*)&(p->twdInitParams.tGeneral.tFmCoexParams.uLdoStabilizationTime)); + +regReadIntegerParameter(pAdapter, &STRFmCoexDisturbedBandMargin, + FM_COEX_DISTURBED_BAND_MARGIN_DEF, FM_COEX_DISTURBED_BAND_MARGIN_MIN, FM_COEX_DISTURBED_BAND_MARGIN_MAX, + sizeof (p->twdInitParams.tGeneral.tFmCoexParams.uFmDisturbedBandMargin), + (TI_UINT8*)&(p->twdInitParams.tGeneral.tFmCoexParams.uFmDisturbedBandMargin)); + +regReadIntegerParameter(pAdapter, &STRFmCoexSwallowClkDif, + FM_COEX_SWALLOW_CLK_DIF_DEF, FM_COEX_SWALLOW_CLK_DIF_MIN, FM_COEX_SWALLOW_CLK_DIF_MAX, + sizeof (p->twdInitParams.tGeneral.tFmCoexParams.uSwallowClkDif), + (TI_UINT8*)&(p->twdInitParams.tGeneral.tFmCoexParams.uSwallowClkDif)); + + +/*----------------------------------------------*/ +/* Rate Management parameters */ +/*----------------------------------------------*/ + +regReadIntegerParameter(pAdapter, &STRRateMngRateRetryScore, + RATE_MNG_RATE_RETRY_SCORE_DEF, RATE_MNG_RATE_RETRY_SCORE_MIN, RATE_MNG_RATE_RETRY_SCORE_MAX, + sizeof (p->twdInitParams.tRateMngParams.RateRetryScore), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.RateRetryScore)); + +regReadIntegerParameter(pAdapter, &STRRateMngPerAdd, + RATE_MNG_PER_ADD_DEF, RATE_MNG_PER_ADD_MIN, RATE_MNG_PER_ADD_MAX, + sizeof (p->twdInitParams.tRateMngParams.PerAdd), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.PerAdd)); + +regReadIntegerParameter(pAdapter, &STRRateMngPerTh1, + RATE_MNG_PER_TH1_DEF, RATE_MNG_PER_TH1_MIN, RATE_MNG_PER_TH1_MAX, + sizeof (p->twdInitParams.tRateMngParams.PerTh1), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.PerTh1)); + +regReadIntegerParameter(pAdapter, &STRRateMngPerTh2, + RATE_MNG_PER_TH2_DEF, RATE_MNG_PER_TH2_MIN, RATE_MNG_PER_TH2_MAX, + sizeof (p->twdInitParams.tRateMngParams.PerTh2), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.PerTh2)); + +regReadIntegerParameter(pAdapter, &STRRateMngInverseCuriosityFactor, + RATE_MNG_INVERSE_CURISITY_FACTOR_DEF, RATE_MNG_INVERSE_CURISITY_FACTOR_MIN, RATE_MNG_INVERSE_CURISITY_FACTOR_MAX, + sizeof (p->twdInitParams.tRateMngParams.InverseCuriosityFactor), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.InverseCuriosityFactor)); + +regReadIntegerParameter(pAdapter, &STRRateMngTxFailLowTh, + RATE_MNG_TX_FAIL_LOW_TH_DEF, RATE_MNG_TX_FAIL_LOW_TH_MIN, RATE_MNG_TX_FAIL_LOW_TH_MAX, + sizeof (p->twdInitParams.tRateMngParams.TxFailLowTh), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.TxFailLowTh)); + +regReadIntegerParameter(pAdapter, &STRRateMngTxFailHighTh, + RATE_MNG_TX_FAIL_HIGH_TH_DEF, RATE_MNG_TX_FAIL_HIGH_TH_MIN, RATE_MNG_TX_FAIL_HIGH_TH_MAX, + sizeof (p->twdInitParams.tRateMngParams.TxFailHighTh), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.TxFailHighTh)); + +regReadIntegerParameter(pAdapter, &STRRateMngPerAlphaShift, + RATE_MNG_PER_ALPHA_SHIFT_DEF, RATE_MNG_PER_ALPHA_SHIFT_MIN, RATE_MNG_PER_ALPHA_SHIFT_MAX, + sizeof (p->twdInitParams.tRateMngParams.PerAlphaShift), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.PerAlphaShift)); + +regReadIntegerParameter(pAdapter, &STRRateMngPerAddShift, + RATE_MNG_PER_ADD_SHIFT_DEF, RATE_MNG_PER_ADD_SHIFT_MIM, RATE_MNG_PER_ADD_SHIFT_MAX, + sizeof (p->twdInitParams.tRateMngParams.PerAddShift), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.PerAddShift)); + + +regReadIntegerParameter(pAdapter, &STRRateMngPerBeta1Shift, + RATE_MNG_PER_BETA1_SHIFT_DEF, RATE_MNG_PER_BETA1_SHIFT_MIN, RATE_MNG_PER_BETA1_SHIFT_MAX, + sizeof (p->twdInitParams.tRateMngParams.PerBeta1Shift), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.PerBeta1Shift)); + +regReadIntegerParameter(pAdapter, &STRRateMngPerBeta2Shift, + RATE_MNG_PER_BETA2_SHIFT_DEF, RATE_MNG_PER_BETA2_SHIFT_MIN, RATE_MNG_PER_BETA2_SHIFT_MAX, + sizeof (p->twdInitParams.tRateMngParams.PerBeta2Shift), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.PerBeta2Shift)); + +regReadIntegerParameter(pAdapter, &STRRateMngPerBeta2Shift, + RATE_MNG_PER_BETA2_SHIFT_DEF, RATE_MNG_PER_BETA2_SHIFT_MIN, RATE_MNG_PER_BETA2_SHIFT_MAX, + sizeof (p->twdInitParams.tRateMngParams.PerBeta2Shift), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.PerBeta2Shift)); + +regReadIntegerParameter(pAdapter, &STRRateMngMaxPer, + RATE_MNG_MAX_PER_DEF, RATE_MNG_MAX_PER_MIN, RATE_MNG_MAX_PER_MAX, + sizeof (p->twdInitParams.tRateMngParams.MaxPer), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.MaxPer)); + + +regReadIntegerParameter(pAdapter, &STRRateMngRateCheckUp, + RATE_MNG_RATE_CHECK_UP_DEF, RATE_MNG_RATE_CHECK_UP_MIN, RATE_MNG_RATE_CHECK_UP_MAX, + sizeof (p->twdInitParams.tRateMngParams.RateCheckUp), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.RateCheckUp)); + +regReadIntegerParameter(pAdapter, &STRRateMngRateCheckDown, + RATE_MNG_RATE_CHECK_DOWN_DEF, RATE_MNG_RATE_CHECK_DOWN_MIN, RATE_MNG_RATE_CHECK_DOWN_MAX, + sizeof (p->twdInitParams.tRateMngParams.RateCheckDown), + (TI_UINT8*)&(p->twdInitParams.tRateMngParams.RateCheckDown)); + +regReadIntegerTable (pAdapter, &STRRateMngRateRetryPolicy, RATE_MNG_RATE_RETRY_POLICY_DEF_TABLE, + RATE_MNG_MAX_STR_LEN, (TI_UINT8*)&uTempRatePolicyList[0], NULL, + (TI_UINT32*)&uTempRatePolicyCnt, sizeof (TI_UINT8),TI_FALSE); + +/* sanity check */ + if (uTempRatePolicyCnt > RATE_MNG_MAX_RETRY_POLICY_PARAMS_LEN) + { + uTempRatePolicyCnt = RATE_MNG_MAX_RETRY_POLICY_PARAMS_LEN; + } + + for (uIndex = 0; uIndex < RATE_MNG_MAX_RETRY_POLICY_PARAMS_LEN; uIndex++) + { + p->twdInitParams.tRateMngParams.RateRetryPolicy[uIndex] = uTempRatePolicyList[uIndex]; + } + +#ifdef _WINDOWS + /* set etherMaxPayloadSize parameter for MTU size setting */ + pAdapter->etherMaxPayloadSize = ETHER_MAX_PAYLOAD_SIZE; + +#endif /* _WINDOWS */ + +} + + +/*----------------------------------------------------------------------------- + +Routine Name: + + regReadIntegerParameter + +Routine Description: + + +Arguments: + + +Return Value: + + None + +-----------------------------------------------------------------------------*/ +static void regReadIntegerParameter ( + TWlanDrvIfObjPtr pAdapter, + PNDIS_STRING pParameterName, + TI_UINT32 defaultValue, + TI_UINT32 minValue, + TI_UINT32 maxValue, + TI_UINT8 parameterSize, + TI_UINT8* pParameter + ) +{ + PNDIS_CONFIGURATION_PARAMETER RetValue; + NDIS_STATUS Status; + TI_UINT32 value; + + NdisReadConfiguration(&Status, &RetValue, + pAdapter->ConfigHandle, pParameterName, + NdisParameterInteger); + + if(Status != NDIS_STATUS_SUCCESS) { + + NdisReadConfiguration(&Status, &RetValue, + pAdapter->ConfigHandle, pParameterName, + NdisParameterString + ); + + if(Status == NDIS_STATUS_SUCCESS) { + assignRegValue(&value, RetValue); + RetValue->ParameterData.IntegerData = value; + + } + + } + + if (Status != NDIS_STATUS_SUCCESS || + RetValue->ParameterData.IntegerData < minValue || + RetValue->ParameterData.IntegerData > maxValue) + { + PRINTF(DBG_REGISTRY,( "NdisReadConfiguration fail\n")); + value = defaultValue; + + } else + { + value = RetValue->ParameterData.IntegerData; + } + + switch (parameterSize) + { + case 1: + *((TI_UINT8*) pParameter) = (TI_UINT8) value; + break; + + case 2: + *((PUSHORT) pParameter) = (USHORT) value; + break; + + case 4: + *((TI_UINT32*) pParameter) = (TI_UINT32) value; + break; + + default: + PRINT(DBG_REGISTRY_ERROR, "TIWL: Illegal Registry parameter size\n"); + break; + + } + +} + +/*----------------------------------------------------------------------------- + +Routine Name: + + regReadIntegerParameterHex + +Routine Description: + + +Arguments: + + +Return Value: + + None + +-----------------------------------------------------------------------------*/ +static void regReadIntegerParameterHex ( + TWlanDrvIfObjPtr pAdapter, + PNDIS_STRING pParameterName, + TI_UINT32 defaultValue, + TI_UINT32 minValue, + TI_UINT32 maxValue, + TI_UINT8 defaultSize, + TI_UINT8 * pParameter) +{ + TI_UINT32 parameterSize = 0; + TI_UINT32 value; + TI_BOOL paramFound; + + regReadStringParameter (pAdapter, + pParameterName, + "x", + sizeof("x"), + pParameter, + ¶meterSize); + + /* Note: the "x" is used as a dummy string to detect if the requested key + wasn't found (in that case the x is returned as sefault) */ + paramFound = os_memoryCompare(pAdapter, pParameter, "x", sizeof("x")) != 0; + + if (paramFound) + { + value = tiwlnstrtoi_hex (pParameter, parameterSize); + + if (value < minValue || value > maxValue) + { + value = defaultValue; + } + } + else + { + value = defaultValue; + } + + switch (defaultSize) + { + case 1: + *((TI_UINT8*) pParameter) = (TI_UINT8) value; + break; + + case 2: + *((PUSHORT) pParameter) = (USHORT) value; + break; + + case 4: + *((TI_UINT32*) pParameter) = (TI_UINT32) value; + break; + + default: + PRINT(DBG_REGISTRY_ERROR, "TIWL: Illegal Registry parameter size\n"); + break; + } +} + +/*----------------------------------------------------------------------------- + +Routine Name: + + regReadParameters + +Routine Description: + + +Arguments: + + +Return Value: + + None + +-----------------------------------------------------------------------------*/ +static void regReadStringParameter ( + TWlanDrvIfObjPtr pAdapter, + PNDIS_STRING pParameterName, + TI_INT8* pDefaultValue, + USHORT defaultLen, + TI_UINT8* pParameter, + void* pParameterSize + ) +{ + PNDIS_CONFIGURATION_PARAMETER RetValue; + NDIS_STATUS Status; + ANSI_STRING ansiString; + TI_UINT8* pSizeChar = 0; + PUSHORT pSizeShort = 0; + + if(defaultLen <= 256) + { + pSizeChar = (TI_UINT8*)pParameterSize; + ansiString.MaximumLength = 256; + } + else + { + pSizeShort = (PUSHORT)pParameterSize; + ansiString.MaximumLength = 32576; + } + + NdisReadConfiguration(&Status, &RetValue, + pAdapter->ConfigHandle, pParameterName, + NdisParameterString); + + if (Status == NDIS_STATUS_SUCCESS) + { + ansiString.Buffer = (TI_INT8*)pParameter; + + NdisUnicodeStringToAnsiString(&ansiString, &RetValue->ParameterData.StringData); + if(defaultLen <= 256) + *pSizeChar = (TI_UINT8)ansiString.Length; + else + *pSizeShort = (USHORT)ansiString.Length; + } else + { + if(defaultLen <= 256) + *pSizeChar = (TI_UINT8)defaultLen; + else + *pSizeShort = (USHORT)defaultLen; + + memcpy(pParameter, pDefaultValue, defaultLen); + } + + PRINTF(DBG_REGISTRY_LOUD, ("Read String Registry: %c%c%c%c%c%c%c%c%c%c%c%c = %s\n", + pParameterName->Buffer[0], + pParameterName->Buffer[1], + pParameterName->Buffer[2], + pParameterName->Buffer[3], + pParameterName->Buffer[4], + pParameterName->Buffer[5], + pParameterName->Buffer[6], + pParameterName->Buffer[7], + pParameterName->Buffer[8], + pParameterName->Buffer[9], + pParameterName->Buffer[10], + pParameterName->Buffer[11], + pParameter)); + +} + + + +/*----------------------------------------------------------------------------- + +Routine Name: + + regReadParameters + +Routine Description: + + +Arguments: + + +Return Value: + + None + +-----------------------------------------------------------------------------*/ +static void regReadWepKeyParameter (TWlanDrvIfObjPtr pAdapter, TI_UINT8 *pKeysStructure, TI_UINT8 defaultKeyId) +{ + NDIS_STATUS status; + TSecurityKeys *pSecKeys; + int i; + int len; + TI_UINT8 Buf[MAX_KEY_BUFFER_LEN]; + PNDIS_CONFIGURATION_PARAMETER RetValue; + ANSI_STRING ansiString; + NDIS_STRING STRdot11DefaultWEPKey[4] = + { NDIS_STRING_CONST( "dot11WEPDefaultKey1" ), + NDIS_STRING_CONST( "dot11WEPDefaultKey2" ), + NDIS_STRING_CONST( "dot11WEPDefaultKey3" ), + NDIS_STRING_CONST( "dot11WEPDefaultKey4" ) + }; + + + + PRINTF(DBG_REGISTRY_LOUD, ("Reading WEP keys\n")); + + pSecKeys = (TSecurityKeys*)pKeysStructure; + + /**/ + /* Read WEP from registry*/ + /**/ + for ( i = 0; i < DOT11_MAX_DEFAULT_WEP_KEYS; i++ ) + { + NdisReadConfiguration(&status, &RetValue, + pAdapter->ConfigHandle, &STRdot11DefaultWEPKey[i], + NdisParameterString); + + if(status == NDIS_STATUS_SUCCESS) + { + ansiString.Buffer = (TI_INT8*)Buf; + ansiString.MaximumLength = MAX_KEY_BUFFER_LEN; + + pSecKeys->keyIndex = i; + pSecKeys->keyType = KEY_WEP; + NdisZeroMemory((void *)pSecKeys->macAddress, 6); + + if(((char *)(RetValue->ParameterData.StringData.Buffer))[1] == 0) + { + NdisUnicodeStringToAnsiString(&ansiString, &RetValue->ParameterData.StringData); + + len = decryptWEP((TI_INT8*)Buf, (TI_INT8*)pSecKeys->encKey, ansiString.Length); + } else { + len = decryptWEP((TI_INT8*)RetValue->ParameterData.StringData.Buffer, + (TI_INT8*)pSecKeys->encKey, + RetValue->ParameterData.StringData.Length); + } + + if(len < ACX_64BITS_WEP_KEY_LENGTH_BYTES) + { + PRINTF(DBG_REGISTRY_ERROR, ("Error: minimum WEP key size is 5 bytes(%d)\n", len)); + pSecKeys->keyType = KEY_NULL; + len = 0; + } + else if(len < ACX_128BITS_WEP_KEY_LENGTH_BYTES) + { + len = ACX_64BITS_WEP_KEY_LENGTH_BYTES; + } + else if(len < ACX_256BITS_WEP_KEY_LENGTH_BYTES) + { + len = ACX_128BITS_WEP_KEY_LENGTH_BYTES; + } + else + len = ACX_256BITS_WEP_KEY_LENGTH_BYTES; + + pSecKeys->encLen = (TI_UINT8)len; + + } + else + { + pSecKeys->keyType = KEY_NULL; + pSecKeys->encLen = 0; + } + +#ifdef _WINDOWS + /*create local keys cache*/ + pAdapter->DefaultWepKeys[i].KeyIndex = i; + if(i==defaultKeyId) + pAdapter->DefaultWepKeys[i].KeyIndex |= 0x80000000; + pAdapter->DefaultWepKeys[i].KeyLength = pSecKeys->encLen; + NdisMoveMemory((void *)pAdapter->DefaultWepKeys[i].KeyMaterial, + (void *)pSecKeys->encKey, pSecKeys->encLen); + pAdapter->DefaultWepKeys[i].Length = sizeof(OS_802_11_WEP); +#endif /* _WINDOWS */ + + pSecKeys++; + } +} + +#define iswhite(c) ( (c==' ') || (c=='\t') || (c=='\n') ) + +/* + * + * Fun: isnumber + * + * Desc: check if the ascii character is a number in the given base + * + * Ret: 1 if number is a digit, 0 if not. + * + * Notes: none + * + * File: btoi.c + * + */ + +static TI_BOOL isnumber ( short *pi, char c, short base ) +{ + + /* return 1 if c is a digit in the give base, else return 0 */ + /* place value of digit at pi */ + if ( base == 16 ) + { + if ( '0' <= c && c <= '9' ) + { + *pi = c - '0'; + return (1); + } + else if ( 'a' <= c && c <= 'f' ) + { + *pi = c - 'a' + 10 ; + return (1); + } + else if ( 'A' <= c && c <= 'F' ) + { + *pi = c - 'A' + 10 ; + return (1); + } + else + { + return (0); + } + } + c -= '0'; + if ( 0 <= (signed char)c && c < base ) + { + *pi = c ; + return (1); + } + else + { + return (0); + } +} /* end of isnumber */ + + +static short _btoi (char *sptr, short slen, int *pi, short base) +{ + char *s, c ; + short d, sign ; + int result ; + char saved ; + + s = sptr ; + result = 0 ; + saved = sptr [slen]; + sptr [slen] = '\0'; + + /* skip initial white space */ +/* while ( (c = *s++) && iswhite(c) ); */ + do + { + c = *s++; + if (!(c && iswhite(c))) + break; + }while(1); + + --s ; + + /* recognize optional sign */ + if ( *s == '-' ) + { + sign = - 1 ; + s++ ; + } + else if ( *s == '+' ) + { + sign = 1 ; + s++ ; + } + else + { + sign = 1 ; + } + + /* recognize optional hex# prefix */ + if ((base == 16) && ((*s == '0') && ((*(s + 1) == 'x') || (*(s + 1) == 'X')) + )) + s += 2 ; + + /* recognize digits */ + +/* for (; (c = *s++) && isnumber(&d, c, base) ; ) + { + result = base * result + d ; + } +*/ + while(1) + { + c = *s++; + if (!(c && isnumber(&d, c, base))) + break; + result = base * result + d ; + }; + + *pi = sign * result ; + sptr [slen] = saved ; /* restore character which we changed to null */ + return (s - sptr - 1); +} /* end of _btoi */ + +static int decryptWEP +( + TI_INT8* pSrc, + TI_INT8* pDst, + TI_UINT32 len +) +{ + /**/ + /* key to use for encryption*/ + /**/ + static LPCSTR lpEncryptKey = "jkljz98c&2>a+t)cl5[d=n3;\"f_um6\\d~v%$HO1"; + int cnEncryptLen = strlen(lpEncryptKey); + + char cIn, cCrypt, cHex[3]; + int i, j, nLen; + int nPos; + + nLen = len / 2; + nPos = len; + + /* start reading from end*/ + nPos = len - 2; + + for(i = 0; (i < nLen) && (nPos >= 0); i++, nPos -= 2) + { + /* get hex character*/ + cHex[0] = pSrc[nPos]; + cHex[1] = pSrc[nPos + 1]; + cHex[2] = 0; + + _btoi ( cHex, 2, &j, 16); + cIn = (char) j; + + cCrypt = lpEncryptKey[i % cnEncryptLen]; + cIn = cIn ^ cCrypt; + + pDst[i] = cIn; + } + + PRINTF(DBG_REGISTRY_LOUD, ("First 5 bytes of WEP: %x-%x-%x-%x-%x\n", + pDst[0], + pDst[1], + pDst[2], + pDst[3], + pDst[4])); + + return nLen; +} + +static void initValusFromRgstryString +( + TI_INT8* pSrc, + TI_INT8* pDst, + TI_UINT32 len +) +{ + int j; + TI_UINT32 count; + for (count = 0 ; count < len ; count++) + { + _btoi((char *) (pSrc+(count*3)), 2, &j, 16 ); + + pDst[count] = (TI_UINT8) j; + } +} + +#ifdef TI_DBG + +void regReadLastDbgState (TWlanDrvIfObjPtr pAdapter) +{ + NDIS_STRING OsDbgStr = NDIS_STRING_CONST("OsDbgState"); + PNDIS_CONFIGURATION_PARAMETER Value; + NDIS_STATUS Status; + + NdisReadConfiguration(&Status, &Value, + pAdapter->ConfigHandle, &OsDbgStr, + NdisParameterInteger + ); + + if (Status != NDIS_STATUS_SUCCESS) + { + + TiDebugFlag = ((DBG_NDIS_OIDS | DBG_INIT | DBG_RECV | DBG_SEND | DBG_IOCTL | DBG_INTERRUPT) << 16) | + DBG_SEV_VERY_LOUD | DBG_SEV_INFO | DBG_SEV_LOUD | DBG_SEV_ERROR | DBG_SEV_FATAL_ERROR; + + } else + { + + PRINTF(DBG_REGISTRY_VERY_LOUD, ("TIWL: New Flag - 0x%X\n", Value->ParameterData.IntegerData)); + + TiDebugFlag = Value->ParameterData.IntegerData; + + } +} + +#endif /* TI_DBG */ + + + +static void readRates(TWlanDrvIfObjPtr pAdapter, TInitTable *pInitTable) +{ + /* + ** B band + */ + regReadIntegerParameter(pAdapter, &STRdot11BasicRateMask_B, + BASIC_RATE_SET_1_2_5_5_11, BASIC_RATE_SET_1_2, BASIC_RATE_SET_1_2_5_5_11, + sizeof pInitTable->siteMgrInitParams.siteMgrRegstryBasicRate[DOT11_B_MODE], + (TI_UINT8*)&pInitTable->siteMgrInitParams.siteMgrRegstryBasicRate[DOT11_B_MODE]); + + regReadIntegerParameter(pAdapter, &STRdot11SupportedRateMask_B, + SUPPORTED_RATE_SET_1_2_5_5_11_22, SUPPORTED_RATE_SET_1_2, SUPPORTED_RATE_SET_1_2_5_5_11_22, + sizeof pInitTable->siteMgrInitParams.siteMgrRegstrySuppRate[DOT11_B_MODE], + (TI_UINT8*)&pInitTable->siteMgrInitParams.siteMgrRegstrySuppRate[DOT11_B_MODE]); + /* + ** G band (B&G rates) + */ + regReadIntegerParameter(pAdapter, &STRdot11BasicRateMask_G, + BASIC_RATE_SET_1_2_5_5_11, BASIC_RATE_SET_1_2, BASIC_RATE_SET_1_2_5_5_11, + sizeof pInitTable->siteMgrInitParams.siteMgrRegstryBasicRate[DOT11_G_MODE], + (TI_UINT8*)&pInitTable->siteMgrInitParams.siteMgrRegstryBasicRate[DOT11_G_MODE]); + + regReadIntegerParameter(pAdapter, &STRdot11SupportedRateMask_G, + SUPPORTED_RATE_SET_ALL, SUPPORTED_RATE_SET_1_2, SUPPORTED_RATE_SET_ALL, + sizeof pInitTable->siteMgrInitParams.siteMgrRegstrySuppRate[DOT11_G_MODE], + (TI_UINT8*)&pInitTable->siteMgrInitParams.siteMgrRegstrySuppRate[DOT11_G_MODE]); + + /* + ** A band + */ + regReadIntegerParameter(pAdapter, &STRdot11BasicRateMask_A, + BASIC_RATE_SET_6_12_24, BASIC_RATE_SET_6_12_24, BASIC_RATE_SET_6_12_24, + sizeof pInitTable->siteMgrInitParams.siteMgrRegstryBasicRate[DOT11_A_MODE], + (TI_UINT8*)&pInitTable->siteMgrInitParams.siteMgrRegstryBasicRate[DOT11_A_MODE]); + + regReadIntegerParameter(pAdapter, &STRdot11SupportedRateMask_A, + SUPPORTED_RATE_SET_UP_TO_54, SUPPORTED_RATE_SET_1_2, SUPPORTED_RATE_SET_UP_TO_54, + sizeof pInitTable->siteMgrInitParams.siteMgrRegstrySuppRate[DOT11_A_MODE], + (TI_UINT8*)&pInitTable->siteMgrInitParams.siteMgrRegstrySuppRate[DOT11_A_MODE]); + + /* + ** Dual band (A&G) + */ + regReadIntegerParameter(pAdapter, &STRdot11BasicRateMask_AG, + BASIC_RATE_SET_1_2, BASIC_RATE_SET_1_2, BASIC_RATE_SET_1_2, + sizeof pInitTable->siteMgrInitParams.siteMgrRegstryBasicRate[DOT11_DUAL_MODE], + (TI_UINT8*)&pInitTable->siteMgrInitParams.siteMgrRegstryBasicRate[DOT11_DUAL_MODE]); + + regReadIntegerParameter(pAdapter, &STRdot11SupportedRateMask_AG, + SUPPORTED_RATE_SET_ALL_OFDM, SUPPORTED_RATE_SET_1_2, SUPPORTED_RATE_SET_ALL_OFDM, + sizeof pInitTable->siteMgrInitParams.siteMgrRegstrySuppRate[DOT11_DUAL_MODE], + (TI_UINT8*)&pInitTable->siteMgrInitParams.siteMgrRegstrySuppRate[DOT11_DUAL_MODE]); + + /* + ** N supported + */ + regReadIntegerParameter(pAdapter, &STRdot11BasicRateMask_N, + BASIC_RATE_SET_1_2_5_5_11, BASIC_RATE_SET_1_2, BASIC_RATE_SET_1_2_5_5_11, + sizeof pInitTable->siteMgrInitParams.siteMgrRegstryBasicRate[DOT11_N_MODE], + (TI_UINT8*)&pInitTable->siteMgrInitParams.siteMgrRegstryBasicRate[DOT11_N_MODE]); + + regReadIntegerParameter(pAdapter, &STRdot11SupportedRateMask_AG, + SUPPORTED_RATE_SET_ALL_MCS_RATES, SUPPORTED_RATE_SET_ALL_MCS_RATES, SUPPORTED_RATE_SET_ALL_MCS_RATES, + sizeof pInitTable->siteMgrInitParams.siteMgrRegstrySuppRate[DOT11_N_MODE], + (TI_UINT8*)&pInitTable->siteMgrInitParams.siteMgrRegstrySuppRate[DOT11_N_MODE]); +} + + +static void decryptScanControlTable(TI_UINT8* src, TI_UINT8* dst, USHORT len) +{ + + USHORT i; + int parityFlag = 0; + char tmp = 0; + char finalChar = 0; + + for(i=0; i < len; i++) + { + switch(src[i]) + { + case 'A': + case 'a': + tmp = 10; + break; + case 'B': + case 'b': + tmp = 11; + break; + case 'C': + case 'c': + tmp = 12; + break; + case 'D': + case 'd': + tmp = 13; + break; + case 'E': + case 'e': + tmp = 14; + break; + case 'F': + case 'f': + tmp = 15; + break; + default: + if( (src[i] >='0') && (src[i] <= '9') ) + tmp = (src[i] - '0'); + else + return; /* ERROR input char */ + } + if(parityFlag == 0) + finalChar = tmp << 4; + else + { + finalChar |= (tmp & 0x0f); + dst[i/2] = finalChar; + } + parityFlag = 1-parityFlag; + } +} + + +/*----------------------------------------------------------------------------- + +Routine Name: + + regReadIntegerTable + +Routine Description: + reads any table format and insert it to another string. + the delimiters of the tables can be: + - space (" ") + - comma (",") + the table reads only integers thus its reads the following chars: + - "0" till "9" + - minus sign ("-") + +Arguments: + + +Return Value: + + zero on success else - error number. + +-----------------------------------------------------------------------------*/ +TI_UINT32 +regReadIntegerTable( + TWlanDrvIfObjPtr pAdapter, + PNDIS_STRING pParameterName, + TI_INT8* pDefaultValue, + USHORT defaultLen, + TI_UINT8* pUnsignedParameter, + TI_INT8* pSignedParameter, + TI_UINT32* pEntriesNumber, /* returns the number of read entries */ + TI_UINT8 uParameterSize, + TI_BOOL bHex) +{ + static CHAR Buffer[MAX_KEY_BUFFER_LEN]; + TI_UINT32 parameterIndex = 0; + int myNumber; + + TI_UINT32 index; + TI_UINT32 bufferSize = 0; + + char tempBuffer[16]; + char *pTempBuffer = tempBuffer; + TI_UINT32 tempBufferIndex = 0; + + TI_BOOL isDigit; + TI_BOOL numberReady; + TI_BOOL isSign; + TI_BOOL endOfLine; + + TI_UINT32 debugInfo = 0; + TI_INT8* pBuffer = (TI_INT8*)&Buffer; + + regReadStringParameter(pAdapter, + pParameterName, + pDefaultValue, + defaultLen, + (TI_UINT8*)pBuffer, + &bufferSize); + + index = 0; + do { /* Parsing one line */ + + isSign = TI_FALSE; + isDigit = TI_FALSE; + numberReady = TI_FALSE; + tempBufferIndex = 0; + endOfLine = TI_FALSE; + + while ((numberReady==TI_FALSE) && (index<bufferSize)) + { + /* Parsing one number */ + switch (pBuffer[index]) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + pTempBuffer[tempBufferIndex] = pBuffer[index]; + ++tempBufferIndex; + isDigit = TI_TRUE; + break; + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + if (bHex) + { + pTempBuffer[tempBufferIndex] = pBuffer[index]; + ++tempBufferIndex; + isDigit = TI_TRUE; + } + break; + case '-': + pTempBuffer[tempBufferIndex] = pBuffer[index]; + ++tempBufferIndex; + if (isDigit==TI_TRUE) + { + PRINTF(DBG_REGISTRY_INFO, ("Error in read parameter %c in line index %d\n\ + The sign '-' isn't in place!\n",pBuffer[index],index)); + debugInfo = 1; + } + isSign = TI_TRUE; + break; + + case ' ': + case '\t': /* tab char */ + /* for space discard*/ + if ((isDigit==TI_FALSE) && (isSign==TI_FALSE)) + { + break; + } + /* + else we continue to the code of the case ',' + */ + case '\0': + case '\n': + case '\r': + endOfLine = TI_TRUE; + + case ',': + /* end of number reading */ + pTempBuffer[tempBufferIndex] = '\0'; + if (isDigit == TI_FALSE) + { + PRINTF(DBG_REGISTRY_INFO, ("Error in end of number delimiter. number isn't ready.\ + check index %d",index)); + debugInfo = 2; + } + numberReady = TI_TRUE; + break; + + default: + PRINTF(DBG_REGISTRY_INFO, ("%s(%d) Error - unexpected parameter %c.\n", + __FILE__,__LINE__,pBuffer[index])); + debugInfo = 3; + break; + }/* switch( pBuffer[index] ) */ + + if (debugInfo != 0) + { + return debugInfo; + } + ++index; + + }/* while (numberReady==TI_FALSE)*/ + + if (pTempBuffer[0] == '-') + { + ++pTempBuffer; + if (!bHex) + { + myNumber = tiwlnstrtoi(pTempBuffer,tempBufferIndex-1); + } + else + { + myNumber = tiwlnstrtoi_hex(pTempBuffer,tempBufferIndex-1); + } + myNumber = -(myNumber); + } + else + { + if (!bHex) + { + myNumber = tiwlnstrtoi(pTempBuffer,tempBufferIndex); + } + else + { + myNumber = tiwlnstrtoi_hex(pTempBuffer,tempBufferIndex); + } + } + + switch (uParameterSize) + { + case 1: + if (pUnsignedParameter) + { + ((TI_UINT8*) pUnsignedParameter)[parameterIndex] = (TI_UINT8) myNumber; + } + else + { + ((TI_INT8*) pSignedParameter)[parameterIndex] = (TI_INT8) myNumber; + } + break; + + case 2: + if (pUnsignedParameter) + { + ((PUSHORT) pUnsignedParameter)[parameterIndex] = (USHORT) myNumber; + } + else + { + ((TI_INT16*) pSignedParameter)[parameterIndex] = (TI_INT16) myNumber; + } + break; + + case 4: + if (pUnsignedParameter) + { + ((TI_UINT32*) pUnsignedParameter)[parameterIndex] = (TI_UINT32) myNumber; + } + else + { + ((TI_INT32*) pSignedParameter)[parameterIndex] = (TI_INT32) myNumber; + } + break; + + default: + PRINTF(DBG_REGISTRY_INFO, ("%s(%d) Error - Illegal Registry parameter size.\n", + __FILE__,__LINE__)); + break; + } + + ++parameterIndex; + + }while ((index<bufferSize)&&(endOfLine==TI_FALSE)); + + *pEntriesNumber = parameterIndex; /* return number of entries read */ + return debugInfo; +} + + +void assignRegValue(TI_UINT32* lValue, PNDIS_CONFIGURATION_PARAMETER ndisParameter) +{ + char b[8]; + ANSI_STRING a = {0, 0, 0}; + + a.MaximumLength = sizeof(b); + a.Buffer=(TI_INT8*)b; + + if(ndisParameter->ParameterData.StringData.Length <= sizeof (b) * 2) + { + if ( ((char *)(ndisParameter->ParameterData.StringData.Buffer))[1] == 0 ) + { + NdisUnicodeStringToAnsiString ( &a, &(ndisParameter)->ParameterData.StringData ); + *lValue = tiwlnstrtoi ( (char *)a.Buffer, a.Length ); + } else { + *lValue = tiwlnstrtoi ( (char *)(ndisParameter->ParameterData.StringData.Buffer), ndisParameter->ParameterData.StringData.Length); + } + } else { + *lValue = 0; + } + } + +/*----------------------------------------------------------------------------- + +Routine Name: + + regConvertStringtoBeaconIETable + +Routine Description: Converts the Ip Adrress in a form of string readen from the Registry +to the Ip Address Array to be stored in the init_table struct + + +Arguments: + + +Return Value: + + None + +-----------------------------------------------------------------------------*/ +static void regConvertStringtoBeaconIETable(TI_UINT8 *staIpAddressString, TI_UINT8 *IpAddressArray, TI_UINT8 size) +{ + char *ptr; + TI_UINT8 *tmpIpAddr; + TI_UINT8 value = 0, value_l, value_h, add_value; + int i, str_len; + + /* Take the pointer to the string MAC Address to convert it to the Array MAC Address */ + ptr = (char *)staIpAddressString; + tmpIpAddr = IpAddressArray; + str_len = 3 * size - 1; + + for(i=0;(i < size);ptr++,str_len--) + { + if (str_len > 0) { + /* The value can be or "0-9" or from "a-f" */ + value_l = (*ptr - '0'); + value_h = (*ptr - 'a'); + } + else { /* last element */ + value_l = value_h = 16; + } + /*PRINTF(DBG_REGISTRY,("value_l [%d] value_h [%d] *ptr %c value %d\n",value_l,value_h,*ptr,value));*/ + + if( (value_l <= 9) || (value_h <= 15 ) ) + { + /* We are in an expected range */ + /* nCheck if 0-9 */ + if(value_l <= 9 ) + { + add_value = value_l; + } + /* Check if a-f */ + else + { + /* 'a' is in fact 10 decimal in hexa */ + add_value = value_h + 10; + } + value = value * 16 + add_value; + /*PRINTF(DBG_REGISTRY,("value %d add_value %d \n",value,add_value));*/ + } + else + { + tmpIpAddr[i] = value; + /*PRINTF(DBG_REGISTRY,("tmpMacAddr[%d] is %x\n",i,tmpMacAddr[i]));*/ + value = 0; + i++; + } + } +} + +/*----------------------------------------------------------------------------- + +Routine Name: + + regConvertStringtoCoexActivityTable + +Routine Description: Converts the CoexActivity string into CoexActivity config table + + +Arguments: + + +Return Value: + + None + +-----------------------------------------------------------------------------*/ +static void regConvertStringtoCoexActivityTable(TI_UINT8 *strCoexActivityTable, TI_UINT32 numOfElements, TCoexActivity *CoexActivityArray, TI_UINT8 size) +{ + char *ptr; + TI_UINT16 tmpArray[NUM_OF_COEX_ACTIVITY_PARAMS_IN_SG]; + TI_UINT16 value = 0, value_l, value_h, add_value; + TI_UINT32 i; + int entry = 0; + + /* Note: Currently it is not in use, but it has potential buffer overrun + problem if buffer is not ended with blank (Dm) */ + + /* Take the pointer to the string MAC Address to convert it to the Array MAC Address */ + ptr = (char *)strCoexActivityTable; + + for(i=0;(i < numOfElements*NUM_OF_COEX_ACTIVITY_PARAMS_IN_SG);ptr++) + { + /* The value can be or "0-9" or from "a-f" */ + value_l = (*ptr - '0'); + value_h = (*ptr - 'a'); + + /*PRINTF(DBG_REGISTRY,("value_l [%d] value_h [%d] *ptr %c value %d\n",value_l,value_h,*ptr,value));*/ + + if( (value_l <= 9) || (value_h <= 15 ) ) + { + /* We are in an expected range */ + /* nCheck if 0-9 */ + if(value_l <= 9 ) + { + add_value = value_l; + } + /* Check if a-f */ + else + { + /* 'a' is in fact 10 decimal in hexa */ + add_value = value_h + 10; + } + value = value * 16 + add_value; + /* PRINTF(DBG_REGISTRY,("value %d add_value %d \n",value,add_value));*/ + } + else + { + tmpArray[i%NUM_OF_COEX_ACTIVITY_PARAMS_IN_SG] = value; + value = 0; + i++; + if ((i%NUM_OF_COEX_ACTIVITY_PARAMS_IN_SG) == 0) + { + CoexActivityArray[entry].coexIp = (TI_UINT8)tmpArray[0]; + CoexActivityArray[entry].activityId = (TI_UINT8)tmpArray[1]; + CoexActivityArray[entry].defaultPriority= (TI_UINT8)tmpArray[2]; + CoexActivityArray[entry].raisedPriority = (TI_UINT8)tmpArray[3]; + CoexActivityArray[entry].minService = tmpArray[4]; + CoexActivityArray[entry].maxService = tmpArray[5]; + entry++; + } + } + } +} + +static void parse_hex_string(char * pString, TI_UINT8 StrLength, TI_UINT8 * pBuffer, TI_UINT8 * Length) +{ + char ch; + int iter = 0; + + while ((iter < StrLength) && (ch = pString[iter])) + { + TI_UINT8 val = ((ch >= '0' && ch <= '9') ? (ch - '0') : + (ch >= 'A' && ch <= 'F') ? (0xA + ch - 'A') : + (ch >= 'a' && ch <= 'f') ? (0xA + ch - 'a') : 0); + + /* even indexes go to the lower nibble, odd indexes push them to the */ + /* higher nibble and then go themselves to the lower nibble. */ + if (iter % 2) + pBuffer[iter / 2] = ((pBuffer[iter / 2] << (BIT_TO_BYTE_FACTOR / 2)) | val); + else + pBuffer[iter / 2] = val; + + ++iter; + } + + /* iter = 0 len = 0, iter = 1 len = 1, iter = 2 len = 1, and so on... */ + *Length = (iter + 1) / 2; +} + +static void parse_binary_string(char * pString, TI_UINT8 StrLength, TI_UINT8 * pBuffer, TI_UINT8 * Length) +{ + char ch; + int iter = 0; + + while ((iter < StrLength) && (ch = pString[iter])) + { + TI_UINT8 val = (ch == '1' ? 1 : 0); + + if (iter % BIT_TO_BYTE_FACTOR) + pBuffer[iter / BIT_TO_BYTE_FACTOR] |= (val << (iter % BIT_TO_BYTE_FACTOR)); + else + pBuffer[iter / BIT_TO_BYTE_FACTOR] = val; + + ++iter; + } + + /* iter = 0 len = 0, iter = 1 len = 1, iter = 8 len = 1, and so on... */ + *Length = (iter + BIT_TO_BYTE_FACTOR - 1) / BIT_TO_BYTE_FACTOR; +} + +static void parse_filter_request(TRxDataFilterRequest* request, TI_UINT8 offset, char * mask, TI_UINT8 maskLength, char * pattern, TI_UINT8 patternLength) +{ + request->offset = offset; + request->maskLength = request->patternLength = 0; + + if (maskLength > 0) + { + parse_binary_string(mask, maskLength, request->mask, &request->maskLength); + parse_hex_string(pattern, patternLength, request->pattern, &request->patternLength); + } +} diff --git a/wilink_6_1/platforms/os/common/src/tracebuf.c b/wilink_6_1/platforms/os/common/src/tracebuf.c new file mode 100644 index 0000000..5a0f156 --- /dev/null +++ b/wilink_6_1/platforms/os/common/src/tracebuf.c @@ -0,0 +1,262 @@ +/* + * tracebuf.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + +/* + * Benchmark tracing utility + */ + +#include "osApi.h" +#include "tracebuf.h" +#include "tracebuf_api.h" +#include "report.h" + +typedef struct { + unsigned long loc;/* trace entry identification */ + unsigned long ts;/* Timestamp */ + unsigned long p1; /* Parameter 1 */ + unsigned long p2; /* Parameter 2 */ + char msg[MAX_TB_MSG]; +} tb_entry_t; + +typedef struct { + int pos; + int count; + int print_pos; + int nusers; + unsigned long self_delay; + unsigned long options; + tb_entry_t entry[1]; /* Array of entries */ +} tb_control_t; + +static tb_control_t *tb_control; + +static int tb_control_size(void) +{ + return TI_FIELD_OFFSET(tb_control_t, entry) + sizeof(tb_entry_t)*TB_NUM_ENTRIES; +} + + +/* Initialization */ +int tb_init(unsigned long options) +{ + if (tb_control) + { + ++tb_control->nusers; + return 0; + } + tb_control = (tb_control_t *)TB_MALLOC(tb_control_size()); + if (!tb_control) + return -1; + memset(tb_control, 0, tb_control_size()); + tb_control->nusers = 1; + + /* Measure self-delay */ + tb_trace(0, 0, 0); + tb_trace(0, 0, 0); + tb_control->self_delay = tb_control->entry[1].ts - tb_control->entry[0].ts; + tb_control->pos = tb_control->count = 0; + tb_control->options = options; + return 0; +} + +/* De-initialization */ +void tb_destroy(void) +{ + if (--tb_control->nusers) + return; + TB_FREE(tb_control ); +} + +static int tb_next(void) +{ + int pos; + if (!tb_control || tb_control->print_pos) + return -1; + pos = tb_control->pos; + tb_control->pos = (pos+1) % TB_NUM_ENTRIES; + ++tb_control->count; + + tb_control->entry[tb_control->pos].ts = + tb_control->entry[tb_control->pos].loc= + tb_control->entry[tb_control->pos].p1 = + tb_control->entry[tb_control->pos].p2 = 0xffffffff; + + return pos; +} +static void tb_autoprint(void) +{ + if ((tb_control->pos == 0) && (tb_control->count)) + { + if (tb_control->options & TB_OPTION_PRINTONCE) + { + tb_printf(); + tb_reset_option(TB_OPTION_PRINTONCE); + } + else if (tb_control->options & TB_OPTION_AUTOPRINT) + { + tb_printf(); + } + } +} + +/* Add trace entry. not safe, but will do */ +int tb_trace(int loc, unsigned long p1, unsigned long p2) +{ + int pos; + + if ((tb_control->options & TB_OPTION_STOP) || ((pos = tb_next()) < 0)) + { + return -1; + } + tb_control->entry[pos].ts = os_timeStampUs(NULL); + tb_control->entry[pos].loc= loc; + tb_control->entry[pos].p1 = p1; + tb_control->entry[pos].p2 = p2; + + return pos; +} +void tb_dump(void) +{ + int j, pos; + + WLAN_OS_REPORT(("Trace Dump:\n")); + WLAN_OS_REPORT(("===========\n\n")); + if (tb_control->count < TB_NUM_ENTRIES) + { + pos = 0; + } + else + { + pos = (tb_control->pos + 1) % TB_NUM_ENTRIES; + } + for (j=0; (unsigned int)j < tb_min((unsigned int)TB_NUM_ENTRIES,(unsigned int)tb_control->count); j++) + { + WLAN_OS_REPORT(("%4i %08x %08x %08x %08x\n", j, + (int)tb_control->entry[pos].ts, + (int)tb_control->entry[pos].loc, + (int)tb_control->entry[pos].p1, + (int)tb_control->entry[pos].p2)); + pos = (pos+1) % TB_NUM_ENTRIES; + } + +} + +int tb_sprintf(const char *format ,...) +{ + + va_list ap; + int pos; + + if ((tb_control->options & TB_OPTION_STOP) || ((pos = tb_next()) < 0)) + { + return -1; + } + tb_control->entry[pos].loc = TB_ID; + va_start(ap,format); + vsprintf(&tb_control->entry[pos].msg[0], format, ap); + tb_autoprint(); + return pos; +} + +void tb_printf(void) +{ + int j, pos; + unsigned long saved_options=tb_control->options; + + tb_set_option(TB_OPTION_STOP); + WLAN_OS_REPORT(("Trace Dump:\n")); + WLAN_OS_REPORT(("===========\n\n")); + if (tb_control->count < TB_NUM_ENTRIES) + { + pos = 0; + } + else + { + pos = (tb_control->pos + 1) % TB_NUM_ENTRIES; + } + for (j=0; (unsigned int)j < tb_min((unsigned int)TB_NUM_ENTRIES,(unsigned int)tb_control->count); j++) + { + WLAN_OS_REPORT(("%4i id=0x%8x %s \n", j, +tb_control->entry[pos].loc, tb_control->entry[pos].msg)); + pos = (pos+1) % TB_NUM_ENTRIES; + } + tb_control->options = saved_options; +} +void tb_set_option(unsigned long option) +{ + tb_control->options |= option; +} + +void tb_reset_option(unsigned long option) +{ + tb_control->options &= ~option; +} + +void tb_scan(void) +{ + + int j,k, Size, nAllocs=0, nFrees=0; + unsigned long address, Allocs=0, Frees=0; + + for (j=0; j < TB_NUM_ENTRIES; j++) + { + Size = (int)tb_control->entry[j].p2; + if (Size > 0) /* Alloc */ + { + nAllocs += 1; + Allocs += Size; + address = tb_control->entry[j].p1; + for (k=j+1; k < TB_NUM_ENTRIES; k++) + { + if (address == tb_control->entry[k].p1) + { + if (tb_control->entry[k].p2 != -Size) + { + TB_PRINTF("Bad free size at 0x%lx address = 0x%lx Size = %ld Allocated = %d\n", + tb_control->entry[k].loc, tb_control->entry[k].p1, (long)tb_control->entry[k].p2, Size); + } + Frees += tb_control->entry[k].p2; + nFrees += 1; + break; + } + } + if (k == TB_NUM_ENTRIES) + { + TB_PRINTF("Memory leak at 0x%lx address = 0x%lx Size = %d\n", + tb_control->entry[j].loc, address, Size); + } + } + } + TB_PRINTF("tb_scan() Allocs = %ld nAllocs = %d Frees = %ld nFrees = %d\n", Allocs, nAllocs, Frees, nFrees); +} + diff --git a/wilink_6_1/platforms/os/linux/Makefile b/wilink_6_1/platforms/os/linux/Makefile new file mode 100644 index 0000000..a2217fb --- /dev/null +++ b/wilink_6_1/platforms/os/linux/Makefile @@ -0,0 +1,439 @@ + +## +## +## Application Make Flags +## +## + +# +# Host platform +# +HOST_PLATFORM ?= zoom2 + +# +# Statically link the CU +# +STATIC_LIB ?= y + +# +# Rebuild the supplicant +# +BUILD_SUPPL ?= y + +# +# Supplicant +# +SUPPL ?= ANDROID + +# +# XCC +# +XCC ?= n +#ifeq ($(XCC),y) +# SUPPL = DEVICESCAPE +#endif + +# +# FW +# +FW ?= 1273 + +# +# Full Async Mode +# +FULL_ASYNC ?= n + +# +# Build bmtrace performance tool +# +BMTRACE ?= n + +# +# Full Async Mode +# +USE_IRQ_ACTIVE_HIGH ?= n + +# +# Eth Support +# +ETH_SUPPORT ?= n + +# +# Debug +# +DEBUG ?= n + +## +## +## File lists and locations +## +## + +# +# DK_ROOT must be set prior to including common.inc +# +DK_ROOT = ../../.. + +# +# Includes common definitions and source file list +# +ifneq ($(KERNELRELEASE),) + include $(M)/$(DK_ROOT)/stad/build/linux/common.inc +else + include $(DK_ROOT)/stad/build/linux/common.inc +endif + +# +# Location and filename of the driver .lib file. +# +DRIVER_LIB_DIR = $(DK_ROOT)/stad/build/linux +DRIVER_LIB = $(DRIVER_LIB_DIR)/libestadrv.a + +# +# Location and filename of the OS .lib file. +# +OS_COMMON_DIR = $(DK_ROOT)/platforms/os/common/build/linux +OS_COMMON = $(OS_COMMON_DIR)/libuadrv.a + +# +# Location and filename of the linux OS object file. +# +OS_LINUX_DIR = $(DK_ROOT)/platforms/os/linux/build +OS_LINUX = $(OS_LINUX_DIR)/tiwlan_drv_stub.o +OS_AUXILIARY_LIBS = ../$(DRIVER_LIB)\ ../$(OS_COMMON) + +# +# Location and filename of the wlan user-mode programs root directory. +# +WLAN_CUDK_DIR = $(DK_ROOT)/CUDK + +# +# Location and filename of the wlan configuraion utility CLI program. +# +WLAN_CU_CLI_DIR = $(DK_ROOT)/CUDK/configurationutility +WLAN_CU_CLI = $(WLAN_CUDK_DIR)/output/wlan_cu + +# +# Location and filename of the wlan logger utility program. +# +WLAN_LOGGER_DIR = $(DK_ROOT)/CUDK/logger +WLAN_LOGGER = $(WLAN_CUDK_DIR)/output/wlan_logger + +# +# Location and filename of the WLAN loader utility +# +WLAN_LOADER_DIR = $(DK_ROOT)/CUDK/tiwlan_loader/ +WLAN_LOADER = $(WLAN_CUDK_DIR)/output/tiwlan_loader + +# +# Location and filename of the Linux Wireless Tools +# + +#LINUX_WIRELESS_TOOLS_DIR = $(DK_ROOT)/CUDK/wireless_tools +#LINUX_WIRELESS_TOOLS = $(LINUX_WIRELESS_TOOLS_DIR)/iwconfig + +# +# The location of the supplicant depending on whether or not we rebuild it. +# +SUPPLICANT = $(WLAN_CUDK_DIR)/output/wpa_supplicant + +# +# The combined linux module file. +# +OUTPUT_DIR = $(DK_ROOT)/platforms/os/linux +OUTPUT_FILE = $(OUTPUT_DIR)/tiwlan_drv.ko + +# +# Firmware +# +ifeq "$(FW)" "1273" + ifeq "$(FPGA1273)" "y" + FW_IMAGE ?= $(DK_ROOT)/fw/Latest/Fw1273_FPGA.bin + else + FW_IMAGE ?= $(DK_ROOT)/fw/Latest/Fw1273_CHIP.bin + endif +else +FW_IMAGE ?= $(DK_ROOT)/fw/Latest/Fw1251r1c.bin +endif + +FW_IMAGE_DEST_FILE ?= $(OUTPUT_DIR)/firmware.bin + +## +## +## Build process +## +## + +#ifneq ($(KERNELRELEASE),) + + +## +## +## This is the kernel build phase - set the appropriate arguments +## +## + +# +# Intermediate object name - this should be renamed to the desired object name +# after the kernel makefile finishes its work. +# +# obj-m = linux.o + +# +# List of object files the kernel makefile needs to compile. +# +# linux-y = $(DRIVER_LIB) $(OS_COMMON) $(OS_LINUX) + + +#else # ifneq ($(KERNELRELEASE),) + + +## +## +## This is the regular build phase - act according to the make actions +## +## + +# +# The location of the kernel makefile +# +KERNEL_DIR ?= + +# +# Dont use the original mkfs.jffs2 on TI's servers (voice.img won't work) +# +MAKEJFFS2 ?= /apps/crosstool/bin/mkfs.jffs2 + +# +# Used to check if the necessary packages are present. +# +HAVE_NONGPL = $(wildcard $(DRIVER_LIB_DIR)/Makefile) +HAVE_GPL = $(wildcard $(OS_LINUX_DIR)/Makefile) +# +# Combines all the three components to create the driver. +# +HOST_PLATFORM ?= *UNDEFINED* +ifeq "$(HOST_PLATFORM)" "omap2430" +TARGET = apps.tar +endif +ifeq "$(HOST_PLATFORM)" "omap3430" +TARGET = apps.tar +endif +ifeq "$(HOST_PLATFORM)" "zoom2" +TARGET = apps.tar +endif +ifeq "$(HOST_PLATFORM)" "zoom1" +TARGET = apps.tar +endif +ifeq "$(HOST_PLATFORM)" "*UNDEFINED*" +TARGET = help +endif +# +.PHONY: all +all: verifypackages .depend $(TARGET) +help: + @echo + @echo 'In order to select host platform one of the scripts: omap2430_env.tcsh or omap3430_env.tcsh must be run:' + @echo 'source omap2430_env.tcsh' + @echo 'or' + @echo 'source omap3430_env.tcsh' + @echo + @echo Default Compilation: + @echo ==================== + @echo HOST_PLATFORM = $(HOST_PLATFORM) // omap2430 or omap3430 + @echo DEBUG = $(DEBUG) // Include debug prints and statistics + @echo INTR = $(INTR) + @echo WSPI = $(WSPI) + @echo XCC = $(XCC) + @echo SUPPL = $(SUPPL) // WPA or DEVICESCAPE + @echo FPGA1273 = $(FPGA1273) // FPGA device support + @echo FULL_ASYNC = $(FULL_ASYNC) // Use only Asynchronous bus transactions + @echo USE_IRQ_ACTIVE_HIGH = $(USE_IRQ_ACTIVE_HIGH) // Use IRQ polarity high + @echo BMTRACE = $(BMTRACE) // Build also the bmtrace performance tool + @echo TARGET = $(TARGET) + @echo ETH_SUPPORT = $(ETH_SUPPORT) + @echo + @echo EXTRA CFLAGS = $(EXTRA_CFLAGS) + @echo +# +# Create the images +# +.PHONY: suppl.img voice.img apps.img apps.tar $(BUS_DRV) +MODULES_LIST = tiwlan_drv.ko +IMAGES_AND_FILES = dhcpcd wfa_dut dotnet_personal_test.cer dotnet_personal_test.pem dotnet_root.cer wpa_supplicant_wpa_tls.txt +TAR_FILE = $(HOST_PLATFORM)Binaries.tar + +apps.tar: apps +ifeq ($(STRIP),y) + @echo stripping... + cd $(OUTPUT_DIR) && $(CROSS_COMPILE)strip -g --strip-unneeded $(MODULES_LIST) +# cd $(DK_ROOT)/external_drivers/$(HOST_PLATFORM)/Linux/$(BUS_DRV) && $(CROSS_COMPILE)strip -g $(BUS_DRIVER_MODULE) +endif +# tar Ccvf $(OUTPUT_DIR) $(TAR_FILE) $(MODULES_LIST) tiwlan_loader +# tar Crvf $(DK_ROOT)/external_drivers/$(HOST_PLATFORM)/Linux/$(BUS_DRV) $(TAR_FILE) $(BUS_DRIVER_MODULE) +# tar Crvf . $(TAR_FILE) tiwlan.ini wpa_supplicant.txt +# tar Crvf images/$(HOST_PLATFORM) $(TAR_FILE) ${IMAGES_AND_FILES} + + + +apps.img: apps + mkcramfs apps apps.cram + mkimgti -t data -o apps.img apps.cram + +apps: $(OUTPUT_FILE) +# rm -f $(OUTPUT_DIR)/$(BUS_DRV_REMOVE).ko $(OUTPUT_DIR)/$(BUS_DRV_REMOVE)_test +# cp -f $(WLAN_CU_CLI) $(OUTPUT_DIR) +# cp -f $(WLAN_LOADER) $(OUTPUT_DIR) + +voice.img: + $(MAKEJFFS2) -l -r voice -e 0x10000 -o voice.jffs2 + mkimgti -t data -o voice.img voice.jffs2 + +suppl.img: +ifeq ($(BUILD_SUPPL),y) + cp -f $(SUPPLICANT) . +endif + mkcramfs suppl suppl.cram + mkimgti -t data -o suppl.img suppl.cram + +# +# Recursively cleans the driver, OS, bus and CLI files +# +.PHONY: clean +clean: + $(MAKE) -C $(DRIVER_LIB_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) WSPI=$(WSPI) INTR=$(INTR) XCC=$(XCC) INFO=$(INFO) STATIC_LIB=$(STATIC_LIB) clean + $(MAKE) -C $(OS_COMMON_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) WSPI=$(WSPI) INTR=$(INTR) XCC=$(XCC) INFO=$(INFO) STATIC_LIB=$(STATIC_LIB) clean + $(MAKE) -C $(OS_LINUX_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) WSPI=$(WSPI) INTR=$(INTR) XCC=$(XCC) INFO=$(INFO) STATIC_LIB=$(STATIC_LIB) clean +# $(MAKE) -C $(DK_ROOT)/external_drivers/$(HOST_PLATFORM)/Linux/$(BUS_DRV) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) KERNEL_DIR=$(KERNEL_DIR) OUTPUT_DIR=$(shell pwd)/$(OUTPUT_DIR) clean +# $(MAKE) -C $(WLAN_CUDK_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) XCC=$(XCC) clean +# $(MAKE) -C $(WLAN_CU_CLI_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) XCC=$(XCC) cleanall +# $(MAKE) -C $(WLAN_LOADER_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) XCC=$(XCC) clean +# $(MAKE) -C $(LINUX_WIRELESS_TOOLS_DIR) CROSS_COMPILE=$(CROSS_COMPILE) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) XCC=$(XCC) clean +# $(MAKE) -C $(DBG_MDL) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) KERNEL_DIR=$(KERNEL_DIR) clean + +# @rm -f suppl.* apps.* voice.* +# @rm -f *spi*.ko sdio.ko +# @rm -f $(OUTPUT_DIR)/wlan_cu + @rm -f $(OUTPUT_DIR)/tiwlan_drv.ko +# @rm -f $(OUTPUT_DIR)/wlan_logger $(OUTPUT_DIR)/tiwlan_drv.ko +# @rm -f wpa_supplicant +# @rm -f $(FW_IMAGE_DEST_FILE) +# @rm -rf *.o *.a \.*.o.cmd *~ *.~* core .depend dep +# @rm -rf $(OUTPUT_DIR)/tiwlan_loader + +# @rm -f tiwlan_drv.ko $(OUTPUT_DIR)/gwsi_drv.o $(OUTPUT_DIR)/debug_tools.o +# @rm -rf $(OUTPUT_DIR)/iwconfig apps/iwlist $(OUTPUT_DIR)/iwevent + +# in order to remove all .*.o.cmd + @find ../../../. -type f -print | grep .o.cmd | xargs rm -f +# in order to remove all *.order and *.symvers + @find ../../../. -type f -print | grep .order | xargs rm -f + @find ../../../. -type f -print | grep .symvers | xargs rm -f +# in order to remove the binaries tar + @rm -rf $(TAR_FILE) + + +# +# Verifies that all necessary packages are present. +# +.PHONY: verifypackages +verifypackages: +ifeq ($(strip $(HAVE_GPL)),) + @echo "*** The GPL package does not seem to be present. You will need both the" + @echo "*** GPL package and the Non GPL package to execute this makefile." + exit 1 +endif + +ifeq ($(strip $(HAVE_NONGPL)),) + @echo "*** The Non GPL package does not seem to be present. You will need both the" + @echo "*** GPL package and the Non GPL package to execute this makefile." + exit 1 +endif + + +# Builds the WSPI or SDIO driver +# +$(BUS_DRV): + $(MAKE) -C $(DK_ROOT)/external_drivers/$(HOST_PLATFORM)/Linux/$(BUS_DRV) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) KERNEL_DIR=$(KERNEL_DIR) OUTPUT_DIR=$(shell pwd)/$(OUTPUT_DIR) all + + +# +# Causes the driver and the configuration utility object files to get rebuilt +# +.depend: + rm -f $(OUTPUT_FILE) $(DRIVER_LIB) $(OS_COMMON) $(OS_LINUX) $(WLAN_CU_CLI) $(WLAN_LOADER) $(WLAN_LOGGER) + + +# +# Build the configuration utility; optionally rebuilds the supplicant +# +$(SUPPLICANT): $(WLAN_CU_CLI) + +.PHONY: CU_DK +CU_DK: + $(MAKE) -C $(WLAN_CUDK_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) XCC=$(XCC) STATIC_LIB=$(STATIC_LIB) SG=$(SG) ETH_SUPPORT=$(ETH_SUPPORT) + +#$(WLAN_CU_CLI): +# $(MAKE) -C $(WLAN_CU_CLI_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) XCC=$(XCC) STATIC_LIB=$(STATIC_LIB) SG=$(SG) + +#$(LINUX_WIRELESS_TOOLS): +# $(MAKE) -C $(LINUX_WIRELESS_TOOLS_DIR) CROSS_COMPILE=$(CROSS_COMPILE) + +#$(WLAN_LOADER): +# $(MAKE) -C $(WLAN_LOADER_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) XCC=$(XCC) STATIC_LIB=$(STATIC_LIB) SG=$(SG) + + +# +# Recursively builds the driver lib file +# +$(DRIVER_LIB): + $(MAKE) -C $(DRIVER_LIB_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) WSPI=$(WSPI) INTR=$(INTR) XCC=$(XCC) INFO=$(INFO) STATIC_LIB=$(STATIC_LIB) + + +# +# Recursively builds the OS lib file +# +$(OS_COMMON): + $(MAKE) -C $(OS_COMMON_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) WSPI=$(WSPI) INTR=$(INTR) XCC=$(XCC) INFO=$(INFO) STATIC_LIB=$(STATIC_LIB) OS_AUXILIARY_LIBS+=../../$(DRIVER_LIB) + + +# +# Recursively builds the linux OS stub object file +# +$(OS_LINUX): + $(MAKE) -C $(OS_LINUX_DIR) CROSS_COMPILE=$(CROSS_COMPILE) DEBUG=$(DEBUG) BUILD_SUPPL=$(BUILD_SUPPL) SUPPL=$(SUPPL) WSPI=$(WSPI) INTR=$(INTR) XCC=$(XCC) INFO=$(INFO) STATIC_LIB=$(STATIC_LIB) OS_AUXILIARY_LIBS+=../$(DRIVER_LIB) OS_AUXILIARY_LIBS+=../$(OS_COMMON) + + +# +# Recursively builds the driver object file +# +$(OUTPUT_FILE): $(DRIVER_LIB) $(OS_COMMON) $(OS_LINUX) + mv $(OS_LINUX) $(OUTPUT_FILE) + +.PHONY: link +link: + $(MAKE) -C $(KERNEL_DIR) M=`pwd` ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules + mv tiwlan_drv.ko $(OUTPUT_FILE) + + +# +# Builds the debug module object file +# +#$(DBG_MDL)/debug_module.ko: +# $(MAKE) -C $(DBG_MDL) KERNEL_DIR=$(KERNEL_DIR) +# mv $(DBG_MDL)/debug_module.ko $(OUTPUT_DIR)/debug_tools.o + + +# +# Not in use? +# +TAGS: $(SRCS) + { find ${DK_ROOT}/common -name '*.h' -print ; \ + find . -name '*.h' -print ; } | etags - + etags -a $(SRCS) + +CTAGS: $(SRCS) + find ${DK_ROOT} -iname '*.[ch]' -print | ctags --c++-types=+px --excmd=pattern -L - + + +#endif # ifneq ($(KERNELRELEASE),) diff --git a/wilink_6_1/platforms/os/linux/build/Makefile b/wilink_6_1/platforms/os/linux/build/Makefile new file mode 100644 index 0000000..c93bb80 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/build/Makefile @@ -0,0 +1,235 @@ + + +## +## +## Make Flags +## +## + +NO_ARCH_STRCMP ?= y +NO_USERMODE_WORKAROUND ?= n +MEM_ALLOC_TRACE ?= n +STACK_PROFILING_ON ?= n + +## +## +## File lists and locations +## +## + +# +# DK_ROOT must be set prior to including common.inc +# +DK_ROOT = ../../../.. + +# +# Includes common definitions and source file list +# +ifneq ($(KERNELRELEASE),) + include $(M)/$(DK_ROOT)/stad/build/linux/common.inc + include $(M)/$(DK_ROOT)/platforms/os/linux/build/os_sources.inc +else + include $(DK_ROOT)/stad/build/linux/common.inc + include $(DK_ROOT)/platforms/os/linux/build/os_sources.inc +endif + + +# +# List of linux OS files needed to be compiled +# +OS_SRCS = \ + $(DK_ROOT)/platforms/os/linux/src/WlanDrvIf.c \ + $(DK_ROOT)/platforms/os/linux/src/osapi.c \ + $(DK_ROOT)/platforms/os/linux/src/osmemapi.c \ + $(DK_ROOT)/platforms/os/linux/src/osRgstry_parser.c \ + $(DK_ROOT)/platforms/os/linux/src/ipc_k.c \ + $(DK_ROOT)/platforms/os/linux/src/WlanDrvWext.c \ + $(DK_ROOT)/platforms/os/linux/src/CmdInterpretWext.c \ + $(DK_ROOT)/platforms/os/linux/src/RxBuf.c \ + $(DK_ROOT)/platforms/hw/linux/host_platform.c \ + $(DK_ROOT)/external_drivers/sdio/linux/SdioDrv.c +# $(DK_ROOT)/external_drivers/$(HOST_PLATFORM)/Linux/sdio/SdioDrv.c +# $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux/host_platform.c + +ifeq ($(STACK_PROFILING_ON),y) + OS_SRCS += $(DK_ROOT)/platforms/os/linux/src/stack_profile.c + EXTRA_CFLAGS += -D STACK_PROFILE +endif + +ifeq ($(NO_ARCH_STRCMP),y) + OS_SRCS += $(DK_ROOT)/platforms/os/linux/src/string.c +endif + +OS_INCS = $(DK_ROOT)/platforms/os/linux/inc $(DK_ROOT)/platforms/os/linux/src $(DK_ROOT)/platforms/os/common/inc +#OS_INCS += $(DK_ROOT)/stad/src/core/EvHandler $(DK_ROOT)/Test $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux +OS_INCS += $(DK_ROOT)/stad/src/core/EvHandler $(DK_ROOT)/Test $(DK_ROOT)/platforms/hw/linux + +ifeq ($(WSPI),y) + OS_SRCS += $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux/WspiAdapter.c + OS_INCS += $(EXT_DRV)/$(HOST_PLATFORM)/Linux/spi +endif + +ifeq ($(WSPI),n) +# OS_SRCS += $(DK_ROOT)/platforms/hw/host_platform_$(HOST_PLATFORM)/linux/SdioAdapter.c +# OS_INCS += $(EXT_DRV)/$(HOST_PLATFORM)/Linux/sdio + OS_SRCS += $(DK_ROOT)/platforms/hw/linux/SdioAdapter.c + OS_INCS += $(EXT_DRV)/sdio/linux +endif + +OS_OBJS = $(patsubst %.c, %.o, $(OS_SRCS)) + +# +# OS include paths required for compilation. +# + + +# +# Firmware +# +FW_SRCS = ./firmware.c ./radio.c +FW_OBJS = $(patsubst %.c, %.o, $(FW_SRCS)) +ifeq "$(FW)" "1273" +FW_IMAGE = $(DK_ROOT)/fw/Latest/Fw1273.bin +else +FW_IMAGE = $(DK_ROOT)/fw/Latest/Fw1251rc1.bin +endif +RAD_IMAGE = $(DK_ROOT)/fw/Latest/nvs_map.bin + + +# +# Location and filename of the linux OS stub object file created by this makefile. +# +OUTPUT_DIR = $(DK_ROOT)/platforms/os/linux/build +OUTPUT_FILE = $(OUTPUT_DIR)/tiwlan_drv_stub.o +OUTPUT_LIB = $(OUTPUT_DIR)/tiwlan_drv_stub.a + + + + + +## +## +## Compilation Directives +## +## +ifeq ($(NO_USERMODE_WORKAROUND),y) + EXTRA_CFLAGS += -D NO_USERMODE_WORKAROUND +endif + +ifeq ($(POLLING_MODE),y) + EXTRA_CFLAGS += -D TIWLAN_OMAP1610_IRQ=0 +endif + +ifeq ($(MEM_ALLOC_TRACE),y) + EXTRA_CFLAGS += -D TI_MEM_ALLOC_TRACE +endif + + + + + +## +## +## Build process +## +## + +ifneq ($(KERNELRELEASE),) + + + ## + ## + ## This is the kernel build phase - set the appropriate arguments + ## + ## + + # + # Adds the current directory as a prefix to all include directories. + # + EXTRA_CFLAGS += $(addprefix -I$(M)/, $(OS_DK_INCS) $(OS_INCS)) + + # + # Intermediate object name - this should be renamed to the desired object name + # after the kernel makefile finishes its work. + # + obj-m = tiwlan_drv.o + # + # List of object files the kernel makefile needs to compile. + # + tiwlan_drv-y = $(OS_OBJS) $(OS_AUXILIARY_LIBS) + + +else # ifneq ($(KERNELRELEASE),) + + +## +## +## This is the regular build phase - act according to the make actions +## +## + +# +# The location of the kernel makefile +# +KERNEL_DIR ?= $(KERNEL_DIR) + + +# +# Build the linux OS stub object file +# +.PHONY: all +all: .depend $(OUTPUT_DIR) $(OUTPUT_FILE) + +# +# Prints variables +# +.PHONY: help +help: + @echo Default Compilation: PLATFORM=$(PLATFORM) DEBUG=$(DEBUG) INTR=$(INTR) WSPI=$(WSPI) XCC=$(XCC) EXTRA CFLAGS: $(EXTRA_CFLAGS) + + +# +# Recursively cleans the linux OS stub object files +# +.PHONY: clean +clean: + $(MAKE) -C $(KERNEL_DIR) M=`pwd` ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) clean + @rm -f *.o *.a .*.o.cmd *~ *.~* core .depend dep $(OS_OBJS) $(FW_SRCS) $(FW_OBJS) + + +# +# Causes the linux OS stub object file to get rebuilt +# +.depend: + rm -f $(OUTPUT_FILE) + +# +# Make sure the output directory exists +# +$(OUTPUT_DIR): + mkdir -p $(OUTPUT_DIR) + +# +# Recursively builds the linux OS stub object file +# +$(OUTPUT_FILE): + $(MAKE) -C $(KERNEL_DIR) M=`pwd` ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) modules + $(CROSS_COMPILE)$(AR) rcs $(OUTPUT_LIB) $(OS_OBJS) + mv tiwlan_drv.ko $(OUTPUT_FILE) + + +# +# Handles firmware image and radio module for when firmware is statically linked +# +$(BIN2C): $(BIN2C).c + gcc $^ -o $@ + +firmware.c: $(FW_IMAGE) $(BIN2C) + $(BIN2C) $< tiwlan_fwimage > $@ + +radio.c: $(RAD_IMAGE) $(BIN2C) + $(BIN2C) $< tiwlan_radimage > $@ + + +endif # ifneq ($(KERNELRELEASE),) + diff --git a/wilink_6_1/platforms/os/linux/build/common.inc b/wilink_6_1/platforms/os/linux/build/common.inc new file mode 100644 index 0000000..544a854 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/build/common.inc @@ -0,0 +1,168 @@ + + +## +## +## Directory Locations +## +## + +COMMON := $(DK_ROOT)/stad +COMSRC := $(COMMON)/src +TWD := $(DK_ROOT)/TWD +UTILS := $(DK_ROOT)/utils +TESTSRC := $(DK_ROOT)/Test +LINUX_PFORM := $(DK_ROOT)/platforms/os/linux +PLATFORMS := $(DK_ROOT)/platforms +EXT_DRV := $(DK_ROOT)/external_drivers +TXN := $(DK_ROOT)/Txn + +## +## +## Make Flags +## +## + +# +# Compile with FW1273 or FW1251 +# +FW ?= 1273 + +# +# Compile with XCC support or not +# +XCC ?= n + +# +# Choose the bus type (n for SDIO, y for WSPI) +# +WSPI ?= n + +# +# Use periodic interrupt +# +INTR ?= y + +# +# Enable or disable debugging +# +DEBUG ?= y +KERNEL_DEBUGGER ?= n +STRIP ?= y +BMTRACE ?= n +# +# Enable or disable OS and init messages +# +INFO ?= n + +# +# 1273 FPGA platform +# +FPGA1273 ?= n + +# +# Enable trace buffer +# +TI_TRACE_BUFFER ?= n + +## +## +## Driver Compilation Directives +## +## +ifeq "$(HOST_PLATFORM)" "omap3430" + DK_DEFINES += -D HOST_PLATFORM_OMAP3430 +endif +ifeq "$(HOST_PLATFORM)" "zoom2" + DK_DEFINES += -D HOST_PLATFORM_ZOOM2 +endif +ifeq "$(HOST_PLATFORM)" "zoom1" + DK_DEFINES += -D HOST_PLATFORM_ZOOM1 +endif + +ifeq ($(XCC),y) + DK_DEFINES += -D XCC_MODULE_INCLUDED +endif + +ifeq ($(INTR),n) + DK_DEFINES += -D PRIODIC_INTERRUPT +endif + +ifeq ($(DEBUG),y) + DK_DEFINES += -D TI_DBG + DK_DEFINES += -D REPORT_LOG + DK_DEFINES += -O2 + DK_DEFINES += -D PRINTF_ROLLBACK +else + DK_DEFINES += -D TI_DBG + DK_DEFINES += -U REPORT_LOG + DK_DEFINES += -O2 +endif +ifeq ($(KERNEL_DEBUGGER),y) + DK_DEFINES += -g -O2 + STRIP = n +endif +export KERNEL_DEBUGGER + +DK_DEFINES += -D __BYTE_ORDER_LITTLE_ENDIAN + +ifeq ($(TI_TRACE_BUFFER),y) + DK_DEFINES += -D TI_TRACE_BUF +endif + +ifeq ($(BMTRACE),y) + DK_DEFINES += -D TIWLAN_BMTRACE +endif + +## +## +## Platform Compilation Directives +## +## + +# +# Bus Driver +# +ifeq ($(WSPI),y) + BUS_DRV = spi + BUS_DRV_REMOVE = sdio + BUS_DRIVER_MODULE = spi.ko + PFORM_DEFINES += -D WSPI +else + BUS_DRV = sdio + BUS_DRV_REMOVE = spi + BUS_DRV = sdio + BUS_DRV_REMOVE = spi + BUS_DRIVER_MODULE = sdio.ko +endif + +ifeq ($(INFO),y) + PFORM_DEFINES += -D OS_INFO_MESSAGES + PFORM_DEFINES += -D INIT_MESSAGES +endif + +PFORM_DEFINES += -D HOST_COMPILE +PFORM_DEFINES += -D FW_RUNNING_AS_STA +PFORM_DEFINES += -D TNETW1273 + +ifeq ($(FPGA1273),y) + PFORM_DEFINES += -D FPGA1273_STAGE_ +endif + +ifeq ($(FULL_ASYNC),y) + PFORM_DEFINES += -D FULL_ASYNC_MODE +endif + +ifeq ($(USE_IRQ_ACTIVE_HIGH),y) + PFORM_DEFINES += -D USE_IRQ_ACTIVE_HIGH +endif + +## +## +## Miscellaneous Compilation Directivcs +## +## + +EXTRA_CFLAGS += -fsigned-char +EXTRA_CFLAGS += -D __LINUX__ +EXTRA_CFLAGS += $(DK_DEFINES) +EXTRA_CFLAGS += $(PFORM_DEFINES) diff --git a/wilink_6_1/platforms/os/linux/build/os_sources.inc b/wilink_6_1/platforms/os/linux/build/os_sources.inc new file mode 100644 index 0000000..7578954 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/build/os_sources.inc @@ -0,0 +1,109 @@ + +#start of OS_DK_INCS_FILES# do not remove or change this comment +OS_DK_INCS_FILES = \ + $(COMMON)/Export_Inc/Ethernet.h \ + $(COMMON)/Export_Inc/TI_IPC_Api.h \ + $(COMMON)/Export_Inc/paramOut.h \ + $(COMMON)/Export_Inc/tiwlnif.h \ + $(COMMON)/Export_Inc/STADExternalIf.h \ + $(COMMON)/Export_Inc/bssTypes.h \ + $(COMMON)/Export_Inc/InternalCmdCodes.h \ + $(COMMON)/Export_Inc/coreDefaultParams.h \ + $(COMMON)/Export_Inc/TI_Results.h \ + $(COMMON)/Export_Inc/privateCmd.h \ + $(COMMON)/Export_Inc/p_buffer.h \ + $(COMSRC)/Sta_Management/mlmeApi.h \ + $(COMSRC)/Sta_Management/healthMonitor.h \ + $(COMSRC)/Connection_Managment/rsnApi.h \ + $(COMSRC)/Ctrl_Interface/DrvMain.h \ + $(COMSRC)/Ctrl_Interface/CmdHndlr.h \ + $(COMSRC)/Ctrl_Interface/CmdDispatcher.h \ + $(COMSRC)/Ctrl_Interface/CmdInterpret.h \ + $(COMSRC)/Ctrl_Interface/EvHandler.h \ + $(COMSRC)/Data_link/txDataQueue_Api.h \ + $(COMSRC)/Data_link/txMgmtQueue_Api.h \ + $(COMSRC)/Ctrl_Interface/DrvMainModules.h \ + $(COMSRC)/Application/roamingMngrTypes.h \ + $(COMSRC)/Application/scanMngrTypes.h \ + $(UTILS)/fsm.h \ + $(UTILS)/report.h \ + $(UTILS)/utils.h \ + $(UTILS)/tidef.h \ + $(UTILS)/rate.h \ + $(UTILS)/802_11Defs.h \ + $(UTILS)/osDot11.h \ + $(UTILS)/commonTypes.h \ + $(UTILS)/CmdInterfaceCodes.h \ + $(UTILS)/tiQosTypes.h \ + $(UTILS)/version.h \ + $(TWD)/TWDriver/TWDriver.h \ + $(TWD)/TWDriver/TWDriverMsr.h \ + $(TWD)/TWDriver/TWDriverRate.h \ + $(TWD)/TWDriver/TWDriverScan.h \ + $(TWD)/TWDriver/Device.h \ + $(TWD)/TWDriver/Device1273.h \ + $(TWD)/Ctrl/Export_Inc/CmdQueue_api.h \ + $(TWD)/MacServices/Export_Inc/MacServices_api.h \ + $(TWD)/FW_Transfer/Export_Inc/rxXfer_api.h \ + $(TWD)/FW_Transfer/Export_Inc/fwDebug_api.h \ + $(TWD)/FirmwareApi/public_descriptors.h \ + $(TWD)/FirmwareApi/public_infoele.h \ + $(TWD)/FirmwareApi/public_types.h \ + $(TWD)/FirmwareApi/public_host_int.h \ + $(TWD)/FirmwareApi/public_radio.h \ + $(TWD)/FirmwareApi/public_commands.h \ + $(TWD)/FirmwareApi/public_event_mbox.h \ + $(TWD)/TwIf/TwIf.h \ + $(TXN)/BusDrv.h \ + $(TXN)/TxnQueue.h \ + $(EXT_APP)/Linux/bmtrace/Export_Inc \ + $(TESTSRC)/debug.h + +#start of OS_DK_INCS_FILES_XCC# do not remove or change this comment +ifeq ($(XCC),y) + OS_DK_INCS_FILES_XCC = \ + $(COMMON)/Export_Inc/XCC/paramOutXCC.h \ + $(UTILS)/XCC/osDot11XCC.h + + OS_DK_INCS_FILES += $(OS_DK_INCS_FILES_XCC) +endif +#end of OS_DK_INCS_FILES_XCC# do not remove or change this comment + +#start of OS_DK_INCS_FILES# do not remove or change this comment + + +#start of OS_DK_INCS# do not remove or change this comment +OS_DK_INCS = \ + $(COMMON)/Export_Inc \ + $(COMSRC)/AirLink_Managment \ + $(COMSRC)/Application \ + $(COMSRC)/Connection_Managment \ + $(COMSRC)/Ctrl_Interface \ + $(COMSRC)/Data_link \ + $(COMSRC)/Sta_Management \ + $(UTILS) \ + $(TWD) \ + $(TWD)/Ctrl \ + $(TWD)/Data_Service/Export_Inc \ + $(TWD)/FW_Transfer/Export_Inc \ + $(TWD)/Ctrl/Export_Inc \ + $(TWD)/MacServices/Export_Inc \ + $(TWD)/FirmwareApi \ + $(TWD)/TwIf \ + $(TWD)/MacServices \ + $(TWD)/TWDriver \ + $(TESTSRC) \ + $(TXN) + +#start of OS_DK_INCS_XCC# do not remove or change this comment +ifeq ($(XCC),y) + OS_DK_INCS_XCC = \ + $(COMMON)/Export_Inc/XCC \ + $(COMSRC)/XCC \ + $(UTILS)/XCC + + OS_DK_INCS += $(OS_DK_INCS_XCC) +endif +#end of OS_DK_INCS_XCC# do not remove or change this comment + +#start of OS_DK_INCS# do not remove or change this comment diff --git a/wilink_6_1/platforms/os/linux/inc/CmdInterpretWext.h b/wilink_6_1/platforms/os/linux/inc/CmdInterpretWext.h new file mode 100644 index 0000000..b5e0c5b --- /dev/null +++ b/wilink_6_1/platforms/os/linux/inc/CmdInterpretWext.h @@ -0,0 +1,85 @@ +/* + * CmdInterpretWext.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + +#ifndef _CMD_INTERPRET_WEXT_H_ +#define _CMD_INTERPRET_WEXT_H_ +/* Command interpreter header file */ + +#include <linux/wireless.h> + +typedef struct +{ + TI_UINT8 iw_auth_wpa_version; + TI_UINT8 iw_auth_cipher_pairwise; + TI_UINT8 iw_auth_cipher_group; + TI_UINT8 iw_auth_key_mgmt; + TI_UINT8 iw_auth_80211_auth_alg; +} wext_auth_info; + +typedef struct +{ + TI_HANDLE hOs; /* Pointer to the adapter object */ + TI_UINT8 nickName[IW_ESSID_MAX_SIZE + 1]; /* Interface nickname */ + wext_auth_info wai; /* Authentication parameters */ + struct iw_statistics wstats; /* Statistics information */ + TI_HANDLE hEvHandler; /* Event-handler module handle */ + TI_HANDLE hCmdHndlr; /* Handle to the Command-Handler */ + TI_HANDLE hCmdDispatch; /* Handle to the Command-Dispatcher */ + TI_HANDLE hEvents[IPC_EVENT_MAX]; /* Contains handlers of events registered to */ + TConfigCommand *pAsyncCmd; /* Pointer to the command currently being processed */ + void *pAllocatedBuffer; + TI_UINT32 AllocatedBufferSize; +} cmdInterpret_t; + +#define WLAN_PROTOCOL_NAME "IEEE 802.11ABG" + +typedef enum _TIWLAN_KEY_FLAGS +{ + TIWLAN_KEY_FLAGS_TRANSMIT = 0x80000000, /* Used whenever key should be immidiately used for TX */ + TIWLAN_KEY_FLAGS_PAIRWISE = 0x40000000, /* Used to indicate pairwise key */ + TIWLAN_KEY_FLAGS_SET_KEY_RSC = 0x20000000, /* Used to set RSC (receive sequence counter) to driver */ + TIWLAN_KEY_FLAGS_AUTHENTICATOR = 0x10000000 /* Not used currently */ +} TIWLAN_KEY_FLAGS; + +#define TKIP_KEY_LENGTH 32 +#define AES_KEY_LENGTH 16 +#define WEP_KEY_LENGTH_40 5 +#define WEP_KEY_LENGTH_104 13 + +#define MAX_THROUGHPUT 5500000 + +#define WEXT_OK 0 +#define WEXT_NOT_SUPPORTED -EOPNOTSUPP +#define WEXT_INVALID_PARAMETER -EINVAL + +#endif /* _CMD_INTERPRET_WEXT_H_ */ diff --git a/wilink_6_1/platforms/os/linux/inc/RxBuf_linux.h b/wilink_6_1/platforms/os/linux/inc/RxBuf_linux.h new file mode 100644 index 0000000..b853a7c --- /dev/null +++ b/wilink_6_1/platforms/os/linux/inc/RxBuf_linux.h @@ -0,0 +1,53 @@ +/* + * RxBuf_linux.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/***************************************************************************/ +/* */ +/* MODULE: buf.h */ +/* PURPOSE: manages the allocation/free and field access of the BUF */ +/* */ +/***************************************************************************/ +#ifndef _BUF_LINUX_H_ +#define _BUF_LINUX_H_ + +#include "RxBuf.h" +typedef struct _rx_head_ +{ + struct sk_buff *skb; +} rx_head_t; + +#define RX_HEAD_LEN_ALIGNED ((sizeof(rx_head_t) + 0x3) & ~0x3) + +#endif + diff --git a/wilink_6_1/platforms/os/linux/inc/WlanDrvIf.h b/wilink_6_1/platforms/os/linux/inc/WlanDrvIf.h new file mode 100644 index 0000000..07fd05f --- /dev/null +++ b/wilink_6_1/platforms/os/linux/inc/WlanDrvIf.h @@ -0,0 +1,129 @@ +/* + * WlanDrvIf.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * src/WlanDrvIf.h + * + */ + +#ifndef WLAN_DRV_IF_H +#define WLAN_DRV_IF_H + +#include <linux/version.h> +#include <linux/completion.h> +#include <linux/netdevice.h> +#include <linux/workqueue.h> +#include <mach/gpio.h> +#ifdef CONFIG_HAS_WAKELOCK +#include <linux/wakelock.h> +#endif + +#include "tidef.h" +#include "WlanDrvCommon.h" +#include "paramOut.h" +#include "DrvMain.h" +#include "windows_types.h" + +#define TIWLAN_DRV_NAME "tiwlan" +#define DRIVERWQ_NAME "tiwlan_wq" +#define TIWLAN_DRV_IF_NAME TIWLAN_DRV_NAME"%d" + +#ifdef TI_DBG +#define ti_dprintf(log, fmt, args...) do { \ + if (log != TIWLAN_LOG_OTHER) { \ + printk(KERN_INFO fmt, ## args); \ + } \ +} while (0) +#else +#define ti_dprintf(log, fmt, args...) +#endif + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) +#define NETDEV_SET_PRIVATE(dev, drv) dev->priv = drv +#define NETDEV_GET_PRIVATE(dev) dev->priv +#else +#define NETDEV_SET_PRIVATE(dev, drv) dev->ml_priv = drv +#define NETDEV_GET_PRIVATE(dev) dev->ml_priv +#endif + +#define ti_nodprintf(log, fmt, args...) + +typedef enum +{ + TIWLAN_LOG_ERROR, + TIWLAN_LOG_INFO, + TIWLAN_LOG_OTHER, + TIWLAN_LOG_DUMMY +} EWlanDrvIfLog; + +/* + * TCmdRespUnion is defined for each OS: + * For Linx and WM that defined is empty. + * For OSE the new typedef includes all "Done" typedefs in union from EMP code (H files). + */ +typedef struct +{ +} TCmdRespUnion; + + +/* Driver object */ +typedef struct +{ + TWlanDrvIfCommon tCommon; /* The driver object common part */ + + int irq; /* The OS IRQ handle */ + unsigned long irq_flags; /* The IRQ flags */ + struct workqueue_struct *tiwlan_wq; /* Work Queue */ + struct work_struct tWork; /* The OS work handle. */ + spinlock_t lock; /* The OS spinlock handle. */ + unsigned long flags; /* For saving the cpu flags during spinlock */ + TI_HANDLE hPollTimer;/* Polling timer for working without interrupts (debug) */ + struct net_device_stats stats; /* The driver's statistics for OS reports. */ + struct sock *wl_sock; /* The OS socket used for sending it the driver events */ + struct net_device *netdev; /* The OS handle for the driver interface. */ + int wl_packet; /* Remember to stay awake */ + int wl_count; /* Wifi wakelock counter */ +#ifdef CONFIG_HAS_WAKELOCK + struct wake_lock wl_wifi; /* Wifi wakelock */ + struct wake_lock wl_rxwake; /* Wifi rx wakelock */ +#endif + NDIS_HANDLE ConfigHandle;/* Temp - For Windows compatibility */ + +} TWlanDrvIfObj, *TWlanDrvIfObjPtr; + + +#define NETDEV(drv) (((TWlanDrvIfObj*)(drv))->netdev) + +#endif /* WLAN_DRV_IF_H*/ diff --git a/wilink_6_1/platforms/os/linux/inc/arch_ti.h b/wilink_6_1/platforms/os/linux/inc/arch_ti.h new file mode 100644 index 0000000..edc8c85 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/inc/arch_ti.h @@ -0,0 +1,50 @@ +/* + * arch_ti.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * inc/arch_ti.h + * + * Architecture and OS specific include files + * + */ + +#ifndef __ARCH_TI_H__ +#define __ARCH_TI_H__ + +#define __NO_VERSION__ + +#include <linux/module.h> +#include <linux/kernel.h> + +#endif diff --git a/wilink_6_1/platforms/os/linux/inc/ioctl_init.h b/wilink_6_1/platforms/os/linux/inc/ioctl_init.h new file mode 100644 index 0000000..b4ea56f --- /dev/null +++ b/wilink_6_1/platforms/os/linux/inc/ioctl_init.h @@ -0,0 +1,68 @@ +/* + * ioctl_init.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * inc/ioctl_init.h + * + */ + +#ifndef TI1610_IOCTL_INIT +#define TI1610_IOCTL_INIT + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/netdevice.h> + +#ifndef DRIVER_NAME +#define DRIVER_NAME "TIWLAN" +#endif + +#if defined(DEBUG_MESSAGES) +# define print_deb(fmt, arg...) printk(KERN_INFO DRIVER_NAME ": " fmt,##arg) +#else +# define print_deb(fmt, arg...) +#endif + +#if defined(OS_INFO_MESSAGES) +# define print_info(fmt, arg...) printk(KERN_INFO DRIVER_NAME ": " fmt,##arg) +#else +# define print_info(fmt, arg...) +#endif + +#ifndef print_err +# define print_err(fmt, arg...) printk(KERN_ERR DRIVER_NAME ": " fmt,##arg) +#endif + + +#endif /* TI1610_IOCTL_INIT */ diff --git a/wilink_6_1/platforms/os/linux/inc/osTIType.h b/wilink_6_1/platforms/os/linux/inc/osTIType.h new file mode 100644 index 0000000..8549dfb --- /dev/null +++ b/wilink_6_1/platforms/os/linux/inc/osTIType.h @@ -0,0 +1,68 @@ +/* + * osTIType.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * inc/osTIType.h + * + * This module contains eSTA-DK types definitions + * + */ + +#ifndef __OSTITYPE_H__ +#define __OSTITYPE_H__ + +#ifdef __KERNEL__ +#include <linux/compiler.h> /* likely()/unlikely() */ +#endif + +typedef char TI_CHAR; +typedef signed char TI_INT8; +typedef unsigned char TI_UINT8; +typedef signed short TI_INT16; +typedef unsigned short TI_UINT16; +typedef signed int TI_INT32; +typedef unsigned int TI_UINT32; +typedef signed long long TI_INT64; +typedef unsigned long long TI_UINT64; + +#define TI_CONST64(x) (x##LL) + +#define TI_LIKELY likely +#define TI_UNLIKELY unlikely + +#define INLINE inline + +#endif /* __OSTITYPE_H__*/ + + diff --git a/wilink_6_1/platforms/os/linux/inc/osdot11nousermode.h b/wilink_6_1/platforms/os/linux/inc/osdot11nousermode.h new file mode 100644 index 0000000..8df6ff3 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/inc/osdot11nousermode.h @@ -0,0 +1,47 @@ +/* + * osdot11nousermode.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/*--------------------------------------------------------------------------*/ +/* Module: osDot11.h */ +/**/ +/* Purpose: */ +/**/ +/*--------------------------------------------------------------------------*/ +#ifndef __OSDOT11NO_USER_MODE_H__ +#define __OSDOT11NO_USER_MODE_H__ + +#define OID_802_11_CAPABILITY 0x0D010218 +#define OID_802_11_PMKID 0x0D010219 + +#endif diff --git a/wilink_6_1/platforms/os/linux/inc/stack_profile.h b/wilink_6_1/platforms/os/linux/inc/stack_profile.h new file mode 100644 index 0000000..90c114b --- /dev/null +++ b/wilink_6_1/platforms/os/linux/inc/stack_profile.h @@ -0,0 +1,9 @@ +#ifndef _STACK_PROFILE_H_ +#define _STACK_PROFILE_H_ +unsigned long check_stack(unsigned long *base); +unsigned long check_stack_start(unsigned long *base, unsigned long real_sp, + int id); +unsigned long check_stack_stop(unsigned long *base, int id); +unsigned long save_stack_context(char *name, int id); +void print_stack(int id); +#endif diff --git a/wilink_6_1/platforms/os/linux/inc/tracebuf.h b/wilink_6_1/platforms/os/linux/inc/tracebuf.h new file mode 100644 index 0000000..249b785 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/inc/tracebuf.h @@ -0,0 +1,48 @@ +/* + * tracebuf.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + +/* + * Benchmark tracing utility + */ +#include <linux/module.h> + +#ifndef TB_TRACE_H + +#define TB_TRACE_H + +#define TB_MALLOC(size) kmalloc(size, GFP_ATOMIC); +#define TB_FREE kfree +#define TB_PRINTF printk +#define TB_ID current->pid + +#endif diff --git a/wilink_6_1/platforms/os/linux/inc/wbuf.h b/wilink_6_1/platforms/os/linux/inc/wbuf.h new file mode 100644 index 0000000..1dbeb1d --- /dev/null +++ b/wilink_6_1/platforms/os/linux/inc/wbuf.h @@ -0,0 +1,119 @@ +/* + * wbuf.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/***************************************************************************/ +/* */ +/* MODULE: wbuf.h */ +/* PURPOSE: manages the allocation/free and field access of the WBUF */ +/* */ +/***************************************************************************/ +#ifndef _WBUF_H_ +#define _WBUF_H_ + +#include <linux/version.h> +#include <linux/skbuff.h> +#include "tidef.h" +#include "queue.h" + +typedef void WBUF; + +/* Packet types */ +typedef enum +{ + TX_PKT_TYPE_MGMT = 0x01, + TX_PKT_TYPE_EAPOL = 0x02, + TX_PKT_TYPE_ETHER = 0x04, /* Data packets from the Network interface. */ + TX_PKT_TYPE_WLAN_DATA = 0x08 /* Currently includes Null and IAPP packets. */ +} TX_PKT_TYPE; + +#define TX_PKT_FLAGS_LINK_TEST 0x1 /* Tx-Packet-Flag */ +#define WSPI_PAD_BYTES 16 /* Add padding before data buffer for WSPI overhead */ + +/* user callback definition (in tx complete) */ +typedef void *CB_ARG; +typedef void (*CB_FUNC)(CB_ARG cb_arg); + +/* + * wbuf user fields: + */ +typedef struct +{ + TQueNodeHdr queNodeHdr; /* The header used for queueing the WBUF */ + TX_PKT_TYPE pktType; /* wbuf packet type */ + CB_FUNC cb_func; /* callback function to use in tx complete */ + CB_ARG cb_arg; /* callback argument to use in tx complete */ + TI_UINT8 Tid; /* WLAN TID (traffic identity) */ + TI_UINT8 hdrLen; /* WLAN header length, not including alignment pad. */ + TI_UINT8 flags; /* Some application flags, see Tx-Packet-Flags defs above. */ +} WBUF_PARAMS; + + + +#define WBUF_DATA(pWbuf) ( ((struct sk_buff *)(pWbuf))->data ) +#define WBUF_LEN(pWbuf) ( ((struct sk_buff *)(pWbuf))->len ) +#define WBUF_PRIORITY(pWbuf) ( ((struct sk_buff *)(pWbuf))->priority ) +#define WBUF_DEV(pWbuf) ( ((struct sk_buff *)(pWbuf))->dev ) +#define WBUF_DEV_SET(pWbuf,pDev) ( ((struct sk_buff *)(pWbuf))->dev) = ((struct net_device *)(pDev)) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) +#define WBUF_STAMP(pWbuf) ( ((struct sk_buff *)(pWbuf))->tstamp.off_usec ) +#else +#define WBUF_STAMP(pWbuf) ( ((struct sk_buff *)(pWbuf))->tstamp.tv.nsec ) +#endif +#define WBUF_CB(pWbuf) ( ((struct sk_buff *)(pWbuf))->cb ) +#define WBUF_PKT_TYPE(pWbuf) ( ((WBUF_PARAMS *)&(WBUF_CB(pWbuf)))->pktType ) +#define WBUF_CB_FUNC(pWbuf) ( ((WBUF_PARAMS *)&(WBUF_CB(pWbuf)))->cb_func ) +#define WBUF_CB_ARG(pWbuf) ( ((WBUF_PARAMS *)&(WBUF_CB(pWbuf)))->cb_arg ) +#define WBUF_TID(pWbuf) ( ((WBUF_PARAMS *)&(WBUF_CB(pWbuf)))->Tid ) +#define WBUF_HDR_LEN(pWbuf) ( ((WBUF_PARAMS *)&(WBUF_CB(pWbuf)))->hdrLen ) +#define WBUF_FLAGS(pWbuf) ( ((WBUF_PARAMS *)&(WBUF_CB(pWbuf)))->flags ) + +/* The offset of the node-header field from the WBUF entry (for queueing) */ +#define WBUF_NODE_HDR_OFFSET \ + ( (unsigned long) &( ( (WBUF_PARAMS *) &( ( (struct sk_buff *)0 )->cb ) )->queNodeHdr ) ) + +/* + * Allocate WBUF for Tx/Rx packets. + * Add 16 bytes before the data buffer for WSPI overhead! + */ +static inline WBUF *WbufAlloc (TI_HANDLE hOs, TI_UINT32 len) +{ + WBUF *pWbuf = alloc_skb (len + WSPI_PAD_BYTES, GFP_ATOMIC); + WBUF_DATA (pWbuf) += WSPI_PAD_BYTES; + return pWbuf; +} + +#define WbufFree(hOs, pWbuf) ( dev_kfree_skb((struct sk_buff *)pWbuf) ) +#define WbufReserve(hOs, pWbuf,len) ( skb_reserve((struct sk_buff *)pWbuf,(int)len) ) + +#endif diff --git a/wilink_6_1/platforms/os/linux/inc/windows_types.h b/wilink_6_1/platforms/os/linux/inc/windows_types.h new file mode 100644 index 0000000..1cc83bf --- /dev/null +++ b/wilink_6_1/platforms/os/linux/inc/windows_types.h @@ -0,0 +1,195 @@ +/* + * windows_types.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * inc/windows_types.h + * + */ + +#ifndef _WINDOWS_TYPES_H +#define _WINDOWS_TYPES_H + +#include "tidef.h" +#include "ioctl_init.h" + +/*typedef TI_BOOL TI_BOOL, *PBOOLEAN;*/ +typedef TI_UINT16 USHORT, *PUSHORT; +typedef char CHAR; +typedef const char * LPCSTR; + +#define IN +#define OUT +#define NDIS_MAX_STRING_LEN 361 + +typedef struct _STRING { + USHORT Length; + USHORT MaximumLength; + TI_INT8* Buffer; +} ANSI_STRING, *PANSI_STRING, UNICODE_STRING, *PUNICODE_STRING; + +typedef ANSI_STRING NDIS_STRING, *PNDIS_STRING; +typedef void * NDIS_HANDLE; +typedef int NDIS_STATUS, *PNDIS_STATUS; + + +typedef TI_UINT32 NDIS_OID, *PNDIS_OID; +#define PCI_TYPE0_ADDRESSES 6 +#define PCI_TYPE1_ADDRESSES 2 +/*typedef LARGE_INTEGER NDIS_PHYSICAL_ADDRESS; */ +typedef void* *PDEVICE_OBJECT, *PDRIVER_OBJECT; +typedef TI_UINT32 NDIS_MINIPORT_INTERRUPT, NDIS_MINIPORT_TIMER, NDIS_SPIN_LOCK; +typedef TI_UINT32 PNDIS_PACKET, *PPNDIS_PACKET; + +typedef enum _NDIS_PARAMETER_TYPE { + NdisParameterInteger, + NdisParameterHexInteger, + NdisParameterString, + NdisParameterMultiString, + NdisParameterBinary +} NDIS_PARAMETER_TYPE, *PNDIS_PARAMETER_TYPE; + +typedef struct { + USHORT Length; + void* Buffer; +} BINARY_DATA; + +typedef struct _NDIS_CONFIGURATION_PARAMETER { + NDIS_PARAMETER_TYPE ParameterType; + union { + TI_UINT32 IntegerData; + NDIS_STRING StringData; + BINARY_DATA BinaryData; + } ParameterData; + char StringBuffer[NDIS_MAX_STRING_LEN]; +} NDIS_CONFIGURATION_PARAMETER, *PNDIS_CONFIGURATION_PARAMETER; + +typedef TI_UINT32 NTSTATUS; + +#ifndef NDIS_STATUS_SUCCESS +# define NDIS_STATUS_SUCCESS ((NDIS_STATUS)0x00000000L) +# define NDIS_STATUS_PENDING ((NDIS_STATUS)0x00000103L) +# define NDIS_STATUS_RESET_END ((NDIS_STATUS)0x40010005L) +# define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION ((NDIS_STATUS)0x40010012L) +# define NDIS_STATUS_FAILURE ((NDIS_STATUS)0xC0000001L) +# define NDIS_STATUS_ADAPTER_NOT_FOUND ((NDIS_STATUS)0xC0010006L) +# define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L) +# define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L) +# define NDIS_STATUS_INVALID_OID ((NDIS_STATUS)0xC0010017L) +#endif /* NDIS_STATUS_SUCCESS */ + +#define STATUS_SUCCESS 0 +#define STATUS_INVALID_PARAMETER -1 + +#define NdisZeroMemory(p, size) os_memoryZero( NULL, p, size ) +#define NdisMoveMemory(d, s, size) os_memoryCopy( NULL, d, s, size ) + +NDIS_STATUS NdisUnicodeStringToAnsiString( IN OUT PANSI_STRING DestinationString, + IN PUNICODE_STRING SourceString ); +void NdisReadConfiguration( OUT PNDIS_STATUS Status, OUT PNDIS_CONFIGURATION_PARAMETER *ParameterValue, + IN NDIS_HANDLE ConfigurationHandle, IN PNDIS_STRING Keyword, IN NDIS_PARAMETER_TYPE ParameterType ); +void NdisWriteConfiguration( OUT PNDIS_STATUS Status, IN NDIS_HANDLE ConfigurationHandle, + IN PNDIS_STRING Keyword, IN PNDIS_CONFIGURATION_PARAMETER ParameterValue ); + +typedef struct _NDIS_PACKET_POOL { + NDIS_SPIN_LOCK SpinLock; + struct _NDIS_PACKET *FreeList; + TI_UINT32 PacketLength; + TI_UINT8 Buffer[1]; +} NDIS_PACKET_POOL, * PNDIS_PACKET_POOL; + +typedef enum _NDIS_802_11_STATUS_TYPE +{ + Ndis802_11StatusType_Authentication, + Ndis802_11StatusTypeMax /* not a real type, defined as an upper bound*/ +} NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; + +typedef TI_UINT8 NDIS_802_11_MAC_ADDRESS[6]; + +typedef struct _NDIS_802_11_STATUS_INDICATION +{ + NDIS_802_11_STATUS_TYPE StatusType; +} NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION; + +typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST +{ + TI_UINT32 Length; /* Length of structure*/ + NDIS_802_11_MAC_ADDRESS Bssid; + TI_UINT32 Flags; +} NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST; + +typedef TI_INT32 NDIS_802_11_RSSI; /* in dBm*/ + +typedef struct _NDIS_802_11_TEST +{ + TI_UINT32 Length; + TI_UINT32 Type; + union { + struct _AuthenticationEvent { + NDIS_802_11_STATUS_INDICATION Status; + NDIS_802_11_AUTHENTICATION_REQUEST Request[1]; + } AuthenticationEvent; + NDIS_802_11_RSSI RssiTrigger; + }; +} NDIS_802_11_TEST, *PNDIS_802_11_TEST; + +/* Added new encryption types*/ +/* Also aliased typedef to new name*/ +typedef enum _NDIS_802_11_WEP_STATUS +{ + Ndis802_11WEPEnabled, + Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, + Ndis802_11WEPDisabled, + Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, + Ndis802_11WEPKeyAbsent, + Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, + Ndis802_11WEPNotSupported, + Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, + Ndis802_11Encryption2Enabled, + Ndis802_11Encryption2KeyAbsent, + Ndis802_11Encryption3Enabled, + Ndis802_11Encryption3KeyAbsent +} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, + NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; + +#ifdef TI_DBG +#ifdef __KERNEL__ +#define DbgPrint printk +#else +#define DbgPrint printf +#endif +#else +#define DbgPrint +#endif + +#endif /* _WINDOWS_TYPES_H */ diff --git a/wilink_6_1/platforms/os/linux/src/CmdInterpretWext.c b/wilink_6_1/platforms/os/linux/src/CmdInterpretWext.c new file mode 100644 index 0000000..7163744 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/CmdInterpretWext.c @@ -0,0 +1,1793 @@ +/* + * CmdInterpretWext.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +#include "tidef.h" +#include "WlanDrvIf.h" +#include "tiwlnif.h" +#include "osDot11.h" +#include "802_11Defs.h" +#include "paramOut.h" +#include "coreDefaultParams.h" +#include "version.h" +#include "osApi.h" +#include "CmdHndlr.h" +#include "CmdInterpret.h" +#include "CmdInterpretWext.h" +#include "TI_IPC_Api.h" +#include "WlanDrvIf.h" +#include <linux/wireless.h> +#include <linux/if_arp.h> +#include <asm/uaccess.h> +#include <net/iw_handler.h> +#include "privateCmd.h" +#include "DrvMain.h" +#include "CmdDispatcher.h" +#include "EvHandler.h" +#include "admCtrl.h" + + +static TI_INT32 cmdInterpret_Event(IPC_EV_DATA* pData); +static int cmdInterpret_setSecurityParams (TI_HANDLE hCmdInterpret); +static int cmdInterpret_initEvents(TI_HANDLE hCmdInterpret); +static int cmdInterpret_unregisterEvents(TI_HANDLE hCmdInterpret, TI_HANDLE hEvHandler); + +#define CHECK_PENDING_RESULT(x,y) if (x == COMMAND_PENDING) { os_printf ("Unexpected COMMAND PENDING result (cmd = 0x%x)\n",y->paramType); break; } + +static const char *ieee80211_modes[] = { + "?", "IEEE 802.11 B", "IEEE 802.11 A", "IEEE 802.11 BG", "IEEE 802.11 ABG" +}; +#ifdef XCC_MODULE_INCLUDED +typedef struct +{ + + TI_UINT8 *assocRespBuffer; + TI_UINT32 assocRespLen; +} cckm_assocInformation_t; + +#define ASSOC_RESP_FIXED_DATA_LEN 6 +#define MAX_BEACON_BODY_LENGTH 350 +#define BEACON_HEADER_FIX_SIZE 12 +#define CCKM_START_EVENT_SIZE 23 /* cckm-start string + timestamp + bssid + null */ +#endif + +/* Initialize the CmdInterpreter module */ +TI_HANDLE cmdInterpret_Create (TI_HANDLE hOs) +{ + cmdInterpret_t *pCmdInterpret; + + /* Allocate memory for object */ + pCmdInterpret = os_memoryAlloc (hOs, sizeof(cmdInterpret_t)); + + /* In case of failure -> return NULL */ + if (!pCmdInterpret) + { + os_printf ("cmdInterpret_init: failed to allocate memory...aborting\n"); + return NULL; + } + + /* Clear all fields in cmdInterpreter module object */ + os_memoryZero (hOs, pCmdInterpret, sizeof (cmdInterpret_t)); + + /* Save handlers */ + pCmdInterpret->hOs = hOs; + + /* Return pointer to object */ + return (TI_HANDLE)pCmdInterpret; +} + + +/* Deinitialize the cmdInterpreter module */ +TI_STATUS cmdInterpret_Destroy (TI_HANDLE hCmdInterpret, TI_HANDLE hEvHandler) +{ + cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)hCmdInterpret; + + /* Unregister events */ + cmdInterpret_unregisterEvents ((TI_HANDLE)pCmdInterpret, hEvHandler); + + /* Release allocated memory */ + os_memoryFree (pCmdInterpret->hOs, pCmdInterpret, sizeof(cmdInterpret_t)); + + return TI_OK; +} + + +void cmdInterpret_Init (TI_HANDLE hCmdInterpret, TStadHandlesList *pStadHandles) +{ + cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)hCmdInterpret; + + pCmdInterpret->hCmdHndlr = pStadHandles->hCmdHndlr; + pCmdInterpret->hEvHandler = pStadHandles->hEvHandler; + pCmdInterpret->hCmdDispatch = pStadHandles->hCmdDispatch; + + /* Register to driver events */ + cmdInterpret_initEvents (hCmdInterpret); +} + + +/* Handle a single command */ +int cmdInterpret_convertAndExecute(TI_HANDLE hCmdInterpret, TConfigCommand *cmdObj) +{ + cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)hCmdInterpret; + paramInfo_t *pParam; + TI_STATUS res = TI_NOK; + int i,j; + + union iwreq_data *wrqu = (union iwreq_data *)cmdObj->buffer1; + + cmdObj->return_code = WEXT_NOT_SUPPORTED; + pParam = (paramInfo_t *)os_memoryAlloc(pCmdInterpret->hOs, sizeof(paramInfo_t)); + if (!pParam) + return res; + /* Check user request */ + switch (cmdObj->cmd) + { + + /* get name == wireless protocol - used to verify the presence of Wireless Extensions*/ + case SIOCGIWNAME: + os_memoryCopy(pCmdInterpret->hOs, cmdObj->buffer1, WLAN_PROTOCOL_NAME, IFNAMSIZ); + res = TI_OK; + break; + + /* Set channel / frequency */ + case SIOCSIWFREQ: + { + /* If there is a given channel */ + if (wrqu->freq.m != 0) + { + pParam->paramType = SITE_MGR_DESIRED_CHANNEL_PARAM; + pParam->paramLength = sizeof(TI_UINT32); + pParam->content.siteMgrDesiredChannel = wrqu->freq.m; + + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) + } + break; + } + + /* Get channel / frequency */ + case SIOCGIWFREQ: + { + pParam->paramType = SITE_MGR_CURRENT_CHANNEL_PARAM; + pParam->paramLength = sizeof(TI_UINT32); + + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, pParam); + if(res == NO_SITE_SELECTED_YET) + res = TI_OK; + + CHECK_PENDING_RESULT(res,pParam) + + if (res == TI_OK) + { + wrqu->freq.m = pParam->content.siteMgrCurrentChannel; + wrqu->freq.e = 3; + wrqu->freq.i = 0; + } + break; + } + + /* Set Mode (Adhoc / infrastructure) */ + case SIOCSIWMODE: + { + pParam->paramType = SME_DESIRED_BSS_TYPE_PARAM; + pParam->paramLength = sizeof(ScanBssType_e); + + switch (wrqu->mode) + { + case IW_MODE_AUTO: + pParam->content.smeDesiredBSSType = BSS_ANY; + break; + case IW_MODE_ADHOC: + pParam->content.smeDesiredBSSType = BSS_INDEPENDENT; + break; + case IW_MODE_INFRA: + pParam->content.smeDesiredBSSType = BSS_INFRASTRUCTURE; + break; + default: + res = -EOPNOTSUPP; + goto cmd_end; + } + + res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) + + /* also set the site mgr desired mode */ + pParam->paramType = SITE_MGR_DESIRED_BSS_TYPE_PARAM; + res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) + + break; + } + + /* Get Mode (Adhoc / infrastructure) */ + case SIOCGIWMODE: + { + pParam->paramType = SME_DESIRED_BSS_TYPE_PARAM; + pParam->paramLength = sizeof(ScanBssType_e); + res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) + + switch (pParam->content.smeDesiredBSSType) + { + case BSS_ANY: + wrqu->mode = IW_MODE_AUTO; + break; + case BSS_INDEPENDENT: + wrqu->mode = IW_MODE_ADHOC; + break; + case BSS_INFRASTRUCTURE: + wrqu->mode = IW_MODE_INFRA; + break; + default: + break; + } + + break; + } + + /* Set sensitivity (Rssi roaming threshold)*/ + case SIOCSIWSENS: + { + /* First get the current roaming configuration as a whole */ + pParam->paramType = ROAMING_MNGR_APPLICATION_CONFIGURATION; + pParam->paramLength = sizeof (roamingMngrConfigParams_t); + res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); + + CHECK_PENDING_RESULT(res,pParam) + + /* Now change the low rssi threshold supplied by the user */ + pParam->content.roamingConfigBuffer.roamingMngrThresholdsConfig.lowRssiThreshold = wrqu->param.value; + + /* And set the parameters back to the roaming module */ + res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, pParam); + + CHECK_PENDING_RESULT(res,pParam) + + break; + } + + /* Get sensitivity (Rssi threshold OR CCA?)*/ + case SIOCGIWSENS: + { + pParam->paramType = ROAMING_MNGR_APPLICATION_CONFIGURATION; + pParam->paramLength = sizeof (roamingMngrConfigParams_t); + res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); + + CHECK_PENDING_RESULT(res,pParam) + + if (res == TI_OK) + { + wrqu->param.value = pParam->content.roamingConfigBuffer.roamingMngrThresholdsConfig.lowRssiThreshold; + wrqu->param.disabled = (wrqu->param.value == 0); + wrqu->param.fixed = 1; + } + + break; + } + + /* Get a range of parameters regarding the device capabilities */ + case SIOCGIWRANGE: + { + struct iw_point *data = (struct iw_point *) cmdObj->buffer1; + struct iw_range *range = (struct iw_range *) cmdObj->buffer2; + int i; + + /* Reset structure */ + data->length = sizeof(struct iw_range); + os_memorySet(pCmdInterpret->hOs, range, 0, sizeof(struct iw_range)); + + /* Wireless Extension version info */ + range->we_version_compiled = WIRELESS_EXT; /* Must be WIRELESS_EXT */ + range->we_version_source = 19; /* Last update of source */ + + /* estimated maximum TCP throughput values (bps) */ + range->throughput = MAX_THROUGHPUT; + + /* NWID (or domain id) */ + range->min_nwid = 0; /* Minimal NWID we are able to set */ + range->max_nwid = 0; /* Maximal NWID we are able to set */ + + /* Old Frequency - no need to support this*/ + range->old_num_channels = 0; + range->old_num_frequency = 0; + + /* Wireless event capability bitmasks */ + IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); + IW_EVENT_CAPA_SET(range->event_capa, IWEVREGISTERED); + IW_EVENT_CAPA_SET(range->event_capa, IWEVEXPIRED); + + /* signal level threshold range */ + range->sensitivity = 0; + + /* Rates */ + pParam->paramType = SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, pParam ); + + CHECK_PENDING_RESULT(res,pParam) + + /* Number of entries in the rates list */ + range->num_bitrates = pParam->content.siteMgrDesiredSupportedRateSet.len; + for (i=0; i<pParam->content.siteMgrDesiredSupportedRateSet.len; i++) + { + range->bitrate[i] = ((pParam->content.siteMgrDesiredSupportedRateSet.ratesString[i] & 0x7F) * 500000); + } + + /* RTS threshold */ + range->min_rts = TWD_RTS_THRESHOLD_MIN; /* Minimal RTS threshold */ + range->max_rts = TWD_RTS_THRESHOLD_DEF; /* Maximal RTS threshold */ + + /* Frag threshold */ + range->min_frag = TWD_FRAG_THRESHOLD_MIN; /* Minimal frag threshold */ + range->max_frag = TWD_FRAG_THRESHOLD_DEF; /* Maximal frag threshold */ + + /* Power Management duration & timeout */ + range->min_pmp = 0; /* Minimal PM period */ + range->max_pmp = 0; /* Maximal PM period */ + range->min_pmt = 0; /* Minimal PM timeout */ + range->max_pmt = 0; /* Maximal PM timeout */ + range->pmp_flags = IW_POWER_ON; /* How to decode max/min PM period */ + range->pmt_flags = IW_POWER_ON; /* How to decode max/min PM timeout */ + + /* What Power Management options are supported */ + range->pm_capa = IW_POWER_UNICAST_R | /* Receive only unicast messages */ + IW_POWER_MULTICAST_R | /* Receive only multicast messages */ + IW_POWER_ALL_R | /* Receive all messages though PM */ + IW_POWER_FORCE_S | /* Force PM procedure for sending unicast */ + IW_POWER_PERIOD | /* Value is a period/duration of */ + IW_POWER_TIMEOUT; /* Value is a timeout (to go asleep) */ + + /* Transmit power */ + range->txpower_capa = IW_TXPOW_RELATIVE | IW_TXPOW_RANGE; /* What options are supported */ + range->num_txpower = 5; /* Number of entries in the list */ + range->txpower[0] = 1; /* list of values (maximum is IW_MAX_TXPOWER = 8) */ + range->txpower[1] = 2; /* list of values (maximum is IW_MAX_TXPOWER = 8) */ + range->txpower[2] = 3; /* list of values (maximum is IW_MAX_TXPOWER = 8) */ + range->txpower[3] = 4; /* list of values (maximum is IW_MAX_TXPOWER = 8) */ + range->txpower[4] = 5; /* list of values (maximum is IW_MAX_TXPOWER = 8) */ + + /* Retry limits and lifetime */ + range->retry_capa = 0; /* What retry options are supported */ + range->retry_flags = 0; /* How to decode max/min retry limit */ + range->r_time_flags = 0; /* How to decode max/min retry life */ + range->min_retry = 0; /* Minimal number of retries */ + range->max_retry = 0; /* Maximal number of retries */ + range->min_r_time = 0; /* Minimal retry lifetime */ + range->max_r_time = 0; /* Maximal retry lifetime */ + + /* Get Supported channels */ + pParam->paramType = SITE_MGR_RADIO_BAND_PARAM; + res = cmdDispatch_GetParam( pCmdInterpret->hCmdDispatch, pParam ); + + CHECK_PENDING_RESULT(res,pParam) + + /* pParam->content.siteMgrRadioBand contains the current band, now get list of supported channels */ + pParam->paramType = REGULATORY_DOMAIN_ALL_SUPPORTED_CHANNELS; + res = cmdDispatch_GetParam( pCmdInterpret->hCmdDispatch, pParam ); + + CHECK_PENDING_RESULT(res,pParam) + + range->num_channels = pParam->content.supportedChannels.sizeOfList; /* Number of channels [0; num - 1] */ + range->num_frequency = pParam->content.supportedChannels.sizeOfList; /* Number of entry in the list */ + + for (i=0; i<pParam->content.supportedChannels.sizeOfList; i++) + { + range->freq[i].e = 0; + range->freq[i].m = i; + range->freq[i].i = pParam->content.supportedChannels.listOfChannels[i]+1; + } + + /* Encoder (Encryption) capabilities */ + range->num_encoding_sizes = 4; + /* 64(40) bits WEP */ + range->encoding_size[0] = WEP_KEY_LENGTH_40; + /* 128(104) bits WEP */ + range->encoding_size[1] = WEP_KEY_LENGTH_104; + /* 256 bits for WPA-PSK */ + range->encoding_size[2] = TKIP_KEY_LENGTH; + /* 128 bits for WPA2-PSK */ + range->encoding_size[3] = AES_KEY_LENGTH; + /* 4 keys are allowed */ + range->max_encoding_tokens = 4; + + range->encoding_login_index = 0; /* token index for login token */ + + /* Encryption capabilities */ + range->enc_capa = IW_ENC_CAPA_WPA | + IW_ENC_CAPA_WPA2 | + IW_ENC_CAPA_CIPHER_TKIP | + IW_ENC_CAPA_CIPHER_CCMP; /* IW_ENC_CAPA_* bit field */ + + } + break; + + /* Set desired BSSID */ + case SIOCSIWAP: + { + + /* If MAC address is zeroes -> connect to "ANY" BSSID */ + if (MAC_NULL (wrqu->ap_addr.sa_data)) + { + /* Convert to "FF:FF:FF:FF:FF:FF" since this driver requires this value */ + MAC_COPY (pParam->content.siteMgrDesiredBSSID, "\xff\xff\xff\xff\xff\xff"); + } + else + { + MAC_COPY (pParam->content.siteMgrDesiredBSSID, wrqu->ap_addr.sa_data); + } + + pParam->paramType = SITE_MGR_DESIRED_BSSID_PARAM; + res = cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) + + /* also set it to the SME */ + pParam->paramType = SME_DESIRED_BSSID_PARAM; + res = cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) + + break; + } + + + /* Get current BSSID */ + case SIOCGIWAP: + { + /* Get current AP BSSID */ + pParam->paramType = SITE_MGR_CURRENT_BSSID_PARAM; + res = cmdDispatch_GetParam ( pCmdInterpret->hCmdDispatch, pParam ); + + CHECK_PENDING_RESULT(res,pParam) + + /* In case we are not associated - copy zeroes into bssid */ + if (res == NO_SITE_SELECTED_YET) + { + MAC_COPY (wrqu->ap_addr.sa_data, "\x00\x00\x00\x00\x00\x00"); + cmdObj->return_code = WEXT_OK; + } + else if (res == TI_OK) + { + MAC_COPY (wrqu->ap_addr.sa_data, pParam->content.siteMgrDesiredBSSID); + } + + break; + } + + + /* request MLME operation (Deauthenticate / Disassociate) */ + case SIOCSIWMLME: + { + struct iw_mlme *mlme = (struct iw_mlme *)cmdObj->param3; + + pParam->paramType = SITE_MGR_DESIRED_SSID_PARAM; + + /* In either case - we need to disconnect, so prepare "junk" SSID */ + for (i = 0; i < MAX_SSID_LEN; i++) + pParam->content.siteMgrDesiredSSID.str[i] = (i+1); + pParam->content.siteMgrDesiredSSID.len = MAX_SSID_LEN; + + switch (mlme->cmd) + { + case IW_MLME_DEAUTH: + case IW_MLME_DISASSOC: + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) + /* now also set it to the SME */ + pParam->paramType = SME_DESIRED_SSID_ACT_PARAM; + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) + break; + default: + res = -EOPNOTSUPP; + goto cmd_end; + } + break; + } + + /* trigger scanning (list cells) */ + case SIOCSIWSCAN: + { + if (wrqu->data.flags & IW_SCAN_THIS_ESSID) + { + struct iw_scan_req scanReq; + + if(copy_from_user(&scanReq, wrqu->data.pointer, sizeof(scanReq))) + { + printk("CRITICAL: Could not copy data from user space!!!"); + res = -EFAULT; + goto cmd_end; + } + + pParam->content.tScanDesiredSSID.len = scanReq.essid_len; + os_memoryCopy(pCmdInterpret->hOs, pParam->content.tScanDesiredSSID.str, scanReq.essid, scanReq.essid_len); + } + else + { + pParam->content.tScanDesiredSSID.len = 0; + } + + pParam->paramType = SCAN_CNCN_BSSID_LIST_SCAN_PARAM; + pParam->paramLength = sizeof(pParam->content.tScanDesiredSSID); + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) + } + break; + + /* get scanning results */ + case SIOCGIWSCAN: + { + unsigned char ies[256]; + unsigned char buf[30]; + char *event = (char *)cmdObj->buffer2; + struct iw_event iwe; + char *end_buf, *current_val; + int allocated_size; + OS_802_11_BSSID_LIST_EX *my_list; + OS_802_11_BSSID_EX *my_current; + int offset; + OS_802_11_VARIABLE_IEs *pRsnIes; + int ies_offset; + int i; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + struct iw_request_info info; + info.cmd = SIOCGIWSCAN; + info.flags = 0; +#endif + end_buf = (char *)(cmdObj->buffer2 + wrqu->data.length); + + /* First get the amount of memory required to hold the entire BSSID list by setting the length to 0 */ + pParam->paramType = SCAN_CNCN_BSSID_LIST_SIZE_PARAM; + pParam->paramLength = 0; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) + + allocated_size = pParam->content.uBssidListSize; + + /* Allocate required memory */ + my_list = os_memoryAlloc (pCmdInterpret->hOs, allocated_size); + if (!my_list) { + res = -ENOMEM; + goto cmd_end; + } + + /* And retrieve the list */ + pParam->paramType = SCAN_CNCN_BSSID_LIST_PARAM; + pParam->content.pBssidList = my_list; + pParam->paramLength = allocated_size; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) + + my_current = &my_list->Bssid[0]; + i=0; + if(wrqu->data.flags) + { + for (i=0; i<wrqu->data.flags; i++) + my_current = (OS_802_11_BSSID_EX *) (((char *) my_current) + my_current->Length); + } + /* Now send a wireless event per BSSID with "tokens" describing it */ + + for (; i<my_list->NumberOfItems; i++) + { + + if (event + my_current->Length > end_buf) + { + break; + } + + /* The first entry MUST be the AP BSSID */ + os_memorySet (pCmdInterpret->hOs, &iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWAP; + iwe.u.ap_addr.sa_family = ARPHRD_ETHER; + iwe.len = IW_EV_ADDR_LEN; + os_memoryCopy(pCmdInterpret->hOs, iwe.u.ap_addr.sa_data, &my_current->MacAddress, ETH_ALEN); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_ADDR_LEN); +#else + event = iwe_stream_add_event(&info,event, end_buf, &iwe, IW_EV_ADDR_LEN); +#endif + /* Add SSID */ + iwe.cmd = SIOCGIWESSID; + iwe.u.data.flags = 1; + iwe.u.data.length = min((TI_UINT8)my_current->Ssid.SsidLength, (TI_UINT8)32); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + event = iwe_stream_add_point(event, end_buf, &iwe, my_current->Ssid.Ssid); +#else + event = iwe_stream_add_point(&info,event, end_buf, &iwe, my_current->Ssid.Ssid); +#endif + /* Add the protocol name (BSS support for A/B/G) */ + os_memorySet (pCmdInterpret->hOs, &iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWNAME; + os_memoryCopy(pCmdInterpret->hOs, (void*)iwe.u.name, (void*)ieee80211_modes[my_current->NetworkTypeInUse], IFNAMSIZ); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_CHAR_LEN); +#else + event = iwe_stream_add_event(&info,event, end_buf, &iwe, IW_EV_CHAR_LEN); +#endif + /* add mode (infrastructure or Adhoc) */ + os_memorySet (pCmdInterpret->hOs, &iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWMODE; + if (my_current->InfrastructureMode == os802_11IBSS) + iwe.u.mode = IW_MODE_ADHOC; + else if (my_current->InfrastructureMode == os802_11Infrastructure) + iwe.u.mode = IW_MODE_INFRA; + else + iwe.u.mode = IW_MODE_AUTO; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_UINT_LEN); +#else + event = iwe_stream_add_event(&info,event, end_buf, &iwe, IW_EV_UINT_LEN); +#endif + + /* add freq */ + os_memorySet (pCmdInterpret->hOs, &iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWFREQ; + iwe.u.freq.m = my_current->Configuration.Union.channel; + iwe.u.freq.e = 3; /* Frequency divider */ + iwe.u.freq.i = 0; + iwe.len = IW_EV_FREQ_LEN; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_FREQ_LEN); +#else + event = iwe_stream_add_event(&info,event, end_buf, &iwe, IW_EV_FREQ_LEN); +#endif + /* Add quality statistics */ + iwe.cmd = IWEVQUAL; + iwe.u.qual.updated = IW_QUAL_LEVEL_UPDATED | IW_QUAL_QUAL_INVALID | IW_QUAL_NOISE_INVALID | IW_QUAL_DBM; + iwe.u.qual.qual = 0; + iwe.u.qual.level = my_current->Rssi; + iwe.u.qual.noise = 0; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + event = iwe_stream_add_event(event, end_buf, &iwe, IW_EV_QUAL_LEN); +#else + event = iwe_stream_add_event(&info,event, end_buf, &iwe, IW_EV_QUAL_LEN); +#endif + /* Add encryption capability */ + iwe.cmd = SIOCGIWENCODE; + if ((my_current->Capabilities >> CAP_PRIVACY_SHIFT) & CAP_PRIVACY_MASK) + iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; + else + iwe.u.data.flags = IW_ENCODE_DISABLED; + iwe.u.data.length = 0; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + event = iwe_stream_add_point(event, end_buf, &iwe, NULL); +#else + event = iwe_stream_add_point(&info,event, end_buf, &iwe, NULL); +#endif + + /* add rate */ + os_memorySet (pCmdInterpret->hOs, &iwe, 0, sizeof(iwe)); + iwe.cmd = SIOCGIWRATE; + current_val = event + IW_EV_LCP_LEN; + for (j=0; j<16; j++) + { + if (my_current->SupportedRates[j]) + { + iwe.u.bitrate.value = ((my_current->SupportedRates[j] & 0x7f) * 500000); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + current_val = iwe_stream_add_value(event, current_val, end_buf, &iwe,IW_EV_PARAM_LEN); +#else + current_val = iwe_stream_add_value(&info,event, current_val,end_buf, &iwe,IW_EV_PARAM_LEN); +#endif + } + } + + event = current_val; + + /* CUSTOM - Add beacon interval */ + os_memorySet (pCmdInterpret->hOs, &iwe, 0, sizeof(iwe)); + iwe.cmd = IWEVCUSTOM; + sprintf(buf, "Bcn int = %d ms ", my_current->Configuration.BeaconPeriod); + iwe.u.data.length = strlen(buf); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + event = iwe_stream_add_point(event, end_buf, &iwe, buf); +#else + event = iwe_stream_add_point(&info,event, end_buf, &iwe, buf); +#endif + /* add RSN IE */ + os_memorySet (pCmdInterpret->hOs, &iwe, 0, sizeof(iwe)); + os_memorySet (pCmdInterpret->hOs, ies, 0, 256); + iwe.cmd = IWEVGENIE; + offset = sizeof(OS_802_11_FIXED_IEs); + ies_offset = 0; + + while(offset < my_current->IELength) + { + pRsnIes = (OS_802_11_VARIABLE_IEs*)&(my_current->IEs[offset]); + if((pRsnIes->ElementID == RSN_IE_ID) || (pRsnIes->ElementID == WPA_IE_ID)) + { + os_memoryCopy (pCmdInterpret->hOs, ies + ies_offset, (char *)&(my_current->IEs[offset]), pRsnIes->Length + 2); + ies_offset += pRsnIes->Length + 2; + } + offset += pRsnIes->Length + 2; + } + if (ies_offset) + { + iwe.u.data.flags = 1; + iwe.u.data.length = ies_offset; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) + event = iwe_stream_add_point(event, end_buf, &iwe, (char *)ies); +#else + event = iwe_stream_add_point(&info, event, end_buf, &iwe, (char *)ies); +#endif + } + + my_current = (OS_802_11_BSSID_EX *) (((char *) my_current) + my_current->Length); + } + + wrqu->data.length = event - ((char *)cmdObj->buffer2); + if(i == my_list->NumberOfItems) + { + wrqu->data.flags = 0; + } + else + { + wrqu->data.flags = i; + } + + os_memoryFree (pCmdInterpret->hOs, my_list, allocated_size); + cmdObj->return_code = WEXT_OK; + } + + break; + + /* Set ESSID */ + case SIOCSIWESSID: + { + char *extra = cmdObj->buffer2; + int length; + + if (wrqu->essid.flags & SET_SSID_WITHOUT_SUPPL) + wrqu->essid.flags &= ~SET_SSID_WITHOUT_SUPPL; + else + cmdInterpret_setSecurityParams (hCmdInterpret); + + os_memoryZero (pCmdInterpret->hOs, &pParam->content.siteMgrDesiredSSID.str, MAX_SSID_LEN); + + pParam->content.siteMgrCurrentSSID.len = 0; + + if (wrqu->essid.flags == 0) + { + /* Connect to ANY ESSID - use empty */ + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.siteMgrCurrentSSID.str, "\00", 1); + pParam->content.siteMgrCurrentSSID.len = 0;; + } else + { + /* Handle ESSID length issue in WEXT (backward compatibility with old/new versions) */ + length = wrqu->essid.length - 1; + if (length > 0) + length--; + while (length < wrqu->essid.length && extra[length]) + length++; + + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.siteMgrCurrentSSID.str, cmdObj->buffer2, length); + pParam->content.siteMgrCurrentSSID.len = length; + } + + pParam->paramType = SITE_MGR_DESIRED_SSID_PARAM; + pParam->paramLength = sizeof (TSsid); + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) + /* also set it to the SME */ + pParam->paramType = SME_DESIRED_SSID_ACT_PARAM; + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam ); + CHECK_PENDING_RESULT(res,pParam) + } + break; + + /* get ESSID */ + case SIOCGIWESSID: + { + char *extra = (char *)cmdObj->buffer2; + + pParam->paramType = SITE_MGR_CURRENT_SSID_PARAM; + res = cmdDispatch_GetParam ( pCmdInterpret->hCmdDispatch, pParam ); + if(res == NO_SITE_SELECTED_YET) + res = WEXT_OK; + + CHECK_PENDING_RESULT(res,pParam) + + wrqu->essid.flags = 1; + + os_memoryCopy(pCmdInterpret->hOs, cmdObj->buffer2, &pParam->content.siteMgrCurrentSSID.str, pParam->content.siteMgrCurrentSSID.len ); + + if (pParam->content.siteMgrCurrentSSID.len < MAX_SSID_LEN) + { + extra[pParam->content.siteMgrCurrentSSID.len] = 0; + } + wrqu->essid.length = pParam->content.siteMgrCurrentSSID.len; + } + + break; + + /* set node name/nickname */ + case SIOCSIWNICKN: + { + if (wrqu->data.length > IW_ESSID_MAX_SIZE) { + res = -EINVAL; + goto cmd_end; + } + os_memoryCopy(pCmdInterpret->hOs, pCmdInterpret->nickName, cmdObj->buffer2, wrqu->data.length); + pCmdInterpret->nickName[IW_ESSID_MAX_SIZE] = 0; + res = TI_OK; + } + + break; + + /* get node name/nickname */ + case SIOCGIWNICKN: + { + struct iw_point *data = (struct iw_point *) cmdObj->buffer1; + + data->length = strlen(pCmdInterpret->nickName); + os_memoryCopy(pCmdInterpret->hOs, cmdObj->buffer2, &pCmdInterpret->nickName, data->length); + + res = TI_OK; + } + break; + + /* Set RTS Threshold */ + case SIOCSIWRTS: + { + pParam->paramType = TWD_RTS_THRESHOLD_PARAM; + + if (wrqu->rts.disabled) + pParam->content.halCtrlRtsThreshold = TWD_RTS_THRESHOLD_DEF; + else + pParam->content.halCtrlRtsThreshold = wrqu->rts.value; + + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch,pParam); + CHECK_PENDING_RESULT(res,pParam) + break; + } + + /* Get RTS Threshold */ + case SIOCGIWRTS: + { + pParam->paramType = TWD_RTS_THRESHOLD_PARAM; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); + + CHECK_PENDING_RESULT(res,pParam) + + wrqu->rts.value = pParam->content.halCtrlRtsThreshold; + wrqu->rts.fixed = 1; + cmdObj->return_code = WEXT_OK; + break; + } + + /* Set Fragmentation threshold */ + case SIOCSIWFRAG: + { + pParam->paramType = TWD_FRAG_THRESHOLD_PARAM; + pParam->content.halCtrlFragThreshold = ((wrqu->frag.value+1)>>1) << 1; /* make it always even */ + + res = cmdDispatch_SetParam(pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) + + break; + } + + /* Get Fragmentation threshold */ + case SIOCGIWFRAG: + { + pParam->paramType = TWD_FRAG_THRESHOLD_PARAM; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); + + CHECK_PENDING_RESULT(res,pParam) + + wrqu->rts.value = pParam->content.halCtrlFragThreshold; + wrqu->rts.fixed = 1; + cmdObj->return_code = WEXT_OK; + break; + } + + /* Set TX power level */ + case SIOCSIWTXPOW: + if (wrqu->txpower.disabled == 1) + { + cmdObj->return_code = WEXT_INVALID_PARAMETER; + } + else + { + pParam->paramType = REGULATORY_DOMAIN_CURRENT_TX_POWER_LEVEL_PARAM; + pParam->content.desiredTxPower = wrqu->txpower.value; + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch,pParam); + CHECK_PENDING_RESULT(res,pParam) + } + break; + + /* Get TX power level */ + case SIOCGIWTXPOW: + { + pParam->paramType = REGULATORY_DOMAIN_CURRENT_TX_POWER_IN_DBM_PARAM; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); + + CHECK_PENDING_RESULT(res,pParam) + + wrqu->txpower.flags = IW_TXPOW_RELATIVE | IW_TXPOW_RANGE; + wrqu->txpower.disabled = 0; + wrqu->txpower.fixed = 0; + wrqu->txpower.value = pParam->content.desiredTxPower; + + break; + } + + /* set encoding token & mode - WEP only */ + case SIOCSIWENCODE: + { + int index; + + index = (wrqu->encoding.flags & IW_ENCODE_INDEX); + + /* iwconfig gives index as 1 - N */ + if (index > 0) + index--; + else + { + pParam->paramType = RSN_DEFAULT_KEY_ID; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); + CHECK_PENDING_RESULT(res,pParam) + index = pParam->content.rsnDefaultKeyID; + } + + pParam->paramType = RSN_ADD_KEY_PARAM; + /* remove key if disabled */ + if (wrqu->data.flags & IW_ENCODE_DISABLED) + { + pParam->paramType = RSN_REMOVE_KEY_PARAM; + } + + pParam->content.rsnOsKey.KeyIndex = index; + + if (wrqu->data.length) + { + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.rsnOsKey.KeyMaterial, cmdObj->buffer2, wrqu->data.length); + pParam->content.rsnOsKey.KeyLength = wrqu->data.length; + } else + { + /* No key material is provided, just set given index as default TX key */ + pParam->paramType = RSN_DEFAULT_KEY_ID; + pParam->content.rsnDefaultKeyID = index; + } + + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) + + break; + } + + + /* get encoding token & mode */ + case SIOCGIWENCODE: + { + int index, encr_mode; + char *extra = (char *)cmdObj->buffer2; + TSecurityKeys myKeyInfo; + + wrqu->data.length = 0; + extra[0] = 0; + + /* Get Index from user request */ + index = (wrqu->encoding.flags & IW_ENCODE_INDEX); + if (index > 0) + index--; + else + { + pParam->paramType = RSN_DEFAULT_KEY_ID; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); + CHECK_PENDING_RESULT(res,pParam) + index = pParam->content.rsnDefaultKeyID; + wrqu->data.flags = (index+1); + } + + pParam->content.pRsnKey = &myKeyInfo; + + pParam->paramType = RSN_KEY_PARAM; + pParam->content.pRsnKey->keyIndex = index; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); + CHECK_PENDING_RESULT(res,pParam) + + if ((pParam->content.pRsnKey) && (pParam->content.pRsnKey->encLen)) + { + wrqu->data.flags |= IW_ENCODE_ENABLED; + wrqu->data.length = pParam->content.pRsnKey->encLen; + os_memoryCopy(pCmdInterpret->hOs,extra, &pParam->content.pRsnKey->encKey,wrqu->data.length); + } + + /* Convert from driver (OID-like) authentication parameters to WEXT */ + if (pCmdInterpret->wai.iw_auth_cipher_pairwise & IW_AUTH_CIPHER_CCMP) + encr_mode = os802_11Encryption3Enabled; + else if (pCmdInterpret->wai.iw_auth_cipher_pairwise & IW_AUTH_CIPHER_TKIP) + encr_mode = os802_11Encryption2Enabled; + else if (pCmdInterpret->wai.iw_auth_cipher_pairwise & (IW_AUTH_CIPHER_WEP40 | IW_AUTH_CIPHER_WEP104)) + encr_mode = os802_11Encryption1Enabled; + else if (pCmdInterpret->wai.iw_auth_cipher_group & IW_AUTH_CIPHER_CCMP) + encr_mode = os802_11Encryption3Enabled; + else if (pCmdInterpret->wai.iw_auth_cipher_group & IW_AUTH_CIPHER_TKIP) + encr_mode = os802_11Encryption2Enabled; + else + encr_mode = os802_11EncryptionDisabled; + + if (encr_mode == os802_11EncryptionDisabled) + wrqu->data.flags |= IW_ENCODE_OPEN; + else + wrqu->data.flags |= IW_ENCODE_RESTRICTED; + + cmdObj->return_code = WEXT_OK; + + } + break; + + /* Set Authentication */ + case SIOCSIWAUTH: + res = TI_OK; + switch (wrqu->param.flags & IW_AUTH_INDEX) + { + case IW_AUTH_WPA_VERSION: + pCmdInterpret->wai.iw_auth_wpa_version = wrqu->param.value; + break; + case IW_AUTH_CIPHER_PAIRWISE: + pCmdInterpret->wai.iw_auth_cipher_pairwise = wrqu->param.value; + break; + case IW_AUTH_CIPHER_GROUP: + pCmdInterpret->wai.iw_auth_cipher_group = wrqu->param.value; + break; + case IW_AUTH_KEY_MGMT: + pCmdInterpret->wai.iw_auth_key_mgmt = wrqu->param.value; + break; + case IW_AUTH_80211_AUTH_ALG: + pCmdInterpret->wai.iw_auth_80211_auth_alg = wrqu->param.value; + break; + case IW_AUTH_WPA_ENABLED: + break; + case IW_AUTH_TKIP_COUNTERMEASURES: + break; + case IW_AUTH_DROP_UNENCRYPTED: + break; + case IW_AUTH_RX_UNENCRYPTED_EAPOL: + break; + case IW_AUTH_PRIVACY_INVOKED: + break; + default: + res = -EOPNOTSUPP; + } + break; + + /* Get Authentication */ + case SIOCGIWAUTH: + res = TI_OK; + { + switch (wrqu->param.flags & IW_AUTH_INDEX) + { + case IW_AUTH_WPA_VERSION: + wrqu->param.value = pCmdInterpret->wai.iw_auth_wpa_version; + break; + case IW_AUTH_CIPHER_PAIRWISE: + wrqu->param.value = pCmdInterpret->wai.iw_auth_cipher_pairwise; + break; + case IW_AUTH_CIPHER_GROUP: + wrqu->param.value = pCmdInterpret->wai.iw_auth_cipher_group; + break; + case IW_AUTH_KEY_MGMT: + wrqu->param.value = pCmdInterpret->wai.iw_auth_key_mgmt; + break; + case IW_AUTH_80211_AUTH_ALG: + wrqu->param.value = pCmdInterpret->wai.iw_auth_80211_auth_alg; + break; + default: + res = -EOPNOTSUPP; + } + } + break; + + /* set encoding token & mode */ + case SIOCSIWENCODEEXT: + { + struct iw_encode_ext *ext = (struct iw_encode_ext *)cmdObj->buffer2; + TI_UINT8 *addr; + TI_UINT8 temp[32]; + + addr = ext->addr.sa_data; + + /* + os_printf ("\next->address = %02x:%02x:%02x:%02x:%02x:%02x \n",addr[0],addr[1],addr[2],addr[3],addr[4],addr[5]); + os_printf ("ext->alg = 0x%x\n",ext->alg); + os_printf ("ext->ext_flags = 0x%x\n",ext->ext_flags); + os_printf ("ext->key_len = 0x%x\n",ext->key_len); + os_printf ("ext->key_idx = 0x%x\n",(wrqu->encoding.flags & IW_ENCODE_INDEX)); + + os_printf ("key = "); + for (i=0; i<ext->key_len; i++) + { + os_printf ("0x%02x:",ext->key[i]); + } + os_printf ("\n"); + */ + + MAC_COPY (pParam->content.rsnOsKey.BSSID, addr); + + pParam->content.rsnOsKey.KeyLength = ext->key_len; + + pParam->content.rsnOsKey.KeyIndex = wrqu->encoding.flags & IW_ENCODE_INDEX; + pParam->content.rsnOsKey.KeyIndex -= 1; + + if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) + { + pParam->content.rsnOsKey.KeyIndex |= TIWLAN_KEY_FLAGS_TRANSMIT; + } + + if (addr[0]!=0xFF) + { + pParam->content.rsnOsKey.KeyIndex |= TIWLAN_KEY_FLAGS_PAIRWISE; + } + + if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) + { + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.rsnOsKey.KeyRSC, &ext->rx_seq, IW_ENCODE_SEQ_MAX_SIZE); + pParam->content.rsnOsKey.KeyIndex |= TIWLAN_KEY_FLAGS_SET_KEY_RSC; + } + + /* If key is TKIP - need to switch RX and TX MIC (to match driver API) */ + if (ext->alg == IW_ENCODE_ALG_TKIP) + { + os_memoryCopy(pCmdInterpret->hOs,(TI_UINT8*)(((TI_UINT8*)&temp)+24),(TI_UINT8*)(((TI_UINT8*)&ext->key)+16),8); + os_memoryCopy(pCmdInterpret->hOs,(TI_UINT8*)(((TI_UINT8*)&temp)+16),(TI_UINT8*)(((TI_UINT8*)&ext->key)+24),8); + os_memoryCopy(pCmdInterpret->hOs,&temp,&ext->key,16); + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.rsnOsKey.KeyMaterial, &temp, ext->key_len); + } else + { + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.rsnOsKey.KeyMaterial, &ext->key, ext->key_len); + } + + if (ext->key_len == 0) + pParam->paramType = RSN_REMOVE_KEY_PARAM; + else + pParam->paramType = RSN_ADD_KEY_PARAM; + + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) + + } + break; + + /* SIOCSIWPMKSA - PMKSA cache operation */ + case SIOCSIWPMKSA: + { + struct iw_pmksa *pmksa = (struct iw_pmksa *) cmdObj->buffer2; + + switch (pmksa->cmd) + { + case IW_PMKSA_ADD: + pParam->paramType = RSN_PMKID_LIST; + pParam->content.rsnPMKIDList.BSSIDInfoCount = 1; + pParam->content.rsnPMKIDList.Length = 2*sizeof(TI_UINT32) + MAC_ADDR_LEN + PMKID_VALUE_SIZE; + MAC_COPY (pParam->content.rsnPMKIDList.osBSSIDInfo[0].BSSID, pmksa->bssid.sa_data); + os_memoryCopy(pCmdInterpret->hOs, &pParam->content.rsnPMKIDList.osBSSIDInfo[0].PMKID, pmksa->pmkid, IW_PMKID_LEN); + + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) + + break; + case IW_PMKSA_REMOVE: + /* Not supported yet */ + break; + case IW_PMKSA_FLUSH: + pParam->paramType = RSN_PMKID_LIST; + /* By using info count=0, RSN knows to clear its tables */ + /* It's also possible to call rsn_resetPMKIDList directly, but cmdDispatcher should be the interface */ + pParam->content.rsnPMKIDList.BSSIDInfoCount = 0; + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch, pParam); + CHECK_PENDING_RESULT(res,pParam) + + break; + default: + cmdObj->return_code = WEXT_NOT_SUPPORTED; + break; + } + } + + break; + + case SIOCIWFIRSTPRIV: + { + ti_private_cmd_t *my_command = (ti_private_cmd_t *)cmdObj->param3; + + /* + os_printf ("cmd = 0x%x flags = 0x%x\n",(unsigned int)my_command->cmd,(unsigned int)my_command->flags); + os_printf ("in_buffer = 0x%x (len = %d)\n",my_command->in_buffer,(unsigned int)my_command->in_buffer_len); + os_printf ("out_buffer = 0x%x (len = %d)\n",my_command->out_buffer,(unsigned int)my_command->out_buffer_len); + */ + + pParam->paramType = my_command->cmd; + + if (IS_PARAM_ASYNC(my_command->cmd)) + { + /* os_printf ("Detected ASYNC command - setting CB \n"); */ + pParam->content.interogateCmdCBParams.hCb = (TI_HANDLE)pCmdInterpret; + pParam->content.interogateCmdCBParams.fCb = (void*)cmdInterpret_ServiceCompleteCB; + pParam->content.interogateCmdCBParams.pCb = my_command->out_buffer; + if (my_command->out_buffer) + { + /* the next copy is need for PLT commands */ + os_memoryCopy(pCmdInterpret->hOs, my_command->out_buffer, my_command->in_buffer, min(my_command->in_buffer_len,my_command->out_buffer_len)); + } + } + else if ((my_command->in_buffer) && (my_command->in_buffer_len)) + { + /* + this cmd doesnt have the structure allocated as part of the paramInfo_t structure. + as a result we need to allocate the memory internally. + */ + if(IS_ALLOC_NEEDED_PARAM(my_command->cmd)) + { + *(void **)&pParam->content = os_memoryAlloc(pCmdInterpret->hOs, my_command->in_buffer_len); + os_memoryCopy(pCmdInterpret->hOs, *(void **)&pParam->content, my_command->in_buffer, my_command->in_buffer_len); + } + else + os_memoryCopy(pCmdInterpret->hOs,&pParam->content,my_command->in_buffer,my_command->in_buffer_len); + } + + if (my_command->flags & PRIVATE_CMD_SET_FLAG) + { + /* os_printf ("Calling setParam\n"); */ + pParam->paramLength = my_command->in_buffer_len; + res = cmdDispatch_SetParam (pCmdInterpret->hCmdDispatch,pParam); + } + else if (my_command->flags & PRIVATE_CMD_GET_FLAG) + { + /* os_printf ("Calling getParam\n"); */ + pParam->paramLength = my_command->out_buffer_len; + res = cmdDispatch_GetParam (pCmdInterpret->hCmdDispatch,pParam); + if(res == EXTERNAL_GET_PARAM_DENIED) + { + cmdObj->return_code = WEXT_INVALID_PARAMETER; + goto cmd_end; + } + + /* + this is for cmd that want to check the size of memory that they need to + allocate for the actual data. + */ + if(pParam->paramLength && (my_command->out_buffer_len == 0)) + { + my_command->out_buffer_len = pParam->paramLength; + } + } + else + { + res = TI_NOK; + } + + if (res == TI_OK) + { + if(IS_PARAM_ASYNC(my_command->cmd)) + { + pCmdInterpret->pAsyncCmd = cmdObj; /* Save command handle for completion CB */ + res = COMMAND_PENDING; + } + else + { + if ((my_command->out_buffer) && (my_command->out_buffer_len)) + { + if(IS_ALLOC_NEEDED_PARAM(my_command->cmd)) + { + os_memoryCopy(pCmdInterpret->hOs,my_command->out_buffer,*(void **)&pParam->content,my_command->out_buffer_len); + } + else + { + os_memoryCopy(pCmdInterpret->hOs,my_command->out_buffer,&pParam->content,my_command->out_buffer_len); + } + } + } + } + + /* need to free the allocated memory */ + if(IS_ALLOC_NEEDED_PARAM(my_command->cmd)) + { + os_memoryFree(pCmdInterpret->hOs, *(void **)&pParam->content, my_command->in_buffer_len); + } + } + + break; + + default: + break; + + } + + if (res == TI_OK) + { + cmdObj->return_code = WEXT_OK; + } +cmd_end: + os_memoryFree(pCmdInterpret->hOs, pParam, sizeof(paramInfo_t)); + /* Return with return code */ + return res; + +} + + + +/* This routine is called by the command mailbox module to signal an ASYNC command has complete */ +int cmdInterpret_ServiceCompleteCB (TI_HANDLE hCmdInterpret, int status, void *buffer) +{ + cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)hCmdInterpret; + + if (pCmdInterpret->pAsyncCmd == NULL) + { + os_printf ("cmdInterpret_ServiceCompleteCB: AsyncCmd is NULL!!\n"); + return TI_NOK; + } + + pCmdInterpret->pAsyncCmd->return_code = status; + + pCmdInterpret->pAsyncCmd = NULL; + + /* Call the Cmd module to complete command processing */ + cmdHndlr_Complete (pCmdInterpret->hCmdHndlr); + + /* Call commands handler to continue handling further commands if queued */ + cmdHndlr_HandleCommands (pCmdInterpret->hCmdHndlr); + + return TI_OK; +} + +/* Register to receive events */ +static int cmdInterpret_initEvents(TI_HANDLE hCmdInterpret) +{ + cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)(hCmdInterpret); + IPC_EVENT_PARAMS evParams; + int i = 0; + + for (i=0; i<IPC_EVENT_MAX; i++) + { + evParams.uDeliveryType = DELIVERY_PUSH; + evParams.uProcessID = 0; + evParams.uEventID = 0; + evParams.hUserParam = hCmdInterpret; + evParams.pfEventCallback = cmdInterpret_Event; + evParams.uEventType = i; + EvHandlerRegisterEvent (pCmdInterpret->hEvHandler, (TI_UINT8*) &evParams, sizeof(IPC_EVENT_PARAMS)); + pCmdInterpret->hEvents[i] = evParams.uEventID; + } + + return TI_OK; +} + + +/* Unregister events */ +static int cmdInterpret_unregisterEvents(TI_HANDLE hCmdInterpret, TI_HANDLE hEvHandler) +{ + cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)(hCmdInterpret); + IPC_EVENT_PARAMS evParams; + int i = 0; + os_setDebugOutputToLogger(TI_FALSE); + + for (i=0; i<IPC_EVENT_MAX; i++) + { + evParams.uEventType = i; + evParams.uEventID = pCmdInterpret->hEvents[i]; + EvHandlerUnRegisterEvent (pCmdInterpret->hEvHandler, &evParams); + } + + return TI_OK; +} + + +/* Handle driver events and convert to WEXT format */ +static TI_INT32 cmdInterpret_Event(IPC_EV_DATA* pData) +{ + IPC_EVENT_PARAMS * pInParam = (IPC_EVENT_PARAMS *)pData; + cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)(pInParam->hUserParam); + OS_802_11_ASSOCIATION_INFORMATION *assocInformation; + TI_UINT8 *requestIEs; + TI_UINT8 *responseIEs; + union iwreq_data wrqu; + char *memptr; + int TotalLength, res = TI_OK; +#ifdef XCC_MODULE_INCLUDED + cckm_assocInformation_t cckm_assoc; + unsigned char beaconIE[MAX_BEACON_BODY_LENGTH]; + unsigned char Cckmstart[CCKM_START_EVENT_SIZE * 2]; + int i,len,n; + OS_802_11_BSSID_EX *my_current; +#endif + /* indicate to the OS */ + os_IndicateEvent (pCmdInterpret->hOs, pData); + + + switch (pData->EvParams.uEventType) + { + case IPC_EVENT_ASSOCIATED: + { + paramInfo_t *pParam; + + pParam = (paramInfo_t *)os_memoryAlloc(pCmdInterpret->hOs, sizeof(paramInfo_t)); + if (!pParam) + return TI_NOK; + + /* Get Association information */ + + /* first check if this is ADHOC or INFRA (to avoid retrieving ASSOC INFO for ADHOC)*/ + + pParam->paramType = CTRL_DATA_CURRENT_BSS_TYPE_PARAM; + cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); + if (pParam->content.ctrlDataCurrentBssType == BSS_INFRASTRUCTURE) + { + + /* First get length of data */ + pParam->paramType = ASSOC_ASSOCIATION_INFORMATION_PARAM; + pParam->paramLength = 0; + res = cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); + + if (res != TI_NOK) + { + TotalLength = sizeof(OS_802_11_ASSOCIATION_INFORMATION) + pParam->content.assocAssociationInformation.RequestIELength + + pParam->content.assocAssociationInformation.ResponseIELength; + + memptr = os_memoryAlloc (pCmdInterpret->hOs, TotalLength); + + /* Get actual data */ + + pParam->paramType = ASSOC_ASSOCIATION_INFORMATION_PARAM; + pParam->paramLength = TotalLength; + cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); + + os_memoryCopy(pCmdInterpret->hOs, memptr, &pParam->content, TotalLength); + + assocInformation = (OS_802_11_ASSOCIATION_INFORMATION*)memptr; + requestIEs = (TI_UINT8*)memptr + sizeof(OS_802_11_ASSOCIATION_INFORMATION); + + if (assocInformation->RequestIELength > 0) + { + os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = assocInformation->RequestIELength; + wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVASSOCREQIE, &wrqu, (char *)assocInformation->OffsetRequestIEs); + } + + responseIEs = (char *)assocInformation->OffsetRequestIEs + assocInformation->RequestIELength; + + if (assocInformation->ResponseIELength > 0) + { + os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = assocInformation->ResponseIELength; + wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVASSOCRESPIE, &wrqu, (char *)responseIEs); + } + + os_memoryFree (pCmdInterpret->hOs, memptr, TotalLength); + + } + } + +#ifdef XCC_MODULE_INCLUDED + /* + the driver must provide BEACON IE for calculate MIC in case of fast roaming + the data is an ASCII NUL terminated string + */ + + + my_current = os_memoryAlloc (pCmdInterpret->hOs,MAX_BEACON_BODY_LENGTH); + if (!my_current) { + res = TI_NOK; + goto event_end; + } + pParam->paramType = SITE_MGR_GET_SELECTED_BSSID_INFO_EX; + pParam->content.pSiteMgrSelectedSiteInfo = my_current; + pParam->paramLength = MAX_BEACON_BODY_LENGTH; + cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); + + len = pParam->content.pSiteMgrSelectedSiteInfo->IELength - BEACON_HEADER_FIX_SIZE; + + n = sprintf(beaconIE, "BEACONIE="); + for (i = 0; i < len; i++) + { + n += sprintf(beaconIE + n, "%02x", pParam->content.pSiteMgrSelectedSiteInfo->IEs[BEACON_HEADER_FIX_SIZE+i] & 0xff); + } + + os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = n; + wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVCUSTOM, &wrqu, beaconIE); + os_memoryFree(pCmdInterpret->hOs,my_current,MAX_BEACON_BODY_LENGTH); + + + /* + The driver should be sending the Association Resp IEs + This informs the supplicant of the IEs used in the association exchanged which are required to proceed with CCKM. + */ + + + pParam->paramType = ASSOC_ASSOCIATION_RESP_PARAM; + pParam->paramLength = sizeof(TAssocReqBuffer); + cmdDispatch_GetParam(pCmdInterpret->hCmdDispatch, pParam); + + cckm_assoc.assocRespLen = Param.content.assocReqBuffer.bufferSize - ASSOC_RESP_FIXED_DATA_LEN ; + cckm_assoc.assocRespBuffer = os_memoryAlloc (pCmdInterpret->hOs, cckm_assoc.assocRespLen); + if (!cckm_assoc.assocRespBuffer) { + res = TI_NOK; + goto event_end; + } + memcpy(cckm_assoc.assocRespBuffer,(pParam->content.assocReqBuffer.buffer)+ASSOC_RESP_FIXED_DATA_LEN,cckm_assoc.assocRespLen); + wrqu.data.length = cckm_assoc.assocRespLen; + wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVASSOCRESPIE, &wrqu, (TI_UINT8*)cckm_assoc.assocRespBuffer); + os_memoryFree(pCmdInterpret->hOs,cckm_assoc.assocRespBuffer,cckm_assoc.assocRespLen); + +#endif + /* Send associated event (containing BSSID of AP) */ + + os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); + pParam->paramType = SITE_MGR_CURRENT_BSSID_PARAM; + cmdDispatch_GetParam ( pCmdInterpret->hCmdDispatch, pParam ); + MAC_COPY (wrqu.ap_addr.sa_data, pParam->content.siteMgrDesiredBSSID); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + wireless_send_event(NETDEV(pCmdInterpret->hOs), SIOCGIWAP, &wrqu, NULL); +#ifdef XCC_MODULE_INCLUDED +event_end: +#endif + os_memoryFree(pCmdInterpret->hOs, pParam, sizeof(paramInfo_t)); + } + break; + case IPC_EVENT_DISASSOCIATED: + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + os_memorySet (pCmdInterpret->hOs,wrqu.ap_addr.sa_data, 0, ETH_ALEN); + + wireless_send_event(NETDEV(pCmdInterpret->hOs), SIOCGIWAP, &wrqu, NULL); + + os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = sizeof(IPC_EV_DATA); + wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVCUSTOM, &wrqu, (TI_UINT8 *)pData); + + break; + + case IPC_EVENT_SCAN_COMPLETE: + { + TI_UINT8 *buf; + wrqu.data.length = 0; + wrqu.data.flags = 0; + buf = pData->uBuffer; + + if (*(TI_UINT32*)buf == SCAN_STATUS_COMPLETE) + wireless_send_event(NETDEV(pCmdInterpret->hOs), SIOCGIWSCAN, &wrqu, NULL); + else + { + if (*(TI_UINT32*)buf == SCAN_STATUS_STOPPED) // scan is stopped successfully + pData->EvParams.uEventType = IPC_EVENT_SCAN_STOPPED; + else if (*(TI_UINT32*)buf == SCAN_STATUS_FAILED) // scan is stopped successfully + pData->EvParams.uEventType = IPC_EVENT_SCAN_FAILED; + else + break; + + os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = sizeof(IPC_EV_DATA); + wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVCUSTOM, &wrqu, (u8 *)pData); + } + } + break; + + case IPC_EVENT_MEDIA_SPECIFIC: + { + TI_UINT8 *buf; + OS_802_11_AUTHENTICATION_REQUEST *request; + struct iw_michaelmicfailure ev; + struct iw_pmkid_cand pcand; + + buf = pData->uBuffer; + + if (*(TI_UINT32*)buf == os802_11StatusType_Authentication) + { + request = (OS_802_11_AUTHENTICATION_REQUEST *) (buf + sizeof(TI_UINT32)); + if ( request->Flags == OS_802_11_REQUEST_PAIRWISE_ERROR || request->Flags == OS_802_11_REQUEST_GROUP_ERROR) + { + os_printf ("MIC failure detected\n"); + + os_memorySet (pCmdInterpret->hOs,&ev, 0, sizeof(ev)); + + ev.flags = 0 & IW_MICFAILURE_KEY_ID; + + if (request->Flags == OS_802_11_REQUEST_GROUP_ERROR) + ev.flags |= IW_MICFAILURE_GROUP; + else + ev.flags |= IW_MICFAILURE_PAIRWISE; + + ev.src_addr.sa_family = ARPHRD_ETHER; + MAC_COPY (ev.src_addr.sa_data, request->BSSID); + os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = sizeof(ev); + wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVMICHAELMICFAILURE, &wrqu, (char *) &ev); + } + + } else if (*(TI_UINT32*)buf == os802_11StatusType_PMKID_CandidateList) + { + OS_802_11_PMKID_CANDIDATELIST *pCandList = (OS_802_11_PMKID_CANDIDATELIST *) (buf + sizeof(TI_UINT32)); + int i; + + os_printf ("Preauthentication list (%d entries)!\n",pCandList->NumCandidates); + + for (i=0; i<pCandList->NumCandidates; i++) + { + os_memorySet (pCmdInterpret->hOs,&pcand, 0, sizeof(pcand)); + pcand.flags |= IW_PMKID_CAND_PREAUTH; + + pcand.index = i; + + MAC_COPY (pcand.bssid.sa_data, pCandList->CandidateList[i].BSSID); + + os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); + + wrqu.data.length = sizeof(pcand); + + wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVPMKIDCAND, + &wrqu, (TI_UINT8 *)&pcand); + } + + } + + } + + break; +#ifdef XCC_MODULE_INCLUDED + case IPC_EVENT_CCKM_START: + + n = sprintf(Cckmstart, "CCKM-Start="); + for (i = 0; i < 14; i++) + { + n += sprintf(Cckmstart + n, "%02x", pData->uBuffer[i] & 0xff); + } + + os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = n; + wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVCUSTOM, &wrqu, Cckmstart); + + break; +#endif + + default: + /* Other event? probably private and does not need interface-specific conversion */ + /* Send as "custom" event */ + { + os_memorySet (pCmdInterpret->hOs,&wrqu, 0, sizeof(wrqu)); + wrqu.data.length = sizeof(IPC_EV_DATA); + wireless_send_event(NETDEV(pCmdInterpret->hOs), IWEVCUSTOM, &wrqu, (TI_UINT8 *)pData); + } + + break; + } + + return res; +} + + +/* Configure driver authentication and security by converting from WEXT interface to driver (OID-like) settings */ +static int cmdInterpret_setSecurityParams (TI_HANDLE hCmdInterpret) +{ + cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)hCmdInterpret; + paramInfo_t *pParam; + int auth_mode, encr_mode; + + /* + printk ("wpa_version=0x%x auth_alg=0x%x key_mgmt=0x%x " + "cipher_pairwise=0x%x cipher_group=0x%x\n", + pCmdInterpret->wai.iw_auth_wpa_version, pCmdInterpret->wai.iw_auth_80211_auth_alg, + pCmdInterpret->wai.iw_auth_key_mgmt, pCmdInterpret->wai.iw_auth_cipher_pairwise, + pCmdInterpret->wai.iw_auth_cipher_group); + */ + pParam = (paramInfo_t *)os_memoryAlloc(pCmdInterpret->hOs, sizeof(paramInfo_t)); + if (!pParam) + return TI_NOK; + if (pCmdInterpret->wai.iw_auth_wpa_version & IW_AUTH_WPA_VERSION_WPA2) + { + if (pCmdInterpret->wai.iw_auth_key_mgmt & IW_AUTH_KEY_MGMT_802_1X) + auth_mode = os802_11AuthModeWPA2; + else + auth_mode = os802_11AuthModeWPA2PSK; + } else if (pCmdInterpret->wai.iw_auth_wpa_version & IW_AUTH_WPA_VERSION_WPA) + { + if (pCmdInterpret->wai.iw_auth_key_mgmt & IW_AUTH_KEY_MGMT_802_1X) + auth_mode = os802_11AuthModeWPA; + else if (pCmdInterpret->wai.iw_auth_key_mgmt & IW_AUTH_KEY_MGMT_PSK) + auth_mode = os802_11AuthModeWPAPSK; + else + auth_mode = os802_11AuthModeWPANone; + } else if (pCmdInterpret->wai.iw_auth_80211_auth_alg & IW_AUTH_ALG_SHARED_KEY) + { + if (pCmdInterpret->wai.iw_auth_80211_auth_alg & IW_AUTH_ALG_OPEN_SYSTEM) + auth_mode = os802_11AuthModeAutoSwitch; + else + auth_mode = os802_11AuthModeShared; + } else + auth_mode = os802_11AuthModeOpen; + + if (pCmdInterpret->wai.iw_auth_cipher_pairwise & IW_AUTH_CIPHER_CCMP) + encr_mode = os802_11Encryption3Enabled; + else if (pCmdInterpret->wai.iw_auth_cipher_pairwise & IW_AUTH_CIPHER_TKIP) + encr_mode = os802_11Encryption2Enabled; + else if (pCmdInterpret->wai.iw_auth_cipher_pairwise & + (IW_AUTH_CIPHER_WEP40 | IW_AUTH_CIPHER_WEP104)) + encr_mode = os802_11Encryption1Enabled; + else if (pCmdInterpret->wai.iw_auth_cipher_group & IW_AUTH_CIPHER_CCMP) + encr_mode = os802_11Encryption3Enabled; + else if (pCmdInterpret->wai.iw_auth_cipher_group & IW_AUTH_CIPHER_TKIP) + encr_mode = os802_11Encryption2Enabled; + else + encr_mode = os802_11EncryptionDisabled; + + switch (encr_mode) + { + case os802_11WEPDisabled: + encr_mode = TWD_CIPHER_NONE; + break; + case os802_11WEPEnabled: + encr_mode = TWD_CIPHER_WEP; + break; + case os802_11Encryption2Enabled: + encr_mode = TWD_CIPHER_TKIP; + break; + case os802_11Encryption3Enabled: + encr_mode = TWD_CIPHER_AES_CCMP; + break; + default: + break; + } + + pParam->paramType = RSN_EXT_AUTHENTICATION_MODE; + pParam->content.rsnExtAuthneticationMode = auth_mode; + cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, pParam ); + + pParam->paramType = RSN_ENCRYPTION_STATUS_PARAM; + pParam->content.rsnEncryptionStatus = encr_mode; + cmdDispatch_SetParam ( pCmdInterpret->hCmdDispatch, pParam ); + os_memoryFree(pCmdInterpret->hOs, pParam, sizeof(paramInfo_t)); + return TI_OK; +} + + +void *cmdInterpret_GetStat (TI_HANDLE hCmdInterpret) +{ + cmdInterpret_t *pCmdInterpret = (cmdInterpret_t *)hCmdInterpret; + + /* Check if driver is initialized - If not - return empty statistics */ + if (hCmdInterpret) + { + pCmdInterpret->wstats.status = 0; + pCmdInterpret->wstats.miss.beacon = 0; + pCmdInterpret->wstats.discard.retries = 0; /* Tx : Max MAC retries num reached */ + pCmdInterpret->wstats.discard.nwid = 0; /* Rx : Wrong nwid/essid */ + pCmdInterpret->wstats.discard.code = 0; /* Rx : Unable to code/decode (WEP) */ + pCmdInterpret->wstats.discard.fragment = 0; /* Rx : Can't perform MAC reassembly */ + pCmdInterpret->wstats.discard.misc = 0; /* Others cases */ + + pCmdInterpret->wstats.qual.qual = 0; + pCmdInterpret->wstats.qual.level = 0; + pCmdInterpret->wstats.qual.noise = 0; + pCmdInterpret->wstats.qual.updated = IW_QUAL_NOISE_INVALID | IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; + return &pCmdInterpret->wstats; + } + return (void *)NULL; +} diff --git a/wilink_6_1/platforms/os/linux/src/RxBuf.c b/wilink_6_1/platforms/os/linux/src/RxBuf.c new file mode 100644 index 0000000..6197292 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/RxBuf.c @@ -0,0 +1,98 @@ +/* + * RxBuf.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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 buf.c + * \brief Linux buf implementation. + * + * \see + */ + +#include "tidef.h" +#include "RxBuf_linux.h" +#include <linux/netdevice.h> +/*--------------------------------------------------------------------------------------*/ +/* + * Allocate BUF Rx packets. + * Add 16 bytes before the data buffer for WSPI overhead! + */ +void *RxBufAlloc(TI_HANDLE hOs, TI_UINT32 len,PacketClassTag_e ePacketClassTag) +{ + TI_UINT32 alloc_len = len + WSPI_PAD_BYTES + PAYLOAD_ALIGN_PAD_BYTES + RX_HEAD_LEN_ALIGNED; + struct sk_buff *skb; + rx_head_t *rx_head; + + skb = alloc_skb(alloc_len, GFP_ATOMIC); + if (!skb) + return NULL; + rx_head = (rx_head_t *)skb->head; + rx_head->skb = skb; + skb_reserve(skb, RX_HEAD_LEN_ALIGNED + WSPI_PAD_BYTES); +/* + printk("-->> RxBufAlloc(len=%d) skb=0x%x skb->data=0x%x skb->head=0x%x skb->len=%d\n", + (int)len, (int)skb, (int)skb->data, (int)skb->head, (int)skb->len); +*/ + return skb->data; + +} + +/*--------------------------------------------------------------------------------------*/ + +inline void RxBufFree(TI_HANDLE hOs, void *pBuf) +{ + unsigned char *pdata = (unsigned char *)((TI_UINT32)pBuf & ~(TI_UINT32)0x3); + rx_head_t *rx_head = (rx_head_t *)(pdata - WSPI_PAD_BYTES - RX_HEAD_LEN_ALIGNED); + struct sk_buff *skb = rx_head->skb; + +#ifdef TI_DBG + if ((TI_UINT32)pBuf & 0x3) + { + if ((TI_UINT32)pBuf - (TI_UINT32)skb->data != 2) + { + printk("RxBufFree() address error skb=0x%x skb->data=0x%x pPacket=0x%x !!!\n",(int)skb, (int)skb->data, (int)pBuf); + } + } + else + { + if ((TI_UINT32)skb->data != (TI_UINT32)pBuf) + { + printk("RxBufFree() address error skb=0x%x skb->data=0x%x pPacket=0x%x !!!\n",(int)skb, (int)skb->data, (int)pBuf); + } + } +#endif +/* + printk("-->> RxBufFree() skb=0x%x skb->data=0x%x skb->head=0x%x skb->len=%d\n", + (int)skb, (int)skb->data, (int)skb->head, (int)skb->len); +*/ + dev_kfree_skb(skb); +} diff --git a/wilink_6_1/platforms/os/linux/src/WlanDrvIf.c b/wilink_6_1/platforms/os/linux/src/WlanDrvIf.c new file mode 100644 index 0000000..d32b31b --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/WlanDrvIf.c @@ -0,0 +1,1049 @@ +/* + * WlanDrvIf.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * src/esta_drv.c + * + * Kernel level portion of eSTA DK Linux module driver + * + */ + + +/** \file WlanDrvIf.c + * \brief The OS-Dependent interfaces of the WLAN driver with external applications: + * - Configuration utilities (including download, configuration and activation) + * - Network Stack (Tx and Rx) + * - Interrupts + * - Events to external applications + * + * \see WlanDrvIf.h, Wext.c + */ + + +#include <net/sock.h> +#include <linux/etherdevice.h> +#include <linux/delay.h> +#include <linux/netlink.h> + +#include "WlanDrvIf.h" +#include "osApi.h" +#include "host_platform.h" +#include "context.h" +#include "CmdHndlr.h" +#include "WlanDrvWext.h" +#include "DrvMain.h" +#include "txDataQueue_Api.h" +#include "txMgmtQueue_Api.h" +#include "TWDriver.h" +#include "Ethernet.h" +#ifdef TI_DBG +#include "tracebuf_api.h" +#endif +/* PM hooks */ +#ifdef TI_CONFIG_PM_HOOKS +#include "SdioDrv.h" +static int wlanDrvIf_pm_resume(void); +static int wlanDrvIf_pm_suspend(void); +#endif +#include "bmtrace_api.h" +#ifdef STACK_PROFILE +#include "stack_profile.h" +#endif + +/* save driver handle just for module cleanup */ +static TWlanDrvIfObj *pDrvStaticHandle; + +#define OS_SPECIFIC_RAM_ALLOC_LIMIT (0xFFFFFFFF) /* assume OS never reach that limit */ + + +MODULE_DESCRIPTION("TI WLAN Embedded Station Driver"); +MODULE_LICENSE("GPL"); + +/** + * \fn wlanDrvIf_Xmit + * \brief Packets transmission + * + * The network stack calls this function in order to transmit a packet + * through the WLAN interface. + * The packet is inserted to the drver Tx queues and its handling is continued + * after switching to the driver context. + * + * \note + * \param skb - The Linux packet buffer structure + * \param dev - The driver network-interface handle + * \return 0 (= OK) + * \sa + */ +static int wlanDrvIf_Xmit (struct sk_buff *skb, struct net_device *dev) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + TTxCtrlBlk * pPktCtrlBlk; + int status; + + CL_TRACE_START_L1(); + + os_profile (drv, 0, 0); + drv->stats.tx_packets++; + drv->stats.tx_bytes += skb->len; + + /* Allocate a TxCtrlBlk for the Tx packet and save timestamp, length and packet handle */ + pPktCtrlBlk = TWD_txCtrlBlk_Alloc (drv->tCommon.hTWD); + + pPktCtrlBlk->tTxDescriptor.startTime = os_timeStampMs(drv); /* remove use of skb->tstamp.off_usec */ + pPktCtrlBlk->tTxDescriptor.length = skb->len; + pPktCtrlBlk->tTxPktParams.pInputPkt = skb; + + /* Point the first BDL buffer to the Ethernet header, and the second buffer to the rest of the packet */ + pPktCtrlBlk->tTxnStruct.aBuf[0] = skb->data; + pPktCtrlBlk->tTxnStruct.aLen[0] = ETHERNET_HDR_LEN; + pPktCtrlBlk->tTxnStruct.aBuf[1] = skb->data + ETHERNET_HDR_LEN; + pPktCtrlBlk->tTxnStruct.aLen[1] = (TI_UINT16)skb->len - ETHERNET_HDR_LEN; + pPktCtrlBlk->tTxnStruct.aLen[2] = 0; + + /* Send the packet to the driver for transmission. */ + status = txDataQ_InsertPacket (drv->tCommon.hTxDataQ, pPktCtrlBlk,(TI_UINT8)skb->priority); + + /* If failed (queue full or driver not running), drop the packet. */ + if (status != TI_OK) + { + drv->stats.tx_errors++; + } + os_profile (drv, 1, 0); + + CL_TRACE_END_L1("tiwlan_drv.ko", "OS", "TX", ""); + + return 0; +} +/*--------------------------------------------------------------------------------------*/ +/** + * \fn wlanDrvIf_FreeTxPacket + * \brief Free the OS Tx packet + * + * Free the OS Tx packet after driver processing is finished. + * + * \note + * \param hOs - The OAL object handle + * \param pPktCtrlBlk - The packet CtrlBlk + * \param eStatus - The packet transmission status (OK/NOK) + * \return void + * \sa + */ +/*--------------------------------------------------------------------------------------*/ + +void wlanDrvIf_FreeTxPacket (TI_HANDLE hOs, TTxCtrlBlk *pPktCtrlBlk, TI_STATUS eStatus) +{ + dev_kfree_skb((struct sk_buff *)pPktCtrlBlk->tTxPktParams.pInputPkt); +} + +/** + * \fn wlanDrvIf_XmitDummy + * \brief Dummy transmission handler + * + * This function is registered at the network stack interface as the packets-transmission + * handler (replacing wlanDrvIf_Xmit) when the driver is not operational. + * Using this dummy handler is more efficient then checking the driver state for every + * packet transmission. + * + * \note + * \param skb - The Linux packet buffer structure + * \param dev - The driver network-interface handle + * \return error + * \sa wlanDrvIf_Xmit + */ +static int wlanDrvIf_XmitDummy (struct sk_buff *skb, struct net_device *dev) +{ + /* Just return error. The driver is not running (network stack frees the packet) */ + return -ENODEV; +} + + +/** + * \fn wlanDrvIf_NetGetStat + * \brief Provides driver statistics + * + * Provides driver Tx and Rx statistics to network stack. + * + * \note + * \param dev - The driver network-interface handle + * \return The statistics pointer + * \sa + */ +static struct net_device_stats *wlanDrvIf_NetGetStat (struct net_device *dev) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_NetGetStat()\n"); + + return &drv->stats; +} + + +/** + * \fn wlanDrvIf_UpdateDriverState + * \brief Update the driver state + * + * The DrvMain uses this function to update the OAL with the driver steady state + * that is relevant for the driver users. + * + * \note + * \param hOs - The driver object handle + * \param eDriverState - The new driver state + * \return void + * \sa + */ +void wlanDrvIf_UpdateDriverState (TI_HANDLE hOs, EDriverSteadyState eDriverState) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hOs; + + ti_dprintf(TIWLAN_LOG_OTHER, "wlanDrvIf_UpdateDriverState(): State = %d\n", eDriverState); + + /* Save the new state */ + drv->tCommon.eDriverState = eDriverState; + + /* If the new state is not RUNNING, replace the Tx handler to a dummy one. */ + if (eDriverState != DRV_STATE_RUNNING) + { + drv->netdev->hard_start_xmit = wlanDrvIf_XmitDummy; + } +} + + +/** + * \fn wlanDrvIf_HandleInterrupt + * \brief The WLAN interrupt handler + * + * The WLAN driver interrupt handler called in the interrupt context. + * The actual handling is done in the driver's context after switching to the workqueue. + * + * \note + * \param irq - The interrupt type + * \param hDrv - The driver object handle + * \param cpu_regs - The CPU registers + * \return IRQ_HANDLED + * \sa + */ +irqreturn_t wlanDrvIf_HandleInterrupt (int irq, void *hDrv, struct pt_regs *cpu_regs) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hDrv; + + TWD_InterruptRequest (drv->tCommon.hTWD); + + return IRQ_HANDLED; +} + + +/** + * \fn PollIrqHandler + * \brief WLAN IRQ polling handler - for debug! + * + * A debug option to catch the WLAN events in polling instead of interrupts. + * A timer calls this function periodically to check the interrupt status register. + * + * \note + * \param parm - The driver object handle + * \return void + * \sa + */ +#ifdef PRIODIC_INTERRUPT +static void wlanDrvIf_PollIrqHandler (TI_HANDLE parm) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)parm; + + wlanDrvIf_HandleInterrupt (0, drv, NULL); + os_periodicIntrTimerStart (drv); +} +#endif + + +/** + * \fn wlanDrvIf_DriverTask + * \brief The driver task + * + * This is the driver's task, where most of its job is done. + * External contexts just save required information and schedule the driver's + * task to continue the handling. + * See more information in the context engine module (context.c). + * + * \note + * \param hDrv - The driver object handle + * \return void + * \sa + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) +static void wlanDrvIf_DriverTask (void *hDrv) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hDrv; +#else +static void wlanDrvIf_DriverTask(struct work_struct *work) +{ +#ifdef STACK_PROFILE + register unsigned long sp asm ("sp"); + unsigned long local_sp = sp; +#endif + TWlanDrvIfObj *drv = container_of(work, TWlanDrvIfObj, tWork); +#endif + +#ifdef STACK_PROFILE + unsigned long curr1, base1; + unsigned long curr2, base2; + static unsigned long maximum_stack = 0; +#endif + os_profile (drv, 0, 0); + +#ifdef STACK_PROFILE + curr1 = check_stack_start(&base1, local_sp + 4, 0); +#endif + + /* Call the driver main task */ + context_DriverTask (drv->tCommon.hContext); + + os_profile (drv, 1, 0); + os_wake_lock_timeout(drv); + os_wake_unlock(drv); +#ifdef STACK_PROFILE + curr2 = check_stack_stop(&base2, 0); + if (base2 == base1) { + /* if the current measurement is bigger then the maximum store it and print*/ + if ((curr1 - curr2) > maximum_stack) { + printk("STACK PROFILER GOT THE LOCAL MAXIMMUM!!!! \n"); + printk("current operation stack use=%lu \n",(curr1 - curr2)); + printk("total stack use=%lu \n",8192 - curr2 + base2); + printk("total stack usage=%lu percent \n",100 * (8192 - curr2 + base2) / 8192); + maximum_stack = curr1 - curr2; + } + } +#endif +} + + +/** + * \fn wlanDrvIf_LoadFiles + * \brief Load init files from loader + * + * This function is called from the loader context right after the driver + * is created (in IDLE state). + * It copies the following files to the driver's memory: + * - Ini-File - The driver's default parameters values + * - NVS-File - The NVS data for FW usage + * - FW-Image - The FW program image + * + * \note + * \param drv - The driver object handle + * \return void + * \sa wlanDrvIf_GetFile + */ +int wlanDrvIf_LoadFiles (TWlanDrvIfObj *drv, TLoaderFilesData *pInitFiles) +{ + if (!pInitFiles) + { + ti_dprintf (TIWLAN_LOG_ERROR, "No Init Files!\n"); + return -EINVAL; + } + + if (drv->tCommon.eDriverState != DRV_STATE_IDLE) + { + ti_dprintf (TIWLAN_LOG_ERROR, "Trying to load files not in IDLE state!\n"); + return -EINVAL; + } + + if (pInitFiles->uIniFileLength) + { + drv->tCommon.tIniFile.uSize = pInitFiles->uIniFileLength; + drv->tCommon.tIniFile.pImage = kmalloc (pInitFiles->uIniFileLength, GFP_KERNEL); + #ifdef TI_MEM_ALLOC_TRACE + os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, pInitFiles->uIniFileLength, GFP_KERNEL, pInitFiles->uIniFileLength); + #endif + if (!drv->tCommon.tIniFile.pImage) + { + ti_dprintf (TIWLAN_LOG_ERROR, "Cannot allocate buffer for Ini-File!\n"); + return -ENOMEM; + } + memcpy (drv->tCommon.tIniFile.pImage, + &pInitFiles->data[pInitFiles->uNvsFileLength + pInitFiles->uFwFileLength], + drv->tCommon.tIniFile.uSize); + } + + if (pInitFiles->uNvsFileLength) + { + drv->tCommon.tNvsImage.uSize = pInitFiles->uNvsFileLength; + drv->tCommon.tNvsImage.pImage = kmalloc (drv->tCommon.tNvsImage.uSize, GFP_KERNEL); + #ifdef TI_MEM_ALLOC_TRACE + os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", + __FUNCTION__, __LINE__, drv->tCommon.tNvsImage.uSize, GFP_KERNEL, drv->tCommon.tNvsImage.uSize); + #endif + if (!drv->tCommon.tNvsImage.pImage) + { + ti_dprintf (TIWLAN_LOG_ERROR, "Cannot allocate buffer for NVS image\n"); + return -ENOMEM; + } + memcpy (drv->tCommon.tNvsImage.pImage, &pInitFiles->data[0], drv->tCommon.tNvsImage.uSize ); + } + + drv->tCommon.tFwImage.uSize = pInitFiles->uFwFileLength; + if (!drv->tCommon.tFwImage.uSize) + { + ti_dprintf (TIWLAN_LOG_ERROR, "No firmware image\n"); + return -EINVAL; + } + drv->tCommon.tFwImage.pImage = os_memoryAlloc (drv, drv->tCommon.tFwImage.uSize); + #ifdef TI_MEM_ALLOC_TRACE + os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", + __FUNCTION__, __LINE__, drv->tCommon.tFwImage.uSize, GFP_KERNEL, drv->tCommon.tFwImage.uSize); + #endif + if (!drv->tCommon.tFwImage.pImage) + { + ti_dprintf(TIWLAN_LOG_ERROR, "Cannot allocate buffer for firmware image\n"); + return -ENOMEM; + } + memcpy (drv->tCommon.tFwImage.pImage, + &pInitFiles->data[pInitFiles->uNvsFileLength], + drv->tCommon.tFwImage.uSize); + + ti_dprintf(TIWLAN_LOG_OTHER, "--------- Eeeprom=%p(%lu), Firmware=%p(%lu), IniFile=%p(%lu)\n", + drv->tCommon.tNvsImage.pImage, drv->tCommon.tNvsImage.uSize, + drv->tCommon.tFwImage.pImage, drv->tCommon.tFwImage.uSize, + drv->tCommon.tIniFile.pImage, drv->tCommon.tIniFile.uSize); + + return 0; +} + + +/** + * \fn wlanDrvIf_GetFile + * \brief Provides access to a requested init file + * + * Provide the requested file information and call the requester callback. + * Note that in Linux the files were previously loaded to driver memory + * by the loader (see wlanDrvIf_LoadFiles). + * + * \note + * \param hOs - The driver object handle + * \param pFileInfo - The requested file's properties + * \return TI_OK + * \sa wlanDrvIf_LoadFiles + */ +int wlanDrvIf_GetFile (TI_HANDLE hOs, TFileInfo *pFileInfo) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hOs; + + if (drv == NULL || pFileInfo == NULL) { + ti_dprintf(TIWLAN_LOG_ERROR, "wlanDrv_GetFile: ERROR: Null File Handler, Exiting"); + return TI_NOK; + } + + /* Future option for getting the FW image part by part */ + pFileInfo->hOsFileDesc = NULL; + + /* Fill the file's location and size in the file's info structure */ + switch (pFileInfo->eFileType) + { + case FILE_TYPE_INI: + pFileInfo->pBuffer = (TI_UINT8 *)drv->tCommon.tIniFile.pImage; + pFileInfo->uLength = drv->tCommon.tIniFile.uSize; + break; + case FILE_TYPE_NVS: + pFileInfo->pBuffer = (TI_UINT8 *)drv->tCommon.tNvsImage.pImage; + pFileInfo->uLength = drv->tCommon.tNvsImage.uSize; + break; + case FILE_TYPE_FW: + pFileInfo->pBuffer = (TI_UINT8 *)drv->tCommon.tFwImage.pImage; + pFileInfo->bLast = TI_FALSE; + pFileInfo->uLength = 0; + pFileInfo->uOffset = 0; + pFileInfo->uChunkBytesLeft = 0; + pFileInfo->uChunksLeft = BYTE_SWAP_LONG( *((TI_UINT32*)(pFileInfo->pBuffer)) ); + /* check uChunksLeft's Validity */ + if (( pFileInfo->uChunksLeft == 0 ) || ( pFileInfo->uChunksLeft > MAX_CHUNKS_IN_FILE )) + { + ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_GetFile() Read Invalid Chunks Left: %d!\n",pFileInfo->uChunksLeft); + return TI_NOK; + } + pFileInfo->pBuffer += DRV_ADDRESS_SIZE; + /* FALL THROUGH */ + case FILE_TYPE_FW_NEXT: + /* check dec. validity */ + if ( pFileInfo->uChunkBytesLeft >= pFileInfo->uLength ) + { + pFileInfo->uChunkBytesLeft -= pFileInfo->uLength; + } + /* invalid Dec. */ + else + { + ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_GetFile() No. of Bytes Left < File Length\n"); + return TI_NOK; + } + pFileInfo->pBuffer += pFileInfo->uLength; + + /* Finished reading all Previous Chunk */ + if ( pFileInfo->uChunkBytesLeft == 0 ) + { + /* check dec. validity */ + if ( pFileInfo->uChunksLeft > 0 ) + { + pFileInfo->uChunksLeft--; + } + /* invalid Dec. */ + else + { + ti_dprintf (TIWLAN_LOG_ERROR, "No. of Bytes Left = 0 and Chunks Left <= 0\n"); + return TI_NOK; + } + /* read Chunk's address */ + pFileInfo->uAddress = BYTE_SWAP_LONG( *((TI_UINT32*)(pFileInfo->pBuffer)) ); + pFileInfo->pBuffer += DRV_ADDRESS_SIZE; + /* read Portion's length */ + pFileInfo->uChunkBytesLeft = BYTE_SWAP_LONG( *((TI_UINT32*)(pFileInfo->pBuffer)) ); + pFileInfo->pBuffer += DRV_ADDRESS_SIZE; + } + /* Reading Chunk is NOT complete */ + else + { + pFileInfo->uAddress += pFileInfo->uLength; + } + + if ( pFileInfo->uChunkBytesLeft < OS_SPECIFIC_RAM_ALLOC_LIMIT ) + { + pFileInfo->uLength = pFileInfo->uChunkBytesLeft; + } + else + { + pFileInfo->uLength = OS_SPECIFIC_RAM_ALLOC_LIMIT; + } + + /* If last chunk to download */ + if (( pFileInfo->uChunksLeft == 0 ) && + ( pFileInfo->uLength == pFileInfo->uChunkBytesLeft )) + { + pFileInfo->bLast = TI_TRUE; + } + + break; + } + + /* Call the requester callback */ + if (pFileInfo->fCbFunc) + { + pFileInfo->fCbFunc (pFileInfo->hCbHndl); + } + + return TI_OK; +} + + +/** + * \fn wlanDrvIf_SetMacAddress + * \brief Set STA MAC address + * + * Called by DrvMain from init process. + * Copies STA MAC address to the network interface structure. + * + * \note + * \param hOs - The driver object handle + * \param pMacAddr - The STA MAC address + * \return TI_OK + * \sa wlanDrvIf_LoadFiles + */ +void wlanDrvIf_SetMacAddress (TI_HANDLE hOs, TI_UINT8 *pMacAddr) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)hOs; + + /* Copy STA MAC address to the network interface structure */ + MAC_COPY (drv->netdev->dev_addr, pMacAddr); +} + + +/** + * \fn wlanDrvIf_Start + * \brief Start driver + * + * Called by network stack upon opening network interface (ifconfig up). + * Can also be called from user application or CLI for flight mode. + * Start the driver initialization process up to OPERATIONAL state. + * + * \note + * \param dev - The driver network-interface handle + * \return 0 if succeeded, error if driver not available + * \sa wlanDrvIf_Stop + */ +int wlanDrvIf_Start (struct net_device *dev) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + + ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Start()\n"); + printk("%s\n", __func__); + if (!drv->tCommon.hDrvMain) + { + ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Start() Driver not created!\n"); + return -ENODEV; + } + + /* + * Insert Start command in DrvMain action queue, request driver scheduling + * and wait for action completion (all init process). + */ + os_wake_lock_timeout_enable(drv); + drvMain_InsertAction (drv->tCommon.hDrvMain, ACTION_TYPE_START); + return 0; +} + +int wlanDrvIf_Open (struct net_device *dev) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + + ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Open()\n"); + printk("%s\n", __func__); + if (!drv->tCommon.hDrvMain) + { + ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Open() Driver not created!\n"); + return -ENODEV; + } + + if (drv->tCommon.eDriverState != DRV_STATE_RUNNING) { + wlanDrvIf_Start(dev); + } + + /* + * Finalize network interface setup + */ + drv->netdev->hard_start_xmit = wlanDrvIf_Xmit; + drv->netdev->addr_len = MAC_ADDR_LEN; + netif_start_queue (dev); + + /* register 3430 PM hooks in our SDIO driver */ +#ifdef TI_CONFIG_PM_HOOKS +#ifndef CONFIG_MMC_EMBEDDED_SDIO + sdioDrv_register_pm(wlanDrvIf_pm_resume, wlanDrvIf_pm_suspend); +#endif +#endif + return 0; +} + +/** + * \fn wlanDrvIf_Stop + * \brief Stop driver + * + * Called by network stack upon closing network interface (ifconfig down). + * Can also be called from user application or CLI for flight mode. + * Stop the driver and turn off the device. + * + * \note + * \param dev - The driver network-interface handle + * \return 0 (OK) + * \sa wlanDrvIf_Start + */ +int wlanDrvIf_Stop (struct net_device *dev) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + + ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Stop()\n"); + printk("%s\n", __func__); + /* + * Insert Stop command in DrvMain action queue, request driver scheduling + * and wait for Stop process completion. + */ + os_wake_lock_timeout_enable(drv); + drvMain_InsertAction (drv->tCommon.hDrvMain, ACTION_TYPE_STOP); + return 0; +} + +int wlanDrvIf_Release (struct net_device *dev) +{ + /* TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); */ + + ti_dprintf (TIWLAN_LOG_OTHER, "wlanDrvIf_Release()\n"); + printk("%s\n", __func__); + /* Disable network interface queue */ + netif_stop_queue (dev); + return 0; +} + +/* 3430 PM hooks */ +#ifdef TI_CONFIG_PM_HOOKS +static int wlanDrvIf_pm_resume(void) +{ + return(wlanDrvIf_Start(pDrvStaticHandle->netdev)); +} + +static int wlanDrvIf_pm_suspend(void) +{ + return(wlanDrvIf_Stop(pDrvStaticHandle->netdev)); +} +#endif + +/** + * \fn wlanDrvIf_SetupNetif + * \brief Setup driver network interface + * + * Called in driver creation process. + * Setup driver network interface. + * + * \note + * \param drv - The driver object handle + * \return 0 - OK, else - failure + * \sa + */ +static int wlanDrvIf_SetupNetif (TWlanDrvIfObj *drv) +{ + struct net_device *dev; + int res; + + /* Allocate network interface structure for the driver */ + dev = alloc_etherdev (0); + if (dev == NULL) + { + ti_dprintf (TIWLAN_LOG_ERROR, "alloc_etherdev() failed\n"); + return -ENOMEM; + } + + /* Setup the network interface */ + ether_setup (dev); + +/* the following is required on at least BSP 23.8 and higher. + Without it, the Open function of the driver will not be called + when trying to 'ifconfig up' the interface */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23) + dev->validate_addr = NULL; +#endif + + NETDEV_SET_PRIVATE(dev,drv); + drv->netdev = dev; + strcpy (dev->name, TIWLAN_DRV_IF_NAME); + netif_carrier_off (dev); + dev->open = wlanDrvIf_Open; + dev->stop = wlanDrvIf_Release; + dev->hard_start_xmit = wlanDrvIf_XmitDummy; + dev->get_stats = wlanDrvIf_NetGetStat; + dev->tx_queue_len = 100; + dev->do_ioctl = NULL; + + /* Initialize Wireless Extensions interface (WEXT) */ + wlanDrvWext_Init (dev); + + res = register_netdev (dev); + if (res != 0) + { + ti_dprintf (TIWLAN_LOG_ERROR, "register_netdev() failed : %d\n", res); + kfree (dev); + return res; + } +/* +On the latest Kernel there is no more support for the below macro. +*/ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) + SET_MODULE_OWNER (dev); +#endif + return 0; +} + +/** + * \fn wlanDrvIf_CommandDone + * \brief Free current command semaphore. + * + * This routine is called whenever a command has finished executing and Free current command semaphore. + * + * \note + * \param hOs - The driver object handle + * \param pSignalObject - handle to complete mechanism per OS + * \param CmdResp_p - respond structure (TCmdRespUnion) for OSE OS only + * \return 0 - OK, else - failure + * \sa wlanDrvIf_Destroy + */ +void wlanDrvIf_CommandDone (TI_HANDLE hOs, void *pSignalObject, TI_UINT8 *CmdResp_p) +{ + /* Free semaphore */ + os_SignalObjectSet (hOs, pSignalObject); +} + + +/** + * \fn wlanDrvIf_Create + * \brief Create the driver instance + * + * Allocate driver object. + * Initialize driver OS resources (IRQ, workqueue, events socket) + * Setup driver network interface. + * Create and link all driver modules. + * + * \note + * \param void + * \return 0 - OK, else - failure + * \sa wlanDrvIf_Destroy + */ +static int wlanDrvIf_Create (void) +{ + TWlanDrvIfObj *drv; /* Dm: Failure is not cleaned properly !!! */ + int rc; + + /* Allocate driver's structure */ + drv = kmalloc (sizeof(TWlanDrvIfObj), GFP_KERNEL); + if (!drv) { + return -ENOMEM; + } +#ifdef TI_DBG + tb_init(TB_OPTION_NONE); +#endif + pDrvStaticHandle = drv; /* save for module destroy */ +#ifdef TI_MEM_ALLOC_TRACE + os_printf ("MTT:%s:%d ::kmalloc(%lu, %x) : %lu\n", __FUNCTION__, __LINE__, sizeof(TWlanDrvIfObj), GFP_KERNEL, sizeof(TWlanDrvIfObj)); +#endif + memset (drv, 0, sizeof(TWlanDrvIfObj)); + + /* Dm: drv->irq = TNETW_IRQ; */ + drv->tCommon.eDriverState = DRV_STATE_IDLE; + + drv->tiwlan_wq = create_freezeable_workqueue(DRIVERWQ_NAME); + if (!drv->tiwlan_wq) { + ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Create(): Failed to create workQ!\n"); + rc = -EINVAL; + goto drv_create_end_1; + } + drv->wl_packet = 0; + drv->wl_count = 0; +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_init(&drv->wl_wifi, WAKE_LOCK_SUSPEND, "wifi_wake"); + wake_lock_init(&drv->wl_rxwake, WAKE_LOCK_SUSPEND, "wifi_rx_wake"); +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) + INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask, (void *)drv); +#else + INIT_WORK(&drv->tWork, wlanDrvIf_DriverTask); +#endif + spin_lock_init (&drv->lock); + + /* Setup driver network interface. */ + rc = wlanDrvIf_SetupNetif (drv); + if (rc) { + goto drv_create_end_2; + } + + /* Create the events socket interface */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) + drv->wl_sock = netlink_kernel_create( NETLINK_USERSOCK, 0, NULL, THIS_MODULE ); +#else + drv->wl_sock = netlink_kernel_create(&init_net, NETLINK_USERSOCK, 0, NULL, NULL, THIS_MODULE ); +#endif + if (drv->wl_sock == NULL) { + ti_dprintf (TIWLAN_LOG_ERROR, "netlink_kernel_create() failed !\n"); + rc = -EINVAL; + goto drv_create_end_3; + } + + /* Create all driver modules and link their handles */ + rc = drvMain_Create (drv, + &drv->tCommon.hDrvMain, + &drv->tCommon.hCmdHndlr, + &drv->tCommon.hContext, + &drv->tCommon.hTxDataQ, + &drv->tCommon.hTxMgmtQ, + &drv->tCommon.hTxCtrl, + &drv->tCommon.hTWD, + &drv->tCommon.hEvHandler); + if (rc != TI_OK) { + ti_dprintf (TIWLAN_LOG_ERROR, "%s: Failed to dvrMain_Create!\n", __func__); + rc = -EINVAL; + goto drv_create_end_4; + } + /* + * Initialize interrupts (or polling mode for debug): + */ +#ifdef PRIODIC_INTERRUPT + /* Debug mode: Polling (the timer is started by HwInit process) */ + drv->hPollTimer = os_timerCreate ((TI_HANDLE)drv, wlanDrvIf_PollIrqHandler, (TI_HANDLE)drv); +#else + /* Normal mode: Interrupts (the default mode) */ + rc = hPlatform_initInterrupt (drv, (void*)wlanDrvIf_HandleInterrupt); + if (rc) { + ti_dprintf (TIWLAN_LOG_ERROR, "wlanDrvIf_Create(): Failed to register interrupt handler!\n"); + goto drv_create_end_5; + } +#endif /* PRIODIC_INTERRUPT */ + return 0; +drv_create_end_5: + /* Destroy all driver modules */ + if (drv->tCommon.hDrvMain) { + drvMain_Destroy (drv->tCommon.hDrvMain); + } +drv_create_end_4: + if (drv->wl_sock) { + sock_release (drv->wl_sock->sk_socket); + } + +drv_create_end_3: + /* Release the driver network interface */ + if (drv->netdev) { + unregister_netdev (drv->netdev); + free_netdev (drv->netdev); + } + +drv_create_end_2: +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_destroy(&drv->wl_wifi); + wake_lock_destroy(&drv->wl_rxwake); +#endif + if (drv->tiwlan_wq) + destroy_workqueue(drv->tiwlan_wq); + +drv_create_end_1: + kfree(drv); + printk("%s: Fail\n", __func__); + return rc; +} + + +/** + * \fn wlanDrvIf_Destroy + * \brief Destroy the driver instance + * + * Destroy all driver modules. + * Release driver OS resources (IRQ, workqueue, events socket) + * Release driver network interface. + * Free init files memory. + * Free driver object. + * + * \note + * \param drv - The driver object handle + * \return void + * \sa wlanDrvIf_Create + */ +static void wlanDrvIf_Destroy (TWlanDrvIfObj *drv) +{ + /* Release the driver network interface */ + if (drv->netdev) { + netif_stop_queue (drv->netdev); + wlanDrvIf_Stop (drv->netdev); + unregister_netdev (drv->netdev); + free_netdev (drv->netdev); + } + /* Destroy all driver modules */ + if (drv->tCommon.hDrvMain) { + drvMain_Destroy (drv->tCommon.hDrvMain); + } + + /* close the ipc_kernel socket*/ + if (drv && drv->wl_sock) { + sock_release (drv->wl_sock->sk_socket); + } + /* Release the driver interrupt (or polling timer) */ +#ifdef PRIODIC_INTERRUPT + os_timerDestroy (drv, drv->hPollTimer); +#else + if (drv->irq) { + hPlatform_freeInterrupt(drv); + } +#endif + if (drv->tiwlan_wq) + destroy_workqueue(drv->tiwlan_wq); + +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_destroy(&drv->wl_wifi); + wake_lock_destroy(&drv->wl_rxwake); +#endif + /* + * Free init files memory + */ + if (drv->tCommon.tFwImage.pImage) { + os_memoryFree (drv, drv->tCommon.tFwImage.pImage, drv->tCommon.tFwImage.uSize); +#ifdef TI_MEM_ALLOC_TRACE + os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", + __FUNCTION__, __LINE__, drv->tCommon.tFwImage.uSize, + -drv->tCommon.tFwImage.uSize); +#endif + } + if (drv->tCommon.tNvsImage.pImage) { + kfree (drv->tCommon.tNvsImage.pImage); +#ifdef TI_MEM_ALLOC_TRACE + os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", + __FUNCTION__, __LINE__, drv->tCommon.tNvsImage.uSize, + -drv->tCommon.tNvsImage.uSize); +#endif + } + if (drv->tCommon.tIniFile.pImage) { + kfree (drv->tCommon.tIniFile.pImage); +#ifdef TI_MEM_ALLOC_TRACE + os_printf ("MTT:%s:%d ::kfree(0x%p) : %d\n", + __FUNCTION__, __LINE__, drv->tCommon.tIniFile.uSize, + -drv->tCommon.tIniFile.uSize); +#endif + } + + /* Free the driver object */ +#ifdef TI_DBG + tb_destroy(); +#endif + kfree (drv); +} + + +/** + * \fn wlanDrvIf_ModuleInit & wlanDrvIf_ModuleExit + * \brief Linux Init/Exit functions + * + * The driver Linux Init/Exit functions (insmod/rmmod) + * + * \note + * \param void + * \return Init: 0 - OK, else - failure. Exit: void + * \sa wlanDrvIf_Create, wlanDrvIf_Destroy + */ +#ifndef TI_SDIO_STANDALONE +static int sdc_ctrl = 2; +module_param(sdc_ctrl, int, S_IRUGO | S_IWUSR | S_IWGRP); + +extern int sdioDrv_init(int sdcnum); +extern void sdioDrv_exit(void); +#endif + +static int __init wlanDrvIf_ModuleInit (void) +{ + printk(KERN_INFO "TIWLAN: driver init\n"); +#ifndef TI_SDIO_STANDALONE +#ifndef CONFIG_MMC_EMBEDDED_SDIO + sdioDrv_init(sdc_ctrl); +#endif +#endif + return wlanDrvIf_Create (); +} + +static void __exit wlanDrvIf_ModuleExit (void) +{ + wlanDrvIf_Destroy (pDrvStaticHandle); +#ifndef TI_SDIO_STANDALONE +#ifndef CONFIG_MMC_EMBEDDED_SDIO + sdioDrv_exit(); +#endif +#endif + printk (KERN_INFO "TI WLAN: driver unloaded\n"); +} + +module_init (wlanDrvIf_ModuleInit); +module_exit (wlanDrvIf_ModuleExit); diff --git a/wilink_6_1/platforms/os/linux/src/WlanDrvWext.c b/wilink_6_1/platforms/os/linux/src/WlanDrvWext.c new file mode 100644 index 0000000..afdd147 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/WlanDrvWext.c @@ -0,0 +1,269 @@ +/* + * WlanDrvWext.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * src/wext.c + * + * Support for Linux Wireless Extensions + * + */ +#include <linux/types.h> +#include <linux/socket.h> +#include <linux/if.h> +#include <linux/wireless.h> +#include <net/iw_handler.h> +#include "WlanDrvIf.h" +#include "CmdHndlr.h" +#include "CmdInterpretWext.h" +#include "privateCmd.h" +#include "DrvMain.h" + +/* Routine prototypes */ + +int wlanDrvWext_Handler (struct net_device *dev, + struct iw_request_info *info, + void *iw_req, + void *extra); + +static struct iw_statistics *wlanDrvWext_GetWirelessStats (struct net_device *dev); + +extern int wlanDrvIf_LoadFiles (TWlanDrvIfObj *drv, TLoaderFilesData *pInitInfo); +extern int wlanDrvIf_Start (struct net_device *dev); +extern int wlanDrvIf_Stop (struct net_device *dev); + + +/* callbacks for WEXT commands */ +static const iw_handler aWextHandlers[] = { + (iw_handler) NULL, /* SIOCSIWCOMMIT */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWNAME */ + (iw_handler) NULL, /* SIOCSIWNWID */ + (iw_handler) NULL, /* SIOCGIWNWID */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWFREQ */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWFREQ */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWMODE */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWMODE */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWSENS */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWSENS */ + (iw_handler) NULL, /* SIOCSIWRANGE - not used */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWRANGE */ + (iw_handler) NULL, /* SIOCSIWPRIV - not used */ + (iw_handler) NULL, /* SIOCGIWPRIV - kernel code */ + (iw_handler) NULL, /* SIOCSIWSTATS - not used */ + (iw_handler) NULL, /* SIOCGIWSTATS - kernel code */ + (iw_handler) NULL, /* SIOCSIWSPY */ + (iw_handler) NULL, /* SIOCGIWSPY */ + (iw_handler) NULL, /* SIOCSIWTHRSPY */ + (iw_handler) NULL, /* SIOCGIWTHRSPY */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWAP */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWAP */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWMLME */ + (iw_handler) NULL, /* SIOCGIWAPLIST */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWSCAN */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWSCAN */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWESSID */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWESSID */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWNICKN */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWNICKN */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* SIOCSIWRATE */ + (iw_handler) NULL, /* SIOCGIWRATE */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWRTS */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWRTS */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWFRAG */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWFRAG */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWTXPOW */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWTXPOW */ + (iw_handler) NULL, /* SIOCSIWRETRY */ + (iw_handler) NULL, /* SIOCGIWRETRY */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWENCODE */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWENCODE */ + (iw_handler) NULL, /* SIOCSIWPOWER */ + (iw_handler) NULL, /* SIOCGIWPOWER */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* -- hole -- */ + (iw_handler) NULL, /* SIOCSIWGENIE */ + (iw_handler) NULL, /* SIOCGIWGENIE */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWAUTH */ + (iw_handler) wlanDrvWext_Handler, /* SIOCGIWAUTH */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWENCODEEXT */ + (iw_handler) NULL, /* SIOCGIWENCODEEXT */ + (iw_handler) wlanDrvWext_Handler, /* SIOCSIWPMKSA */ +}; + +/* callbacks for private commands */ +static const iw_handler aPrivateHandlers[] = { + (iw_handler) wlanDrvWext_Handler, /* SIOCIWFIRSTPRIV+0 (set) */ + (iw_handler) wlanDrvWext_Handler, /* SIOCIWFIRSTPRIV+1 (get) */ +}; + +/* Describe the level of WEXT support to kernel */ +static struct iw_handler_def tWextIf = { +#define N(a) (sizeof (a) / sizeof (a[0])) + .standard = (iw_handler *) aWextHandlers, + .num_standard = N(aWextHandlers), + .private = (iw_handler *) aPrivateHandlers, + .num_private = N(aPrivateHandlers), + .private_args = NULL, + .num_private_args = 0, + .get_wireless_stats = wlanDrvWext_GetWirelessStats, +#undef N +}; + +/* Initialite WEXT support - Register callbacks in kernel */ +void wlanDrvWext_Init (struct net_device *dev) +{ +#ifdef HOST_PLATFORM_OMAP3430 + dev->get_wireless_stats = wlanDrvWext_GetWirelessStats; +#endif + dev->wireless_handlers = &tWextIf; + +} + +/* Return driver statistics - currently not supported */ +static struct iw_statistics *wlanDrvWext_GetWirelessStats(struct net_device *dev) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + + return (struct iw_statistics *) cmdHndlr_GetStat (drv->tCommon.hCmdHndlr); +} + +/* Generic callback for WEXT commands */ + +int wlanDrvWext_Handler (struct net_device *dev, + struct iw_request_info *info, + void *iw_req, + void *extra) +{ + int rc; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)NETDEV_GET_PRIVATE(dev); + ti_private_cmd_t my_command; + struct iw_mlme mlme; + void *copy_to_buf=NULL, *param3=NULL; + + os_memoryZero(drv, &my_command, sizeof(ti_private_cmd_t)); + os_memoryZero(drv, &mlme, sizeof(struct iw_mlme)); + + switch (info->cmd) + { + case SIOCIWFIRSTPRIV: + { + void *copy_from_buf; + + if (os_memoryCopyFromUser(drv, &my_command, ((union iwreq_data *)iw_req)->data.pointer, sizeof(ti_private_cmd_t))) + { + os_printf ("wlanDrvWext_Handler() os_memoryCopyFromUser FAILED !!!\n"); + return TI_NOK; + } + if (IS_PARAM_FOR_MODULE(my_command.cmd, DRIVER_MODULE_PARAM)) + { + /* If it's a driver level command, handle it here and exit */ + switch (my_command.cmd) + { + case DRIVER_INIT_PARAM: + return wlanDrvIf_LoadFiles (drv, my_command.in_buffer); + + case DRIVER_START_PARAM: + return wlanDrvIf_Start (dev); + + case DRIVER_STOP_PARAM: + return wlanDrvIf_Stop (dev); + + case DRIVER_STATUS_PARAM: + *(TI_UINT32 *)my_command.out_buffer = + (drv->tCommon.eDriverState == DRV_STATE_RUNNING) ? TI_TRUE : TI_FALSE; + return TI_OK; + } + } + /* if we are still here handle a normal private command*/ + + if ((my_command.in_buffer) && (my_command.in_buffer_len)) + { + copy_from_buf = my_command.in_buffer; + my_command.in_buffer = os_memoryAlloc(drv, my_command.in_buffer_len); + if (os_memoryCopyFromUser(drv, my_command.in_buffer, copy_from_buf, my_command.in_buffer_len)) + { + os_printf ("wlanDrvWext_Handler() os_memoryCopyFromUser 1 FAILED !!!\n"); + return TI_NOK; + } + } + if ((my_command.out_buffer) && (my_command.out_buffer_len)) + { + copy_to_buf = my_command.out_buffer; + my_command.out_buffer = os_memoryAlloc(drv, my_command.out_buffer_len); + } + param3 = &my_command; + } + break; + + case SIOCSIWMLME: + { + os_memoryCopyFromUser(drv, &mlme, ((union iwreq_data *)iw_req)->data.pointer, sizeof(struct iw_mlme)); + param3 = &mlme; + } + break; + } + /* If the friver is not running, return NOK */ + if (drv->tCommon.eDriverState != DRV_STATE_RUNNING) + { + return TI_NOK; + } + + /* Call the Cmd module with the given user paramters */ + rc = (cmdHndlr_InsertCommand (drv->tCommon.hCmdHndlr, + info->cmd, + info->flags, + iw_req, + 0, + extra, + 0, + param3, + NULL)); + /* Here we are after the command was completed */ + if (my_command.in_buffer) + { + os_memoryFree (drv, my_command.in_buffer, my_command.in_buffer_len); + } + if (my_command.out_buffer) + { + if (os_memoryCopyToUser(drv, copy_to_buf, my_command.out_buffer, my_command.out_buffer_len)) + { + os_printf ("wlanDrvWext_Handler() os_memoryCopyToUser FAILED !!!\n"); + rc = TI_NOK; + } + os_memoryFree (drv, my_command.out_buffer, my_command.out_buffer_len); + } + + return rc; +} diff --git a/wilink_6_1/platforms/os/linux/src/WlanDrvWext.h b/wilink_6_1/platforms/os/linux/src/WlanDrvWext.h new file mode 100644 index 0000000..36b79f2 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/WlanDrvWext.h @@ -0,0 +1,42 @@ +/* + * WlanDrvWext.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * src/wext.h + * + * Support for Linux Wireless Extensions - Header file + * + */ + +void wlanDrvWext_Init (struct net_device *dev); diff --git a/wilink_6_1/platforms/os/linux/src/ipc_k.c b/wilink_6_1/platforms/os/linux/src/ipc_k.c new file mode 100644 index 0000000..c0b439a --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/ipc_k.c @@ -0,0 +1,122 @@ +/* + * ipc_k.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * src/ipc_k.c + * + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/stddef.h> +#include <linux/netdevice.h> +#include <linux/rtnetlink.h> +#include <linux/netlink.h> + +#include "tidef.h" +#include "WlanDrvIf.h" +#include "osApi.h" +#include "ioctl_init.h" +#include "cli_cu_common.h" +#include "TI_IPC_Api.h" + +TI_UINT32 IPCKernelInit (TI_HANDLE hAdapter,TI_HANDLE hIPCEv) +{ + return 0; +} + +TI_UINT32 IPCKernelDeInit (TI_HANDLE hAdapter) +{ + return 0; +} + + +/*******************************************************/ +TI_INT32 IPC_EventSend(TI_HANDLE hAdapter, TI_UINT8* pEvData, TI_UINT32 EvDataSize) +{ + struct sk_buff *skb; + int res; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *) hAdapter; + TI_UINT32 realSize = 0; + TI_UINT32 msgSize; + struct nlmsghdr *nlh; + TI_UINT8 *msg; + + os_wake_lock_timeout_enable(drv); + /* This event is targetted to the OS process Id 0 is not a valid pId for LINUX*/ + if (((IPC_EVENT_PARAMS *)pEvData)->uProcessID == 0) + { + ((IPC_EVENT_PARAMS *)pEvData)->pfEventCallback(( IPC_EV_DATA *)pEvData); + return 0; + } + + /* set the payload size */ + msgSize = (( IPC_EV_DATA *) pEvData) ->uBufferSize + offsetof(IPC_EV_DATA,uBuffer); + + /* add the netlink header size */ + realSize = NLMSG_SPACE(msgSize); + + /* allocate the complete message */ + skb = dev_alloc_skb(realSize); + if (!skb) { + printk(KERN_ERR "Failed to allocate new skb with size=%u.\n",realSize); + return -1; + } + + /* set the netlink header params */ + nlh = NLMSG_PUT(skb, 0, 0, NLMSG_DONE, realSize - sizeof(*nlh)); + + /* get the payload pointer */ + msg = (char *)NLMSG_DATA(nlh); + + /* copy the data to the payload */ + memcpy(msg,pEvData,msgSize); + + NETLINK_CB(skb).pid = 0; /* from kernel */ +#define RTMGRP_LINK 1 + NETLINK_CB(skb).dst_group = RTMGRP_LINK; + + /* send the message*/ + res = netlink_unicast(drv->wl_sock, skb, (( IPC_EVENT_PARAMS *) pEvData) ->uProcessID, MSG_DONTWAIT); + + /* Sanity checks. As far as we're concerned this error is unrecovarable.*/ + if (res >= 0) + { + return 0; + } + +nlmsg_failure: + ti_dprintf(TIWLAN_LOG_INFO,"IPC kernel: did not send the netlink message\n"); + return -1; +} diff --git a/wilink_6_1/platforms/os/linux/src/ipc_k.h b/wilink_6_1/platforms/os/linux/src/ipc_k.h new file mode 100644 index 0000000..77998f1 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/ipc_k.h @@ -0,0 +1,49 @@ +/* + * ipc_k.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * src/ipc_k.h + * + */ + +#ifndef _IPC_K +#define _IPC_K + +#include "tidef.h" + + +/*TI_INT32 IPC_EventSend(struct net_device *dev, sk_buff *skb, TI_UINT32 pid);*/ +#endif + + diff --git a/wilink_6_1/platforms/os/linux/src/osRgstry_parser.c b/wilink_6_1/platforms/os/linux/src/osRgstry_parser.c new file mode 100644 index 0000000..8aa108b --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/osRgstry_parser.c @@ -0,0 +1,222 @@ +/* + * osRgstry_parser.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * src/osRgstry_parser.c + * + */ + +#include "osRgstry_parser.h" + +extern void regReadLastDbgState(TWlanDrvIfObjPtr pAdapter); + +static char *init_file = NULL; +static int init_file_length = 0; +static PNDIS_CONFIGURATION_PARAMETER pNdisParm; + +int osInitTable_IniFile (TI_HANDLE hOs, TInitTable *InitTable, char *file_buf, int file_length) +{ + TWlanDrvIfObjPtr drv = (TWlanDrvIfObjPtr)hOs; + static NDIS_CONFIGURATION_PARAMETER vNdisParm; + + init_file = file_buf; + init_file_length = file_length; + pNdisParm = &vNdisParm; + + regFillInitTable (drv, InitTable); +#ifdef TI_DBG + regReadLastDbgState(drv); +#endif + return 0; +} + +unsigned long TiDebugFlag; + +/* void PRINT( char * type, char *format, ... )*/ +/* {*/ +/* return ;*/ +/* }*/ + +NDIS_STATUS NdisUnicodeStringToAnsiString( IN OUT PANSI_STRING DestinationString, + IN PUNICODE_STRING SourceString ) +{ + if( DestinationString->MaximumLength < SourceString->Length ) + return NDIS_STATUS_BUFFER_TOO_SHORT; + + DestinationString->Length = SourceString->Length; + os_memoryCopy( NULL, DestinationString->Buffer, SourceString->Buffer, SourceString->Length ); + return NDIS_STATUS_SUCCESS; + +} + +#ifndef tolower +#define tolower(c) ( (c) | 0x20) +#endif + + /* Search sub-string in memory buffer */ + /* From '#' to EOL ---- remarks */ +char *mem_str(char *buf, char *str, char *end_buf) +{ + int i; + + for( ; buf <= end_buf; buf++ ) + { + if( *buf == '#' ) + { + buf = strchr(buf+1, '\n' ); + if( !buf ) + return NULL; + + } + for( i=0; &buf[i] <= end_buf && buf[i] && str[i] && (tolower(buf[i]) == tolower(str[i])); i++ ) ; + + if ((!str[i]) && (!((tolower(*(buf-1))>='a') && (tolower(*(buf-1))<='z')))) + return buf; + } + return NULL; +} + +char * ltrim(char *s ) +{ + while( *s == ' ' || *s == '\t' ) s++; + return s; +} + +void NdisReadConfiguration( OUT PNDIS_STATUS status, OUT PNDIS_CONFIGURATION_PARAMETER *param_value, + IN NDIS_HANDLE config_handle, IN PNDIS_STRING keyword, IN NDIS_PARAMETER_TYPE param_type ) +{ + char *name = keyword->Buffer; + char *s, *buf = init_file, *end_buf = init_file + init_file_length; + static int count = 0; + + *status = NDIS_STATUS_FAILURE; + *param_value = pNdisParm; + + if( !count ) + { + print_deb("\n++++++++++++\n%s+++++++++++\n", init_file); + count++; + } + + if( !name || !*name || !init_file || !init_file_length ) + return ; + + memset(pNdisParm, 0, sizeof(NDIS_CONFIGURATION_PARAMETER)); + + while(buf < end_buf) + { + buf = ltrim(buf); + if( !(s = mem_str(buf, name, end_buf)) ) + break; + + buf = ltrim(s + strlen(name)); + if( *buf == '=' ) + buf++; + else { + /*print_err("\n...init_config err: delim not found (=): ** %s **\n", buf );*/ + buf = s + 1; /*strlen(name);*/ + continue; + } + buf = ltrim(buf); + if( param_type == NdisParameterString ) + { + char *remark = NULL; + + s = strchr(buf, '\n'); + if( !s ) + s = buf+strlen(buf); + + remark = memchr(buf, '#', s - buf); /* skip remarks */ + if( remark ) + { + do { /* remove whitespace */ + remark--; + } while( *remark == ' ' || *remark == '\t' ); + + pNdisParm->ParameterData.StringData.Length = remark - buf + 1; + } + else + pNdisParm->ParameterData.StringData.Length = s - buf; + + pNdisParm->ParameterData.StringData.Buffer = (TI_UINT8*)&pNdisParm->StringBuffer[0]; + pNdisParm->ParameterData.StringData.MaximumLength = NDIS_MAX_STRING_LEN; + if( !pNdisParm->ParameterData.StringData.Length > NDIS_MAX_STRING_LEN ) + { + *status = NDIS_STATUS_BUFFER_TOO_SHORT; + return; + } + memcpy(pNdisParm->ParameterData.StringData.Buffer, buf, pNdisParm->ParameterData.StringData.Length); + print_info("NdisReadConfiguration(): %s = (%d)'%s'\n", name, pNdisParm->ParameterData.StringData.Length, pNdisParm->ParameterData.StringData.Buffer); + } + else if( param_type == NdisParameterInteger ) + { + char *end_p; + pNdisParm->ParameterData.IntegerData = simple_strtol(buf, &end_p, 0); + if (end_p && *end_p && *end_p!=' ' && *end_p!='\n' + && *end_p!='\r' && *end_p!='\t') + { + print_err("\n...init_config: invalid int value for <%s> : %s\n", name, buf ); + return; + } + /*print_deb(" NdisReadConfiguration(): buf = %p (%.20s)\n", buf, buf );*/ + print_info("NdisReadConfiguration(): %s = %d\n", name, (TI_INT32) pNdisParm->ParameterData.IntegerData); + } + else + { + print_err("NdisReadConfiguration(): unknow parameter type %d for %s\n", param_type, name ); + return; + } + *status = NDIS_STATUS_SUCCESS; + return; + + } + return ; +} + +void NdisWriteConfiguration( OUT PNDIS_STATUS Status, + IN NDIS_HANDLE ConfigurationHandle, + IN PNDIS_STRING Keyword, + IN PNDIS_CONFIGURATION_PARAMETER ParameterValue ) +{ + print_err(" NdisWriteConfiguration(): ** not implemented yet ...\n"); +} + +void NdisMIndicateStatus( + NDIS_HANDLE MiniportAdapterHandle, + NDIS_STATUS GeneralStatus, + void* StatusBuffer, + TI_UINT32 StatusBufferSize +) +{ +} diff --git a/wilink_6_1/platforms/os/linux/src/osRgstry_parser.h b/wilink_6_1/platforms/os/linux/src/osRgstry_parser.h new file mode 100644 index 0000000..c0c33b0 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/osRgstry_parser.h @@ -0,0 +1,62 @@ +/* + * osRgstry_parser.h + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * src/osRgstry_parser.h + * + */ + +#ifndef _OS_RGSTRY_PARSER_ +#define _OS_RGSTRY_PARSER_ + +#include "ioctl_init.h" + +#include "tidef.h" +#include "osApi.h" +#include "osDebug.h" + + + +#define NDIS_STRING_CONST(a) {sizeof(a), sizeof(a), a} +#include "WlanDrvIf.h" +#include "WlanDrvIf.h" + +void regFillInitTable ( TWlanDrvIfObjPtr pAdapter, void* pInitTable); + +extern void osInitTable (TInitTable *InitTable); +extern int osInitTable_IniFile (TI_HANDLE hOs, TInitTable *InitTable, char *file_buf, int file_length); + + +#endif /* _OS_RGSTRY_PARSER_ */ + diff --git a/wilink_6_1/platforms/os/linux/src/osapi.c b/wilink_6_1/platforms/os/linux/src/osapi.c new file mode 100644 index 0000000..fd99089 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/osapi.c @@ -0,0 +1,928 @@ +/* + * osapi.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * src/osapi.c + * + */ +#include "tidef.h" +#include "arch_ti.h" + +#include <linux/stddef.h> +#include <linux/string.h> +#include <linux/time.h> +#include <linux/timer.h> +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/netdevice.h> +#include <linux/completion.h> +#include <linux/etherdevice.h> +#include <linux/vmalloc.h> +#include <linux/string.h> +#include <linux/delay.h> +#include <linux/time.h> +#include <linux/list.h> +#include <stdarg.h> +#include <asm/io.h> +#include "RxBuf_linux.h" + +/*#include "debug_module.h"*/ +#include "host_platform.h" +#include "WlanDrvIf.h" +#include "bmtrace_api.h" +#include "TI_IPC_Api.h" +#include "802_11Defs.h" +#include "osApi.h" +#include "txMgmtQueue_Api.h" +#include "EvHandler.h" + +#ifdef ESTA_TIMER_DEBUG +#define esta_timer_log(fmt,args...) printk(fmt, ## args) +#else +#define esta_timer_log(fmt,args...) +#endif + +#define FRAG_SIZE 200 + +typedef struct timer_list TOsTimer; + +TI_BOOL bRedirectOutputToLogger = TI_FALSE; +TI_BOOL use_debug_module = TI_FALSE; + +/**************************************************************************************** + * * + * OS Report API * + * * + ****************************************************************************************/ +static void SendLoggerData (TI_HANDLE OsContext, TI_UINT8 *pMsg, TI_UINT16 len) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + + if (len > 0) + { + EvHandlerSendEvent(drv->tCommon.hEvHandler, IPC_EVENT_LOGGER, pMsg, len); + } +} + +void os_setDebugOutputToLogger(TI_BOOL value) +{ + bRedirectOutputToLogger = value; +} +/**************************************************************************************** + * os_setDebugMode() + **************************************************************************************** +DESCRIPTION: Set the Debug Mode + +INPUT: + +RETURN: None + +NOTES: +*****************************************************************************************/ +void os_setDebugMode(TI_BOOL enable) +{ + use_debug_module = enable; +} + + +/**************************************************************************************** + * os_printf() + **************************************************************************************** +DESCRIPTION: Print formatted output. + +INPUT: format - Specifies the string, to be printed + +RETURN: None + +NOTES: +*****************************************************************************************/ +void os_printf(const char *format ,...) +{ + static int from_new_line = 1; /* Used to save the last message EOL */ + va_list ap; + static char msg[MAX_MESSAGE_SIZE]; + char *p_msg = msg; /* Pointer to the message */ + TI_UINT16 message_len; + TI_UINT32 sec = 0; + TI_UINT32 uSec = 0; + os_memoryZero(NULL,msg, MAX_MESSAGE_SIZE); + + /* Format the message and keep the message length */ + va_start(ap,format); + message_len = vsnprintf(&msg[0], sizeof(msg) -1 , format, ap); + if( from_new_line ) + { + if (msg[1] == '$') + { + p_msg += 4; + } + + sec = os_timeStampUs(NULL); + uSec = sec % MICROSECOND_IN_SECONDS; + sec /= MICROSECOND_IN_SECONDS; + + printk(KERN_INFO DRIVER_NAME ": %d.%06d: %s",sec,uSec,p_msg); + } + else + { + printk(&msg[0]); + } + + from_new_line = ( msg[message_len] == '\n' ); + va_end(ap); +} + +/**************************************************************************************** + * * + * OS TIMER API * + * * + ****************************************************************************************/ + +/**************************************************************************************** + * os_timerCreate() + **************************************************************************************** +DESCRIPTION: This function creates and initializes an OS timer object associated with a + caller's pRoutine function. + +ARGUMENTS: OsContext - The OS handle + pRoutine - The user callback function + hFuncHandle - The user callback handle + +RETURN: A handle of the created OS timer. + +NOTES: 1) The user's callback is called directly from OS timer context when expired. + 2) In some OSs, it may be needed to use an intermediate callback in the + osapi layer (use os_timerHandlr for that). + +*****************************************************************************************/ +TI_HANDLE os_timerCreate (TI_HANDLE OsContext, fTimerFunction pRoutine, TI_HANDLE hFuncHandle) +{ + TOsTimer *pOsTimer = os_memoryAlloc (OsContext, sizeof(TOsTimer)); + + init_timer (pOsTimer); + pOsTimer->function = (void *)pRoutine; + pOsTimer->data = (int)hFuncHandle; + + return (TI_HANDLE)pOsTimer; +} + + +/**************************************************************************************** + * os_timerDestroy() + **************************************************************************************** +DESCRIPTION: This function destroys the OS timer object. + +ARGUMENTS: + +RETURN: + +NOTES: +*****************************************************************************************/ +void os_timerDestroy (TI_HANDLE OsContext, TI_HANDLE TimerHandle) +{ + os_timerStop (OsContext, TimerHandle); + os_memoryFree (OsContext, TimerHandle, sizeof(TOsTimer)); +} + + +/**************************************************************************************** + * os_timerStart() + **************************************************************************************** +DESCRIPTION: This function start the timer object. + +ARGUMENTS: + +RETURN: + +NOTES: +*****************************************************************************************/ +void os_timerStart (TI_HANDLE OsContext, TI_HANDLE TimerHandle, TI_UINT32 DelayMs) +{ + TI_UINT32 jiffie_cnt = msecs_to_jiffies (DelayMs); + + mod_timer ((TOsTimer *)TimerHandle, jiffies + jiffie_cnt); +} + + +/**************************************************************************************** + * os_stopTimer() + **************************************************************************************** +DESCRIPTION: This function stop the timer object. + +ARGUMENTS: + +RETURN: + +NOTES: +*****************************************************************************************/ +void os_timerStop (TI_HANDLE OsContext, TI_HANDLE TimerHandle) +{ + del_timer_sync((TOsTimer *)TimerHandle); +} + + +/**************************************************************************************** + * os_periodicIntrTimerStart() + **************************************************************************************** +DESCRIPTION: This function starts the periodic interrupt mechanism. This mode is used + when interrupts that usually received from the Fw is now masked, and we are + checking for any need of Fw handling in time periods. + +ARGUMENTS: + +RETURN: + +NOTES: Power level of the CHIP should be always awake in this mode (no ELP) +*****************************************************************************************/ +#ifdef PRIODIC_INTERRUPT +void os_periodicIntrTimerStart (TI_HANDLE OsContext) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + + mod_timer (drv->hPollTimer, jiffies + TIWLAN_IRQ_POLL_INTERVAL); +} +#endif + + +/**************************************************************************************** + * os_timeStampMs() + **************************************************************************************** +DESCRIPTION: This function returns the number of milliseconds that have elapsed since + the system was booted. + +ARGUMENTS: OsContext - our adapter context. + +RETURN: + +NOTES: +*****************************************************************************************/ +TI_UINT32 os_timeStampMs (TI_HANDLE OsContext) +{ + struct timeval tv; + do_gettimeofday(&tv); + return tv.tv_sec*1000 + tv.tv_usec/1000; +} + + +/**************************************************************************************** + * os_timeStampUs() + **************************************************************************************** +DESCRIPTION: This function returns the number of microseconds that have elapsed since + the system was booted. + +ARGUMENTS: OsContext - our adapter context. + Note that sometimes this function will be called with NULL(!!!) as argument! + +RETURN: + +NOTES: +*****************************************************************************************/ +TI_UINT32 os_timeStampUs (TI_HANDLE OsContext) +{ + struct timeval tv; + do_gettimeofday(&tv); + return tv.tv_sec*1000000 + tv.tv_usec; +} + + +/**************************************************************************************** + * os_StalluSec() + **************************************************************************************** +DESCRIPTION: This function make delay in microseconds. + +ARGUMENTS: OsContext - our adapter context. + uSec - delay time in microseconds + +RETURN: + +NOTES: +*****************************************************************************************/ +void os_StalluSec (TI_HANDLE OsContext, TI_UINT32 uSec) +{ + udelay (uSec); +} + + +/**************************************************************************************** + * * + * Protection services API * + * * + **************************************************************************************** + * OS protection is implemented as spin_lock_irqsave and spin_unlock_irqrestore * + ****************************************************************************************/ + + +/**************************************************************************************** + * os_protectCreate() + **************************************************************************************** +DESCRIPTION: + +ARGUMENTS: OsContext - our adapter context. + +RETURN: A handle of the created mutex/spinlock. + TI_HANDLE_INVALID if there is insufficient memory available or problems + initializing the mutex + +NOTES: +*****************************************************************************************/ +TI_HANDLE os_protectCreate (TI_HANDLE OsContext) +{ + return NULL; +} + + +/**************************************************************************************** + * os_protectDestroy() + **************************************************************************************** +DESCRIPTION: + +ARGUMENTS: OsContext - our adapter context. + +RETURN: None - This had better work since there is not a return value to the user + +NOTES: +*****************************************************************************************/ +void os_protectDestroy (TI_HANDLE OsContext, TI_HANDLE ProtectCtx) +{ +} + + +/**************************************************************************************** + * os_protectLock() + **************************************************************************************** +DESCRIPTION: + +ARGUMENTS: OsContext - our adapter context. + +RETURN: None - This had better work since there is not a return value to the user + +NOTES: +*****************************************************************************************/ +void os_protectLock (TI_HANDLE OsContext, TI_HANDLE ProtectContext) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + + spin_lock_irqsave (&drv->lock, drv->flags); +} + + +/**************************************************************************************** + * os_protectUnlock() + **************************************************************************************** +DESCRIPTION: + +ARGUMENTS: OsContext - our adapter context. + +RETURN: None - This had better work since there is not a return value to the user + +NOTES: +*****************************************************************************************/ +void os_protectUnlock (TI_HANDLE OsContext, TI_HANDLE ProtectContext) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + + spin_unlock_irqrestore (&drv->lock, drv->flags); +} +/**************************************************************************************** + * os_receivePacket() + **************************************************************************************** +DESCRIPTION: + +ARGUMENTS: + +RETURN: + +NOTES: +*****************************************************************************************/ +TI_BOOL os_receivePacket (TI_HANDLE OsContext, void* pPacket, TI_UINT16 Length) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + unsigned char *pdata = (unsigned char *)((TI_UINT32)pPacket & ~(TI_UINT32)0x3); + rx_head_t *rx_head = (rx_head_t *)(pdata - WSPI_PAD_BYTES - RX_HEAD_LEN_ALIGNED); + struct sk_buff *skb = rx_head->skb; + +#ifdef TI_DBG + if ((TI_UINT32)pPacket & 0x3) + { + if ((TI_UINT32)pPacket - (TI_UINT32)skb->data != 2) + { + printk("os_receivePacket() address error skb=0x%x skb->data=0x%x pPacket=0x%x !!!\n",(int)skb, (int)skb->data, (int)pPacket); + } + } + else + { + if ((TI_UINT32)skb->data != (TI_UINT32)pPacket) + { + printk("os_receivePacket() address error skb=0x%x skb->data=0x%x pPacket=0x%x !!!\n",(int)skb, (int)skb->data, (int)pPacket); + } + } + if (Length != RX_ETH_PKT_LEN(pPacket)) + { + printk("os_receivePacket() Length=%d != RX_ETH_PKT_LEN(pPacket)=%d!!!\n",(int)Length, RX_ETH_PKT_LEN(pPacket)); + } + +#endif +/* + printk("-->> os_receivePacket() pPacket=0x%x Length=%d skb=0x%x skb->data=0x%x skb->head=0x%x skb->len=%d\n", + (int)pPacket, (int)Length, (int)skb, (int)skb->data, (int)skb->head, (int)skb->len); +*/ + /* Use skb_reserve, it updates both skb->data and skb->tail. */ + skb->data = RX_ETH_PKT_DATA(pPacket); + skb->tail = skb->data; + skb_put(skb, RX_ETH_PKT_LEN(pPacket)); +/* + printk("-->> os_receivePacket() skb=0x%x skb->data=0x%x skb->head=0x%x skb->len=%d\n", + (int)skb, (int)skb->data, (int)skb->head, (int)skb->len); +*/ + ti_nodprintf(TIWLAN_LOG_INFO, "os_receivePacket - Received EAPOL len-%d\n", WBUF_LEN(pWbuf)); + + skb->dev = drv->netdev; + skb->protocol = eth_type_trans(skb, drv->netdev); + skb->ip_summed = CHECKSUM_NONE; + + drv->stats.rx_packets++; + drv->stats.rx_bytes += skb->len; + + /* Send the skb to the TCP stack. + * it responsibly of the Linux kernel to free the skb + */ + { + CL_TRACE_START_L1(); + + os_wake_lock_timeout_enable(drv); + + netif_rx_ni(skb); + + /* Note: Don't change this trace (needed to exclude OS processing from Rx CPU utilization) */ + CL_TRACE_END_L1("tiwlan_drv.ko", "OS", "RX", ""); + } + + return TI_TRUE; +} + +/*----------------------------------------------------------------------------- + +Routine Name: os_timerHandlr + +Routine Description: + + Just a place holder for timer expiration handling in other OSs. + In Linux, user callback is called directly on OS timer expiry. + +Arguments: parm - timer object handle + +Return Value: None. + +Notes: + +-----------------------------------------------------------------------------*/ +void os_timerHandlr(unsigned long parm) +{ + /* Not needed in Linux (user callback is called directly on OS timer expiry). */ +} + + +/*----------------------------------------------------------------------------- +Routine Name: os_connectionStatus + +Routine Description: + +The eSTA-DK will call this API so the OS stack is aware that the +WLAN layer is ready to function. + +Arguments: +cStatus = 1; WLAN in ready for network packets +cStatus = 0; WLAN in not ready for network packets + +Return Value: None +-----------------------------------------------------------------------------*/ +TI_INT32 os_IndicateEvent (TI_HANDLE OsContext, IPC_EV_DATA* pData) +{ + IPC_EVENT_PARAMS *pInParam = &pData->EvParams; + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + /*TI_UINT8 AuthBuf[sizeof(TI_UINT32) + sizeof(OS_802_11_AUTHENTICATION_REQUEST)];*/ + + ti_nodprintf(TIWLAN_LOG_INFO, "\n os_ConnectionStatus Event 0x%08x \n", CsStatus->Event); + + switch(pInParam->uEventType) + { + case IPC_EVENT_ASSOCIATED: + if (drv->netdev != NULL) + netif_carrier_on(drv->netdev); + break; + + case IPC_EVENT_DISASSOCIATED: + if (drv->netdev != NULL) + netif_carrier_off(drv->netdev); + break; + + case IPC_EVENT_LINK_SPEED: + drv->tCommon.uLinkSpeed = (*(TI_UINT32*)pData->uBuffer * 10000) / 2; + ti_nodprintf(TIWLAN_LOG_INFO, "\n Link Speed = 0x%08x \n",drv->tCommon.uLinkSpeed); + break; + } + + return TI_OK; +} + + + +/******************************************************************************/ + +void os_disableIrq (TI_HANDLE OsContext) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + disable_irq (drv->irq); +} + +void os_enableIrq (TI_HANDLE OsContext) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + enable_irq (drv->irq); +} + +/*----------------------------------------------------------------------------- +Routine Name: os_InterruptServiced + +Routine Description: Called when IRQ line is not asserted any more + (i.e. we can enable IRQ in Level sensitive platform) + +Arguments: OsContext - handle to OS context + +Return Value: none +-----------------------------------------------------------------------------*/ +void os_InterruptServiced (TI_HANDLE OsContext) +{ + /* To be implemented with Level IRQ */ +} + +/*----------------------------------------------------------------------------- +Routine Name: os_wake_lock_timeout + +Routine Description: Called to prevent system from suspend for some time + +Arguments: OsContext - handle to OS context + +Return Value: packet counter +-----------------------------------------------------------------------------*/ +int os_wake_lock_timeout (TI_HANDLE OsContext) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + int ret = 0; + unsigned long flags; + + spin_lock_irqsave(&drv->lock, flags); + if (drv) { + ret = drv->wl_packet; + if (drv->wl_packet) { + drv->wl_packet = 0; +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_timeout(&drv->wl_rxwake, (HZ >> 1)); +#endif + } + } + spin_unlock_irqrestore(&drv->lock, flags); + /* printk("%s: %d\n", __func__, ret); */ + return ret; +} + +/*----------------------------------------------------------------------------- +Routine Name: os_wake_lock_timeout_enable + +Routine Description: Called to set flag for suspend prevention for some time + +Arguments: OsContext - handle to OS context + +Return Value: packet counter +-----------------------------------------------------------------------------*/ +int os_wake_lock_timeout_enable (TI_HANDLE OsContext) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + unsigned long flags; + int ret; + + spin_lock_irqsave(&drv->lock, flags); + ret = drv->wl_packet = 1; + spin_unlock_irqrestore(&drv->lock, flags); + return ret; +} + +/*----------------------------------------------------------------------------- +Routine Name: os_wake_lock + +Routine Description: Called to prevent system from suspend + +Arguments: OsContext - handle to OS context + +Return Value: wake_lock counter +-----------------------------------------------------------------------------*/ +int os_wake_lock (TI_HANDLE OsContext) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + int ret = 0; + unsigned long flags; + + spin_lock_irqsave(&drv->lock, flags); + if (drv) { +#ifdef CONFIG_HAS_WAKELOCK + if (!drv->wl_count) + wake_lock(&drv->wl_wifi); +#endif + drv->wl_count++; + ret = drv->wl_count; + } + spin_unlock_irqrestore(&drv->lock, flags); + /* printk("%s: %d\n", __func__, ret); */ + return ret; +} + +/*----------------------------------------------------------------------------- +Routine Name: os_wake_unlock + +Routine Description: Called to allow system to suspend + +Arguments: OsContext - handle to OS context + +Return Value: wake_lock counter +-----------------------------------------------------------------------------*/ +int os_wake_unlock (TI_HANDLE OsContext) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + int ret = 0; + unsigned long flags; + + spin_lock_irqsave(&drv->lock, flags); + if (drv && drv->wl_count) { + drv->wl_count--; +#ifdef CONFIG_HAS_WAKELOCK + if (!drv->wl_count) + wake_unlock(&drv->wl_wifi); +#endif + ret = drv->wl_count; + } + spin_unlock_irqrestore(&drv->lock, flags); + /* printk("%s: %d\n", __func__, ret); */ + return ret; +} + +/*----------------------------------------------------------------------------- +Routine Name: os_RequestSchedule + +Routine Description: + +Arguments: + +Return Value: TI_OK +-----------------------------------------------------------------------------*/ +int os_RequestSchedule (TI_HANDLE OsContext) +{ + TWlanDrvIfObj *drv = (TWlanDrvIfObj *)OsContext; + + /* Note: The performance trace below doesn't inclose the schedule + * itself because the rescheduling can occur immediately and call + * os_RequestSchedule again which will confuse the trace tools */ + CL_TRACE_START_L3(); + CL_TRACE_END_L3("tiwlan_drv.ko", "OS", "TASK", ""); + + if( !queue_work(drv->tiwlan_wq, &drv->tWork) ) { + /* printk("%s: Fail\n",__func__); */ + return TI_NOK; + } + + return TI_OK; +} + + +/*----------------------------------------------------------------------------- +Routine Name: os_SignalObjectCreate + +Routine Description: + +Arguments: + +Return Value: TI_OK +-----------------------------------------------------------------------------*/ +void *os_SignalObjectCreate (TI_HANDLE OsContext) +{ + struct completion *myPtr; + myPtr = os_memoryAlloc(OsContext, sizeof(struct completion)); + if (myPtr) + init_completion (myPtr); + return (myPtr); +} + + +/*----------------------------------------------------------------------------- +Routine Name: os_SignalObjectWait + +Routine Description: + +Arguments: + +Return Value: TI_OK +-----------------------------------------------------------------------------*/ +int os_SignalObjectWait (TI_HANDLE OsContext, void *signalObject) +{ + if (!signalObject) + return TI_NOK; + wait_for_completion ((struct completion *)signalObject); + return TI_OK; +} + + +/*----------------------------------------------------------------------------- +Routine Name: os_SignalObjectSet + +Routine Description: + +Arguments: + +Return Value: TI_OK +-----------------------------------------------------------------------------*/ +int os_SignalObjectSet (TI_HANDLE OsContext, void *signalObject) +{ + if (!signalObject) + return TI_NOK; + complete ((struct completion *)signalObject); + return TI_OK; +} + + +/*----------------------------------------------------------------------------- +Routine Name: os_SignalObjectFree + +Routine Description: + +Arguments: + +Return Value: TI_OK +-----------------------------------------------------------------------------*/ +int os_SignalObjectFree (TI_HANDLE OsContext, void *signalObject) +{ + if (!signalObject) + return TI_NOK; + os_memoryFree(OsContext, signalObject, sizeof(struct completion)); + return TI_OK; +} + + +/** + * \fn os_Trace + * \brief Prepare and send trace message to the logger. + * + * \param OsContext - The OS handle + * \param uLevel - Severity level of the trace message + * \param uFileId - Source file ID of the trace message + * \param uLineNum - Line number of the trace message + * \param uParamsNum - Number of parameters in the trace message + * \param ... - The trace message parameters + * + * \return void + */ +void os_Trace (TI_HANDLE OsContext, TI_UINT32 uLevel, TI_UINT32 uFileId, TI_UINT32 uLineNum, TI_UINT32 uParamsNum, ...) +{ + TI_UINT32 index; + TI_UINT32 uParam; + TI_UINT32 uMaxParamValue = 0; + TI_UINT32 uMsgLen = TRACE_MSG_MIN_LENGTH; + TI_UINT8 aMsg[TRACE_MSG_MAX_LENGTH] = {0}; + TTraceMsg *pMsgHdr = (TTraceMsg *)&aMsg[0]; + TI_UINT8 *pMsgData = &aMsg[0] + sizeof(TTraceMsg); + va_list list; + + if (!bRedirectOutputToLogger) + { + return; + } + + if (uParamsNum > TRACE_MSG_MAX_PARAMS) + { + uParamsNum = TRACE_MSG_MAX_PARAMS; + } + + /* sync on the parameters */ + va_start(list, uParamsNum); + + /* find the longest parameter */ + for (index = 0; index < uParamsNum; index++) + { + /* get parameter from the stack */ + uParam = va_arg (list, TI_UINT32); + + /* save the longest parameter at variable 'uMaxParamValue' */ + if (uParam > uMaxParamValue) + { + uMaxParamValue = uParam; + } + + /* 32 bit parameter is the longest possible - get out of the loop */ + if (uMaxParamValue > UINT16_MAX_VAL) + { + break; + } + } + + /* Set msg length and format according to the biggest parameter value (8/16/32 bits) */ + if (uMaxParamValue > UINT16_MAX_VAL) + { + pMsgHdr->uFormat = TRACE_FORMAT_32_BITS_PARAMS; + uMsgLen += uParamsNum * sizeof(TI_UINT32); + } + else if (uMaxParamValue > UINT8_MAX_VAL) + { + pMsgHdr->uFormat = TRACE_FORMAT_16_BITS_PARAMS; + uMsgLen += uParamsNum * sizeof(TI_UINT16); + } + else + { + pMsgHdr->uFormat = TRACE_FORMAT_8_BITS_PARAMS; + uMsgLen += uParamsNum; + } + + /* Fill all other header information */ + pMsgHdr->uLevel = (TI_UINT8)uLevel; + pMsgHdr->uParamsNum = (TI_UINT8)uParamsNum; + pMsgHdr->uFileId = (TI_UINT16)uFileId; + pMsgHdr->uLineNum = (TI_UINT16)uLineNum; + + /* re-sync on the parameters */ + va_start(list, uParamsNum); + + /* add the parameters */ + for (index = 0; index < uParamsNum; index++) + { + /* get parameter from the stack */ + uParam = va_arg(list, TI_UINT32); + + /* insert the parameter and increment msg pointer */ + switch(pMsgHdr->uFormat) + { + case TRACE_FORMAT_8_BITS_PARAMS: + INSERT_BYTE(pMsgData, uParam); + break; + + case TRACE_FORMAT_16_BITS_PARAMS: + INSERT_2_BYTES(pMsgData, uParam); + break; + + case TRACE_FORMAT_32_BITS_PARAMS: + INSERT_4_BYTES(pMsgData, uParam); + break; + + default: + va_end(list); + return; + } + } + + va_end(list); + + /* Send the trace message to the logger */ + SendLoggerData(OsContext, aMsg, (TI_UINT16)uMsgLen); +} + +/*--------------------------------------------------------------------------------------*/ + +/** + * \fn os_SetDrvThreadPriority + * \brief Called upon init to set WLAN driver thread priority. + * Currently not supported in Linux. + * + * \param OsContext - The OS handle + * \param uWlanDrvThreadPriority - The WLAN driver thread priority + * \return + */ +void os_SetDrvThreadPriority (TI_HANDLE OsContext, TI_UINT32 uWlanDrvThreadPriority) +{ +} diff --git a/wilink_6_1/platforms/os/linux/src/osmemapi.c b/wilink_6_1/platforms/os/linux/src/osmemapi.c new file mode 100644 index 0000000..f80bfde --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/osmemapi.c @@ -0,0 +1,513 @@ +/* + * osmemapi.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * src/osmemapi.c + * + */ + +#include "arch_ti.h" + +#include <linux/stddef.h> +#include <linux/string.h> +#include <linux/time.h> +#include <linux/timer.h> + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/netdevice.h> +#include <linux/etherdevice.h> +#include <linux/vmalloc.h> +#include <linux/string.h> +#include <linux/delay.h> +#include <linux/time.h> +#include <linux/list.h> + +#include "osApi.h" +#include "tidef.h" +#include "WlanDrvIf.h" + +typedef void (*os_free)(void *); +struct os_mem_block +{ + struct list_head blk_list; + os_free f_free; + __u32 size; + __u32 signature; +}; +#define MEM_BLOCK_START (('m'<<24) | ('e'<<16) | ('m'<<8) | 's') +#define MEM_BLOCK_END (('m'<<24) | ('e'<<16) | ('m'<<8) | 'e') + +/**************************************************************************************** + * * + * OS Memory API * + * * + ****************************************************************************************/ + +/**************************************************************************************** + * os_memoryAlloc() + **************************************************************************************** +DESCRIPTION: Allocates resident (nonpaged) system-space memory. + +ARGUMENTS: OsContext - our adapter context. + Size - Specifies the size, in bytes, to be allocated. + +RETURN: Pointer to the allocated memory. + NULL if there is insufficient memory available. + +NOTES: With the call to vmalloc it is assumed that this function will + never be called in an interrupt context. vmalloc has the potential to + sleep the caller while waiting for memory to become available. + +*****************************************************************************************/ +void* +os_memoryAlloc( + TI_HANDLE OsContext, + TI_UINT32 Size + ) +{ + struct os_mem_block *blk; + __u32 total_size = Size + sizeof(struct os_mem_block) + sizeof(__u32); + +#ifdef TI_MEM_ALLOC_TRACE + os_printf("MTT:%s:%d ::os_memoryAlloc(0x%p, %lu) : %lu\n",__FUNCTION__, __LINE__,OsContext,Size,total_size); +#endif + /* + Memory optimization issue. Allocate up to 2 pages (8k) from the SLAB + allocator (2^n), otherwise allocate from virtual pool. + If full Async mode is used, allow up to 6 pages (24k) for DMA-able + memory, so the TxCtrlBlk table can be transacted over DMA. + */ +#ifdef FULL_ASYNC_MODE + if (total_size < 6 * 4096) +#else + if (total_size < 2 * 4096) +#endif + { + if (in_atomic()) + blk = kmalloc(total_size, GFP_ATOMIC); + else + blk = kmalloc(total_size, GFP_KERNEL); + if (!blk) { + printk("%s: NULL\n",__func__); + return NULL; + } + blk->f_free = (os_free)kfree; + } + else { + /* We expect that the big allocations should be made outside + the interrupt, otherwise fail + */ + if (in_interrupt()) { + printk("%s: NULL\n",__func__); + return NULL; + } + blk = vmalloc(total_size); + if (!blk) { + printk("%s: NULL\n",__func__); + return NULL; + } + blk->f_free = (os_free)vfree; + } + + os_profile (OsContext, 4, total_size); + + /*list_add(&blk->blk_list, &drv->mem_blocks);*/ + blk->size = Size; + blk->signature = MEM_BLOCK_START; + *(__u32 *)((unsigned char *)blk + total_size - sizeof(__u32)) = MEM_BLOCK_END; + return (void *)((char *)blk + sizeof(struct os_mem_block)); +} + + +/**************************************************************************************** + * os_memoryCAlloc() + **************************************************************************************** +DESCRIPTION: Allocates an array in memory with elements initialized to 0. + +ARGUMENTS: OsContext - our adapter context. + Number - Number of elements + Size - Length in bytes of each element + +RETURN: None + +NOTES: +*****************************************************************************************/ +void* +os_memoryCAlloc( + TI_HANDLE OsContext, + TI_UINT32 Number, + TI_UINT32 Size + ) +{ + void* pAllocatedMem; + TI_UINT32 MemSize; + +#ifdef TI_MEM_ALLOC_TRACE + os_printf("MTT:%s:%d ::os_memoryCAlloc(0x%p, %lu, %lu) : %lu\n",__FUNCTION__,__LINE__,OsContext,Number,Size,Number*Size); +#endif + MemSize = Number * Size; + + pAllocatedMem = os_memoryAlloc(OsContext, MemSize); + + if (!pAllocatedMem) + return NULL; + + memset(pAllocatedMem,0,MemSize); + + return pAllocatedMem; +} + + + +/**************************************************************************************** + * os_memoryFree() + **************************************************************************************** +DESCRIPTION: This function releases a block of memory previously allocated with the + os_memoryAlloc function. + + +ARGUMENTS: OsContext - our adapter context. + pMemPtr - Pointer to the base virtual address of the allocated memory. + This address was returned by the os_memoryAlloc function. + Size - Specifies the size, in bytes, of the memory block to be released. + This parameter must be identical to the Length that was passed to + os_memoryAlloc. + +RETURN: None + +NOTES: +*****************************************************************************************/ +void +os_memoryFree( + TI_HANDLE OsContext, + void* pMemPtr, + TI_UINT32 Size + ) +{ + struct os_mem_block *blk; + + if (!pMemPtr) { + printk("%s: NULL\n",__func__); + return; + } + blk = (struct os_mem_block *)((char *)pMemPtr - sizeof(struct os_mem_block)); + +#ifdef TI_MEM_ALLOC_TRACE + os_printf("MTT:%s:%d ::os_memoryFree(0x%p, 0x%p, %lu) : %d\n",__FUNCTION__,__LINE__,OsContext,pMemPtr,Size,-Size); +#endif + if (blk->signature != MEM_BLOCK_START) + { + printk("\n\n%s: memory block signature is incorrect - 0x%x\n\n\n", + __FUNCTION__, blk->signature); + return; + } + *(char *)(&blk->signature) = '~'; + if (*(__u32 *)((unsigned char *)blk + blk->size + sizeof(struct os_mem_block)) + != MEM_BLOCK_END) + { + printk("\n\n%s: memory block corruption. Size=%u\n\n\n", + __FUNCTION__, blk->size); + } + + os_profile (OsContext, 5, blk->size + sizeof(struct os_mem_block) + sizeof(__u32)); + + blk->f_free(blk); +} + + +/**************************************************************************************** + * os_memorySet() + **************************************************************************************** +DESCRIPTION: This function fills a block of memory with given value. + +ARGUMENTS: OsContext - our adapter context. + pMemPtr - Specifies the base address of a block of memory + Value - Specifies the value to set + Length - Specifies the size, in bytes, to copy. + +RETURN: None + +NOTES: +*****************************************************************************************/ +void +os_memorySet( + TI_HANDLE OsContext, + void* pMemPtr, + TI_INT32 Value, + TI_UINT32 Length + ) +{ + if (!pMemPtr) { + printk("%s: NULL\n",__func__); + return; + } + memset(pMemPtr,Value,Length); +} + +/**************************************************************************************** + * _os_memoryAlloc4HwDma() + **************************************************************************************** +DESCRIPTION: Allocates resident (nonpaged) system-space memory for DMA operations. + +ARGUMENTS: OsContext - our adapter context. + Size - Specifies the size, in bytes, to be allocated. + +RETURN: Pointer to the allocated memory. + NULL if there is insufficient memory available. + +NOTES: + +*****************************************************************************************/ +void* +os_memoryAlloc4HwDma( + TI_HANDLE pOsContext, + TI_UINT32 Size + ) +{ + struct os_mem_block *blk; + __u32 total_size = Size + sizeof(struct os_mem_block) + sizeof(__u32); + /* + if the size is greater than 2 pages then we cant allocate the memory + through kmalloc so the function fails + */ + if (Size < 2 * OS_PAGE_SIZE) + { + blk = kmalloc(total_size, GFP_ATOMIC|GFP_DMA); + if (!blk) { + printk("%s: NULL\n",__func__); + return NULL; + } + blk->f_free = (os_free)kfree; + } + else + { + printk("\n\n%s: memory cant be allocated-Size = %d\n\n\n", + __FUNCTION__, Size); + return NULL; + } + blk->size = Size; + blk->signature = MEM_BLOCK_START; + *(__u32 *)((unsigned char *)blk + total_size - sizeof(__u32)) = MEM_BLOCK_END; + + return (void *)((char *)blk + sizeof(struct os_mem_block)); +} + +/**************************************************************************************** + * _os_memory4HwDmaFree() + **************************************************************************************** +DESCRIPTION: This function releases a block of memory previously allocated with the + _os_memoryAlloc4HwDma function. + + +ARGUMENTS: OsContext - our adapter context. + pMemPtr - Pointer to the base virtual address of the allocated memory. + This address was returned by the os_memoryAlloc function. + Size - Specifies the size, in bytes, of the memory block to be released. + This parameter must be identical to the Length that was passed to + os_memoryAlloc. + +RETURN: None + +NOTES: +*****************************************************************************************/ +void +os_memory4HwDmaFree( + TI_HANDLE pOsContext, + void* pMem_ptr, + TI_UINT32 Size + ) +{ + struct os_mem_block *blk; + + if (!pMem_ptr) { + printk("%s: NULL\n",__func__); + return; + } + blk = (struct os_mem_block *)((char *)pMem_ptr - sizeof(struct os_mem_block)); + + if (blk->signature != MEM_BLOCK_START) + { + printk("\n\n%s: memory block signature is incorrect - 0x%x\n\n\n", + __FUNCTION__, blk->signature); + return; + } + *(char *)(&blk->signature) = '~'; + if (*(__u32 *)((unsigned char *)blk + blk->size + sizeof(struct os_mem_block)) + != MEM_BLOCK_END) + { + printk("\n\n%s: memory block corruption. Size=%u\n\n\n", + __FUNCTION__, blk->size); + } + + blk->f_free(blk); +} + +/**************************************************************************************** + * os_memoryZero() + **************************************************************************************** +DESCRIPTION: This function fills a block of memory with 0s. + +ARGUMENTS: OsContext - our adapter context. + pMemPtr - Specifies the base address of a block of memory + Length - Specifies how many bytes to fill with 0s. + +RETURN: None + +NOTES: +*****************************************************************************************/ +void +os_memoryZero( + TI_HANDLE OsContext, + void* pMemPtr, + TI_UINT32 Length + ) +{ + if (!pMemPtr) { + printk("%s: NULL\n",__func__); + return; + } + memset(pMemPtr,0,Length); +} + + +/**************************************************************************************** + * os_memoryCopy() + **************************************************************************************** +DESCRIPTION: This function copies a specified number of bytes from one caller-supplied + location to another. + +ARGUMENTS: OsContext - our adapter context. + pDstPtr - Destination buffer + pSrcPtr - Source buffer + Size - Specifies the size, in bytes, to copy. + +RETURN: None + +NOTES: +*****************************************************************************************/ +void +os_memoryCopy( + TI_HANDLE OsContext, + void* pDstPtr, + void* pSrcPtr, + TI_UINT32 Size + ) +{ + + memcpy(pDstPtr,pSrcPtr,Size); +} + +/**************************************************************************************** + * os_memoryCompare() + **************************************************************************************** +DESCRIPTION: Compare characters in two buffers. + +ARGUMENTS: OsContext - our adapter context. + Buf1 - First buffer + Buf2 - Second buffer + Count - Number of characters + +RETURN: The return value indicates the relationship between the buffers: + < 0 Buf1 less than Buf2 + 0 Buf1 identical to Buf2 + > 0 Buf1 greater than Buf2 + +NOTES: +*****************************************************************************************/ +TI_INT32 +os_memoryCompare( + TI_HANDLE OsContext, + TI_UINT8* Buf1, + TI_UINT8* Buf2, + TI_INT32 Count + ) +{ + return memcmp(Buf1, Buf2, Count); +} + + + + +/**************************************************************************************** + * os_memoryCopyFromUser() + **************************************************************************************** +DESCRIPTION: This function copies a specified number of bytes from one caller-supplied + location to another. source buffer is in USER-MODE address space + +ARGUMENTS: OsContext - our adapter context. + pDstPtr - Destination buffer + pSrcPtr - Source buffer + Size - Specifies the size, in bytes, to copy. + +RETURN: None + +NOTES: +*****************************************************************************************/ +int +os_memoryCopyFromUser( + TI_HANDLE OsContext, + void* pDstPtr, + void* pSrcPtr, + TI_UINT32 Size + ) +{ + return copy_from_user(pDstPtr,pSrcPtr,Size); +} + +/**************************************************************************************** + * os_memoryCopyToUser() + **************************************************************************************** +DESCRIPTION: This function copies a specified number of bytes from one caller-supplied + location to another. desination buffer is in USER-MODE address space + +ARGUMENTS: OsContext - our adapter context. + pDstPtr - Destination buffer + pSrcPtr - Source buffer + Size - Specifies the size, in bytes, to copy. + +RETURN: None + +NOTES: +*****************************************************************************************/ +int +os_memoryCopyToUser( + TI_HANDLE OsContext, + void* pDstPtr, + void* pSrcPtr, + TI_UINT32 Size + ) +{ + return copy_to_user(pDstPtr,pSrcPtr,Size); +} diff --git a/wilink_6_1/platforms/os/linux/src/stack_profile.c b/wilink_6_1/platforms/os/linux/src/stack_profile.c new file mode 100644 index 0000000..37e55cb --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/stack_profile.c @@ -0,0 +1,174 @@ +/* + * stack_profile.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + +/* + * src/stack_profile.c + * + */ + +#include <linux/stddef.h> +#include <linux/kernel.h> +#include <linux/sched.h> + +#define STACK_MASK (THREAD_SIZE-1) +#define MAX_STACK_FRAME 2 + +typedef struct STACK_FRAME { + unsigned long stack_buf[THREAD_SIZE/sizeof(unsigned long)]; + unsigned long *stack_start; + unsigned long stack_size; +} stack_frame_t; + +static stack_frame_t sf_array[MAX_STACK_FRAME]; + +static unsigned long check_stack(unsigned long *base) +{ + register unsigned long sp asm ("sp"); + unsigned long retval = sp; + + *base = ((sp & ~STACK_MASK) + sizeof(struct task_struct) + 4); + return retval; +} + +unsigned long check_stack_start(unsigned long *base, unsigned long real_sp, + int id) +{ + unsigned long i; + unsigned long from, to; + + to = check_stack(&from); + *base = from; + + /* save used stack context */ + if (id < MAX_STACK_FRAME) { + stack_frame_t *sfp = &sf_array[id]; + + if (!real_sp) + real_sp = to; + sfp->stack_size = THREAD_SIZE - (real_sp & STACK_MASK); + sfp->stack_start = (unsigned long *)real_sp; + memcpy(sfp->stack_buf, sfp->stack_start, sfp->stack_size); + } + /* run from the stack pointer down to the base */ + for(i=from;(i < to);i+=4) { + /* fill up the pattern */ + *(unsigned long *)i = 0xdeadbeef; + } + /*printk("check_stack_start: from=%x to=%x data=%x\n",from,to,*(long *)(from+4));*/ + return to; +} + +unsigned long check_stack_stop(unsigned long *base, int id) +{ + unsigned long i; + unsigned long from, to; + + to = check_stack(&from); + *base = from; + + /* check used stack context */ + if (id < MAX_STACK_FRAME) { + stack_frame_t *sfp = &sf_array[id]; + + if (memcmp(sfp->stack_buf, sfp->stack_start, sfp->stack_size)) { + printk("%s: %p - Error\n", __func__, sfp->stack_start); + for(i=0;(i < sfp->stack_size/sizeof(unsigned long));i++) { + if (sfp->stack_start[i] != sfp->stack_buf[i]) + printk("%p: 0x%08lx != 0x%08lx\n", &sfp->stack_start[i], sfp->stack_start[i], sfp->stack_buf[i]); + } + } + } + + /* run from the stack pointer down to the base */ + for(i=from;(i < to);i+=4) { + /* check up the pattern */ + if ((*(unsigned long *)i) != 0xdeadbeef) + break; + } + + /*printk("check_stack_stop: from=%x to=%x data=%x data=%x i=0x%x\n",from,to,*(long *)from,*(long *)(from+4),i);*/ + /* return the first time when the pattern doesn't match */ + return i; +} + +void print_stack(int id) +{ + stack_frame_t *sfp = &sf_array[id]; + unsigned long i; + + printk("%s: %d\n", __func__, id); + for(i=0;(i < sfp->stack_size/sizeof(unsigned long));i++) { + printk("%p: 0x%08lx\n", &sfp->stack_start[i], sfp->stack_start[i]); + } +} + +struct task_struct *get_task_struct_ptr_by_name(char *name) +{ + struct task_struct *g, *p; + + read_lock(&tasklist_lock); + do_each_thread(g, p) { + /* + * reset the NMI-timeout, listing all files on a slow + * console might take alot of time: + */ + /* touch_nmi_watchdog(); */ + if (!strcmp(name, p->comm)) { + read_unlock(&tasklist_lock); + return p; + } + } while_each_thread(g, p); + read_unlock(&tasklist_lock); + return NULL; +} + +unsigned long save_stack_context(char *name, int id) +{ +/* register unsigned long sp asm ("sp"); + unsigned long sp_local = sp; +*/ + struct task_struct *p; + stack_frame_t *sfp; + + if (id >= MAX_STACK_FRAME) + return 0L; + sfp = &sf_array[id]; + p = get_task_struct_ptr_by_name(name); + if (p) { + printk("%s: %s found\n", __func__, p->comm); /* sched_show_task(t);*/ + sfp->stack_start = (unsigned long *)((unsigned long)end_of_stack(p) & ~STACK_MASK); + sfp->stack_size = THREAD_SIZE; + memcpy(sfp->stack_buf, sfp->stack_start, sfp->stack_size); + } + return sfp->stack_size; +} diff --git a/wilink_6_1/platforms/os/linux/src/string.c b/wilink_6_1/platforms/os/linux/src/string.c new file mode 100644 index 0000000..4fee004 --- /dev/null +++ b/wilink_6_1/platforms/os/linux/src/string.c @@ -0,0 +1,72 @@ +/* + * string.c + * + * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, 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. + * * 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 Texas Instruments nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER 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, WHETHER IN 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. + */ + + +/* + * src/string.c + * + */ + +/** + * memcmp - Compare two areas of memory + * @cs: One area of memory + * @ct: Another area of memory + * @count: The size of the area. + */ +int memcmp(const void * cs,const void * ct, unsigned int count) +{ + const unsigned char *su1, *su2; + int res = 0; + + for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) + if ((res = *su1 - *su2) != 0) + break; + return res; +} + +/** + * strcmp - Compare two strings + * @cs: One string + * @ct: Another string + */ +int strcmp(const char * cs,const char * ct) +{ + register signed char __res; + + while (1) { + if ((__res = *cs - *ct++) != 0 || !*cs++) + break; + } + + return __res; +} diff --git a/wilink_6_1/platforms/os/linux/zoom2_env.bash b/wilink_6_1/platforms/os/linux/zoom2_env.bash new file mode 100644 index 0000000..bf1addc --- /dev/null +++ b/wilink_6_1/platforms/os/linux/zoom2_env.bash @@ -0,0 +1,4 @@ +export CROSS_COMPILE=arm-eabi- +export ARCH=arm +export HOST_PLATFORM=zoom2 +export KERNEL_DIR=/usr/local/google/android/eclair/kernel |